X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/blobdiff_plain/3408345e51af6a54ac7c29655e150d248bde4b80..1c15e88899094343f75aeba04122cd96a96b428e:/usr/src/usr.bin/file/file.c diff --git a/usr/src/usr.bin/file/file.c b/usr/src/usr.bin/file/file.c index 0c98d306cb..a14c39bb40 100644 --- a/usr/src/usr.bin/file/file.c +++ b/usr/src/usr.bin/file/file.c @@ -1,5 +1,5 @@ #ifndef lint -static char sccsid[] = "@(#)file.c 4.15 (Berkeley) %G%"; +static char sccsid[] = "@(#)file.c 4.17 (Berkeley) 7/1/90"; #endif /* * file - determine type of file @@ -7,13 +7,12 @@ static char sccsid[] = "@(#)file.c 4.15 (Berkeley) %G%"; #include #include +#include #include #include #include extern int errno; -extern int sys_nerr; -extern char *sys_errlist[]; int in; int i = 0; @@ -58,7 +57,6 @@ char **argv; int l = strlen(p); if (l>0) p[l-1] = '\0'; - printf("%s: ", p); type(p); if (ifile>=0) close(ifile); @@ -66,7 +64,6 @@ char **argv; exit(1); } while(argc > 1) { - printf("%s: ", argv[1]); type(argv[1]); fflush(stdout); argc--; @@ -87,10 +84,10 @@ char *file; ifile = -1; if (lstat(file, &mbuf) < 0) { - printf("%s\n", - (unsigned)errno < sys_nerr? sys_errlist[errno]: "Cannot stat"); + fprintf(stderr, "file: %s: %s\n", file, strerror(errno)); return; } + printf("%s:\t", file); switch (mbuf.st_mode & S_IFMT) { case S_IFLNK: @@ -123,8 +120,7 @@ char *file; ifile = open(file, 0); if(ifile < 0) { - printf("%s\n", - (unsigned)errno < sys_nerr? sys_errlist[errno]: "Cannot read"); + fprintf(stderr, "file: %s: %s\n", file, strerror(errno)); return; } in = read(ifile, buf, BUFSIZ);