#include "patchlevel.h"
#ifndef lint
-FILE_RCSID("@(#)$Id: file.c,v 1.74 2003/03/26 15:35:30 christos Exp $")
+FILE_RCSID("@(#)$Id: file.c,v 1.75 2003/03/26 16:31:19 christos Exp $")
#endif /* lint */
process(const char *inname, int wid)
{
const char *type;
+ int std_in = strcmp(inname, "-") == 0;
if (wid > 0 && !bflag)
- (void) printf("%s%c%*s ", inname, separator,
- (int) (nopad ? 0 : (wid - strlen(inname))), "");
+ (void) printf("%s%c%*s ", std_in ? "/dev/stdin" : inname,
+ separator, (int) (nopad ? 0 : (wid - strlen(inname))), "");
- type = magic_file(magic, strcmp(inname, "-") == 0 ? NULL : inname);
+ type = magic_file(magic, std_in ? NULL : inname);
if (type == NULL)
printf("ERROR: %s\n", magic_error(magic));
else
#undef HAVE_MAJOR
#ifndef lint
-FILE_RCSID("@(#)$Id: fsmagic.c,v 1.38 2003/03/23 21:16:26 christos Exp $")
+FILE_RCSID("@(#)$Id: fsmagic.c,v 1.39 2003/03/26 16:31:20 christos Exp $")
#endif /* lint */
protected int
{
int ret = 0;
+ if (fn == NULL)
+ return 0;
+
/*
* Fstat is cheaper but fails for files you don't have read perms on.
* On 4.2BSD and similar systems, use lstat() to identify symlinks.