Changeset View
Changeset View
Standalone View
Standalone View
bin/cat/cat.c
Show First 20 Lines • Show All 68 Lines • ▼ Show 20 Lines | |||||
#include <wctype.h> | #include <wctype.h> | ||||
static int bflag, eflag, lflag, nflag, sflag, tflag, vflag; | static int bflag, eflag, lflag, nflag, sflag, tflag, vflag; | ||||
static int rval; | static int rval; | ||||
static const char *filename; | static const char *filename; | ||||
static void usage(void) __dead2; | static void usage(void) __dead2; | ||||
static void scanfiles(char *argv[], int cooked); | static void scanfiles(char *argv[], int cooked); | ||||
#ifndef BOOTSTRAP_CAT | |||||
static void cook_cat(FILE *); | static void cook_cat(FILE *); | ||||
#endif | |||||
static void raw_cat(int); | static void raw_cat(int); | ||||
#ifndef NO_UDOM_SUPPORT | #ifndef NO_UDOM_SUPPORT | ||||
static int udom_open(const char *path, int flags); | static int udom_open(const char *path, int flags); | ||||
#endif | #endif | ||||
/* | /* | ||||
* Memory strategy threshold, in pages: if physmem is larger than this, | * Memory strategy threshold, in pages: if physmem is larger than this, | ||||
▲ Show 20 Lines • Show All 87 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
fprintf(stderr, "usage: cat [-" SUPPORTED_FLAGS "] [file ...]\n"); | fprintf(stderr, "usage: cat [-" SUPPORTED_FLAGS "] [file ...]\n"); | ||||
exit(1); | exit(1); | ||||
/* NOTREACHED */ | /* NOTREACHED */ | ||||
} | } | ||||
static void | static void | ||||
scanfiles(char *argv[], int cooked) | scanfiles(char *argv[], int cooked __unused) | ||||
{ | { | ||||
int fd, i; | int fd, i; | ||||
char *path; | char *path; | ||||
#ifndef BOOTSTRAP_CAT | |||||
FILE *fp; | FILE *fp; | ||||
#endif | |||||
i = 0; | i = 0; | ||||
fd = -1; | fd = -1; | ||||
while ((path = argv[i]) != NULL || i == 0) { | while ((path = argv[i]) != NULL || i == 0) { | ||||
if (path == NULL || strcmp(path, "-") == 0) { | if (path == NULL || strcmp(path, "-") == 0) { | ||||
filename = "stdin"; | filename = "stdin"; | ||||
fd = STDIN_FILENO; | fd = STDIN_FILENO; | ||||
} else { | } else { | ||||
▲ Show 20 Lines • Show All 223 Lines • Show Last 20 Lines |