all repos — dmenu @ 6b1d658d1224cd108d64a6c340d47b66ad99816d

my build of dmenu

stest: restore stream testing
Connor Lane Smith cls@lubutu.com
Fri, 09 Dec 2011 11:49:44 +0100
commit

6b1d658d1224cd108d64a6c340d47b66ad99816d

parent

32ef0f5662bfe8b8891ba6341d3a27818fb55508

2 files changed, 10 insertions(+), 2 deletions(-)

jump to
M stest.1stest.1

@@ -13,7 +13,8 @@ .SH DESCRIPTION

.B stest takes a list of files and filters by the files' properties, analogous to .IR test (1). -Files which pass all tests are printed to stdout. +Files which pass all tests are printed to stdout. If no files are given, stest +reads files from stdin. .SH OPTIONS .TP .B \-a
M stest.cstest.c

@@ -3,6 +3,7 @@ #include <dirent.h>

#include <stdbool.h> #include <stdio.h> #include <stdlib.h> +#include <string.h> #include <unistd.h> #include <sys/stat.h>

@@ -17,7 +18,7 @@

int main(int argc, char *argv[]) { struct dirent *d; - char buf[BUFSIZ]; + char buf[BUFSIZ], *p; DIR *dir; int opt;

@@ -34,6 +35,12 @@ break;

case '?': /* error: unknown flag */ 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]))) {