Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/file end this destructive conflict



details:   https://anonhg.NetBSD.org/src/rev/8fc8535d362f
branches:  trunk
changeset: 533790:8fc8535d362f
user:      pooka <pooka%NetBSD.org@localhost>
date:      Tue Jul 09 14:59:52 2002 +0000

description:
end this destructive conflict

diffstat:

 usr.bin/file/apprentice.c       |  28 +++++++-------
 usr.bin/file/ascmagic.c         |   7 +--
 usr.bin/file/compress.c         |   8 +--
 usr.bin/file/config.h           |   2 +-
 usr.bin/file/file.1             |   8 ++--
 usr.bin/file/file.c             |  11 ++---
 usr.bin/file/file.h             |  23 +++++++++---
 usr.bin/file/fsmagic.c          |   9 +---
 usr.bin/file/is_tar.c           |  13 ++----
 usr.bin/file/magdir/archive     |   6 +++
 usr.bin/file/magdir/audio       |  19 ++++++++++
 usr.bin/file/magdir/database    |   6 +++
 usr.bin/file/magdir/filesystems |  72 +++++++++++++++++++++++++++++++++++++++++
 usr.bin/file/magdir/linux       |  64 ++++++++++++++++++++++++++++++++++++
 usr.bin/file/magic.5            |   8 ++--
 usr.bin/file/patchlevel.h       |  13 +++++-
 usr.bin/file/print.c            |   8 ++--
 usr.bin/file/readelf.c          |   9 +---
 usr.bin/file/readelf.h          |   2 +-
 usr.bin/file/softmagic.c        |  10 ++---
 20 files changed, 247 insertions(+), 79 deletions(-)

diffs (truncated from 750 to 300 lines):

diff -r f2af518011a5 -r 8fc8535d362f usr.bin/file/apprentice.c
--- a/usr.bin/file/apprentice.c Tue Jul 09 14:54:39 2002 +0000
+++ b/usr.bin/file/apprentice.c Tue Jul 09 14:59:52 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: apprentice.c,v 1.31 2002/06/14 19:05:18 wiz Exp $      */
+/*     $NetBSD: apprentice.c,v 1.32 2002/07/09 14:59:52 pooka Exp $    */
 
 /*
  * apprentice - make one pass through /etc/magic, learning its secrets.
@@ -28,14 +28,12 @@
  */
 
 #include "file.h"
-#include <stdio.h>
 #include <stdlib.h>
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
 #include <string.h>
 #include <ctype.h>
-#include <errno.h>
 #include <fcntl.h>
 #include <unistd.h>
 #include <sys/types.h>
@@ -47,9 +45,9 @@
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
 #if 0
-FILE_RCSID("@(#)Id: apprentice.c,v 1.46 2002/05/16 18:45:56 christos Exp ")
+FILE_RCSID("@(#)Id: apprentice.c,v 1.49 2002/07/03 19:00:41 christos Exp ")
 #else
-__RCSID("$NetBSD: apprentice.c,v 1.31 2002/06/14 19:05:18 wiz Exp $");
+__RCSID("$NetBSD: apprentice.c,v 1.32 2002/07/09 14:59:52 pooka Exp $");
 #endif
 #endif /* lint */
 
@@ -915,7 +913,7 @@
  */
 static int
 apprentice_map(struct magic **magicp, uint32_t *nmagicp, const char *fn,
-              int action)
+    int action)
 {
        int fd;
        struct stat st;
@@ -923,6 +921,7 @@
        uint32_t version;
        int needsbyteswap;
        char *dbname = mkdbname(fn);
+       void *mm;
 
        if (dbname == NULL)
                return -1;
@@ -937,24 +936,25 @@
        }
 
 #ifdef QUICK
