Source-Changes-HG archive

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

[src/trunk]: src/bin/pax PR/29005: Jesse Off: nbpax requires sys/mtio.h which...



details:   https://anonhg.NetBSD.org/src/rev/6b8fc10a5156
branches:  trunk
changeset: 580600:6b8fc10a5156
user:      christos <christos%NetBSD.org@localhost>
date:      Sun May 01 02:59:28 2005 +0000

description:
PR/29005: Jesse Off: nbpax requires sys/mtio.h which doesn't exist on Interix
I added an ifdef called HAVE_MTIO_H and fixed the code to use it. It is
always defined now, but you can change this for Interix.

diffstat:

 bin/pax/Makefile  |   5 ++++-
 bin/pax/ar_io.c   |  37 +++++++++++++++++++++++++++++++------
 bin/pax/options.c |   5 ++---
 3 files changed, 37 insertions(+), 10 deletions(-)

diffs (184 lines):

diff -r cf0392a3d663 -r 6b8fc10a5156 bin/pax/Makefile
--- a/bin/pax/Makefile  Sun May 01 02:41:08 2005 +0000
+++ b/bin/pax/Makefile  Sun May 01 02:59:28 2005 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.31 2004/05/11 17:12:26 christos Exp $
+#      $NetBSD: Makefile,v 1.32 2005/05/01 02:59:28 christos Exp $
 #       @(#)Makefile   8.1 (Berkeley) 5/31/93
 
 # To install on versions prior to BSD 4.4 the following may have to be
@@ -47,6 +47,9 @@
 
 MAN=   pax.1 tar.1 cpio.1
 
+# XXX: Interix does not have it; we need a conditional for it.
+CPPFLAGS+=     -DHAVE_MTIO_H
+
 .if defined(HOSTPROG)
 CPPFLAGS+=     -DHOSTPROG
 .else  # {     ! HOSTPROG
diff -r cf0392a3d663 -r 6b8fc10a5156 bin/pax/ar_io.c
--- a/bin/pax/ar_io.c   Sun May 01 02:41:08 2005 +0000
+++ b/bin/pax/ar_io.c   Sun May 01 02:59:28 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ar_io.c,v 1.45 2005/04/24 01:45:03 christos Exp $      */
+/*     $NetBSD: ar_io.c,v 1.46 2005/05/01 02:59:28 christos Exp $      */
 
 /*-
  * Copyright (c) 1992 Keith Muller.
@@ -42,16 +42,18 @@
 #if 0
 static char sccsid[] = "@(#)ar_io.c    8.2 (Berkeley) 4/18/94";
 #else
-__RCSID("$NetBSD: ar_io.c,v 1.45 2005/04/24 01:45:03 christos Exp $");
+__RCSID("$NetBSD: ar_io.c,v 1.46 2005/05/01 02:59:28 christos Exp $");
 #endif
 #endif /* not lint */
 
 #include <sys/types.h>
+#include <sys/param.h>
 #include <sys/time.h>
 #include <sys/stat.h>
 #include <sys/ioctl.h>
+#ifdef HAVE_MTIO_H
 #include <sys/mtio.h>
-#include <sys/param.h>
+#endif
 #include <sys/wait.h>
 #include <signal.h>
 #include <string.h>
@@ -97,7 +99,9 @@
 time_t starttime;                      /* time the run started */
 int force_one_volume;                  /* 1 if we ignore volume changes */
 
+#ifdef HAVE_MTIO_H
 static int get_phys(void);
+#endif
 extern sigset_t s_mask;
 static void ar_start_gzip(int, const char *, int);
 static const char *timefmt(char *, size_t, off_t, time_t, const char *);
@@ -125,7 +129,9 @@
 int
 ar_open(const char *name)
 {
+#ifdef HAVE_MTIO_H
        struct mtget mb;
+#endif
 
        if (arfd != -1)
                (void)close(arfd);
@@ -213,9 +219,14 @@
                return(-1);
        }
 
