Source-Changes-HG archive

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

[src/netbsd-1-5]: src/usr.sbin/pkg_install/admin Pull up revisions 1.14-1.16, ...



details:   https://anonhg.NetBSD.org/src/rev/2d7c9d543b4e
branches:  netbsd-1-5
changeset: 490910:2d7c9d543b4e
user:      he <he%NetBSD.org@localhost>
date:      Tue Mar 20 17:58:09 2001 +0000

description:
Pull up revisions 1.14-1.16,1.18-1.21 (requested by hubertf):
  Various changes / updates:
   o add -V option to determine version
   o various minor bugfixes and spelling fixes

diffstat:

 usr.sbin/pkg_install/admin/main.c |  29 +++++++++++++----------------
 1 files changed, 13 insertions(+), 16 deletions(-)

diffs (111 lines):

diff -r 2530f8cbbba8 -r 2d7c9d543b4e usr.sbin/pkg_install/admin/main.c
--- a/usr.sbin/pkg_install/admin/main.c Tue Mar 20 17:57:05 2001 +0000
+++ b/usr.sbin/pkg_install/admin/main.c Tue Mar 20 17:58:09 2001 +0000
@@ -1,8 +1,8 @@
-/*     $NetBSD: main.c,v 1.13.4.1 2000/12/15 04:06:05 he Exp $ */
+/*     $NetBSD: main.c,v 1.13.4.2 2001/03/20 17:58:09 he Exp $ */
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: main.c,v 1.13.4.1 2000/12/15 04:06:05 he Exp $");
+__RCSID("$NetBSD: main.c,v 1.13.4.2 2001/03/20 17:58:09 he Exp $");
 #endif
 
 /*
@@ -37,7 +37,6 @@
 
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <db.h>
 #include <dirent.h>
 #include <err.h>
 #include <errno.h>
@@ -50,8 +49,6 @@
 
 void    usage(void);
 
-extern const char *__progname; /* from crt0.o */
-
 int     filecnt;
 int     pkgcnt;
 
@@ -145,7 +142,6 @@
        }
        free_plist(&Plist);
        fclose(f);
-
        pkgcnt++;
 }
 
@@ -258,10 +254,9 @@
                }
                free_plist(&Plist);
                fclose(f);
+               pkgcnt++;
 
                chdir("..");
-
-               pkgcnt++;
        }
        closedir(dp);
        pkgdb_close();
@@ -302,8 +297,6 @@
                printf(".");
 
                chdir("..");
-
-               pkgcnt++;
        }
        closedir(dp);
        pkgdb_close();
@@ -346,7 +339,12 @@
        if (argc < 2)
                usage();
 
-       if (strcasecmp(argv[1], "rebuild") == 0) {
+       if (strcmp(argv[1], "-V") == 0) {
+
+               show_version();
+               /* NOTREACHED */
+
+       } else if (strcasecmp(argv[1], "rebuild") == 0) {
 
                rebuild();
                printf("Done.\n");
@@ -434,7 +432,7 @@
                        if (rc == -1)
                                err(1, "Cannot chdir to %s", _pkgdb_getPKGDB_DIR());
 
-                       cwd = getwd(NULL);
+                       cwd = getcwd(NULL, 0);
                        if (findmatchingname(cwd, base, lspattern_fn, cwd) == -1)
                                errx(1, "Error in findmatchingname(\"%s\", \"%s\", ...)",
                                     cwd, base);
@@ -473,7 +471,7 @@
                        if (rc == -1)
                                err(1, "Cannot chdir to %s", _pkgdb_getPKGDB_DIR());
 
-                       cwd = getwd(NULL);
+                       cwd = getcwd(NULL, 0);
                        p = findbestmatchingname(cwd, base);
                        if (p)
                                printf("%s/%s\n", cwd, p);
@@ -556,7 +554,7 @@
 void 
 usage(void)
 {
-       printf("Usage: %s command args ...\n"
+       printf("usage: pkg_admin [-V] command args ...\n"
            "Where 'commands' and 'args' are:\n"
            " rebuild          - rebuild pkgdb from +CONTENTS files\n"
            " check [pkg ...]  - check md5 checksum of installed files\n"
@@ -564,8 +562,7 @@
            " add key value    - add key & value\n"
            " delete key       - delete reference to key\n"
 #endif
-           " dump             - dump database\n"
-           ,__progname);
+           " dump             - dump database\n");
        exit(1);
 }
 



Home | Main Index | Thread Index | Old Index