chiark / gitweb /
Proper error checking at end of @@? condition
authorian <ian>
Tue, 11 Sep 2001 10:14:50 +0000 (10:14 +0000)
committerian <ian>
Tue, 11 Sep 2001 10:14:50 +0000 (10:14 +0000)
files/_.configs_setenvir
gpt

index 7805096f2ef65fd66dd3becf48249733e8d79524..b951f22c781b84593ada8f93468a168ab561f55f 100755 (executable)
@@ -31,7 +31,7 @@ export PAGER PERLLIB PS1 TRNINIT WWW_HOME
 
 # NNTPAUTH
 
-@@?$ncipher@@
+@@?$ncipher?@@
 NC_SITES=@@$ncipher@@:@@ $ncipher eq 'bos' ? 'cam' : 'bos' @@
 export NC_SITES
 @@;
diff --git a/gpt b/gpt
index ce93196499dfb99039e317ab4be9bc96d0bc4087..30baae08806c85a050c2436bc707df012f6cd579 100755 (executable)
--- a/gpt
+++ b/gpt
@@ -118,17 +118,22 @@ sub eval_expr () {
 sub process_input () {
     my ($esc,$top,$want,$fh,$value,$wasyes);
     while (length $l) {
-       print DEBUG "L $fn:$lno:",join('',@oplist),
-                   ":`$l' e\`$expr' s\`$substr'\n";
+       print DEBUG "L $fn:${lno}_",join('',@oplist),
+                   "_`$l' e\`$expr' s\`$substr'\n";
        if (@oplist & 1) { # scanning perl
            if ($l =~ m/^()\@\@/ || $l =~ m/([^\000])\@\@/) {
                ($to,$op,$esc,$l) = ($`,$1,$&,$');
                add_perl($to);
                if ($op =~ m/[ \t\n0-9a-zA-Z_\;\)\}?]/ || $op eq '') {
                    $top= pop @oplist;
+                   if ($top eq '?') {
+                       $op eq '?' or err("expected ?\@\@, got \@\@");
+                   } else {
+                       $op ne '?' or err("found ?\@\@ not after \@\@?");
+                   }
                    if (!@oplist) {
                        # And evaluate.
-                       $expr.= $op unless $op =~ m/[?]/;
+                       $expr.= $op unless $op eq '?';
                        $value= eval_expr();
                        if ($top eq '<') {
                            process_file($value);