version 1.7, 2006/01/15 19:11:59 |
version 1.8, 2006/03/24 21:13:45 |
|
|
static const char rcsid[] = "$OpenBSD$"; |
static const char rcsid[] = "$OpenBSD$"; |
#endif /* not lint */ |
#endif /* not lint */ |
|
|
|
#include <sys/stat.h> |
#include <err.h> |
#include <err.h> |
|
#include <errno.h> |
#include <stdlib.h> |
#include <stdlib.h> |
#include <string.h> |
#include <string.h> |
#include <unistd.h> |
#include <unistd.h> |
|
|
FILE *file; |
FILE *file; |
struct source src; |
struct source src; |
char *buf, *p; |
char *buf, *p; |
|
struct stat st; |
|
|
|
|
if ((buf = strdup("")) == NULL) |
if ((buf = strdup("")) == NULL) |
err(1, NULL); |
err(1, NULL); |
/* accept and ignore a single dash to be 4.4BSD dc(1) compatible */ |
/* accept and ignore a single dash to be 4.4BSD dc(1) compatible */ |
|
|
return (0); |
return (0); |
} |
} |
if (argc == 1) { |
if (argc == 1) { |
|
if (stat(argv[0], &st) == -1) |
|
err(1, "%s", argv[0]); |
|
if (S_ISDIR(st.st_mode)) { |
|
errno = EISDIR; |
|
err(1, "%s", argv[0]); |
|
} |
|
|
file = fopen(argv[0], "r"); |
file = fopen(argv[0], "r"); |
if (file == NULL) |
if (file == NULL) |
err(1, "cannot open file %s", argv[0]); |
err(1, "cannot open file %s", argv[0]); |