From db7970fa83ee9f1128682aabd595c6b7ccf226b0 Mon Sep 17 00:00:00 2001 From: BurnZeZ Date: Sat, 19 Mar 2016 20:09:44 -0400 Subject: file(1): print warnings on /fd/2, remove some duplicate strings, whitespace fixes --- sys/src/cmd/file.c | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) (limited to 'sys/src/cmd/file.c') diff --git a/sys/src/cmd/file.c b/sys/src/cmd/file.c index 73bb429c3..5782c1a7f 100644 --- a/sys/src/cmd/file.c +++ b/sys/src/cmd/file.c @@ -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", - "!\n__.SYMDEF", "archive random library", 16, "application/octet-stream", - "!\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", + "!\n__.SYMDEF", "archive random library", 16, OCTET, + "!\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", @@ -829,20 +829,20 @@ struct FILE_STRING "BM", "bmp", 2, "image/bmp", "\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1", "microsoft office document", 8, "application/doc", "