*/
#ifndef lint
static char *moduleid =
- "@(#)$Id: file.c,v 1.37 1997/01/15 17:23:24 christos Exp $";
+ "@(#)$Id: file.c,v 1.38 1997/01/15 19:28:35 christos Exp $";
#endif /* lint */
#include <stdio.h>
static void unwrap __P((char *fn));
+#if 0
static int byteconv4 __P((int, int, int));
static short byteconv2 __P((int, int, int));
+#endif
/*
* main - parse arguments and handle options
}
+#if 0
/*
* byteconv4
* Input:
else
return ntohs(from); /* msb -> lsb conversion on lsb */
}
+#endif
/*
* process - process input file
/*
* file.h - definitions for file(1) program
- * @(#)$Id: file.h,v 1.24 1997/01/15 17:23:24 christos Exp $
+ * @(#)$Id: file.h,v 1.25 1997/01/15 19:28:35 christos Exp $
*
* Copyright (c) Ian F. Darwin, 1987.
* Written by Ian F. Darwin.
extern int zmagic __P((unsigned char *, int));
extern void ckfprintf __P((FILE *, const char *, ...));
extern uint32 signextend __P((struct magic *, unsigned int32));
-
+extern int internatmagic __P((unsigned char *, int));
+extern void tryelf __P((int, char *, int));
extern int errno; /* Some unixes don't define this.. */
#ifndef lint
static char *moduleid =
- "@(#)$Id: fsmagic.c,v 1.24 1996/08/20 01:51:40 christos Exp $";
+ "@(#)$Id: fsmagic.c,v 1.25 1997/01/15 19:28:35 christos Exp $";
#endif /* lint */
int
ckfputs("directory", stdout);
return 1;
case S_IFCHR:
- (void) printf("character special (%d/%d)",
- major(sb->st_rdev), minor(sb->st_rdev));
+ (void) printf("character special (%ld/%ld)",
+ (long) major(sb->st_rdev), (long) minor(sb->st_rdev));
return 1;
case S_IFBLK:
- (void) printf("block special (%d/%d)",
- major(sb->st_rdev), minor(sb->st_rdev));
+ (void) printf("block special (%ld/%ld)",
+ (long) major(sb->st_rdev), (long) minor(sb->st_rdev));
return 1;
/* TODO add code to handle V7 MUX and Blit MUX files */
#ifdef S_IFIFO
#ifndef lint
static char *moduleid =
- "@(#)$Id: print.c,v 1.22 1995/05/20 22:09:21 christos Exp $";
+ "@(#)$Id: print.c,v 1.23 1997/01/15 19:28:35 christos Exp $";
#endif /* lint */
#define SZOF(a) (sizeof(a) / sizeof(a[0]))
m->offset);
if (m->flag & INDIR)
- (void) fprintf(stderr, "(%s,%ld),",
+ (void) fprintf(stderr, "(%s,%d),",
(m->in.type >= 0 && m->in.type < SZOF(typ)) ?
typ[(unsigned char) m->in.type] :
"*bad*",
typ[(unsigned char) m->type] :
"*bad*");
if (m->mask != ~0L)
- (void) fprintf(stderr, " & %.8lx", m->mask);
+ (void) fprintf(stderr, " & %.8x", m->mask);
(void) fprintf(stderr, ",%c", m->reln);
case LELONG:
case BESHORT:
case BELONG:
- (void) fprintf(stderr, "%ld", m->value.l);
+ (void) fprintf(stderr, "%d", m->value.l);
break;
case STRING:
showstr(stderr, m->value.s, -1);
#ifdef BUILTIN_ELF
#include <sys/types.h>
+#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
* one is found or else the binary is stripped.
*/
if (buf[EI_MAG0] != ELFMAG0 || buf[EI_MAG1] != ELFMAG1
- && buf[EI_MAG2] != ELFMAG2 || buf[EI_MAG3] != ELFMAG3)
+ || buf[EI_MAG2] != ELFMAG2 || buf[EI_MAG3] != ELFMAG3)
return;
#ifndef lint
static char *moduleid =
- "@(#)$Id: softmagic.c,v 1.33 1997/01/15 17:23:24 christos Exp $";
+ "@(#)$Id: softmagic.c,v 1.34 1997/01/15 19:28:35 christos Exp $";
#endif /* lint */
static int match __P((unsigned char *, int));
*rt = '\0';
(void) printf(m->desc, pp);
t = m->offset + sizeof(time_t);
- return;
+ break;
+
default:
error("invalid m->type (%d) in mprint().\n", m->type);
/*NOTREACHED*/
return 1;
case STRING:
{
- size_t len;
char *ptr;
/* Null terminate and eat the return */
char *str;
int len;
{
- (void) fprintf(stderr, "mget @%ld: ", offset);
+ (void) fprintf(stderr, "mget @%d: ", offset);
showstr(stderr, (char *) str, len);
(void) fputc('\n', stderr);
(void) fputc('\n', stderr);
switch (m->reln) {
case 'x':
if (debug)
- (void) fprintf(stderr, "%lu == *any* = 1\n", v);
+ (void) fprintf(stderr, "%u == *any* = 1\n", v);
matched = 1;
break;
case '!':
matched = v != l;
if (debug)
- (void) fprintf(stderr, "%lu != %lu = %d\n",
+ (void) fprintf(stderr, "%u != %u = %d\n",
v, l, matched);
break;
case '=':
matched = v == l;
if (debug)
- (void) fprintf(stderr, "%lu == %lu = %d\n",
+ (void) fprintf(stderr, "%u == %u = %d\n",
v, l, matched);
break;
if (m->flag & UNSIGNED) {
matched = v > l;
if (debug)
- (void) fprintf(stderr, "%lu > %lu = %d\n",
+ (void) fprintf(stderr, "%u > %u = %d\n",
v, l, matched);
}
else {
matched = (int32) v > (int32) l;
if (debug)
- (void) fprintf(stderr, "%ld > %ld = %d\n",
+ (void) fprintf(stderr, "%d > %d = %d\n",
v, l, matched);
}
break;
if (m->flag & UNSIGNED) {
matched = v < l;
if (debug)
- (void) fprintf(stderr, "%lu < %lu = %d\n",
+ (void) fprintf(stderr, "%u < %u = %d\n",
v, l, matched);
}
else {
matched = (int32) v < (int32) l;
if (debug)
- (void) fprintf(stderr, "%ld < %ld = %d\n",
+ (void) fprintf(stderr, "%d < %d = %d\n",
v, l, matched);
}
break;
case '&':
matched = (v & l) == l;
if (debug)
- (void) fprintf(stderr, "((%lx & %lx) == %lx) = %d\n",
+ (void) fprintf(stderr, "((%x & %x) == %x) = %d\n",
v, l, l, matched);
break;
case '^':
matched = (v & l) != l;
if (debug)
- (void) fprintf(stderr, "((%lx & %lx) != %lx) = %d\n",
+ (void) fprintf(stderr, "((%x & %x) != %x) = %d\n",
v, l, l, matched);
break;