one of them is accessable. I.e. fstat /foo/* shouldn't crap out just
because one of those files can't be opened.
SCCS-vsn: usr.bin/fstat/fstat.c 5.9
#endif /* !lint */
#ifndef lint
#endif /* !lint */
#ifndef lint
-static char sccsid[] = "@(#)fstat.c 5.8 (Berkeley) %G%";
+static char sccsid[] = "@(#)fstat.c 5.9 (Berkeley) %G%";
extern int errno;
static off_t procp;
extern int errno;
static off_t procp;
+static int fflg, hadfflg, vflg;
static int kmem, mem, nproc, swap;
static char *uname;
static int kmem, mem, nproc, swap;
static char *uname;
}
for (argv += optind; *argv; ++argv) {
}
for (argv += optind; *argv; ++argv) {
- fflg = 1;
- getfname(*argv);
+ hadfflg = 1;
+ if (getfname(*argv))
+ fflg = 1;
+ if (hadfflg && !fflg) /* file(s) specified, but none accessable */
+ exit(1);
printf("USER\t CMD\t PID FD\tDEVICE\tINODE\t SIZE TYPE");
if (fflg)
printf("USER\t CMD\t PID FD\tDEVICE\tINODE\t SIZE TYPE");
if (fflg)
if (stat(filename, &statbuf)) {
perror(filename);
if (stat(filename, &statbuf)) {
perror(filename);
}
if ((cur = (DEVS *)malloc(sizeof(DEVS))) == NULL) {
fprintf(stderr, "fstat: out of space.\n");
}
if ((cur = (DEVS *)malloc(sizeof(DEVS))) == NULL) {
fprintf(stderr, "fstat: out of space.\n");
cur->dev = statbuf.st_rdev;
}
cur->name = filename;
cur->dev = statbuf.st_rdev;
}
cur->name = filename;