summaryrefslogtreecommitdiff
path: root/Build/source/texk/chktex/chktex-src/deweb.in
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/texk/chktex/chktex-src/deweb.in')
-rw-r--r--Build/source/texk/chktex/chktex-src/deweb.in159
1 files changed, 85 insertions, 74 deletions
diff --git a/Build/source/texk/chktex/chktex-src/deweb.in b/Build/source/texk/chktex/chktex-src/deweb.in
index 91750e636a2..fff7fb919a2 100644
--- a/Build/source/texk/chktex/chktex-src/deweb.in
+++ b/Build/source/texk/chktex/chktex-src/deweb.in
@@ -26,93 +26,104 @@
#
#
-print STDERR "DeWEB v1.2 - Copyright 1996 Jens T. Berger Thielemann\n";
+print STDERR "DeWEB v1.3 - Copyright 1996 Jens T. Berger Thielemann\n";
undef $/;
-$texmode = 1;
-$_ = <>;
-
-while(/\@/)
-{
- &out($`);
- $_ = $';
-
- if(/^@/) {
- $_ = $';
- &out('@');
- next;
+my @FILES = @ARGV;
+FILE:
+while( my $file = shift @FILES ) {
+
+ my $success = open my $fh, '<', "$file";
+ if ( ! $success ) {
+ print STDERR "Couldn't open file '$file'\n";
+ next FILE;
}
- if(/^([\s\n])/) {
- $_ = $';
- print "\n" if $1 eq "\n";
- $texmode = 1;
- next;
- }
-
- if(/^[cpd]/i) {
- $_ = $';
- $texmode = 0;
- next;
- }
-
- if(/^\,/i) {
- $_ = $';
- print '\,';
- next;
- }
-
- if(m!^/!) {
- $_ = $';
- print '\\\\';
- next;
- }
-
- if(/^[h\&\|\;\#\+]/i || /^i.*/i) {
- $_ = $';
- next;
- }
-
- if(/^\*[0-9\*]?((.|\n)*?\.)/) {
- $_ = $';
- print $1;
- $texmode = 1;
- next;
- }
-
- if(/^[<(^.t!]((.|\n)*?)\@\>/i) {
- $_ = $';
- print '{'.$1.'}';
- $texmode = 0;
- next;
- }
-
- if(/^[=]((.|\n)*?)\@\>/) {
- $_ = $';
- print &printnl($1);
- next;
- }
+ $texmode = 1;
+ $_ = <$fh>;
+
+ while (/\@/) {
+ &out($`);
+ $_ = $';
+
+ if (/^@/) {
+ $_ = $';
+ &out('@');
+ next;
+ }
+
+ if (/^([\s\n])/) {
+ $_ = $';
+ print "\n" if $1 eq "\n";
+ $texmode = 1;
+ next;
+ }
+
+ if (/^[cpd]/i) {
+ $_ = $';
+ $texmode = 0;
+ next;
+ }
+
+ if (/^\,/i) {
+ $_ = $';
+ print '\,';
+ next;
+ }
+
+ if (m!^/!) {
+ $_ = $';
+ print '\\\\';
+ next;
+ }
+
+ if (/^[h\&\|\;\#\+]/i || /^i.*/i) {
+ $_ = $';
+ next;
+ }
+
+ if (/^\*[0-9\*]?((.|\n)*?\.)/) {
+ $_ = $';
+ print $1;
+ $texmode = 1;
+ next;
+ }
+
+ if (/^[<(^.t!]((.|\n)*?)\@\>/i) {
+ $_ = $';
+ print '{'.$1.'}';
+ $texmode = 0;
+ next;
+ }
+
+ if (/^[=]((.|\n)*?)\@\>/) {
+ $_ = $';
+ print &printnl($1);
+ next;
+ }
+
+ if (/^[fsl](\s+\S+\s+\S+)|^\'(.|\n)*?\'|^\[((.|\n)*?)\@\]/i) {
+ $_ = $';
+ print &printnl($+);
+ next;
+ }
+
+ @line = split(/\n/, $_, 2);
+ print STDERR "Unknown opcode, ignored. Buffer:\n$line[0]\n";
- if(/^[fsl](\s+\S+\s+\S+)|^\'(.|\n)*?\'|^\[((.|\n)*?)\@\]/i) {
- $_ = $';
- print &printnl($+);
- next;
}
- @line = split(/\n/, $_, 2);
- print STDERR "Unknown opcode, ignored. Buffer:\n$line[0]\n";
+ print $_;
}
-print $_;
-
sub printnl {
my($foo);
- if(defined $_[0]) {
- $foo = $_[0];
- $foo =~ s/.//g;
+ if (defined $_[0]) {
+ $foo = $_[0];
+ $foo =~ s/.//g;
} else {
- $foo = "";
+ $foo = "";
}
$foo;
}