|
@ -3,6 +3,7 @@ |
|
|
#include <stdbool.h> |
|
|
#include <stdbool.h> |
|
|
#include <stdio.h> |
|
|
#include <stdio.h> |
|
|
#include <stdlib.h> |
|
|
#include <stdlib.h> |
|
|
|
|
|
#include <string.h> |
|
|
#include <unistd.h> |
|
|
#include <unistd.h> |
|
|
#include <sys/stat.h> |
|
|
#include <sys/stat.h> |
|
|
|
|
|
|
|
@ -17,7 +18,7 @@ static struct stat old, new; |
|
|
int |
|
|
int |
|
|
main(int argc, char *argv[]) { |
|
|
main(int argc, char *argv[]) { |
|
|
struct dirent *d; |
|
|
struct dirent *d; |
|
|
char buf[BUFSIZ]; |
|
|
|
|
|
|
|
|
char buf[BUFSIZ], *p; |
|
|
DIR *dir; |
|
|
DIR *dir; |
|
|
int opt; |
|
|
int opt; |
|
|
|
|
|
|
|
@ -35,6 +36,12 @@ main(int argc, char *argv[]) { |
|
|
fprintf(stderr, "usage: %s [-abcdefghlpqrsuwx] [-n file] [-o file] [file...]\n", argv[0]); |
|
|
fprintf(stderr, "usage: %s [-abcdefghlpqrsuwx] [-n file] [-o file] [file...]\n", argv[0]); |
|
|
exit(2); |
|
|
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++) |
|
|
for(; optind < argc; optind++) |
|
|
if(FLAG('l') && (dir = opendir(argv[optind]))) { |
|
|
if(FLAG('l') && (dir = opendir(argv[optind]))) { |
|
|
/* test directory contents */ |
|
|
/* test directory contents */ |
|
|