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/lib Pull up revisions 1.24-1.25:



details:   https://anonhg.NetBSD.org/src/rev/7c589b4660ac
branches:  netbsd-1-4
changeset: 469391:7c589b4660ac
user:      he <he%NetBSD.org@localhost>
date:      Mon Sep 13 22:30:42 1999 +0000

description:
Pull up revisions 1.24-1.25:
  Hide test for URLlength()>0 behind a macro (IS_URL()).
  Bring closer to /usr/share/misc/style with the aid of indent(1).
(hubertf)

diffstat:

 usr.sbin/pkg_install/lib/lib.h |  186 ++++++++++++++++++++--------------------
 1 files changed, 95 insertions(+), 91 deletions(-)

diffs (259 lines):

diff -r c0f4cdef6c7c -r 7c589b4660ac usr.sbin/pkg_install/lib/lib.h
--- a/usr.sbin/pkg_install/lib/lib.h    Mon Sep 13 22:25:50 1999 +0000
+++ b/usr.sbin/pkg_install/lib/lib.h    Mon Sep 13 22:30:42 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lib.h,v 1.21.2.1 1999/08/22 18:14:29 he Exp $ */
+/* $NetBSD: lib.h,v 1.21.2.2 1999/09/13 22:30:42 he Exp $ */
 
 /* from FreeBSD Id: lib.h,v 1.25 1997/10/08 07:48:03 charnier Exp */
 
@@ -56,12 +56,12 @@
 /* Usually "rm", but often "echo" during debugging! */
 #define RMDIR_CMD      "rmdir"
 
-/* define tar as a string, in case it's called gtar or something */
+/* Define tar as a string, in case it's called gtar or something */
 #ifndef TAR_CMD
 #define TAR_CMD        "tar"
 #endif
 
-/* full path name of TAR_CMD */
+/* Full path name of TAR_CMD */
 #ifndef TAR_FULLPATHNAME
 #define TAR_FULLPATHNAME       "/usr/bin/tar"
 #endif
@@ -90,13 +90,13 @@
 #define PKG_PREFIX_VNAME       "PKG_PREFIX"
 
 /* This should only happen on 1.3 and 1.3.1, not 1.3.2 and up */
-#ifndef TAILQ_FIRST 
+#ifndef TAILQ_FIRST
 #define TAILQ_FIRST(head)               ((head)->tqh_first)
 #define TAILQ_NEXT(elm, field)          ((elm)->field.tqe_next)
 #endif
 
 
-/* enumerated constants for plist entry types */
+/* Enumerated constants for plist entry types */
 typedef enum pl_ent_t {
        PLIST_SHOW_ALL = -1,
        PLIST_FILE,
@@ -117,128 +117,132 @@
        PLIST_IGNORE_INST,
        PLIST_OPTION,
        PLIST_PKGCFL
-} pl_ent_t;
+}       pl_ent_t;
 
 /* Types */
 typedef unsigned int Boolean;
 
-/* this structure describes a packing list entry */
+/* This structure describes a packing list entry */
 typedef struct plist_t {
-       struct plist_t  *prev;          /* previous entry */
-       struct plist_t  *next;          /* next entry */
-       char            *name;          /* name of entry */
-       Boolean         marked;         /* whether entry has been marked */
-       pl_ent_t        type;           /* type of entry */
-} plist_t;
+       struct plist_t *prev;   /* previous entry */
+       struct plist_t *next;   /* next entry */
+       char   *name;           /* name of entry */
+       Boolean marked;         /* whether entry has been marked */
+       pl_ent_t type;          /* type of entry */
+}       plist_t;
 
