diff options
author | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1996-06-04 07:56:15 +0000 |
---|---|---|
committer | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1996-06-04 07:56:15 +0000 |
commit | 167be6f259825b0e88a4cfc7cd9228c9603fc603 (patch) | |
tree | c173305ec5afd2f63886e210fa18f7b9c69695b8 /usr.sbin/pkg_install/info | |
parent | c8e3d32207db0af93ff3f660ded6b01fac993998 (diff) |
add package tools from FreeBSD
Diffstat (limited to 'usr.sbin/pkg_install/info')
-rw-r--r-- | usr.sbin/pkg_install/info/Makefile | 15 | ||||
-rw-r--r-- | usr.sbin/pkg_install/info/info.h | 59 | ||||
-rw-r--r-- | usr.sbin/pkg_install/info/main.c | 182 | ||||
-rw-r--r-- | usr.sbin/pkg_install/info/perform.c | 211 | ||||
-rw-r--r-- | usr.sbin/pkg_install/info/pkg_info.1 | 136 | ||||
-rw-r--r-- | usr.sbin/pkg_install/info/show.c | 195 |
6 files changed, 798 insertions, 0 deletions
diff --git a/usr.sbin/pkg_install/info/Makefile b/usr.sbin/pkg_install/info/Makefile new file mode 100644 index 00000000000..854b0e4a9d3 --- /dev/null +++ b/usr.sbin/pkg_install/info/Makefile @@ -0,0 +1,15 @@ +# $OpenBSD: Makefile,v 1.1 1996/06/04 07:56:09 niklas Exp $ +PROG= pkg_info +CFLAGS+= ${DEBUG} -I${.CURDIR}/../lib + +.if exists(${.CURDIR}/../lib/obj) +LDADD+= -L${.CURDIR}/../lib/obj -linstall +DPADD+= ${.CURDIR}/../lib/obj/libinstall.a +.else +LDADD+= -L${.CURDIR}/../lib -linstall +DPADD+= ${.CURDIR}/../lib/libinstall.a +.endif + +SRCS= main.c perform.c show.c + +.include <bsd.prog.mk> diff --git a/usr.sbin/pkg_install/info/info.h b/usr.sbin/pkg_install/info/info.h new file mode 100644 index 00000000000..b8ad23bc0e1 --- /dev/null +++ b/usr.sbin/pkg_install/info/info.h @@ -0,0 +1,59 @@ +/* $OpenBSD: info.h,v 1.1 1996/06/04 07:56:09 niklas Exp $ */ + +/* + * FreeBSD install - a package for the installation and maintainance + * of non-core utilities. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Jordan K. Hubbard + * 23 August 1993 + * + * Include and define various things wanted by the info command. + * + */ + +#ifndef _INST_INFO_H_INCLUDE +#define _INST_INFO_H_INCLUDE + +#ifndef MAXINDEXSIZE +#define MAXINDEXSIZE 60 +#endif + +#ifndef MAXNAMESIZE +#define MAXNAMESIZE 20 +#endif + +#define SHOW_COMMENT 0x0001 +#define SHOW_DESC 0x0002 +#define SHOW_PLIST 0x0004 +#define SHOW_INSTALL 0x0008 +#define SHOW_DEINSTALL 0x0010 +#define SHOW_REQUIRE 0x0020 +#define SHOW_PREFIX 0x0040 +#define SHOW_INDEX 0x0080 +#define SHOW_FILES 0x0100 +#define SHOW_DISPLAY 0x0200 +#define SHOW_REQBY 0x0400 +#define SHOW_MTREE 0x0800 + +extern int Flags; +extern Boolean AllInstalled; +extern Boolean Quiet; +extern char *InfoPrefix; +extern char PlayPen[]; +extern char *CheckPkg; + +extern void show_file(char *, char *); +extern void show_plist(char *, Package *, plist_t); +extern void show_files(char *, Package *); +extern void show_index(char *, char *); + +#endif /* _INST_INFO_H_INCLUDE */ diff --git a/usr.sbin/pkg_install/info/main.c b/usr.sbin/pkg_install/info/main.c new file mode 100644 index 00000000000..0564276ef86 --- /dev/null +++ b/usr.sbin/pkg_install/info/main.c @@ -0,0 +1,182 @@ +# $OpenBSD: main.c,v 1.1 1996/06/04 07:56:09 niklas Exp $ +#ifndef lint +static char *rcsid = "$OpenBSD: main.c,v 1.1 1996/06/04 07:56:09 niklas Exp $"; +#endif + +/* + * + * FreeBSD install - a package for the installation and maintainance + * of non-core utilities. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Jordan K. Hubbard + * 18 July 1993 + * + * This is the add module. + * + */ + +#include "lib.h" +#include "info.h" + +static char Options[] = "acdDe:fikrRpLqImvhl:"; + +int Flags = 0; +Boolean AllInstalled = FALSE; +Boolean Quiet = FALSE; +char *InfoPrefix = ""; +char PlayPen[FILENAME_MAX]; +char *CheckPkg = NULL; + +int +main(int argc, char **argv) +{ + int ch; + char **pkgs, **start; + char *prog_name = argv[0]; + + pkgs = start = argv; + while ((ch = getopt(argc, argv, Options)) != EOF) + switch(ch) { + case 'a': + AllInstalled = TRUE; + break; + + case 'v': + Verbose = TRUE; + /* Reasonable definition of 'everything' */ + Flags = SHOW_COMMENT | SHOW_DESC | SHOW_PLIST | SHOW_INSTALL | + SHOW_DEINSTALL | SHOW_REQUIRE | SHOW_DISPLAY | SHOW_MTREE; + break; + + case 'I': + Flags |= SHOW_INDEX; + break; + + case 'p': + Flags |= SHOW_PREFIX; + break; + + case 'c': + Flags |= SHOW_COMMENT; + break; + + case 'd': + Flags |= SHOW_DESC; + break; + + case 'D': + Flags |= SHOW_DISPLAY; + break; + + case 'f': + Flags |= SHOW_PLIST; + break; + + case 'i': + Flags |= SHOW_INSTALL; + break; + + case 'k': + Flags |= SHOW_DEINSTALL; + break; + + case 'r': + Flags |= SHOW_REQUIRE; + break; + + case 'R': + Flags |= SHOW_REQBY; + break; + + case 'L': + Flags |= SHOW_FILES; + break; + + case 'm': + Flags |= SHOW_MTREE; + break; + + case 'l': + InfoPrefix = optarg; + break; + + case 'q': + Quiet = TRUE; + break; + + case 't': + strcpy(PlayPen, optarg); + break; + + case 'e': + CheckPkg = optarg; + break; + + case 'h': + case '?': + default: + usage(prog_name, NULL); + break; + } + + argc -= optind; + argv += optind; + + /* Set some reasonable defaults */ + if (!Flags) + Flags = SHOW_COMMENT | SHOW_DESC | SHOW_REQBY; + + /* Get all the remaining package names, if any */ + while (*argv) + *pkgs++ = *argv++; + + /* If no packages, yelp */ + if (pkgs == start && !AllInstalled && !CheckPkg) + usage(prog_name, "Missing package name(s)"); + *pkgs = NULL; + return pkg_perform(start); +} + +void +usage(const char *name, const char *fmt, ...) +{ + va_list args; + + va_start(args, fmt); + if (fmt) { + fprintf(stderr, "%s: ", name); + vfprintf(stderr, fmt, args); + fprintf(stderr, "\n\n"); + } + va_end(args); + fprintf(stderr, "Usage: %s [args] pkg [ .. pkg ]\n", name); + fprintf(stderr, "Where args are one or more of:\n\n"); + fprintf(stderr, "-a show all installed packages (if any)\n"); + fprintf(stderr, "-I print 'index' of packages\n"); + fprintf(stderr, "-c print `one line comment'\n"); + fprintf(stderr, "-d print description\n"); + fprintf(stderr, "-D print install notice\n"); + fprintf(stderr, "-f show packing list\n"); + fprintf(stderr, "-i show install script\n"); + fprintf(stderr, "-k show deinstall script\n"); + fprintf(stderr, "-r show requirements script\n"); + fprintf(stderr, "-R show packages depending on this package\n"); + fprintf(stderr, "-p show prefix\n"); + fprintf(stderr, "-l <str> Prefix each info catagory with <str>\n"); + fprintf(stderr, "-L show intalled files\n"); + fprintf(stderr, "-q minimal output (``quiet'' mode)\n"); + fprintf(stderr, "-v show all information\n"); + fprintf(stderr, "-t temp use temp as template for mktemp()\n"); + fprintf(stderr, "-e pkg returns 0 if pkg is installed, 1 otherwise\n"); + fprintf(stderr, "\n[no args = -c -d -R]\n"); + exit(1); +} diff --git a/usr.sbin/pkg_install/info/perform.c b/usr.sbin/pkg_install/info/perform.c new file mode 100644 index 00000000000..84900147a91 --- /dev/null +++ b/usr.sbin/pkg_install/info/perform.c @@ -0,0 +1,211 @@ +# $OpenBSD: perform.c,v 1.1 1996/06/04 07:56:10 niklas Exp $ +#ifndef lint +static const char *rcsid = "$OpenBSD: perform.c,v 1.1 1996/06/04 07:56:10 niklas Exp $"; +#endif + +/* + * FreeBSD install - a package for the installation and maintainance + * of non-core utilities. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Jordan K. Hubbard + * 23 Aug 1993 + * + * This is the main body of the info module. + * + */ + +#include "lib.h" +#include "info.h" + +#include <signal.h> + +static int pkg_do(char *); + +int +pkg_perform(char **pkgs) +{ + int i, err_cnt = 0; + char *tmp; + + signal(SIGINT, cleanup); + + tmp = getenv(PKG_DBDIR); + if (!tmp) + tmp = DEF_LOG_DIR; + /* Overriding action? */ + if (AllInstalled || CheckPkg) { + if (isdir(tmp)) { + DIR *dirp; + struct dirent *dp; + + dirp = opendir(tmp); + if (dirp) { + for (dp = readdir(dirp); dp != NULL; dp = readdir(dirp)) { + if (strcmp(dp->d_name, ".") && strcmp(dp->d_name, "..")) { + if (CheckPkg) { + if (!strcmp(dp->d_name, CheckPkg)) + return 0; + } + else + err_cnt += pkg_do(dp->d_name); + } + } + (void)closedir(dirp); + if (CheckPkg) + return 1; + } + else + ++err_cnt; + } else if (CheckPkg) + return 1; /* no dir -> not installed! */ + + } + for (i = 0; pkgs[i]; i++) + err_cnt += pkg_do(pkgs[i]); + return err_cnt; +} + +static char *Home; + +static int +pkg_do(char *pkg) +{ + Boolean installed = FALSE, isTMP = FALSE; + char log_dir[FILENAME_MAX]; + char fname[FILENAME_MAX]; + Package plist; + FILE *fp; + struct stat sb; + char *cp = NULL; + int code = 0; + + if (isURL(pkg)) { + if ((cp = fileGetURL(NULL, pkg)) != NULL) { + strcpy(fname, cp); + isTMP = TRUE; + } + } + else if (fexists(pkg) && isfile(pkg)) { + int len; + + if (*pkg != '/') { + if (!getcwd(fname, FILENAME_MAX)) + upchuck("getcwd"); + len = strlen(fname); + snprintf(&fname[len], FILENAME_MAX - len, "/%s", pkg); + } + else + strcpy(fname, pkg); + cp = fname; + } + else { + if ((cp = fileFindByPath(NULL, pkg)) != NULL) + strncpy(fname, cp, FILENAME_MAX); + } + if (cp) { + /* + * Apply a crude heuristic to see how much space the package will + * take up once it's unpacked. I've noticed that most packages + * compress an average of 75%, but we're only unpacking the + files so + * be very optimistic. + */ + if (stat(fname, &sb) == FAIL) { + whinge("Can't stat package file '%s'.", fname); + code = 1; + goto bail; + } + Home = make_playpen(PlayPen, sb.st_size / 2); + if (unpack(fname, "+*")) { + whinge("Error during unpacking, no info for '%s' available.", pkg); + code = 1; + goto bail; + } + } + /* It's not an ininstalled package, try and find it among the installed */ + else { + char *tmp; + + sprintf(log_dir, "%s/%s", (tmp = getenv(PKG_DBDIR)) ? tmp : DEF_LOG_DIR, + pkg); + if (!fexists(log_dir)) { + whinge("Can't find package `%s' installed or in a file!", pkg); + return 1; + } + if (chdir(log_dir) == FAIL) { + whinge("Can't change directory to '%s'!", log_dir); + return 1; + } + installed = TRUE; + } + + /* Suck in the contents list */ + plist.head = plist.tail = NULL; + fp = fopen(CONTENTS_FNAME, "r"); + if (!fp) { + whinge("Unable to open %s file.", CONTENTS_FNAME); + code = 1; + goto bail; + } + /* If we have a prefix, add it now */ + read_plist(&plist, fp); + fclose(fp); + + /* + * Index is special info type that has to override all others to make + * any sense. + */ + if (Flags & SHOW_INDEX) { + char tmp[FILENAME_MAX]; + + snprintf(tmp, FILENAME_MAX, "%-19s ", pkg); + show_index(tmp, COMMENT_FNAME); + } + else { + /* Start showing the package contents */ + if (!Quiet) + printf("%sInformation for %s:\n\n", InfoPrefix, pkg); + if (Flags & SHOW_COMMENT) + show_file("Comment:\n", COMMENT_FNAME); + if ((Flags & SHOW_REQBY) && !isemptyfile(REQUIRED_BY_FNAME)) + show_file("Required by:\n", REQUIRED_BY_FNAME); + if (Flags & SHOW_DESC) + show_file("Description:\n", DESC_FNAME); + if ((Flags & SHOW_DISPLAY) && fexists(DISPLAY_FNAME)) + show_file("Install notice:\n", DISPLAY_FNAME); + if (Flags & SHOW_PLIST) + show_plist("Packing list:\n", &plist, (plist_t)-1); + if ((Flags & SHOW_INSTALL) && fexists(INSTALL_FNAME)) + show_file("Install script:\n", INSTALL_FNAME); + if ((Flags & SHOW_DEINSTALL) && fexists(DEINSTALL_FNAME)) + show_file("De-Install script:\n", DEINSTALL_FNAME); + if ((Flags & SHOW_MTREE) && fexists(MTREE_FNAME)) + show_file("mtree file:\n", MTREE_FNAME); + if (Flags & SHOW_PREFIX) + show_plist("Prefix(s):\n", &plist, PLIST_CWD); + if (Flags & SHOW_FILES) + show_files("Files:\n", &plist); + if (!Quiet) + puts(InfoPrefix); + } + free_plist(&plist); + bail: + leave_playpen(Home); + if (isTMP) + unlink(fname); + return code; +} + +void +cleanup(int sig) +{ + leave_playpen(Home); +} diff --git a/usr.sbin/pkg_install/info/pkg_info.1 b/usr.sbin/pkg_install/info/pkg_info.1 new file mode 100644 index 00000000000..62c619db526 --- /dev/null +++ b/usr.sbin/pkg_install/info/pkg_info.1 @@ -0,0 +1,136 @@ +.\" $OpenBSD: pkg_info.1,v 1.1 1996/06/04 07:56:10 niklas Exp $ +.\" +.\" FreeBSD install - a package for the installation and maintainance +.\" of non-core utilities. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" Jordan K. Hubbard +.\" +.\" +.\" @(#)pkg_info.1 +.\" +.Dd November 25, 1994 +.Dt pkg_info 1 +.Os FreeBSD 2.0 +.Sh NAME +.Nm pkg_info +.Nd a utility for displaying information on software packages. +.Sh SYNOPSIS +.Nm pkg_info +.Op Fl cdDikrRpLqImv +.Op Fl e Ar package +.Op Fl l Ar prefix +.Ar pkg-name [pkg-name ...] +.Nm pkg_info +.Fl a +.Op Ar flags +.Sh DESCRIPTION +The +.Nm +command is used to dump out information for packages, either packed up in +files or already installed on the system +with the +.Xr pkg_create 1 +command. +.Sh OPTIONS +The following command line options are supported. +.Bl -tag -width indent +.It Ar pkg-name ... +The named packages are described. A package name may either be the name of +an installed package, the pathname to a package distribution file or a +URL to an ftp available package. +.It Fl a +Show all currently installed packages. +.It Fl v +Turns on verbose output. +.It Fl p +Show the installation prefix for each package. +.It Fl q +Be ``quiet'' in emitting report headers and such, just dump the +raw info (basically, assume a non-human reading). +.It Fl c +Show the comment (one liner) field for each package. +.It Fl d +Show the long description field for each package. +.It Fl D +Show the install-message file for each package. +.It Fl f +Show the packing list instructions for each package. +.It Fl i +Show the install script (if any) for each package. +.It Fl k +Show the de-install script (if any) for each package. +.It Fl r +Show the requirements script (if any) for each package. +.It Fl m +Show the mtree file (if any) for each package. +.It Fl L +Show the files within each package. This is different from just +viewing the packing list, since full pathnames for everything +are generated. +.It Fl e Ar pkg-name +If the package identified by +.Ar pkg-name +is currently installed, return 0, otherwise return 1. This option +allows you to easily test for the presence of another (perhaps +prerequisite) package from a script. +.It Fl l Ar str +Prefix each information catagory header (see +.Fl q ) +shown with +.Ar 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. +.It Fl t Ar template +Use +.Ar template +as the input to +.Xr mktemp 3 +when creating a ``staging area.'' +By default, this is the string +.Pa /tmp/instmp.XXXXXX , +but it may be necessary to override it in the situation where +space in your +.Pa /tmp +directory is limited. Be sure to leave some number of `X' characters +for +.Xr mktemp 3 +to fill in with a unique ID. +.Bd -filled -offset indent -compact +Note: This should really not be necessary with pkg_info, +since very little information is extracted from each package +and one would have to have a very small +.Pa /tmp +indeed to overflow it. +.Ed +.Sh TECHNICAL DETAILS +Package info is either extracted from package files named on the +command line, or from already installed package information +in +.Pa /var/db/pkg/<pkg-name> . +.Sh SEE ALSO +.Xr pkg_add 1 , +.Xr pkg_create 1 , +.Xr pkg_delete 1 , +.Xr mktemp 3 , +.Xr mtree 8 . +.Sh AUTHORS +.Bl -tag -width indent -compact +.It "Jordan Hubbard" +most of the work +.It "John Kohl" +refined it for NetBSD +.El +.Sh BUGS +Sure to be some. diff --git a/usr.sbin/pkg_install/info/show.c b/usr.sbin/pkg_install/info/show.c new file mode 100644 index 00000000000..3d38df6e20f --- /dev/null +++ b/usr.sbin/pkg_install/info/show.c @@ -0,0 +1,195 @@ +# $OpenBSD: show.c,v 1.1 1996/06/04 07:56:10 niklas Exp $ +#ifndef lint +static const char *rcsid = "$OpenBSD: show.c,v 1.1 1996/06/04 07:56:10 niklas Exp $"; +#endif + +/* + * FreeBSD install - a package for the installation and maintainance + * of non-core utilities. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Jordan K. Hubbard + * 23 Aug 1993 + * + * Various display routines for the info module. + * + */ + +#include "lib.h" +#include "info.h" + +void +show_file(char *title, char *fname) +{ + FILE *fp; + char line[1024]; + int n; + + if (!Quiet) + printf("%s%s", InfoPrefix, title); + fp = fopen(fname, "r"); + if (!fp) + printf("ERROR: show_file: Can't open '%s' for reading!\n", fname); + else { + while (n = fread(line, 1, 1024, fp)) + fwrite(line, 1, n, stdout); + fclose(fp); + } + printf("\n"); /* just in case */ +} + +void +show_index(char *title, char *fname) +{ + FILE *fp; + char line[MAXINDEXSIZE+2]; + int i,n; + + if (!Quiet) + printf("%s%s", InfoPrefix, title); + fp = fopen(fname, "r"); + if (!fp) { + whinge("show_file: Can't open '%s' for reading.", fname); + return; + } + if(fgets(line, MAXINDEXSIZE+1, fp)) { + if(line[MAXINDEXSIZE-1] != '\n') + line[MAXINDEXSIZE] = '\n'; + line[MAXINDEXSIZE+1] = 0; + fputs(line, stdout); + } + fclose(fp); +} + +/* Show a packing list item type. If type is -1, show all */ +void +show_plist(char *title, Package *plist, plist_t type) +{ + PackingList p; + Boolean ign = FALSE; + + if (!Quiet) + printf("%s%s", InfoPrefix, title); + p = plist->head; + while (p) { + if (p->type != type && type != -1) { + p = p->next; + continue; + } + switch(p->type) { + case PLIST_FILE: + if (ign) { + printf(Quiet ? "%s\n" : "File: %s (ignored)\n", p->name); + ign = FALSE; + } + else + printf(Quiet ? "%s\n" : "File: %s\n", p->name); + break; + + case PLIST_CWD: + printf(Quiet ? "@cwd %s\n" : "\tCWD to %s\n", p->name); + break; + + case PLIST_SRC: + printf(Quiet ? "@srcdir %s\n" : "\tSRCDIR to %s\n", p->name); + break; + + case PLIST_CMD: + printf(Quiet ? "@exec %s\n" : "\tEXEC '%s'\n", p->name); + break; + + case PLIST_CHMOD: + printf(Quiet ? "@chmod %s\n" : "\tCHMOD to %s\n", + p->name ? p->name : "(clear default)"); + break; + + case PLIST_CHOWN: + printf(Quiet ? "@chown %s\n" : "\tCHOWN to %s\n", + p->name ? p->name : "(clear default)"); + break; + + case PLIST_CHGRP: + printf(Quiet ? "@chgrp %s\n" : "\tCHGRP to %s\n", + p->name ? p->name : "(clear default)"); + break; + + case PLIST_COMMENT: + printf(Quiet ? "@comment %s\n" : "\tComment: %s\n", p->name); + break; + + case PLIST_IGNORE: + ign = TRUE; + break; + + case PLIST_IGNORE_INST: + printf(Quiet ? "@ignore_inst ??? doesn't belong here.\n" : + "\tIgnore next file installation directive (doesn't belong)\n"); + ign = TRUE; + break; + + case PLIST_NAME: + printf(Quiet ? "@name %s\n" : "\tPackage name: %s\n", p->name); + break; + + case PLIST_DISPLAY: + printf(Quiet ? "@display %s\n" : "\tInstall message file: %s\n", p->name); + break; + + case PLIST_PKGDEP: + printf(Quiet ? "@pkgdep %s\n" : "\tPackage depends on: %s\n", p->name); + break; + + case PLIST_MTREE: + printf(Quiet ? "@mtree %s\n" : "\tPackage mtree file: %s\n", p->name); + break; + + case PLIST_DIR_RM: + printf(Quiet ? "@dirrm %s\n" : "\tDeinstall directory remove: %s\n", p->name); + break; + + default: + barf("Unknown command type %d (%s)\n", p->type, p->name); + break; + } + p = p->next; + } +} + +/* Show all files in the packing list (except ignored ones) */ +void +show_files(char *title, Package *plist) +{ + PackingList p; + Boolean ign = FALSE; + char *dir = "."; + + if (!Quiet) + printf("%s%s", InfoPrefix, title); + p = plist->head; + while (p) { + switch(p->type) { + case PLIST_FILE: + if (!ign) + printf("%s/%s\n", dir, p->name); + ign = FALSE; + break; + + case PLIST_CWD: + dir = p->name; + break; + + case PLIST_IGNORE: + ign = TRUE; + break; + } + p = p->next; + } +} |