Source-Changes-HG archive

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

[src/netbsd-1-4]: src/usr.sbin/pkg_install/create Pull up revision 1.16:



details:   https://anonhg.NetBSD.org/src/rev/57a43563d2ff
branches:  netbsd-1-4
changeset: 469380:57a43563d2ff
user:      he <he%NetBSD.org@localhost>
date:      Mon Sep 13 22:04:52 1999 +0000

description:
Pull up revision 1.16:
  Bring closer to /usr/share/misc/style with the aid of indent(1).  (hubertf)

diffstat:

 usr.sbin/pkg_install/create/pl.c |  106 ++++++++++++++++++++------------------
 1 files changed, 57 insertions(+), 49 deletions(-)

diffs (206 lines):

diff -r 6cce5b55fba1 -r 57a43563d2ff usr.sbin/pkg_install/create/pl.c
--- a/usr.sbin/pkg_install/create/pl.c  Mon Sep 13 22:03:32 1999 +0000
+++ b/usr.sbin/pkg_install/create/pl.c  Mon Sep 13 22:04:52 1999 +0000
@@ -1,11 +1,11 @@
-/*     $NetBSD: pl.c,v 1.11.2.1 1999/08/22 17:46:25 he Exp $   */
+/*     $NetBSD: pl.c,v 1.11.2.2 1999/09/13 22:04:52 he Exp $   */
 
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static const char *rcsid = "from FreeBSD Id: pl.c,v 1.11 1997/10/08 07:46:35 charnier Exp";
 #else
-__RCSID("$NetBSD: pl.c,v 1.11.2.1 1999/08/22 17:46:25 he Exp $");
+__RCSID("$NetBSD: pl.c,v 1.11.2.2 1999/09/13 22:04:52 he Exp $");
 #endif
 #endif
 
@@ -34,23 +34,25 @@
 #include <err.h>
 #include <md5.h>
 
