#ifndef lint
static char *moduleid =
- "@(#)$Header: /home/glen/git/file/cvs/file/src/ascmagic.c,v 1.6 1991/01/23 13:22:06 ian Exp $";
+ "@(#)$Header: /home/glen/git/file/cvs/file/src/ascmagic.c,v 1.7 1991/01/23 13:56:27 ian Exp $";
#endif /* lint */
char *ckfmsg = "write error on output";
#define STREQ(a, b) (*(a) == *(b) && strcmp((a), (b)) == 0)
ascmagic(buf, nbytes)
-register char *buf;
+unsigned char *buf;
int nbytes; /* size actually read */
{
- int i, isblock, is_tar(), is_compress();
- char *s, *strtok(), *token;
+ int i, isblock, is_tar(), is_compress(), has_escapes = 0;
+ unsigned char *s;
+ char *strtok(), *token;
register struct names *p;
- short has_escapes = 0;
extern int zflag;
/* these are easy, do them first */
* and other trash from real troff input.
*/
if (*buf == '.') {
- char *p = buf + 1;
+ unsigned char *tp = buf + 1;
- while (isascii(*p) && isspace(*p))
- ++p; /* skip leading whitespace */
- if ((isascii(*p) && (isalnum(*p) || *p=='\\') &&
- isascii(*(p+1)) && (isalnum(*(p+1)) || *p=='"'))) {
+ while (isascii(*tp) && isspace(*tp))
+ ++tp; /* skip leading whitespace */
+ if ((isascii(*tp) && (isalnum(*tp) || *tp=='\\') &&
+ isascii(*(tp+1)) && (isalnum(*(tp+1)) || *tp=='"'))) {
ckfputs("troff or preprocessor input text", stdout);
return 1;
}
if (i = is_compress(buf, &isblock)) {
if (zflag) {
- char *newbuf;
+ unsigned char *newbuf;
int newsize;
newsize = uncompress(buf, nbytes, &newbuf);
try(newbuf, newsize);
/* free(newbuf) */
- printf("(%scompressed data - %d bits)",
+ printf(" (%scompressed data - %d bits)",
isblock ? "block " : "", i);
}
else printf("%scompressed data - %d bits",
*/
int
is_compress(p, b)
-char *p;
+unsigned char *p;
int *b;
{
#ifndef lint
static char *moduleid =
- "@(#)$Header: /home/glen/git/file/cvs/file/src/file.c,v 1.17 1991/01/23 13:23:23 ian Exp $";
+ "@(#)$Header: /home/glen/git/file/cvs/file/src/file.c,v 1.18 1991/01/23 13:56:37 ian Exp $";
#endif /* lint */
extern char *ckfmsg;
for (; optind < argc; optind++)
process(argv[optind], 1);
- exit(0);
+ return 0;
}
/*
unwrap(fn)
char *fn;
{
-#define FILENAMELEN 128
+#define FILENAMELEN 1024
char buf[FILENAMELEN];
FILE *f;
/*
* process - process input file
*/
+/*ARGSUSED1*/ /* why is top no longer used? */
process(inname, top)
char *inname;
int top; /* true if called from top level */
{
int fd;
- char buf[HOWMANY];
+ unsigned char buf[HOWMANY];
struct utimbuf utbuf;
if (strcmp("-", inname) == 0) {
/*
* try looking at the first HOWMANY bytes
*/
- if ((nbytes = read(fd, buf, HOWMANY)) == -1)
+ if ((nbytes = read(fd, (char *)buf, HOWMANY)) == -1)
warning("read failed");
if (nbytes == 0) {
ckfputs("empty", stdout);
(void) putchar('\n');
}
-try(buf, nbytes)
-char *buf;
-int nbytes;
+try(buf, nb)
+unsigned char *buf;
+int nb;
{
/*
* try tests in /etc/magic (or surrogate magic file)
*/
- if (softmagic(buf, nbytes) == 1)
+ if (softmagic(buf, nb) == 1)
/*NULLBODY*/;
- else if (ascmagic(buf, nbytes) == 1)
+ else if (ascmagic(buf, nb) == 1)
/*
* try known keywords, check for ascii-ness too.
*/
#ifndef lint
static char *moduleid =
- "@(#)$Header: /home/glen/git/file/cvs/file/src/fsmagic.c,v 1.11 1991/01/23 12:12:20 ian Exp $";
+ "@(#)$Header: /home/glen/git/file/cvs/file/src/fsmagic.c,v 1.12 1991/01/23 13:56:40 ian Exp $";
#endif /* lint */
extern char *progname;
buf[nch] = '\0'; /* readlink(2) forgets this */
/* If dangling symlink, say so and quit early. */
- if (stat(buf, tstatbuf) < 0) {
+/*###113 [lint] stat arg. 2 used inconsistently llib-lc(661) :: fsmagic.c(113)%%%*/
+ if (stat(buf, &tstatbuf) < 0) {
ckfputs("dangling symbolic link", stdout);
return 1;
}
* 2 for Unix Std (POSIX) tar file.
*/
int
-is_tar(header)
- register union record *header;
+is_tar(buf)
+unsigned char *buf;
{
+ register union record *header = (union record *)buf;
register int i;
register long sum, recsum;
register char *p;
#ifndef lint
static char *moduleid =
- "@(#)$Header: /home/glen/git/file/cvs/file/src/softmagic.c,v 1.8 1990/10/03 17:53:10 ian Exp $";
+ "@(#)$Header: /home/glen/git/file/cvs/file/src/softmagic.c,v 1.9 1991/01/23 13:56:45 ian Exp $";
#endif /* lint */
extern char *progname;
* (already read from /etc/magic by apprentice.c).
* Passed the name and FILE * of one file to be typed.
*/
-softmagic(buf)
-char *buf;
+/*ARGSUSED1*/ /* nbytes passed for regularity, maybe need later */
+softmagic(buf, nbytes)
+unsigned char *buf;
+int nbytes;
{
magindex = 0;
if (match(buf))
* Be sure to process every continuation of this match.
*/
match(s)
-char *s;
+unsigned char *s;
{
while (magindex < nmagic) {
/* if main entry matches, print it... */
mprint(m,s)
struct magic *m;
-char *s;
+unsigned char *s;
{
register union VALUETYPE *p = (union VALUETYPE *)(s+m->offset);
register long v;
int
mcheck(s, m)
-char *s;
+unsigned char *s;
struct magic *m;
{
register union VALUETYPE *p = (union VALUETYPE *)(s+m->offset);