mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
asa: Read from stdin if *argv is "-".
MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D40563
This commit is contained in:
parent
9e379f9639
commit
f08f90e698
1 changed files with 12 additions and 7 deletions
|
|
@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
|
|||
#include <err.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static void asa(FILE *);
|
||||
|
|
@ -71,13 +72,17 @@ main(int argc, char *argv[])
|
|||
asa(stdin);
|
||||
else {
|
||||
while ((fn = *argv++) != NULL) {
|
||||
if ((fp = fopen(fn, "r")) == NULL) {
|
||||
warn("%s", fn);
|
||||
exval = 1;
|
||||
continue;
|
||||
}
|
||||
asa(fp);
|
||||
fclose(fp);
|
||||
if (strcmp(fn, "-") == 0) {
|
||||
asa(stdin);
|
||||
} else {
|
||||
if ((fp = fopen(fn, "r")) == NULL) {
|
||||
warn("%s", fn);
|
||||
exval = 1;
|
||||
continue;
|
||||
}
|
||||
asa(fp);
|
||||
fclose(fp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue