diff options
author | Connor Lane Smith <cls@lubutu.com> | 2011-12-09 11:49:44 +0100 |
---|---|---|
committer | Connor Lane Smith <cls@lubutu.com> | 2011-12-09 11:49:44 +0100 |
commit | 6b1d658d1224cd108d64a6c340d47b66ad99816d (patch) | |
tree | 13c2e02462f2a26a067d3309f3c049c126b29471 /stest.c | |
parent | 32ef0f5662bfe8b8891ba6341d3a27818fb55508 (diff) | |
download | dmenu-6b1d658d1224cd108d64a6c340d47b66ad99816d.tar.gz dmenu-6b1d658d1224cd108d64a6c340d47b66ad99816d.tar.bz2 dmenu-6b1d658d1224cd108d64a6c340d47b66ad99816d.zip |
stest: restore stream testing
Diffstat (limited to 'stest.c')
-rw-r--r-- | stest.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -3,6 +3,7 @@ #include <stdbool.h> #include <stdio.h> #include <stdlib.h> +#include <string.h> #include <unistd.h> #include <sys/stat.h> @@ -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 */ |