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 | |
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).
28 files changed, 101 insertions, 40 deletions
diff --git a/usr.sbin/pkg_install/add/Makefile b/usr.sbin/pkg_install/add/Makefile index d91baba..8ac76a6 100644 --- a/usr.sbin/pkg_install/add/Makefile +++ b/usr.sbin/pkg_install/add/Makefile @@ -1,6 +1,6 @@ PROG= pkg_add -CFLAGS+= -I${.CURDIR}/../lib +CFLAGS+= ${DEBUG} -I${.CURDIR}/../lib LDADD+= -L${.CURDIR}/../lib -linstall SRCS= main.c perform.c futil.c extract.c diff --git a/usr.sbin/pkg_install/add/add.h b/usr.sbin/pkg_install/add/add.h index 8206f0f..6c5d46f 100644 --- a/usr.sbin/pkg_install/add/add.h +++ b/usr.sbin/pkg_install/add/add.h @@ -1,4 +1,4 @@ -/* $Id: add.h,v 1.3 1993/08/24 09:23:13 jkh Exp $ */ +/* $Id: add.h,v 1.4 1993/09/04 05:06:25 jkh Exp $ */ /* * FreeBSD install - a package for the installation and maintainance diff --git a/usr.sbin/pkg_install/add/extract.c b/usr.sbin/pkg_install/add/extract.c index 62ae03e..84160f7 100644 --- a/usr.sbin/pkg_install/add/extract.c +++ b/usr.sbin/pkg_install/add/extract.c @@ -1,5 +1,5 @@ #ifndef lint -static const char *rcsid = "$Id: extract.c,v 1.4 1993/08/24 09:23:14 jkh Exp $"; +static const char *rcsid = "$Id: extract.c,v 1.5 1993/09/04 05:06:26 jkh Exp $"; #endif /* diff --git a/usr.sbin/pkg_install/add/futil.c b/usr.sbin/pkg_install/add/futil.c index 2b70f5b..423f696 100644 --- a/usr.sbin/pkg_install/add/futil.c +++ b/usr.sbin/pkg_install/add/futil.c @@ -1,5 +1,5 @@ #ifndef lint -static const char *rcsid = "$Id: futil.c,v 1.3 1993/08/26 08:12:25 jkh Exp $"; +static const char *rcsid = "$Id: futil.c,v 1.4 1993/09/04 05:06:27 jkh Exp $"; #endif /* diff --git a/usr.sbin/pkg_install/add/main.c b/usr.sbin/pkg_install/add/main.c index 679dd12..cb8cc65 100644 --- a/usr.sbin/pkg_install/add/main.c +++ b/usr.sbin/pkg_install/add/main.c @@ -1,5 +1,5 @@ #ifndef lint -static char *rcsid = "$Id: main.c,v 1.5 1993/08/26 08:46:54 jkh Exp $"; +static char *rcsid = "$Id: main.c,v 1.6 1993/09/04 05:06:28 jkh Exp $"; #endif /* diff --git a/usr.sbin/pkg_install/add/perform.c b/usr.sbin/pkg_install/add/perform.c index c86922b..64203e5 100644 --- a/usr.sbin/pkg_install/add/perform.c +++ b/usr.sbin/pkg_install/add/perform.c @@ -1,5 +1,5 @@ #ifndef lint -static const char *rcsid = "$Id: perform.c,v 1.7 1993/08/26 08:46:55 jkh Exp $"; +static const char *rcsid = "$Id: perform.c,v 1.8 1993/09/04 05:06:29 jkh Exp $"; #endif /* diff --git a/usr.sbin/pkg_install/create/Makefile b/usr.sbin/pkg_install/create/Makefile index 01e6b20..795ec24 100644 --- a/usr.sbin/pkg_install/create/Makefile +++ b/usr.sbin/pkg_install/create/Makefile @@ -1,6 +1,6 @@ PROG= pkg_create -CFLAGS+= -I${.CURDIR}/../lib +CFLAGS+= ${DEBUG} -I${.CURDIR}/../lib LDADD+= -L${.CURDIR}/../lib -linstall SRCS= main.c perform.c pl.c diff --git a/usr.sbin/pkg_install/create/create.h b/usr.sbin/pkg_install/create/create.h index 2e1e73c..4db51db 100644 --- a/usr.sbin/pkg_install/create/create.h +++ b/usr.sbin/pkg_install/create/create.h @@ -1,4 +1,4 @@ -/* $Id: create.h,v 1.3 1993/08/24 09:23:32 jkh Exp $ */ +/* $Id: create.h,v 1.4 1993/09/04 05:06:32 jkh Exp $ */ /* * FreeBSD install - a package for the installation and maintainance diff --git a/usr.sbin/pkg_install/create/main.c b/usr.sbin/pkg_install/create/main.c index 63f6699..4697c6f 100644 --- a/usr.sbin/pkg_install/create/main.c +++ b/usr.sbin/pkg_install/create/main.c @@ -1,5 +1,5 @@ #ifndef lint -static const char *rcsid = "$Id: main.c,v 1.3 1993/08/20 08:52:39 jkh Exp $"; +static const char *rcsid = "$Id: main.c,v 1.4 1993/09/04 05:06:33 jkh Exp $"; #endif /* diff --git a/usr.sbin/pkg_install/create/perform.c b/usr.sbin/pkg_install/create/perform.c index 634188b..91102a0 100644 --- a/usr.sbin/pkg_install/create/perform.c +++ b/usr.sbin/pkg_install/create/perform.c @@ -1,5 +1,5 @@ #ifndef lint -static const char *rcsid = "$Id: perform.c,v 1.4 1993/08/26 08:12:52 jkh Exp $"; +static const char *rcsid = "$Id: perform.c,v 1.5 1993/09/04 05:06:33 jkh Exp $"; #endif /* @@ -62,14 +62,19 @@ pkg_perform(char **pkgs) else suffix = "tgz"; - /* Register the package name (base part) */ - add_plist(&plist, PLIST_NAME, pkg); if (Prefix) add_plist(&plist, PLIST_CWD, Prefix); /* Slurp in the packing list */ read_plist(&plist, pkg_in); + /* + * Run down the list and see if we've named it, if not stick in a name + * at the top. + */ + if (!in_plist(&plist, PLIST_NAME)) + add_plist_top(&plist, PLIST_NAME, pkg); + /* Make a directory to stomp around in */ home = make_playpen(); signal(SIGINT, cleanup); diff --git a/usr.sbin/pkg_install/create/pkg_create.1 b/usr.sbin/pkg_install/create/pkg_create.1 index dd0e967..6822065 100644 --- a/usr.sbin/pkg_install/create/pkg_create.1 +++ b/usr.sbin/pkg_install/create/pkg_create.1 @@ -121,6 +121,9 @@ in the packing list. Briefly described, these sequences are: Sets the internal directory pointer to point to .I directory. All subsequent filenames will be assumed relative to this directory. +Note: +.BI @cd +is also an alias for this command. .TP .BI "@exec\ " command Execute diff --git a/usr.sbin/pkg_install/create/pl.c b/usr.sbin/pkg_install/create/pl.c index 3b9a2d0..e1b6e36 100644 --- a/usr.sbin/pkg_install/create/pl.c +++ b/usr.sbin/pkg_install/create/pl.c @@ -1,5 +1,5 @@ #ifndef lint -static const char *rcsid = "$Id: pl.c,v 1.4 1993/08/26 08:12:53 jkh Exp $"; +static const char *rcsid = "$Id: pl.c,v 1.5 1993/09/04 05:06:34 jkh Exp $"; #endif /* diff --git a/usr.sbin/pkg_install/delete/Makefile b/usr.sbin/pkg_install/delete/Makefile index 16a110f9..5631cdf 100644 --- a/usr.sbin/pkg_install/delete/Makefile +++ b/usr.sbin/pkg_install/delete/Makefile @@ -1,6 +1,6 @@ PROG= pkg_delete -CFLAGS+= -I${.CURDIR}/../lib +CFLAGS+= ${DEBUG} -I${.CURDIR}/../lib LDADD+= -L${.CURDIR}/../lib -linstall SRCS= main.c perform.c diff --git a/usr.sbin/pkg_install/delete/main.c b/usr.sbin/pkg_install/delete/main.c index 63bc65d..a66edfd 100644 --- a/usr.sbin/pkg_install/delete/main.c +++ b/usr.sbin/pkg_install/delete/main.c @@ -1,5 +1,5 @@ #ifndef lint -static char *rcsid = "$Id: main.c,v 1.4 1993/08/26 08:47:02 jkh Exp $"; +static char *rcsid = "$Id: main.c,v 1.5 1993/09/04 05:06:38 jkh Exp $"; #endif /* diff --git a/usr.sbin/pkg_install/delete/perform.c b/usr.sbin/pkg_install/delete/perform.c index 2694a0a..b806e47 100644 --- a/usr.sbin/pkg_install/delete/perform.c +++ b/usr.sbin/pkg_install/delete/perform.c @@ -1,5 +1,5 @@ #ifndef lint -static const char *rcsid = "$Id: perform.c,v 1.1 1993/08/20 08:53:36 jkh Exp $"; +static const char *rcsid = "$Id: perform.c,v 1.2 1993/09/04 05:06:39 jkh Exp $"; #endif /* diff --git a/usr.sbin/pkg_install/info/Makefile b/usr.sbin/pkg_install/info/Makefile index 2b4f04e..60b5433 100644 --- a/usr.sbin/pkg_install/info/Makefile +++ b/usr.sbin/pkg_install/info/Makefile @@ -1,6 +1,6 @@ PROG= pkg_info -CFLAGS+= -I${.CURDIR}/../lib +CFLAGS+= ${DEBUG} -I${.CURDIR}/../lib LDADD+= -L${.CURDIR}/../lib -linstall SRCS= main.c perform.c show.c diff --git a/usr.sbin/pkg_install/info/info.h b/usr.sbin/pkg_install/info/info.h index 9584afb..3b9195d 100644 --- a/usr.sbin/pkg_install/info/info.h +++ b/usr.sbin/pkg_install/info/info.h @@ -1,4 +1,4 @@ -/* $Id: info.h,v 1.3 1993/08/26 08:47:04 jkh Exp $ */ +/* $Id: info.h,v 1.4 1993/09/04 05:06:40 jkh Exp $ */ /* * FreeBSD install - a package for the installation and maintainance @@ -34,6 +34,7 @@ extern int Flags; extern Boolean AllInstalled; +extern char *InfoPrefix; extern void show_file(char *, char *); extern void show_plist(char *, Package *, plist_t); diff --git a/usr.sbin/pkg_install/info/main.c b/usr.sbin/pkg_install/info/main.c index 9a5e540..90e9e70 100644 --- a/usr.sbin/pkg_install/info/main.c +++ b/usr.sbin/pkg_install/info/main.c @@ -1,5 +1,5 @@ #ifndef lint -static char *rcsid = "$Header: /usr1/cvs/jkh/pkg_install/info/main.c,v 1.4 1993/08/26 08:47:05 jkh Exp $"; +static char *rcsid = "$Header: /usr1/cvs/jkh/pkg_install/info/main.c,v 1.5 1993/09/04 05:06:41 jkh Exp $"; #endif /* @@ -26,10 +26,11 @@ static char *rcsid = "$Header: /usr1/cvs/jkh/pkg_install/info/main.c,v 1.4 1993/ #include "lib.h" #include "info.h" -static char Options[] = "acdfikrpIvh"; +static char Options[] = "acdfikrpIvhl:"; int Flags = 0; Boolean AllInstalled = FALSE; +char *InfoPrefix = ""; int main(int argc, char **argv) @@ -84,6 +85,10 @@ main(int argc, char **argv) Flags |= SHOW_REQUIRE; break; + case 'l': + InfoPrefix = optarg; + break; + case 'h': case '?': default: @@ -132,6 +137,7 @@ usage(const char *name, const char *fmt, ...) fprintf(stderr, "-k show deinstall script\n"); fprintf(stderr, "-r show requirements script\n"); fprintf(stderr, "-p show prefix\n"); + fprintf(stderr, "-l <str> Prefix each info catagory with <str>\n"); fprintf(stderr, "-v show all information\n"); fprintf(stderr, "\n[no args = -c -d]\n"); exit(1); diff --git a/usr.sbin/pkg_install/info/perform.c b/usr.sbin/pkg_install/info/perform.c index 3a38421..d3df042 100644 --- a/usr.sbin/pkg_install/info/perform.c +++ b/usr.sbin/pkg_install/info/perform.c @@ -1,5 +1,5 @@ #ifndef lint -static const char *rcsid = "$Id: perform.c,v 1.3 1993/08/26 08:47:06 jkh Exp $"; +static const char *rcsid = "$Id: perform.c,v 1.4 1993/09/04 05:06:43 jkh Exp $"; #endif /* @@ -117,19 +117,19 @@ pkg_do(char *pkg) } else { /* Start showing the package contents */ - printf("Information for %s:\n\n", pkg); + printf("%sInformation for %s:\n\n", InfoPrefix, pkg); if (Flags & SHOW_COMMENT) - show_file("Comment:\n", COMMENT_FNAME); + show_file("Comment:\n", COMMENT_FNAME); if (Flags & SHOW_DESC) - show_file("Description:\n", DESC_FNAME); + show_file("Description:\n", DESC_FNAME); if (Flags & SHOW_PLIST) - show_plist("Packing list:\n", &plist, (plist_t)-1); + show_plist("Packing list:\n", &plist, (plist_t)-1); if ((Flags & SHOW_INSTALL) && fexists(INSTALL_FNAME)) - show_file("Install script:\n", INSTALL_FNAME); + show_file("Install script:\n", INSTALL_FNAME); if ((Flags & SHOW_DEINSTALL) && fexists(DEINSTALL_FNAME)) - show_file("De-Install script:\n", DEINSTALL_FNAME); + show_file("De-Install script:\n", DEINSTALL_FNAME); if (Flags & SHOW_PREFIX) - show_plist("Prefix(s):\n", &plist, PLIST_CWD); + show_plist("Prefix(s):\n", &plist, PLIST_CWD); putchar('\014'); } free_plist(&plist); diff --git a/usr.sbin/pkg_install/info/pkg_info.1 b/usr.sbin/pkg_install/info/pkg_info.1 index d74c1ff..2746d30 100644 --- a/usr.sbin/pkg_install/info/pkg_info.1 +++ b/usr.sbin/pkg_install/info/pkg_info.1 @@ -62,6 +62,15 @@ Show the de-install script (if any) for each package. .TP .B \-r Show the requirements script (if any) for each package. +.TP +.BI "\-l\ " str +Prefix each catagory of information shown with +.I str. +This is primarily of use to front-end programs who want to request a +lot of different information fields at once for a package, but don't +necessary want the output intermingled in such a way that they can't +organize it. This lets you add a special token to the start of +each field. .PP .SH "TECHNICAL DETAILS" Package info is either extracted from files supplied on the diff --git a/usr.sbin/pkg_install/info/show.c b/usr.sbin/pkg_install/info/show.c index 8e73e88..b18c162 100644 --- a/usr.sbin/pkg_install/info/show.c +++ b/usr.sbin/pkg_install/info/show.c @@ -1,5 +1,5 @@ #ifndef lint -static const char *rcsid = "$Id: show.c,v 1.3 1993/08/26 08:47:07 jkh Exp $"; +static const char *rcsid = "$Id: show.c,v 1.4 1993/09/04 05:06:44 jkh Exp $"; #endif /* @@ -32,7 +32,7 @@ show_file(char *title, char *fname) char line[1024]; int n; - printf(title); + printf("%s%s", InfoPrefix, title); fp = fopen(fname, "r"); if (!fp) { whinge("show_file: Can't open '%s' for reading.", fname); @@ -51,7 +51,7 @@ show_plist(char *title, Package *plist, plist_t type) PackingList p; Boolean ign = FALSE; - printf(title); + printf("%s%s", InfoPrefix, title); p = plist->head; while (p) { if (p->type != type && type != -1) { diff --git a/usr.sbin/pkg_install/lib/Makefile b/usr.sbin/pkg_install/lib/Makefile index d520df5..1f802f6 100644 --- a/usr.sbin/pkg_install/lib/Makefile +++ b/usr.sbin/pkg_install/lib/Makefile @@ -1,5 +1,6 @@ LIB= install SRCS= file.c msg.c plist.c str.c exec.c global.c pen.c +CFLAGS+= ${DEBUG} NOPROFILE= yes install: diff --git a/usr.sbin/pkg_install/lib/exec.c b/usr.sbin/pkg_install/lib/exec.c index 6f1a672..5232dd2 100644 --- a/usr.sbin/pkg_install/lib/exec.c +++ b/usr.sbin/pkg_install/lib/exec.c @@ -1,5 +1,5 @@ #ifndef lint -static const char *rcsid = "$Id: exec.c,v 1.3 1993/08/24 09:24:04 jkh Exp $"; +static const char *rcsid = "$Id: exec.c,v 1.4 1993/09/04 05:06:47 jkh Exp $"; #endif /* diff --git a/usr.sbin/pkg_install/lib/file.c b/usr.sbin/pkg_install/lib/file.c index ac7e4d7..9c86151 100644 --- a/usr.sbin/pkg_install/lib/file.c +++ b/usr.sbin/pkg_install/lib/file.c @@ -1,5 +1,5 @@ #ifndef lint -static const char *rcsid = "$Id: file.c,v 1.5 1993/08/26 08:13:48 jkh Exp $"; +static const char *rcsid = "$Id: file.c,v 1.6 1993/09/04 05:06:48 jkh Exp $"; #endif /* diff --git a/usr.sbin/pkg_install/lib/lib.h b/usr.sbin/pkg_install/lib/lib.h index 05d43e7..8c49933 100644 --- a/usr.sbin/pkg_install/lib/lib.h +++ b/usr.sbin/pkg_install/lib/lib.h @@ -1,4 +1,4 @@ -/* $Id: lib.h,v 1.4 1993/08/24 09:24:07 jkh Exp $ */ +/* $Id: lib.h,v 1.5 1993/09/04 05:06:49 jkh Exp $ */ /* * FreeBSD install - a package for the installation and maintainance @@ -123,10 +123,12 @@ Boolean y_or_n(Boolean, const char *, ...); /* Packing list */ PackingList new_plist_entry(void); PackingList last_plist(Package *); +Boolean in_plist(Package *, plist_t); void free_plist(Package *); void mark_plist(Package *); void csum_plist_entry(char *, PackingList); -void add_plist(Package *, int, char *); +void add_plist(Package *, plist_t, char *); +void add_plist_top(Package *, plist_t, char *); void write_plist(Package *, FILE *); void read_plist(Package *, FILE *); int plist_cmd(char *, char **); diff --git a/usr.sbin/pkg_install/lib/msg.c b/usr.sbin/pkg_install/lib/msg.c index 4c74290..489fc47 100644 --- a/usr.sbin/pkg_install/lib/msg.c +++ b/usr.sbin/pkg_install/lib/msg.c @@ -1,5 +1,5 @@ #ifndef lint -static const char *rcsid = "$Id: msg.c,v 1.2 1993/08/16 14:20:18 jkh Exp $"; +static const char *rcsid = "$Id: msg.c,v 1.3 1993/09/04 05:06:50 jkh Exp $"; #endif /* diff --git a/usr.sbin/pkg_install/lib/pen.c b/usr.sbin/pkg_install/lib/pen.c index 8a3416f..c5eee71 100644 --- a/usr.sbin/pkg_install/lib/pen.c +++ b/usr.sbin/pkg_install/lib/pen.c @@ -1,5 +1,5 @@ #ifndef lint -static const char *rcsid = "$Id: pen.c,v 1.1 1993/08/24 09:24:08 jkh Exp $"; +static const char *rcsid = "$Id: pen.c,v 1.2 1993/09/04 05:06:51 jkh Exp $"; #endif /* 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; |