From: Christos Zoulas Date: Sun, 15 Feb 1998 23:18:53 +0000 (+0000) Subject: Add autoconf X-Git-Tag: FILE3_27~32 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1c03e6c9e528e85566339925f0dc05c790727823;p=file Add autoconf --- diff --git a/doc/file.man b/doc/file.man index 7bc9a894..e384a278 100644 --- a/doc/file.man +++ b/doc/file.man @@ -1,5 +1,5 @@ .TH FILE __CSECTION__ "Copyright but distributable" -.\" $Id: file.man,v 1.30 1997/11/05 16:03:18 christos Exp $ +.\" $Id: file.man,v 1.31 1998/02/15 23:18:53 christos Exp $ .SH NAME file \- determine file type @@ -231,7 +231,7 @@ postal address: P.O. Box 603, Station F, Toronto, Ontario, CANADA M4Y 2L8. Altered by Rob McMahon, cudcv@warwick.ac.uk, 1989, to extend the `&' operator from simple `x&y != 0' to `x&y op z'. .PP -Altered by Guy Harris, guy@auspex.com, 1993, to: +Altered by Guy Harris, guy@netapp.com, 1993, to: .RS .PP put the ``old-style'' `&' diff --git a/src/ascmagic.c b/src/ascmagic.c index 7ba9ae1c..17dec1b3 100644 --- a/src/ascmagic.c +++ b/src/ascmagic.c @@ -28,6 +28,7 @@ #include #include +#include #include #include #include @@ -36,7 +37,7 @@ #ifndef lint static char *moduleid = - "@(#)$Id: ascmagic.c,v 1.21 1997/01/15 17:23:24 christos Exp $"; + "@(#)$Id: ascmagic.c,v 1.22 1998/02/15 23:18:53 christos Exp $"; #endif /* lint */ /* an optimisation over plain strcmp() */ diff --git a/src/compress.c b/src/compress.c index 096abb61..ed10c5b1 100644 --- a/src/compress.c +++ b/src/compress.c @@ -4,13 +4,18 @@ * information if recognized * uncompress(method, old, n, newch) - uncompress old into new, * using method, return sizeof new - * $Id: compress.c,v 1.9 1995/05/20 22:09:21 christos Exp $ + * $Id: compress.c,v 1.10 1998/02/15 23:18:53 christos Exp $ */ #include #include #include #include +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#ifdef HAVE_SYS_WAIT_H #include +#endif #include "file.h" diff --git a/src/file.c b/src/file.c index aa8e663f..a2c8d11f 100644 --- a/src/file.c +++ b/src/file.c @@ -26,7 +26,7 @@ */ #ifndef lint static char *moduleid = - "@(#)$Id: file.c,v 1.38 1997/01/15 19:28:35 christos Exp $"; + "@(#)$Id: file.c,v 1.39 1998/02/15 23:18:53 christos Exp $"; #endif /* lint */ #include @@ -53,9 +53,9 @@ static char *moduleid = #include "file.h" #ifdef S_IFLNK -# define USAGE "Usage: %s [-vczL] [-f namefile] [-m magicfiles] file...\n" +# define USAGE "Usage: %s [-vbczL] [-f namefile] [-m magicfiles] file...\n" #else -# define USAGE "Usage: %s [-vcz] [-f namefile] [-m magicfiles] file...\n" +# define USAGE "Usage: %s [-vbcz] [-f namefile] [-m magicfiles] file...\n" #endif #ifndef MAGIC @@ -65,6 +65,7 @@ static char *moduleid = int /* Global command-line options */ debug = 0, /* debugging */ lflag = 0, /* follow Symlinks (BSD only) */ + bflag = 0, /* brief output format */ zflag = 0; /* follow (uncompress) compressed files */ int /* Misc globals */ @@ -103,12 +104,15 @@ char *argv[]; if (!(magicfile = getenv("MAGIC"))) magicfile = MAGIC; - while ((c = getopt(argc, argv, "vcdf:Lm:z")) != EOF) + while ((c = getopt(argc, argv, "vbcdf:Lm:z")) != EOF) switch (c) { case 'v': (void) fprintf(stdout, "%s-%d.%d\n", progname, FILE_VERSION_MAJOR, patchlevel); return 1; + case 'b': + ++bflag; + break; case 'c': ++check; break; @@ -302,7 +306,7 @@ int wid; inname = stdname; } - if (wid > 0) + if (wid > 0 && !bflag) (void) printf("%s:%*s ", inname, (int) (wid - strlen(inname)), ""); diff --git a/src/fsmagic.c b/src/fsmagic.c index dab854e7..378de243 100644 --- a/src/fsmagic.c +++ b/src/fsmagic.c @@ -31,6 +31,9 @@ #include #include #include +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #ifndef major # if defined(__SVR4) || defined(_SVR4_SOURCE) # include @@ -51,7 +54,7 @@ #ifndef lint static char *moduleid = - "@(#)$Id: fsmagic.c,v 1.25 1997/01/15 19:28:35 christos Exp $"; + "@(#)$Id: fsmagic.c,v 1.26 1998/02/15 23:18:53 christos Exp $"; #endif /* lint */ int @@ -89,12 +92,20 @@ struct stat *sb; ckfputs("directory", stdout); return 1; case S_IFCHR: +#ifdef HAVE_ST_RDEV (void) printf("character special (%ld/%ld)", (long) major(sb->st_rdev), (long) minor(sb->st_rdev)); +#else + (void) printf("character special"); +#endif return 1; case S_IFBLK: +#ifdef HAVE_ST_RDEV (void) printf("block special (%ld/%ld)", (long) major(sb->st_rdev), (long) minor(sb->st_rdev)); +#else + (void) printf("block special"); +#endif return 1; /* TODO add code to handle V7 MUX and Blit MUX files */ #ifdef S_IFIFO diff --git a/src/internat.c b/src/internat.c index 1a97146f..a39799ff 100644 --- a/src/internat.c +++ b/src/internat.c @@ -10,6 +10,7 @@ #include "file.h" #include +#include #define F 0 #define T 1 @@ -63,7 +64,7 @@ internatmagic(buf, nbytes) */ for (i = 0; i < nbytes;) { - cp = memchr(buf, '\n', nbytes - i); + cp = (unsigned char *) memchr(buf, '\n', nbytes - i); if (cp == NULL) { /* Don't fail if we hit the end of buffer. */ if (i + MAXLINELEN >= nbytes) diff --git a/src/readelf.c b/src/readelf.c index aa0c4e77..3ac702d1 100644 --- a/src/readelf.c +++ b/src/readelf.c @@ -8,6 +8,9 @@ #include #include +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "readelf.h" #include "file.h" @@ -288,19 +291,21 @@ tryelf(fd, buf, nbytes) if ((u.c[sizeof(long) - 1] + 1) == elfhdr.e_ident[5]) { #ifdef notyet if (elfhdr.e_type == ET_CORE) - dophn_core(fd, elfhdr.e_phoff, elfhdr.e_phnum, - elfhdr.e_phentsize, buf); + dophn_core(fd, elfhdr.e_phoff[1], + elfhdr.e_phnum, + elfhdr.e_phentsize, buf); else #endif { #ifdef notyet if (elfhdr.e_type == ET_EXEC) { - dophn_exec(fd, elfhdr.e_phoff, - elfhdr.e_phnum, - elfhdr.e_phentsize, buf); + dophn_exec(fd, elfhdr.e_phoff[1], + elfhdr.e_phnum, + elfhdr.e_phentsize, buf); } #endif - doshn(fd, elfhdr.e_shoff, elfhdr.e_shnum, + doshn(fd, elfhdr.e_shoff[1], + elfhdr.e_shnum, elfhdr.e_shentsize, buf); } } diff --git a/src/softmagic.c b/src/softmagic.c index 94a99176..f85042b3 100644 --- a/src/softmagic.c +++ b/src/softmagic.c @@ -31,11 +31,14 @@ #include #include +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "file.h" #ifndef lint static char *moduleid = - "@(#)$Id: softmagic.c,v 1.35 1997/04/13 18:28:30 christos Exp $"; + "@(#)$Id: softmagic.c,v 1.36 1998/02/15 23:18:53 christos Exp $"; #endif /* lint */ static int match __P((unsigned char *, int));