-/* this structure describes a package's complete packing list */
+/* This structure describes a package's complete packing list */
 typedef struct package_t {
-       plist_t         *head;          /* head of list */
-       plist_t         *tail;          /* tail of list */
-} package_t;
+       plist_t *head;          /* head of list */
+       plist_t *tail;          /* tail of list */
+}       package_t;
 
 #define CHECKSUM_HEADER        "MD5:"
 
 enum {
-       ChecksumHeaderLen = 4,          /* strlen(CHECKSUM_HEADER) */
+       ChecksumHeaderLen = 4,  /* strlen(CHECKSUM_HEADER) */
        ChecksumLen = 16,
        LegibleChecksumLen = 33
 };
 
 /* List of packages */
 typedef struct _lpkg_t {
-    TAILQ_ENTRY(_lpkg_t)        lp_link;
-    char        *lp_name;
-} lpkg_t;
+       TAILQ_ENTRY(_lpkg_t) lp_link;
+       char   *lp_name;
+}       lpkg_t;
 TAILQ_HEAD(_lpkg_head_t, _lpkg_t);
 typedef struct _lpkg_head_t lpkg_head_t;
 
-/* type of function to be handed to findmatchingname; return value of this
+/* Type of function to be handed to findmatchingname; return value of this
  * is currently ignored */
-typedef int (*matchfn)(const char *found, char *data);
+typedef int (*matchfn) (const char *found, char *data);
+
+/* If URLlength()>0, then there is a ftp:// or http:// in the string,
+ * and this must be an URL. Hide this behind a more obvious name. */
+#define IS_URL(str)    (URLlength(str) > 0)
 
 /* Prototypes */
 /* Misc */
-int            vsystem(const char *, ...);
-void           cleanup(int);
-char           *make_playpen(char *, size_t, size_t);
-char           *where_playpen(void);
-void           leave_playpen(char *);
-off_t          min_free(char *);
-void            save_dirs(char **c, char **p);
-void            restore_dirs(char *c, char *p);
+int     vsystem(const char *,...);
+void    cleanup(int);
+char   *make_playpen(char *, size_t, size_t);
+char   *where_playpen(void);
+void    leave_playpen(char *);
+off_t   min_free(char *);
+void    save_dirs(char **c, char **p);
+void    restore_dirs(char *c, char *p);
 
 /* String */
-char           *get_dash_string(char **);
-void           str_lowercase(char *);
-char           *basename_of(char *);
-char           *dirname_of(const char *);
-int            pmatch(const char *, const char *);
-int            findmatchingname(const char *, const char *, matchfn, char *); /* doesn't really belong here */
-char           *findbestmatchingname(const char *, const char *); /* neither */
-int            ispkgpattern(const char *);
-char           *strnncpy(char *to, size_t tosize, char *from, size_t cc);
+char   *get_dash_string(char **);
+void    str_lowercase(char *);
+char   *basename_of(char *);
+char   *dirname_of(const char *);
+int     pmatch(const char *, const char *);
+int     findmatchingname(const char *, const char *, matchfn, char *); /* doesn't really belong here */
+char   *findbestmatchingname(const char *, const char *);      /* neither */
+int     ispkgpattern(const char *);
+char   *strnncpy(char *to, size_t tosize, char *from, size_t cc);
 
 /* File */
-Boolean                fexists(char *);
-Boolean                isdir(char *);
-Boolean                islinktodir(char *);
-Boolean                isemptydir(char *fname);
-Boolean                isemptyfile(char *fname);
-Boolean         isfile(char *);
-Boolean                isempty(char *);
-int            URLlength(char *);
-char           *fileGetURL(char *, char *);
-char           *fileURLFilename(char *, char *, int);
-char           *fileURLHost(char *, char *, int);
-char           *fileFindByPath(char *, char *);
-char           *fileGetContents(char *);
-Boolean                make_preserve_name(char *, size_t, char *, char *);
-void           write_file(char *, char *);
-void           copy_file(char *, char *, char *);
-void           move_file(char *, char *, char *);
-int            delete_hierarchy(char *, Boolean, Boolean);
-int            unpack(char *, char *);
-void           format_cmd(char *, size_t , char *, char *, char *);
+Boolean fexists(char *);
+Boolean isdir(char *);
+Boolean islinktodir(char *);
+Boolean isemptydir(char *fname);
+Boolean isemptyfile(char *fname);
+Boolean isfile(char *);
+Boolean isempty(char *);
+int     URLlength(char *);
+char   *fileGetURL(char *, char *);
+char   *fileURLFilename(char *, char *, int);
+char   *fileURLHost(char *, char *, int);
+char   *fileFindByPath(char *, char *);
+char   *fileGetContents(char *);
+Boolean make_preserve_name(char *, size_t, char *, char *);
+void    write_file(char *, char *);
+void    copy_file(char *, char *, char *);
+void    move_file(char *, char *, char *);
+int     delete_hierarchy(char *, Boolean, Boolean);
+int     unpack(char *, char *);
+void    format_cmd(char *, size_t, char *, char *, char *);
 
 /* Packing list */
