diff options
author | jkh <jkh@FreeBSD.org> | 1993-09-03 23:01:17 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 1993-09-03 23:01:17 +0000 |
commit | a1623ebed998f464514c6eafa426c4efeba768ec (patch) | |
tree | 33f2e2fff1fe01fa5806a718ba345fc9ec5b3485 /usr.sbin/pkg_install/lib/plist.c | |
parent | 3e9396c56d8617662d9ee7af612df9381888e538 (diff) | |
download | FreeBSD-src-a1623ebed998f464514c6eafa426c4efeba768ec.zip FreeBSD-src-a1623ebed998f464514c6eafa426c4efeba768ec.tar.gz |
Lots of misc tweaks, support for arbitrary separators in pkg_info, more
intelligent name handling in pkg_create. Most of these files are changed
because of rcsid's being different in my cvs tree and freefall's (foo).
Diffstat (limited to 'usr.sbin/pkg_install/lib/plist.c')
-rw-r--r-- | usr.sbin/pkg_install/lib/plist.c | 40 |
1 files changed, 37 insertions, 3 deletions
diff --git a/usr.sbin/pkg_install/lib/plist.c b/usr.sbin/pkg_install/lib/plist.c index f2992c6..cd8ae24 100644 --- a/usr.sbin/pkg_install/lib/plist.c +++ b/usr.sbin/pkg_install/lib/plist.c @@ -1,5 +1,5 @@ #ifndef lint -static const char *rcsid = "$Id: plist.c,v 1.5 1993/08/26 08:13:49 jkh Exp $"; +static const char *rcsid = "$Id: plist.c,v 1.6 1993/09/04 05:06:52 jkh Exp $"; #endif /* @@ -26,7 +26,7 @@ static const char *rcsid = "$Id: plist.c,v 1.5 1993/08/26 08:13:49 jkh Exp $"; /* Add an item to a packing list */ void -add_plist(Package *p, int type, char *arg) +add_plist(Package *p, plist_t type, char *arg) { PackingList tmp; @@ -43,6 +43,24 @@ add_plist(Package *p, int type, char *arg) } } +void +add_plist_top(Package *p, plist_t type, char *arg) +{ + PackingList tmp; + + tmp = new_plist_entry(); + tmp->name = copy_string(arg); + tmp->type = type; + + if (!p->head) + p->head = p->tail = tmp; + else { + tmp->next = p->head; + p->head->prev = tmp; + p->head = tmp; + } +} + /* Return the last (most recent) entry in a packing list */ PackingList last_plist(Package *p) @@ -62,6 +80,20 @@ mark_plist(Package *pkg) } } +/* Return whether or not there is an item of 'type' in the list */ +Boolean +in_plist(Package *pkg, plist_t type) +{ + PackingList p = pkg->head; + + while (p) { + if (p->type == type) + return TRUE; + p = p->next; + } + return FALSE; +} + /* Allocate a new packing list entry */ PackingList new_plist_entry(void) @@ -116,6 +148,8 @@ plist_cmd(char *s, char **arg) *arg = sp; if (!strcmp(cmd, "cwd")) return PLIST_CWD; + else if (!strcmp(cmd, "cd")) + return PLIST_CWD; else if (!strcmp(cmd, "exec")) return PLIST_CMD; else if (!strcmp(cmd, "mode")) @@ -226,7 +260,7 @@ delete_package(Boolean ign_err, Package *pkg) if (p->type == PLIST_CWD) { Where = p->name; if (Verbose) - printf("Delete: (CWD to %s)\n", Where); + printf("(CWD to %s)\n", Where); } else if (p->type == PLIST_IGNORE) p = p->next; |