-       if ((*magicp = mmap(0, (size_t)st.st_size, PROT_READ|PROT_WRITE,
+       if ((mm = mmap(0, (size_t)st.st_size, PROT_READ|PROT_WRITE,
            MAP_PRIVATE|MAP_FILE, fd, (off_t)0)) == MAP_FAILED) {
                (void)fprintf(stderr, "%s: Cannot map `%s' (%s)\n",
                    progname, dbname, strerror(errno));
                goto error;
        }
 #else
-       if ((*magicp = malloc((size_t)st.st_size)) == NULL) {
+       if ((mm = malloc((size_t)st.st_size)) == NULL) {
                (void) fprintf(stderr, "%s: Out of memory (%s).\n", progname,
                     strerror(errno));
                goto error;
        }
-       if (read(fd, *magicp, (size_t)st.st_size) != (size_t)st.st_size) {
+       if (read(fd, mm, (size_t)st.st_size) != (size_t)st.st_size) {
                (void) fprintf(stderr, "%s: Read failed (%s).\n", progname,
                    strerror(errno));
                goto error;
        }
 #endif
+       *magicp = mm;
        (void)close(fd);
        fd = -1;
        ptr = (uint32_t *) *magicp;
@@ -986,11 +986,11 @@
 error:
        if (fd != -1)
                (void)close(fd);
-       if (*magicp) {
+       if (mm) {
 #ifdef QUICK
-               (void)munmap(*magicp, (size_t)st.st_size);
+               (void)munmap(mm, (size_t)st.st_size);
 #else
-               free(*magicp);
+               free(mm);
 #endif
        } else {
                *magicp = NULL;
@@ -1003,8 +1003,8 @@
  * handle an mmaped file.
  */
 static int
-apprentice_compile(struct magic **magicp, uint32_t *nmagicp,
-                  const char *fn, int action)
+apprentice_compile(struct magic **magicp, uint32_t *nmagicp, const char *fn,
+    int action)
 {
        int fd;
        char *dbname = mkdbname(fn);
diff -r f2af518011a5 -r 8fc8535d362f usr.bin/file/ascmagic.c
--- a/usr.bin/file/ascmagic.c   Tue Jul 09 14:54:39 2002 +0000
+++ b/usr.bin/file/ascmagic.c   Tue Jul 09 14:59:52 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ascmagic.c,v 1.18 2002/06/14 19:05:18 wiz Exp $        */
+/*     $NetBSD: ascmagic.c,v 1.19 2002/07/09 14:59:53 pooka Exp $      */
 
 /*
  * ASCII magic -- file types that we know based on keywords
@@ -37,7 +37,6 @@
  */
 
 #include "file.h"
-#include <stdio.h>
 #include <string.h>
 #include <memory.h>
 #include <ctype.h>
@@ -50,9 +49,9 @@
 #include <sys/cdefs.h>
 #ifndef        lint
 #if 0
-FILE_RCSID("@(#)Id: ascmagic.c,v 1.30 2001/07/26 13:15:49 christos Exp ")
+FILE_RCSID("@(#)Id: ascmagic.c,v 1.32 2002/07/03 18:26:37 christos Exp ")
 #else
-__RCSID("$NetBSD: ascmagic.c,v 1.18 2002/06/14 19:05:18 wiz Exp $");
+__RCSID("$NetBSD: ascmagic.c,v 1.19 2002/07/09 14:59:53 pooka Exp $");
 #endif
 #endif /* lint */
 
diff -r f2af518011a5 -r 8fc8535d362f usr.bin/file/compress.c
--- a/usr.bin/file/compress.c   Tue Jul 09 14:54:39 2002 +0000
+++ b/usr.bin/file/compress.c   Tue Jul 09 14:59:52 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compress.c,v 1.12 2002/06/14 19:05:18 wiz Exp $        */
+/*     $NetBSD: compress.c,v 1.13 2002/07/09 14:59:53 pooka Exp $      */
 
 /*
  * compress routines:
@@ -15,8 +15,6 @@
 #include <unistd.h>
 #endif
 #include <string.h>
-#include <errno.h>
-#include <sys/types.h>
 #ifdef HAVE_SYS_WAIT_H
 #include <sys/wait.h>
 #endif
@@ -27,9 +25,9 @@
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
-FILE_RCSID("@(#)Id: compress.c,v 1.23 2002/05/16 18:57:10 christos Exp ")
+FILE_RCSID("@(#)Id: compress.c,v 1.25 2002/07/03 18:26:37 christos Exp ")
 #else
-__RCSID("$NetBSD: compress.c,v 1.12 2002/06/14 19:05:18 wiz Exp $");
+__RCSID("$NetBSD: compress.c,v 1.13 2002/07/09 14:59:53 pooka Exp $");
 #endif
 #endif
 
diff -r f2af518011a5 -r 8fc8535d362f usr.bin/file/config.h
--- a/usr.bin/file/config.h     Tue Jul 09 14:54:39 2002 +0000
+++ b/usr.bin/file/config.h     Tue Jul 09 14:59:52 2002 +0000
@@ -111,7 +111,7 @@
 #define PACKAGE "file"
 
 /* Version number of package */
-#define VERSION "3.38"
+#define VERSION "3.39"
 
 /* HAVE_TM_ZONE */
 #define HAVE_TM_ZONE 1
diff -r f2af518011a5 -r 8fc8535d362f usr.bin/file/file.1
--- a/usr.bin/file/file.1       Tue Jul 09 14:54:39 2002 +0000
+++ b/usr.bin/file/file.1       Tue Jul 09 14:59:52 2002 +0000
@@ -1,7 +1,7 @@
-.\" $NetBSD: file.1,v 1.26 2002/05/18 07:00:44 pooka Exp $
+.\" $NetBSD: file.1,v 1.27 2002/07/09 14:59:53 pooka Exp $
 .\"
 .TH FILE 1 "Copyright but distributable"
-.\" Id: file.man,v 1.41 2002/05/16 18:45:56 christos Exp 
+.\" Id: file.man,v 1.42 2002/07/03 18:26:37 christos Exp 
 .SH NAME
 file
 \- determine file type
@@ -19,7 +19,7 @@
 .I magicfiles
 ]
 .I file
-\&...
+\*[Am]...
 .br
 .B file
 .B -C
@@ -27,7 +27,7 @@
 .B \-m
 magicfile ]
 .SH DESCRIPTION
-This manual page documents version 3.38 of the
+This manual page documents version 3.39 of the
 .B file
 command.
 .PP
diff -r f2af518011a5 -r 8fc8535d362f usr.bin/file/file.c
--- a/usr.bin/file/file.c       Tue Jul 09 14:54:39 2002 +0000
+++ b/usr.bin/file/file.c       Tue Jul 09 14:59:52 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: file.c,v 1.27 2002/06/14 19:05:18 wiz Exp $    */
+/*     $NetBSD: file.c,v 1.28 2002/07/09 14:59:54 pooka Exp $  */
 
 /*
  * file - find type of a file or files - main program.
@@ -26,15 +26,12 @@
  *
  * 4. This notice may not be removed or altered.
  */
+
 #include "file.h"
-
-#include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <string.h>
-#include <sys/types.h>
 #include <sys/param.h> /* for MAXPATHLEN */
-#include <sys/stat.h>
 #include <fcntl.h>     /* for open() */
 #ifdef RESTORE_TIME
 # if (__COHERENT__ >= 0x420)
@@ -64,9 +61,9 @@
 
 #ifndef        lint
 #if 0
-FILE_RCSID("@(#)Id: file.c,v 1.62 2002/05/16 18:45:56 christos Exp ")
+FILE_RCSID("@(#)Id: file.c,v 1.66 2002/07/03 19:00:41 christos Exp ")
 #else
-__RCSID("$NetBSD: file.c,v 1.27 2002/06/14 19:05:18 wiz Exp $");
+__RCSID("$NetBSD: file.c,v 1.28 2002/07/09 14:59:54 pooka Exp $");
 #endif
 #endif /* lint */
 
diff -r f2af518011a5 -r 8fc8535d362f usr.bin/file/file.h
--- a/usr.bin/file/file.h       Tue Jul 09 14:54:39 2002 +0000
+++ b/usr.bin/file/file.h       Tue Jul 09 14:59:52 2002 +0000
@@ -1,8 +1,8 @@
-/*     $NetBSD: file.h,v 1.27 2002/06/14 19:05:19 wiz Exp $    */
+/*     $NetBSD: file.h,v 1.28 2002/07/09 14:59:54 pooka Exp $  */
 
 /*
  * file.h - definitions for file(1) program
- * @(#)Id: file.h,v 1.39 2002/05/16 18:45:56 christos Exp 
+ * @(#)Id: file.h,v 1.43 2002/07/03 18:57:52 christos Exp 
  *
  * Copyright (c) Ian F. Darwin, 1987.
  * Written by Ian F. Darwin.
@@ -33,12 +33,26 @@
 
 #include <inttypes.h>
 
+#ifndef __linux__
+#define _LARGEFILE_SOURCE
+#define _LARGEFILE64_SOURCE 
+#define _FILE_OFFSET_BITS 64
+#endif
+
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
+#include <errno.h>
+#include <stdio.h>
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
+/* Do this here and now, because struct stat gets re-defined on solaris */
+#include <sys/stat.h>
+
 #ifndef HOWMANY
-# define HOWMANY 16384         /* how much of the file to look at */
+# define HOWMANY 65536         /* how much of the file to look at */
 #endif
 #define MAXMAGIS 4096          /* max entries in /etc/magic */
 #define MAXDESC        50              /* max leng of text description */
@@ -119,9 +133,6 @@
        struct mlist *next, *prev;
 };
 
-#include <errno.h>
-#include <stdio.h>
-
 extern int   apprentice(const char *, int);
 extern int   ascmagic(unsigned char *, int);
 extern void  error(const char *, ...);



Home | Main Index | Thread Index | Old Index