From 6b1d658d1224cd108d64a6c340d47b66ad99816d Mon Sep 17 00:00:00 2001 From: Connor Lane Smith Date: Fri, 9 Dec 2011 11:49:44 +0100 Subject: stest: restore stream testing --- stest.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'stest.c') diff --git a/stest.c b/stest.c index b4dba64..e1dcf36 100644 --- a/stest.c +++ b/stest.c @@ -3,6 +3,7 @@ #include #include #include +#include #include #include @@ -17,7 +18,7 @@ static struct stat old, new; int main(int argc, char *argv[]) { struct dirent *d; - char buf[BUFSIZ]; + char buf[BUFSIZ], *p; DIR *dir; int opt; @@ -35,6 +36,12 @@ main(int argc, char *argv[]) { fprintf(stderr, "usage: %s [-abcdefghlpqrsuwx] [-n file] [-o file] [file...]\n", argv[0]); exit(2); } + if(optind == argc) + while(fgets(buf, sizeof buf, stdin)) { + if((p = strchr(buf, '\n'))) + *p = '\0'; + test(buf, buf); + } for(; optind < argc; optind++) if(FLAG('l') && (dir = opendir(argv[optind]))) { /* test directory contents */ -- cgit v1.2.3-13-gbd6f