doc/ja/revcheck
Jordan K. Hubbard 7cfba98675 My previous commit was essentially a null-commit since cvs just turned
around and smashed the fix again, something I noticed immediately
thereafter.  The submitter heroically leaped forward with a fix after
I confessed insufficient ability with perl to make the match regexp work
correctly myself. :)

Submitted by:	Adruin "Adrian" Chadd <adrian@freebsd.org>
1999-12-25 07:03:37 +00:00

57 lines
1.5 KiB
Perl
Executable file

#!/usr/bin/perl -w
#
# The FreeBSD Japanese Documentation Project
#
# usage: revcheck <build topdir> <relative to localtop> <SGML filename>
#
# $FreeBSD: www/ja/revcheck,v 1.2 1999/12/25 05:25:46 jkh Exp $
my $buildtop = $ARGV[0];
my $reldir = $ARGV[1];
my $name_ja = $ARGV[2];
my $dir_en = $buildtop . "/en/" . $reldir;
my $name_en = $dir_en . "/" . $name_ja;
my $rev_en = 'English Revision Not found';
my $rev_ja = 'Japanese Revision Not found';
my $basename = $name_ja;
$basename =~ s/\.sgml//;
### File exist?
die "Cannot read local file: $!\n"
unless -r $name_ja;
die "Cannot read English file: $!\n"
unless -r $name_en;
### Open English file.
open EN, $name_en or die "Cannot open English file: $!\n";
while (<EN>) {
if (m@\044FreeBSD: (.+?) (.+?) .*$@) {
$rev_en = $2;
last;
}
}
close EN;
### Open Localized file.
open JA, $name_ja or die "Cannot open localized file: $!\n";
while (<JA>) {
if (/Original [Rr]evision:[ \t]*([0-9.]+)/) {
$rev_ja = $1;
last;
}
}
close JA;
#print ".if \${REV_NAME} == $name_ja\n";
# print ".if \${.IMPSRC} == $name_ja\n";
# print "LATEST_EN_REV= $rev_en\n";
# print "CURRENT_BASE_REV= $rev_ja\n";
# print ".endif\n";
print "<!ENTITY buildtop '$buildtop'>\n";
print "<!ENTITY reldir '$reldir'>\n";
print "<!ENTITY dir.en '$dir_en'>\n";
print "<!ENTITY basename '$basename'>\n";
print "<!ENTITY rev.base '$rev_ja'>\n";
print "<!ENTITY rev.latest '$rev_en'>\n";
printf "<!ENTITY %% rev.diff '%s'>\n", ($rev_ja eq $rev_en) ? "IGNORE" : "INCLUDE";