-       if (S_ISCHR(arsb.st_mode))
+       if (S_ISCHR(arsb.st_mode)) {
+#ifdef HAVE_MTIO_H
                artyp = ioctl(arfd, MTIOCGET, &mb) ? ISCHR : ISTAPE;
-       else if (S_ISBLK(arsb.st_mode))
+#else
+               tty_warn(1, "System does not have tape support");
+               artyp = ISREG;
+#endif
+       } else if (S_ISBLK(arsb.st_mode))
                artyp = ISBLK;
        else if ((lseek(arfd, (off_t)0L, SEEK_CUR) == -1) && (errno == ESPIPE))
                artyp = ISPIPE;
@@ -941,7 +952,9 @@
        long fsbz;
        off_t cpos;
        off_t mpos;
+#ifdef HAVE_MTIO_H
        struct mtop mb;
+#endif
 
        /*
         * Fail resync attempts at user request (done) or if this is going to be
@@ -963,6 +976,7 @@
        case ISRMT:
 #endif /* SUPPORT_RMT */
        case ISTAPE:
+#ifdef HAVE_MTIO_H
                /*
                 * if the last i/o was a successful data transfer, we assume
                 * the fault is just a bad record on the tape that we are now
@@ -990,6 +1004,9 @@
                }
 #endif /* SUPPORT_RMT */
                lstrval = 1;
+#else
+               tty_warn(1, "System does not have tape support");
+#endif
                break;
        case ISREG:
        case ISCHR:
@@ -1103,8 +1120,10 @@
 ar_rev(off_t sksz)
 {
        off_t cpos;
+#ifdef HAVE_MTIO_H
+       int phyblk;
        struct mtop mb;
-       int phyblk;
+#endif
 
        /*
         * make sure we do not have try to reverse on a flawed archive
@@ -1172,6 +1191,7 @@
 #ifdef SUPPORT_RMT
        case ISRMT:
 #endif /* SUPPORT_RMT */
+#ifdef HAVE_MTIO_H
                /*
                 * Calculate and move the proper number of PHYSICAL tape
                 * blocks. If the sksz is not an even multiple of the physical
@@ -1224,12 +1244,16 @@
                        lstrval = -1;
                        return(-1);
                }
+#else
+               tty_warn(1, "System does not have tape support");
+#endif
                break;
        }
        lstrval = 1;
        return(0);
 }
 
+#ifdef HAVE_MTIO_H
 /*
  * get_phys()
  *     Determine the physical block size on a tape drive. We need the physical
@@ -1386,6 +1410,7 @@
        }
        return(phyblk);
 }
+#endif
 
 /*
  * ar_next()
diff -r cf0392a3d663 -r 6b8fc10a5156 bin/pax/options.c
--- a/bin/pax/options.c Sun May 01 02:41:08 2005 +0000
+++ b/bin/pax/options.c Sun May 01 02:59:28 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: options.c,v 1.84 2005/04/24 03:39:26 christos Exp $    */
+/*     $NetBSD: options.c,v 1.85 2005/05/01 02:59:28 christos Exp $    */
 
 /*-
  * Copyright (c) 1992 Keith Muller.
@@ -42,14 +42,13 @@
 #if 0
 static char sccsid[] = "@(#)options.c  8.2 (Berkeley) 4/18/94";
 #else
-__RCSID("$NetBSD: options.c,v 1.84 2005/04/24 03:39:26 christos Exp $");
+__RCSID("$NetBSD: options.c,v 1.85 2005/05/01 02:59:28 christos Exp $");
 #endif
 #endif /* not lint */
 
 #include <sys/types.h>
 #include <sys/time.h>
 #include <sys/stat.h>
-#include <sys/mtio.h>
 #include <sys/param.h>
 #include <ctype.h>
 #include <errno.h>



Home | Main Index | Thread Index | Old Index