78 |
static int list_count; |
static int list_count; |
79 |
static char **listarray; /* list for skipping full path */ |
static char **listarray; /* list for skipping full path */ |
80 |
static FILE *ip; |
static FILE *ip; |
81 |
|
static FILE *temp; |
82 |
static STRBUF *ib; |
static STRBUF *ib; |
83 |
static char root[MAXPATHLEN + 1]; |
static char root[MAXPATHLEN + 1]; |
84 |
static size_t rootlen; |
static size_t rootlen; |
445 |
assert(opened == 0); |
assert(opened == 0); |
446 |
opened = FILELIST_OPEN; |
opened = FILELIST_OPEN; |
447 |
ib = strbuf_open(MAXBUFLEN); |
ib = strbuf_open(MAXBUFLEN); |
448 |
if (filename[0] == '-' && filename[1] == '\0') { |
|
449 |
ip = stdin; |
if (!strcmp(filename, "-")) { |
450 |
|
/* |
451 |
|
* If the filename is '-', copy standard input onto |
452 |
|
* temporary file to be able to read repeatedly. |
453 |
|
*/ |
454 |
|
if (temp == NULL) { |
455 |
|
char buf[MAXPATHLEN+1]; |
456 |
|
|
457 |
|
temp = tmpfile(); |
458 |
|
while (fgets(buf, sizeof(buf), stdin) != NULL) |
459 |
|
fputs(buf, temp); |
460 |
|
} |
461 |
|
rewind(temp); |
462 |
|
ip = temp; |
463 |
} else { |
} else { |
464 |
if (test("d", filename)) |
if (test("d", filename)) |
465 |
die("'%s' is a directory.", filename); |
die("'%s' is a directory.", filename); |
473 |
} |
} |
474 |
strlimcpy(root, rootdir, sizeof(root)); |
strlimcpy(root, rootdir, sizeof(root)); |
475 |
rootlen = strlen(root); |
rootlen = strlen(root); |
476 |
|
|
477 |
|
/* |
478 |
|
* prepare regular expressions. |
479 |
|
*/ |
480 |
prepare_skip(); |
prepare_skip(); |
481 |
prepare_source(); |
prepare_source(); |
482 |
} |
} |