Changes per David Mosher: allow space and tab around '<' and '>' on
authorRobert R. Henry <rrh@ucbvax.Berkeley.EDU>
Fri, 29 Oct 1982 06:40:17 +0000 (22:40 -0800)
committerRobert R. Henry <rrh@ucbvax.Berkeley.EDU>
Fri, 29 Oct 1982 06:40:17 +0000 (22:40 -0800)
output redirection specification when starting a process up.

SCCS-vsn: old/adb/adb.vax/runpcs.c 4.2

usr/src/old/adb/adb.vax/runpcs.c

index dd86564..11ed405 100644 (file)
@@ -6,7 +6,7 @@
  */
 
 #include "defs.h"
  */
 
 #include "defs.h"
-static char sccsid[] = "@(#)runpcs.c 4.1 %G%";
+static char sccsid[] = "@(#)runpcs.c 4.2 %G%";
 
 extern MAP     txtmap;
 
 
 extern MAP     txtmap;
 
@@ -170,20 +170,41 @@ doexec()
        *ap++=symfil;
        REP     IF rdc()==EOR THEN break; FI
                *ap = p;
        *ap++=symfil;
        REP     IF rdc()==EOR THEN break; FI
                *ap = p;
-               WHILE lastc!=EOR ANDF lastc!=SP ANDF lastc!=TB DO *p++=lastc; readchar(); OD
-               *p++=0; filnam = *ap+1;
-               IF **ap=='<'
-               THEN    close(0);
+               /*
+                * First thing is to look for direction characters
+                * and get filename.  Do not use up the args for filenames.
+                * Then get rid of spaces before next args.
+                */
+               IF lastc=='<'
+               THEN    REP readchar(); PER lastc==SP ORF lastc==TB DONE
+                       filnam = p;
+                       WHILE lastc!=EOR ANDF lastc!=SP ANDF lastc!=TB ANDF lastc!='>'
+                               DO *p++=lastc; readchar(); OD
+                       *p = 0;
+                       close(0);
                        IF open(filnam,0)<0
                        THEN    printf("%s: cannot open\n",filnam); _exit(0);
                        FI
                        IF open(filnam,0)<0
                        THEN    printf("%s: cannot open\n",filnam); _exit(0);
                        FI
-               ELIF **ap=='>'
-               THEN    close(1);
+                       p = *ap;
+               ELIF lastc=='>'
+               THEN    REP readchar(); PER lastc==SP ORF lastc==TB DONE
+                       filnam = p;
+                       WHILE lastc!=EOR ANDF lastc!=SP ANDF lastc!=TB ANDF lastc!='<'
+                               DO *p++=lastc; readchar(); OD
+                       *p = '\0';
+                       close(1);
                        IF creat(filnam,0666)<0
                        THEN    printf("%s: cannot create\n",filnam); _exit(0);
                        FI
                        IF creat(filnam,0666)<0
                        THEN    printf("%s: cannot create\n",filnam); _exit(0);
                        FI
-               ELSE    ap++;
+                       p = *ap;
+               ELSE    
+                       WHILE lastc!=EOR ANDF lastc!=SP ANDF lastc!=TB ANDF lastc!='>' ANDF lastc!='<'
+                               DO *p++=lastc; readchar(); OD
+                       *p++ = '\0';
+                       ap++;
                FI
                FI
+               WHILE lastc==SP ORF lastc==TB DO readchar(); OD
+
        PER lastc!=EOR DONE
        *ap++=0;
        exect(symfil, argl, environ);
        PER lastc!=EOR DONE
        *ap++=0;
        exect(symfil, argl, environ);