309 |
|
char *file |
310 |
|
) |
311 |
|
{ |
312 |
< |
const int conditional = vardefined("cond"); |
313 |
< |
const int set_recno = (varlookup("recno") != NULL); |
314 |
< |
const int set_outno = (varlookup("outno") != NULL); |
315 |
< |
long nrecs = 0; |
316 |
< |
long nout = 0; |
317 |
< |
FILE *fp; |
312 |
> |
static char condVN[] = "cond"; |
313 |
> |
static char recnoVN[] = "recno"; |
314 |
> |
static char outnoVN[] = "outno"; |
315 |
> |
const int conditional = vardefined(condVN); |
316 |
> |
const int set_recno = (varlookup(recnoVN) != NULL); |
317 |
> |
const int set_outno = (varlookup(outnoVN) != NULL); |
318 |
> |
long nrecs = 0; |
319 |
> |
long nout = 0; |
320 |
> |
FILE *fp; |
321 |
|
|
322 |
|
if (file == NULL) |
323 |
|
fp = stdin; |
331 |
|
#ifdef getc_unlocked /* avoid lock/unlock overhead */ |
332 |
|
flockfile(fp); |
333 |
|
#endif |
334 |
+ |
if (conditional == ':') { |
335 |
+ |
eputs(condVN); |
336 |
+ |
eputs(": defined as constant\n"); |
337 |
+ |
quit(1); |
338 |
+ |
} |
339 |
|
if (inpfmt != NULL) |
340 |
|
initinp(fp); |
341 |
|
|
342 |
|
while (inpfmt != NULL ? getrec() : getinputrec(fp)) { |
343 |
|
++nrecs; |
344 |
|
if (set_recno) |
345 |
< |
varset("recno", '=', (double)nrecs); |
345 |
> |
varset(recnoVN, '=', (double)nrecs); |
346 |
|
if (set_outno) |
347 |
< |
varset("outno", '=', (double)(nout+1)); |
347 |
> |
varset(outnoVN, '=', (double)(nout+1)); |
348 |
|
colflg = 0; |
349 |
|
eclock++; |
350 |
< |
if (!conditional || varvalue("cond") > 0.0) { |
350 |
> |
if (!conditional || varvalue(condVN) > 0.0) { |
351 |
|
putout(); |
352 |
|
++nout; |
353 |
|
advinp(); |