projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
BSD 4_3_Reno release
[unix-history]
/
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
0c98d30
..
a14c39b
100644
(file)
--- a/
usr/src/usr.bin/file/file.c
+++ b/
usr/src/usr.bin/file/file.c
@@
-1,5
+1,5
@@
#ifndef lint
#ifndef lint
-static char sccsid[] = "@(#)file.c 4.1
5 (Berkeley) %G%
";
+static char sccsid[] = "@(#)file.c 4.1
7 (Berkeley) 7/1/90
";
#endif
/*
* file - determine type of file
#endif
/*
* file - determine type of file
@@
-7,13
+7,12
@@
static char sccsid[] = "@(#)file.c 4.15 (Berkeley) %G%";
#include <sys/param.h>
#include <sys/stat.h>
#include <sys/param.h>
#include <sys/stat.h>
+#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include <a.out.h>
extern int errno;
#include <stdio.h>
#include <ctype.h>
#include <a.out.h>
extern int errno;
-extern int sys_nerr;
-extern char *sys_errlist[];
int in;
int i = 0;
int in;
int i = 0;
@@
-58,7
+57,6
@@
char **argv;
int l = strlen(p);
if (l>0)
p[l-1] = '\0';
int l = strlen(p);
if (l>0)
p[l-1] = '\0';
- printf("%s: ", p);
type(p);
if (ifile>=0)
close(ifile);
type(p);
if (ifile>=0)
close(ifile);
@@
-66,7
+64,6
@@
char **argv;
exit(1);
}
while(argc > 1) {
exit(1);
}
while(argc > 1) {
- printf("%s: ", argv[1]);
type(argv[1]);
fflush(stdout);
argc--;
type(argv[1]);
fflush(stdout);
argc--;
@@
-87,10
+84,10
@@
char *file;
ifile = -1;
if (lstat(file, &mbuf) < 0) {
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;
}
return;
}
+ printf("%s:\t", file);
switch (mbuf.st_mode & S_IFMT) {
case S_IFLNK:
switch (mbuf.st_mode & S_IFMT) {
case S_IFLNK:
@@
-123,8
+120,7
@@
char *file;
ifile = open(file, 0);
if(ifile < 0) {
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);
return;
}
in = read(ifile, buf, BUFSIZ);