From a9ac8e4f0a12917c10548cf0fd22e214d845a9a9 Mon Sep 17 00:00:00 2001 From: ceriel Date: Mon, 19 Oct 1987 10:24:52 +0000 Subject: [PATCH] The use of {w} in a program line of fe did not work, because ack scans fe before it scans MACH (which is where most vars are declared). Reversing the order of the scans caused other problems, related to callnames. I have therefore delayed the 'scanvars' of program lines (as is already done with args). --- util/ack/rmach.c | 5 +---- util/ack/run.c | 21 +++++++++++++++------ 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/util/ack/rmach.c b/util/ack/rmach.c index 52f73b51..c7796fbb 100644 --- a/util/ack/rmach.c +++ b/util/ack/rmach.c @@ -131,10 +131,7 @@ intrf() { if ( strcmp(ty_name,PROG)==0 ) { if ( new->t_prog ) twice=YES ; bline= scanb(bol); /* Scan for \ */ - vline= scanvars(gr_start(bline)); /* Scan for {} */ - gr_throw(&bline); - new->t_prog= gr_final(&vline); - clr_noscan(new->t_prog); + new->t_prog= gr_final(&bline); } else if ( strcmp(ty_name,MAPF)==0 ) { /* First read the mapflags line diff --git a/util/ack/run.c b/util/ack/run.c index 79933a4a..099cb18e 100644 --- a/util/ack/run.c +++ b/util/ack/run.c @@ -7,6 +7,7 @@ #include "ack.h" #include "list.h" #include "trans.h" +#include "grows.h" #include "data.h" #include @@ -16,6 +17,8 @@ static char rcs_id[] = "$Header$" ; #define ARG_MORE 40 /* The size of args chunks to allocate */ +extern growstring scanvars(); + static char **arglist ; /* The first argument */ static unsigned argcount ; /* The current number of arguments */ static unsigned argmax; /* The maximum number of arguments so far */ @@ -28,7 +31,11 @@ int do_run() { int runphase(phase) register trf *phase ; { register list_elem *elem ; + char *prog ; int result ; + growstring bline ; + bline=scanvars(phase->t_prog) ; + prog=gr_final(&bline) ; if ( v_flag || debug ) { if ( v_flag==1 && !debug ) { vprint("%s",phase->t_name) ; @@ -43,7 +50,7 @@ int runphase(phase) register trf *phase ; { } } else { /* list all args */ - vprint("%s",phase->t_prog) ; + vprint("%s",prog) ; scanlist(l_first(phase->t_flags), elem) { vprint(" %s",l_content(*elem)) ; } @@ -62,10 +69,12 @@ int runphase(phase) register trf *phase ; { x_arg(l_content(*elem)) ; } x_arg( (char *)0 ) ; - return run_exec(phase) ; + result=run_exec(phase,prog) ; + throws(&prog) ; + return result ; } -int run_exec(phase) trf *phase ; { +int run_exec(phase,prog) trf *phase ; char *prog ; { int status, child, waitchild ; do_flush(); @@ -91,7 +100,7 @@ int run_exec(phase) trf *phase ; { quit(-5) ; default: error("%s died with signal %d", - phase->t_prog,status&0177) ; + prog,status&0177) ; } /* The assumption is that processes voluntarely dying with a non-zero status already produced @@ -124,9 +133,9 @@ int run_exec(phase) trf *phase ; { exit(1) ; } } - execv(phase->t_prog,arglist) ; + execv(prog,arglist) ; if ( phase->t_stdout ) { close(1) ; dup(2) ; } - error("Cannot execute %s",phase->t_prog) ; + error("Cannot execute %s",prog) ; exit(1) ; /*NOTREACHED*/ }