diff options
author | sobomax <sobomax@FreeBSD.org> | 2002-05-04 14:49:49 +0000 |
---|---|---|
committer | sobomax <sobomax@FreeBSD.org> | 2002-05-04 14:49:49 +0000 |
commit | 7af7b2eda9f1aa29b39f4888c6d57a93e2896346 (patch) | |
tree | 88c2e0739e3b1ea436c61ad76259b151f4352d1f /usr.sbin/pkg_install/lib | |
parent | 430e2d77019f398e388e9cdb817a5400dba26c7a (diff) | |
download | FreeBSD-src-7af7b2eda9f1aa29b39f4888c6d57a93e2896346.zip FreeBSD-src-7af7b2eda9f1aa29b39f4888c6d57a93e2896346.tar.gz |
Add ability to query installed packages based on origin.
Diffstat (limited to 'usr.sbin/pkg_install/lib')
-rw-r--r-- | usr.sbin/pkg_install/lib/lib.h | 4 | ||||
-rw-r--r-- | usr.sbin/pkg_install/lib/plist.c | 20 |
2 files changed, 21 insertions, 3 deletions
diff --git a/usr.sbin/pkg_install/lib/lib.h b/usr.sbin/pkg_install/lib/lib.h index 55fd2fa..2b12d2f 100644 --- a/usr.sbin/pkg_install/lib/lib.h +++ b/usr.sbin/pkg_install/lib/lib.h @@ -91,7 +91,7 @@ enum _plist_t { PLIST_CHOWN, PLIST_CHGRP, PLIST_COMMENT, PLIST_IGNORE, PLIST_NAME, PLIST_UNEXEC, PLIST_SRC, PLIST_DISPLAY, PLIST_PKGDEP, PLIST_MTREE, PLIST_DIR_RM, PLIST_IGNORE_INST, - PLIST_OPTION + PLIST_OPTION, PLIST_ORIGIN }; typedef enum _plist_t plist_t; @@ -113,6 +113,8 @@ typedef struct _plist *PackingList; struct _pack { struct _plist *head, *tail; + char *name; + char *origin; int fmtver_maj, fmtver_mnr; }; typedef struct _pack Package; diff --git a/usr.sbin/pkg_install/lib/plist.c b/usr.sbin/pkg_install/lib/plist.c index c60e589..e46d6de 100644 --- a/usr.sbin/pkg_install/lib/plist.c +++ b/usr.sbin/pkg_install/lib/plist.c @@ -42,6 +42,18 @@ add_plist(Package *p, plist_t type, const char *arg) p->tail->next = tmp; p->tail = tmp; } + switch (type) { + case PLIST_NAME: + p->name = tmp->name; + break; + + case PLIST_ORIGIN: + p->origin = tmp->name; + break; + + default: + break; + } } void @@ -210,9 +222,13 @@ plist_cmd(const char *s, char **arg) return PLIST_CHOWN; else if (!strcmp(cmd, "group")) return PLIST_CHGRP; - else if (!strcmp(cmd, "comment")) + else if (!strcmp(cmd, "comment")) { + if (!strncmp(*arg, "ORIGIN:", 7)) { + *arg += 7; + return PLIST_ORIGIN; + } return PLIST_COMMENT; - else if (!strcmp(cmd, "ignore")) + } else if (!strcmp(cmd, "ignore")) return PLIST_IGNORE; else if (!strcmp(cmd, "ignore_inst")) return PLIST_IGNORE_INST; |