| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
#include "config.h" |
| 8 |
|
| 9 |
#if HAVE_STAT && HAS_ISCHR && HAS_ISFIFO && HAS_ISSOCK |
| 10 |
#include <sys/stat.h> |
| 11 |
|
| 12 |
int |
| 13 |
notspecial(char *file) |
| 14 |
{ |
| 15 |
struct stat info; |
| 16 |
|
| 17 |
if ( stat(file, &info) != 0 ) |
| 18 |
return 1; |
| 19 |
|
| 20 |
return !( S_ISCHR(info.st_mode) || S_ISFIFO(info.st_mode) || S_ISSOCK(info.st_mode) ); |
| 21 |
} |
| 22 |
#else |
| 23 |
int |
| 24 |
notspecial(char *file) |
| 25 |
{ |
| 26 |
return 1; |
| 27 |
} |
| 28 |
#endif |
| 29 |
|
| 30 |
|
| 31 |
#if DEBUG |
| 32 |
|
| 33 |
#include <stdio.h> |
| 34 |
|
| 35 |
int |
| 36 |
main(argc, argv) |
| 37 |
char **argv; |
| 38 |
{ |
| 39 |
int i; |
| 40 |
|
| 41 |
for ( i=1; i < argc; i++ ) |
| 42 |
printf("%s is %sspecial\n", argv[i], notspecial(argv[i]) ? "not " : ""); |
| 43 |
} |
| 44 |
#endif |