-/* check that any symbolic link is relative to the prefix */
+/*
+ * Check that any symbolic link is relative to the prefix
+ */
 static void
 CheckSymlink(char *name, char *prefix, size_t prefixcc)
 {
-       char    newtgt[MAXPATHLEN];
-       char    oldtgt[MAXPATHLEN];
-       char    *slash;
-       int     slashc;
-       int     cc;
-       int     i;
+       char    newtgt[MAXPATHLEN];
+       char    oldtgt[MAXPATHLEN];
+       char   *slash;
+       int     slashc;
+       int     cc;
+       int     i;
 
        if ((cc = readlink(name, oldtgt, sizeof(oldtgt))) > 0) {
                oldtgt[cc] = 0;
                if (strncmp(oldtgt, prefix, prefixcc) == 0 && oldtgt[prefixcc] == '/') {
-                       for (slashc = 0, slash = &name[prefixcc + 1] ; (slash = strchr(slash, '/')) != (char *) NULL ; slash++, slashc++) {
+                       for (slashc = 0, slash = &name[prefixcc + 1]; (slash = strchr(slash, '/')) != (char *) NULL; slash++, slashc++) {
                        }
-                       for (cc = i = 0 ; i < slashc ; i++) {
+                       for (cc = i = 0; i < slashc; i++) {
                                strnncpy(&newtgt[cc], sizeof(newtgt) - cc, "../", 3);
                                cc += 3;
                        }
@@ -65,31 +67,35 @@
        }
 }
 
-/* (reversed) comparison routine for directory name sorting */
+/*
+ * (Reversed) comparison routine for directory name sorting
+ */
 static int
 dircmp(const void *vp1, const void *vp2)
 {
-       return strcmp((const char *)vp2, (const char *)vp1);
+       return strcmp((const char *) vp2, (const char *) vp1);
 }
 
-/* re-order the PLIST_DIR_RM entries into reverse alphabetic order */
+/*
+ * Re-order the PLIST_DIR_RM entries into reverse alphabetic order
+ */
 static void
 reorder(package_t *pkg, int dirc)
 {
-       plist_t *p;
-       char    **dirv;
-       int     i;
+       plist_t *p;
+       char  **dirv;
+       int     i;
 
        if ((dirv = (char **) calloc(dirc, sizeof(char *))) == (char **) NULL) {
                warn("No directory re-ordering will be done");
        } else {
-               for (p = pkg->head, i = 0 ; p ; p = p->next) {
+               for (p = pkg->head, i = 0; p; p = p->next) {
                        if (p->type == PLIST_DIR_RM) {
                                dirv[i++] = p->name;
                        }
                }
                qsort(dirv, dirc, sizeof(char *), dircmp);
-               for (p = pkg->head, i = 0 ; p ; p = p->next) {
+               for (p = pkg->head, i = 0; p; p = p->next) {
                        if (p->type == PLIST_DIR_RM) {
                                p->name = dirv[i++];
                        }
@@ -98,26 +104,28 @@
        }
 }
 
-/* Check a list for files that require preconversion */
+/*
+ * Check a list for files that require preconversion
+ */
 void
 check_list(char *home, package_t *pkg, const char *PkgName)
 {
-       struct stat     st;
-       plist_t         *tmp;
-       plist_t         *p;
-       char            name[FILENAME_MAX];
-       char            buf[ChecksumHeaderLen + LegibleChecksumLen];
-       char            *cwd = home;
-       char            *srcdir = NULL;
-       int             dirc;
+       struct stat st;
+       plist_t *tmp;
+       plist_t *p;
+       char    name[FILENAME_MAX];
+       char    buf[ChecksumHeaderLen + LegibleChecksumLen];
+       char   *cwd = home;
+       char   *srcdir = NULL;
+       int     dirc;
 
        /* Open Package Database for writing */
        if (pkgdb_open(0) == -1) {
-           cleanup(0);
-           err(1, "can't open pkgdb");
+               cleanup(0);
+               err(1, "can't open pkgdb");
        }
-       
-       for (dirc = 0, p = pkg->head ; p ; p = p->next) {
+
+       for (dirc = 0, p = pkg->head; p; p = p->next) {
                switch (p->type) {
                case PLIST_CWD:
                        cwd = p->name;
@@ -136,26 +144,26 @@
                         * pkgdb handling - usually, we enter files
                         * into the pkgdb as soon as they hit the disk,
                         * but as they are present before pkg_create
-                        * starts, it's ok to do this somewhere here 
+                        * starts, it's ok to do this somewhere here
                         */
                        {
-                           char *s, t[FILENAME_MAX];
-                           
-                           (void) snprintf(t, sizeof(t), "%s/%s", cwd, p->name);
-                           
-                           s=pkgdb_retrieve(t);
+                               char   *s, t[FILENAME_MAX];
+
+                               (void) snprintf(t, sizeof(t), "%s/%s", cwd, p->name);
+
+                               s = pkgdb_retrieve(t);
 #ifdef PKGDB_DEBUG
- fprintf(stderr, "pkgdb_retrieve(\"%s\")=\"%s\"\n", t, s); /* pkgdb-debug - HF */
+                               fprintf(stderr, "pkgdb_retrieve(\"%s\")=\"%s\"\n", t, s);       /* pkgdb-debug - HF */
 #endif
-                            if (s && PlistOnly)
-                               warnx("Overwriting %s - "
-                                     "pkg %s bogus/conflicting?", t, s);
-                           else {
-                               pkgdb_store(t, PkgName);
+                               if (s && PlistOnly)
+                                       warnx("Overwriting %s - "
+                                           "pkg %s bogus/conflicting?", t, s);
+                               else {
+                                       pkgdb_store(t, PkgName);
 #ifdef PKGDB_DEBUG
- fprintf(stderr, "pkgdb_store(\"%s\", \"%s\")\n", t, PkgName); /* pkgdb-debug - HF */
+                                       fprintf(stderr, "pkgdb_store(\"%s\", \"%s\")\n", t, PkgName);   /* pkgdb-debug - HF */
 #endif
-                           }
+                               }
                        }
 
                        (void) snprintf(name, sizeof(name), "%s/%s", srcdir ? srcdir : cwd, p->name);
@@ -163,7 +171,7 @@
                                warnx("can't stat `%s'", name);
                                continue;
                        }
-                       switch(st.st_mode & S_IFMT) {
+                       switch (st.st_mode & S_IFMT) {
                        case S_IFDIR:
                                p->type = PLIST_DIR_RM;
                                dirc++;
@@ -186,7 +194,7 @@
                        if (MD5File(name, &buf[ChecksumHeaderLen]) != (char *) NULL) {
                                tmp = new_plist_entry();
                                tmp->name = strdup(buf);
-                               tmp->type = PLIST_COMMENT; /* PLIST_MD5 - HF */
+                               tmp->type = PLIST_COMMENT;      /* PLIST_MD5 - HF */
                                tmp->next = p->next;
                                tmp->prev = p;
                                p->next = tmp;
@@ -199,7 +207,7 @@
        }
 
        pkgdb_close();
-       
+
        if (ReorderDirs && dirc > 0) {
                reorder(pkg, dirc);
        }



Home | Main Index | Thread Index | Old Index