pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/pkgtools/pkg_install/files/lib Remove unused variables...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/52d3c328093b
branches:  trunk
changeset: 503551:52d3c328093b
user:      ben <ben%pkgsrc.org@localhost>
date:      Wed Nov 23 04:49:51 2005 +0000

description:
Remove unused variables, fix variable names to avoid shadowing globals,
and add PAX_CMD fallback macro.

diffstat:

 pkgtools/pkg_install/files/lib/fexec.c |   4 +---
 pkgtools/pkg_install/files/lib/file.c  |  33 ++++++++++++++++-----------------
 pkgtools/pkg_install/files/lib/lib.h   |   7 ++++++-
 3 files changed, 23 insertions(+), 21 deletions(-)

diffs (118 lines):

diff -r d13b8cea4a8d -r 52d3c328093b pkgtools/pkg_install/files/lib/fexec.c
--- a/pkgtools/pkg_install/files/lib/fexec.c    Tue Nov 22 23:20:55 2005 +0000
+++ b/pkgtools/pkg_install/files/lib/fexec.c    Wed Nov 23 04:49:51 2005 +0000
@@ -65,7 +65,7 @@
 #include "lib.h"
 
 #ifndef lint
-__RCSID("$NetBSD: fexec.c,v 1.6 2005/11/22 15:44:59 ben Exp $");
+__RCSID("$NetBSD: fexec.c,v 1.7 2005/11/23 04:49:51 ben Exp $");
 #endif
 
 static int     vfcexec(const char *, int, const char *, va_list);
@@ -111,8 +111,6 @@
        static unsigned int     max = 4;
        static const char       **argv = NULL;
        unsigned int            argc;
-       pid_t                   child;
-       int                     status;
 
        if (argv == NULL) {
                argv = malloc(max * sizeof(const char *));
diff -r d13b8cea4a8d -r 52d3c328093b pkgtools/pkg_install/files/lib/file.c
--- a/pkgtools/pkg_install/files/lib/file.c     Tue Nov 22 23:20:55 2005 +0000
+++ b/pkgtools/pkg_install/files/lib/file.c     Wed Nov 23 04:49:51 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: file.c,v 1.15 2005/11/22 15:44:59 ben Exp $    */
+/*     $NetBSD: file.c,v 1.16 2005/11/23 04:49:51 ben Exp $    */
 
 #if HAVE_CONFIG_H
 #include "config.h"
@@ -17,7 +17,7 @@
 #if 0
 static const char *rcsid = "from FreeBSD Id: file.c,v 1.29 1997/10/08 07:47:54 charnier Exp";
 #else
-__RCSID("$NetBSD: file.c,v 1.15 2005/11/22 15:44:59 ben Exp $");
+__RCSID("$NetBSD: file.c,v 1.16 2005/11/23 04:49:51 ben Exp $");
 #endif
 #endif
 
@@ -624,14 +624,13 @@
 int
 unpack(const char *pkg, const lfile_head_t *filesp)
 {
-       char cmd[MaxPathSize];
        const char *decompress_cmd = NULL;
        const char *suf;
        int count = 0;
        lfile_t *lfp;
        char **up_argv;
        int up_argc = 7;
-       int index = 0;
+       int i = 0;
        int result;
 
        if (filesp != NULL)
@@ -652,28 +651,28 @@
        } else
                decompress_cmd = GZIP_CMD;
 
-       up_argv[index] = strrchr(TAR_CMD, '/');
-       if (up_argv[index] == NULL)
-               up_argv[index] = TAR_CMD;
+       up_argv[i] = strrchr(TAR_CMD, '/');
+       if (up_argv[i] == NULL)
+               up_argv[i] = TAR_CMD;
        else
-               up_argv[index]++;  /* skip / character */
+               up_argv[i]++;  /* skip / character */
        if (count > 0)
-               up_argv[++index] = "--fast-read";
+               up_argv[++i] = "--fast-read";
        if (decompress_cmd != NULL) {
-               up_argv[++index] = "--use-compress-program";
-               up_argv[++index] = (char *)decompress_cmd;
+               up_argv[++i] = "--use-compress-program";
+               up_argv[++i] = (char *)decompress_cmd;
        }
-       up_argv[++index] = "-xpf";
-       up_argv[++index] = (char *)pkg;
+       up_argv[++i] = "-xpf";
+       up_argv[++i] = (char *)pkg;
        if (count > 0)
                TAILQ_FOREACH(lfp, filesp, lf_link)
-                       up_argv[++index] = lfp->lf_name;
-       up_argv[++index] = NULL;
+                       up_argv[++i] = lfp->lf_name;
+       up_argv[++i] = NULL;
 
        if (Verbose) {
                printf("running: %s", TAR_CMD);
-               for (index = 1; up_argv[index] != NULL; index++)
-                       printf(" %s", up_argv[index]);
+               for (i = 1; up_argv[i] != NULL; i++)
+                       printf(" %s", up_argv[i]);
                printf("\n");
        }
 
diff -r d13b8cea4a8d -r 52d3c328093b pkgtools/pkg_install/files/lib/lib.h
--- a/pkgtools/pkg_install/files/lib/lib.h      Tue Nov 22 23:20:55 2005 +0000
+++ b/pkgtools/pkg_install/files/lib/lib.h      Wed Nov 23 04:49:51 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lib.h,v 1.18 2005/11/22 15:44:59 ben Exp $ */
+/* $NetBSD: lib.h,v 1.19 2005/11/23 04:49:51 ben Exp $ */
 
 /* from FreeBSD Id: lib.h,v 1.25 1997/10/08 07:48:03 charnier Exp */
 
@@ -97,6 +97,11 @@
 #define TAR_CMD        "tar"
 #endif
 
+/* Define pax as a string, used to copy files from staging area */
+#ifndef PAX_CMD
+#define PAX_CMD        "tar"
+#endif
+
 /* Define gzip and bzip2, used to unpack binary packages */
 #ifndef GZIP_CMD
 #define GZIP_CMD "gzip"



Home | Main Index | Thread Index | Old Index