file(1): print warnings on /fd/2, remove some duplicate strings, whitespace fixes
This commit is contained in:
parent
730578d40c
commit
db7970fa83
1 changed files with 25 additions and 25 deletions
|
@ -266,7 +266,7 @@ type(char *file, int nlen)
|
|||
}
|
||||
fname = file;
|
||||
if ((fd = open(file, OREAD)) < 0) {
|
||||
print("cannot open: %r\n");
|
||||
fprint(2, "cannot open: %r\n");
|
||||
return;
|
||||
}
|
||||
filetype(fd);
|
||||
|
@ -345,7 +345,7 @@ filetype(int fd)
|
|||
free(mbuf);
|
||||
mbuf = dirfstat(fd);
|
||||
if(mbuf == nil){
|
||||
print("cannot stat: %r\n");
|
||||
fprint(2, "cannot stat: %r\n");
|
||||
return;
|
||||
}
|
||||
if(mbuf->mode & DMDIR) {
|
||||
|
@ -362,7 +362,7 @@ filetype(int fd)
|
|||
/* may be reading a pipe on standard input */
|
||||
nbuf = readn(fd, buf, sizeof(buf)-1);
|
||||
if(nbuf < 0) {
|
||||
print("cannot read: %r\n");
|
||||
fprint(2, "cannot read: %r\n");
|
||||
return;
|
||||
}
|
||||
if(nbuf == 0) {
|
||||
|
@ -798,11 +798,11 @@ struct FILE_STRING
|
|||
"\x1f\x9d", "compressed", 2, "application/x-compress",
|
||||
"\x1f\x8b", "gzip compressed", 2, "application/x-gzip",
|
||||
"BZh", "bzip2 compressed", 3, "application/x-bzip2",
|
||||
"!<arch>\n__.SYMDEF", "archive random library", 16, "application/octet-stream",
|
||||
"!<arch>\n", "archive", 8, "application/octet-stream",
|
||||
"070707", "cpio archive - ascii header", 6, "application/octet-stream",
|
||||
"#!/bin/rc", "rc executable file", 9, "text/plain",
|
||||
"#!/bin/sh", "sh executable file", 9, "text/plain",
|
||||
"!<arch>\n__.SYMDEF", "archive random library", 16, OCTET,
|
||||
"!<arch>\n", "archive", 8, OCTET,
|
||||
"070707", "cpio archive - ascii header", 6, OCTET,
|
||||
"#!/bin/rc", "rc executable file", 9, PLAIN,
|
||||
"#!/bin/sh", "sh executable file", 9, PLAIN,
|
||||
"%!", "postscript", 2, "application/postscript",
|
||||
"\004%!", "postscript", 3, "application/postscript",
|
||||
"x T post", "troff output for post", 8, "application/troff",
|
||||
|
@ -856,14 +856,14 @@ struct FILE_STRING
|
|||
".if", "troff input", 3, "text/troff",
|
||||
".nr", "troff input", 3, "text/troff",
|
||||
".tr", "troff input", 3, "text/troff",
|
||||
"vac:", "venti score", 4, "text/plain",
|
||||
"vac:", "venti score", 4, PLAIN,
|
||||
"-----BEGIN CERTIFICATE-----\n",
|
||||
"pem certificate", -1, "text/plain",
|
||||
"pem certificate", -1, PLAIN,
|
||||
"-----BEGIN TRUSTED CERTIFICATE-----\n",
|
||||
"pem trusted certificate", -1, "text/plain",
|
||||
"pem trusted certificate", -1, PLAIN,
|
||||
"-----BEGIN X509 CERTIFICATE-----\n",
|
||||
"pem x.509 certificate", -1, "text/plain",
|
||||
"subject=/C=", "pem certificate with header", -1, "text/plain",
|
||||
"pem x.509 certificate", -1, PLAIN,
|
||||
"subject=/C=", "pem certificate with header", -1, PLAIN,
|
||||
"process snapshot ", "process snapshot", -1, "application/snapfs",
|
||||
"d8:announce", "torrent file", 11, "application/x-bittorrent",
|
||||
"[playlist]", "playlist", 10, "application/x-scpls",
|
||||
|
@ -949,7 +949,7 @@ iff(void)
|
|||
else if (strncmp((char*)buf+8, "AVI ", 4) == 0)
|
||||
print("%s\n", mime? "video/avi": "avi video");
|
||||
else
|
||||
print("%s\n", mime? "application/octet-stream": "riff file");
|
||||
print("%s\n", mime? OCTET : "riff file");
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -1073,7 +1073,7 @@ ismbox(void)
|
|||
return 0;
|
||||
*q = 0;
|
||||
if(strncmp(p, "From ", 5) == 0 && strstr(p, " remote from ") == nil){
|
||||
print("%s\n", mime ? "text/plain" : "mail box");
|
||||
print("%s\n", mime ? PLAIN : "mail box");
|
||||
return 1;
|
||||
}
|
||||
*q = '\n';
|
||||
|
@ -1497,7 +1497,7 @@ isp9font(void)
|
|||
}
|
||||
}
|
||||
if (i) {
|
||||
print(mime ? "text/plain\n" : "font file\n");
|
||||
print("%s\n", mime ? PLAIN : "font file");
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue