char line
[200], *s
, argig
[100], *cv
[50];
int c
, oldc
0, alph
0, nv
0;
strcpy (argig
, arg
); strcat(argig
, ".ig");
sprintf(gfile
, "/tmp/rj%dg", getpid());
fprintf(stderr
, "in grepcall, gfile %s in %o out %o\n", gfile
,in
,out
);
for(cv
[nv
++] = "fgrep"; c
= *inp
; inp
++)
alph
= (c
==0) ? 0 : alph
+1;
fprintf(stderr
, "%d args set up\n", nv
);
if (open (argig
, 0) != 0)
err("Can't read fgrep index %s", argig
);
if (creat(gfile
, 0666) != 1)
err("Can't write fgrep output %s", gfile
);
fprintf(stderr
, "fgrep returned, output is..\n");
close (0); dup(sv0
); close(sv0
);
close (1); dup(sv1
); close(sv1
);
fprintf(stderr
, "back from fgrep\n");
err("can't read fgrep output %s", gfile
);
while (fgets(line
, 100, gf
) == line
)
fprintf(stderr
, "read line as //%s//\n",line
);
for(s
=line
; *s
&& (*s
!= '\t'); s
++);
fprintf(stderr
, "out now /%s/\n",out
);
fprintf(stderr
, "line %o s %o s-1 %o\n",line
,s
,s
[-1]);
while (!feof(gf
) && getc(gf
)!= '\n') ;
fprintf(stderr
, "back from reading %, out %s\n",out
);