From owner-p4-projects@FreeBSD.ORG Tue May 18 01:04:02 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id E12B6106566C; Tue, 18 May 2010 01:04:01 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A46411065674 for ; Tue, 18 May 2010 01:04:01 +0000 (UTC) (envelope-from gcooper@FreeBSD.org) Received: from repoman.freebsd.org (unknown [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 9128C8FC08 for ; Tue, 18 May 2010 01:04:01 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o4I141Cv032777 for ; Tue, 18 May 2010 01:04:01 GMT (envelope-from gcooper@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o4I141R6032775 for perforce@freebsd.org; Tue, 18 May 2010 01:04:01 GMT (envelope-from gcooper@FreeBSD.org) Date: Tue, 18 May 2010 01:04:01 GMT Message-Id: <201005180104.o4I141R6032775@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to gcooper@FreeBSD.org using -f From: Garrett Cooper To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 178411 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 May 2010 01:04:02 -0000 http://p4web.freebsd.org/@@178411?ac=10 Change 178411 by gcooper@gcooper-bioshock on 2010/05/18 01:03:47 - Convert S_I*ALL into their symbolic forms. - Remove NO / YES macros (unused). - Fix indentation. - Rename header guard macro to match the header. Affected files ... .. //depot/projects/soc2007/gcooper-pkg_install-enhancements-simplified/lib/libpkg/pkg.h#10 edit Differences ... ==== //depot/projects/soc2007/gcooper-pkg_install-enhancements-simplified/lib/libpkg/pkg.h#10 (text+ko) ==== @@ -20,8 +20,8 @@ * */ -#ifndef _INST_LIB_LIB_H_ -#define _INST_LIB_LIB_H_ +#ifndef _LIBPKG_PKG_H_ +#define _LIBPKG_PKG_H_ #ifndef YES_I_KNOW_THE_API_IS_RUBBISH_AND_IS_DOOMED_TO_CHANGE #error "You obviously have no idea what you're doing." @@ -51,13 +51,10 @@ #define FALSE (0) #endif -#define YES 2 -#define NO 1 - /* Some more stat macros. */ -#define S_IRALL 0000444 -#define S_IWALL 0000222 -#define S_IXALL 0000111 +#define S_IRALL (S_IRUSR | S_IRGRP | S_IROTH) +#define S_IWALL (S_IWUSR | S_IWGRP | S_IWOTH) +#define S_IXALL (S_IXUSR | S_IXGRP | S_IXOTH) /* Usually "rm", but often "echo" during debugging! */ #define REMOVE_CMD "/bin/rm" @@ -68,9 +65,9 @@ /* Where the ports lives by default */ #define DEF_PORTS_DIR "/usr/ports" /* just in case we change the environment variable name */ -#define PORTSDIR "PORTSDIR" +#define PORTSDIR "PORTSDIR" /* macro to get name of directory where the ports lives */ -#define PORTS_DIR (getenv(PORTSDIR) ? getenv(PORTSDIR) : DEF_PORTS_DIR) +#define PORTS_DIR (getenv(PORTSDIR) ? getenv(PORTSDIR) : DEF_PORTS_DIR) /* Where we put logging information by default, else ${PKG_DBDIR} if set */ #define DEF_LOG_DIR "/var/db/pkg" @@ -109,43 +106,41 @@ #define PLIST_FMT_VER_MAJOR 1 #define PLIST_FMT_VER_MINOR 1 -enum _plist_t { - PLIST_FILE, PLIST_CWD, PLIST_CMD, PLIST_CHMOD, - PLIST_CHOWN, PLIST_CHGRP, PLIST_COMMENT, PLIST_IGNORE, - PLIST_NAME, PLIST_UNEXEC, PLIST_SRC, PLIST_DISPLAY, - PLIST_PKGDEP, PLIST_CONFLICTS, PLIST_MTREE, PLIST_DIR_RM, - PLIST_IGNORE_INST, PLIST_OPTION, PLIST_ORIGIN, PLIST_DEPORIGIN, - PLIST_NOINST -}; -typedef enum _plist_t plist_t; +typedef enum _plist_t { + PLIST_FILE, PLIST_CWD, PLIST_CMD, PLIST_CHMOD, + PLIST_CHOWN, PLIST_CHGRP, PLIST_COMMENT, PLIST_IGNORE, + PLIST_NAME, PLIST_UNEXEC, PLIST_SRC, PLIST_DISPLAY, + PLIST_PKGDEP, PLIST_CONFLICTS, PLIST_MTREE, PLIST_DIR_RM, + PLIST_IGNORE_INST, PLIST_OPTION, PLIST_ORIGIN, PLIST_DEPORIGIN, + PLIST_NOINST +} plist_t; -enum _match_t { - MATCH_ALL, MATCH_EXACT, MATCH_GLOB, MATCH_NGLOB, MATCH_EREGEX, MATCH_REGEX -}; -typedef enum _match_t match_t; +typedef enum _match_t { + MATCH_ALL, MATCH_EXACT, MATCH_GLOB, MATCH_NGLOB, MATCH_EREGEX, + MATCH_REGEX +} match_t; -/* Types */ +/* Custom types */ typedef unsigned int Boolean; struct _plist { - struct _plist *prev, *next; - char *name; - Boolean marked; - plist_t type; + struct _plist *prev, *next; + char *name; + Boolean marked; + plist_t type; }; typedef struct _plist *PackingList; -struct _pack { - struct _plist *head, *tail; - const char *name; - const char *origin; - int fmtver_maj, fmtver_mnr; -}; -typedef struct _pack Package; +typedef struct _pack { + struct _plist *head, *tail; + const char *name; + const char *origin; + int fmtver_maj, fmtver_mnr; +} Package; struct reqr_by_entry { - STAILQ_ENTRY(reqr_by_entry) link; - char pkgname[PATH_MAX]; + STAILQ_ENTRY(reqr_by_entry) link; + char pkgname[PATH_MAX]; }; STAILQ_HEAD(reqr_by_head, reqr_by_entry); @@ -193,14 +188,15 @@ PackingList new_plist_entry(void); PackingList last_plist(Package *); PackingList find_plist(Package *, plist_t); -char *find_plist_option(Package *, const char *name); +char* find_plist_option(Package *, const char *name); void plist_delete(Package *, Boolean, plist_t, const char *); void free_plist(Package *); void mark_plist(Package *); void csum_plist_entry(char *, PackingList); void add_plist(Package *, plist_t, const char *); void add_plist_top(Package *, plist_t, const char *); -void delete_plist(Package *pkg, Boolean all, plist_t type, const char *name); +void delete_plist(Package *pkg, Boolean all, plist_t type, + const char *name); int write_plist(Package *, FILE *); int read_plist(Package *, int); int plist_cmd(const char *, char **); @@ -212,16 +208,18 @@ void pkg_wrap(long, char **); /* Query installed packages */ -char **matchinstalled(match_t, char **, int *); -char **matchbyorigin(const char *, int *); -char ***matchallbyorigin(const char **, int *); +char** matchinstalled(match_t, char **, int *); +char** matchbyorigin(const char *, int *); +char*** matchallbyorigin(const char **, int *); int isinstalledpkg(const char *name); -int pattern_match(match_t MatchType, char *pattern, const char *pkgname); +int pattern_match(match_t MatchType, char *pattern, + const char *pkgname); /* Dependencies */ int sortdeps(char **); int chkifdepends(const char *, const char *); -int requiredby(const char *, struct reqr_by_head **, Boolean, Boolean); +int requiredby(const char *, struct reqr_by_head **, Boolean, + Boolean); /* Version */ int libpkg_version(void);