-plist_t                *new_plist_entry(void);
-plist_t                *last_plist(package_t *);
-plist_t                *find_plist(package_t *, pl_ent_t);
-char           *find_plist_option(package_t *, char *name);
-void           plist_delete(package_t *, Boolean, pl_ent_t, char *);
-void           free_plist(package_t *);
-void           mark_plist(package_t *);
-void           csum_plist_entry(char *, plist_t *);
-void           add_plist(package_t *, pl_ent_t, char *);
-void           add_plist_top(package_t *, pl_ent_t, char *);
-void           delete_plist(package_t *pkg, Boolean all, pl_ent_t type, char *name);
-void           write_plist(package_t *, FILE *);
-void           read_plist(package_t *, FILE *);
-int            plist_cmd(char *, char **);
-int            delete_package(Boolean, Boolean, package_t *);
+plist_t *new_plist_entry(void);
+plist_t *last_plist(package_t *);
+plist_t *find_plist(package_t *, pl_ent_t);
+char   *find_plist_option(package_t *, char *name);
+void    plist_delete(package_t *, Boolean, pl_ent_t, char *);
+void    free_plist(package_t *);
+void    mark_plist(package_t *);
+void    csum_plist_entry(char *, plist_t *);
+void    add_plist(package_t *, pl_ent_t, char *);
+void    add_plist_top(package_t *, pl_ent_t, char *);
+void    delete_plist(package_t *pkg, Boolean all, pl_ent_t type, char *name);
+void    write_plist(package_t *, FILE *);
+void    read_plist(package_t *, FILE *);
+int     plist_cmd(char *, char **);
+int     delete_package(Boolean, Boolean, package_t *);
 
 /* Package Database */
-int            pkgdb_open(int);
-void           pkgdb_close(void);
-int            pkgdb_store(const char *, const char *);
-char*          pkgdb_retrieve(const char *);
-int            pkgdb_remove(const char *);
-char*          pkgdb_iter(void);
-char*          _pkgdb_getPKGDB_FILE(void);
-char*          _pkgdb_getPKGDB_DIR(void);
+int     pkgdb_open(int);
+void    pkgdb_close(void);
+int     pkgdb_store(const char *, const char *);
+char   *pkgdb_retrieve(const char *);
+int     pkgdb_remove(const char *);
+char   *pkgdb_iter(void);
+char   *_pkgdb_getPKGDB_FILE(void);
+char   *_pkgdb_getPKGDB_DIR(void);
 
 /* List of packages functions */
-lpkg_t                 *alloc_lpkg(const char *);
-lpkg_t         *find_on_queue(lpkg_head_t *, const char *);
-void           free_lpkg(lpkg_t *);
+lpkg_t *alloc_lpkg(const char *);
+lpkg_t *find_on_queue(lpkg_head_t *, const char *);
+void    free_lpkg(lpkg_t *);
 
 /* For all */
-int            pkg_perform(lpkg_head_t *);
+int     pkg_perform(lpkg_head_t *);
 
 /* Externs */
-extern Boolean Verbose;
-extern Boolean Fake;
-extern Boolean  Force;
+extern Boolean Verbose;
+extern Boolean Fake;
+extern Boolean Force;
 
-#endif /* _INST_LIB_LIB_H_ */
+#endif                         /* _INST_LIB_LIB_H_ */



Home | Main Index | Thread Index | Old Index