1993-08-26 01:19:55 +00:00
|
|
|
#ifndef lint
|
1997-10-08 07:48:21 +00:00
|
|
|
static const char rcsid[] =
|
1999-08-28 01:35:59 +00:00
|
|
|
"$FreeBSD$";
|
1993-08-26 01:19:55 +00:00
|
|
|
#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"
|
2001-02-08 17:44:00 +00:00
|
|
|
#include <err.h>
|
1993-08-26 01:19:55 +00:00
|
|
|
#include <signal.h>
|
|
|
|
|
|
|
|
static int pkg_do(char *);
|
2001-10-10 06:58:42 +00:00
|
|
|
static int find_pkg(const char *, struct which_head *);
|
2001-03-23 18:45:24 +00:00
|
|
|
static int cmp_path(const char *, const char *, const char *);
|
2001-10-10 06:58:42 +00:00
|
|
|
static char *abspath(const char *);
|
1993-08-26 01:19:55 +00:00
|
|
|
|
|
|
|
int
|
|
|
|
pkg_perform(char **pkgs)
|
|
|
|
{
|
2001-02-27 09:00:18 +00:00
|
|
|
char **matched;
|
2001-10-10 06:58:42 +00:00
|
|
|
const char *tmp;
|
2001-02-27 09:00:18 +00:00
|
|
|
int err_cnt = 0;
|
|
|
|
int i, errcode;
|
1993-08-26 01:19:55 +00:00
|
|
|
|
|
|
|
signal(SIGINT, cleanup);
|
|
|
|
|
2001-08-02 13:13:06 +00:00
|
|
|
tmp = LOG_DIR;
|
2001-03-23 18:45:24 +00:00
|
|
|
|
1993-08-26 01:19:55 +00:00
|
|
|
/* Overriding action? */
|
1996-06-16 16:33:34 +00:00
|
|
|
if (CheckPkg) {
|
|
|
|
char buf[FILENAME_MAX];
|
1993-08-26 01:19:55 +00:00
|
|
|
|
1996-06-16 16:33:34 +00:00
|
|
|
snprintf(buf, FILENAME_MAX, "%s/%s", tmp, CheckPkg);
|
|
|
|
return abs(access(buf, R_OK));
|
2001-02-08 17:44:00 +00:00
|
|
|
/* Not reached */
|
2001-03-23 18:45:24 +00:00
|
|
|
} else if (!TAILQ_EMPTY(whead)) {
|
|
|
|
return find_pkg(tmp, whead);
|
1996-06-16 16:33:34 +00:00
|
|
|
}
|
1995-05-30 03:57:47 +00:00
|
|
|
|
2001-02-27 09:00:18 +00:00
|
|
|
if (MatchType != MATCH_EXACT) {
|
|
|
|
matched = matchinstalled(MatchType, pkgs, &errcode);
|
|
|
|
if (errcode != 0)
|
|
|
|
return 1;
|
|
|
|
/* Not reached */
|
|
|
|
|
|
|
|
if (matched != NULL)
|
|
|
|
pkgs = matched;
|
|
|
|
else switch (MatchType) {
|
|
|
|
case MATCH_GLOB:
|
|
|
|
break;
|
|
|
|
case MATCH_ALL:
|
|
|
|
warnx("no packages installed");
|
|
|
|
return 0;
|
|
|
|
/* Not reached */
|
|
|
|
case MATCH_REGEX:
|
|
|
|
warnx("no packages match pattern(s)");
|
2001-02-08 17:44:00 +00:00
|
|
|
return 1;
|
2001-02-27 09:00:18 +00:00
|
|
|
/* Not reached */
|
|
|
|
default:
|
|
|
|
break;
|
2001-02-08 17:44:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-02-27 09:00:18 +00:00
|
|
|
for (i = 0; pkgs[i]; i++)
|
|
|
|
err_cnt += pkg_do(pkgs[i]);
|
|
|
|
|
1993-08-26 01:19:55 +00:00
|
|
|
return err_cnt;
|
|
|
|
}
|
|
|
|
|
1995-10-25 15:38:37 +00:00
|
|
|
static char *Home;
|
|
|
|
|
1993-08-26 01:19:55 +00:00
|
|
|
static int
|
|
|
|
pkg_do(char *pkg)
|
|
|
|
{
|
1995-04-26 15:08:02 +00:00
|
|
|
Boolean installed = FALSE, isTMP = FALSE;
|
1993-08-26 01:19:55 +00:00
|
|
|
char log_dir[FILENAME_MAX];
|
1995-04-26 15:08:02 +00:00
|
|
|
char fname[FILENAME_MAX];
|
1993-08-26 01:19:55 +00:00
|
|
|
Package plist;
|
|
|
|
FILE *fp;
|
1995-04-26 15:08:02 +00:00
|
|
|
struct stat sb;
|
1995-04-28 18:24:31 +00:00
|
|
|
char *cp = NULL;
|
1995-04-26 15:08:02 +00:00
|
|
|
int code = 0;
|
|
|
|
|
|
|
|
if (isURL(pkg)) {
|
1995-10-25 15:38:37 +00:00
|
|
|
if ((cp = fileGetURL(NULL, pkg)) != NULL) {
|
1995-04-26 15:08:02 +00:00
|
|
|
strcpy(fname, cp);
|
|
|
|
isTMP = TRUE;
|
|
|
|
}
|
|
|
|
}
|
1995-07-30 01:44:45 +00:00
|
|
|
else if (fexists(pkg) && isfile(pkg)) {
|
1995-04-26 15:08:02 +00:00
|
|
|
int len;
|
1993-08-26 01:19:55 +00:00
|
|
|
|
1995-05-10 23:00:07 +00:00
|
|
|
if (*pkg != '/') {
|
|
|
|
if (!getcwd(fname, FILENAME_MAX))
|
|
|
|
upchuck("getcwd");
|
|
|
|
len = strlen(fname);
|
|
|
|
snprintf(&fname[len], FILENAME_MAX - len, "/%s", pkg);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
strcpy(fname, pkg);
|
1995-04-26 15:08:02 +00:00
|
|
|
cp = fname;
|
|
|
|
}
|
|
|
|
else {
|
1995-10-25 15:38:37 +00:00
|
|
|
if ((cp = fileFindByPath(NULL, pkg)) != NULL)
|
1995-04-26 15:08:02 +00:00
|
|
|
strncpy(fname, cp, FILENAME_MAX);
|
|
|
|
}
|
|
|
|
if (cp) {
|
1994-10-04 16:07:50 +00:00
|
|
|
/*
|
|
|
|
* Apply a crude heuristic to see how much space the package will
|
|
|
|
* take up once it's unpacked. I've noticed that most packages
|
1994-10-14 05:55:57 +00:00
|
|
|
* compress an average of 75%, but we're only unpacking the + files so
|
|
|
|
* be very optimistic.
|
1994-10-04 16:07:50 +00:00
|
|
|
*/
|
|
|
|
if (stat(fname, &sb) == FAIL) {
|
1997-10-08 07:48:21 +00:00
|
|
|
warnx("can't stat package file '%s'", fname);
|
1995-04-26 15:08:02 +00:00
|
|
|
code = 1;
|
|
|
|
goto bail;
|
1994-10-04 16:07:50 +00:00
|
|
|
}
|
1995-10-25 15:38:37 +00:00
|
|
|
Home = make_playpen(PlayPen, sb.st_size / 2);
|
1993-08-26 01:19:55 +00:00
|
|
|
if (unpack(fname, "+*")) {
|
1997-10-08 07:48:21 +00:00
|
|
|
warnx("error during unpacking, no info for '%s' available", pkg);
|
1995-04-26 15:08:02 +00:00
|
|
|
code = 1;
|
|
|
|
goto bail;
|
1993-08-26 01:19:55 +00:00
|
|
|
}
|
|
|
|
}
|
1995-04-26 15:08:02 +00:00
|
|
|
/* It's not an ininstalled package, try and find it among the installed */
|
1993-08-26 01:19:55 +00:00
|
|
|
else {
|
2001-08-02 13:13:06 +00:00
|
|
|
sprintf(log_dir, "%s/%s", LOG_DIR, pkg);
|
1993-08-26 01:19:55 +00:00
|
|
|
if (!fexists(log_dir)) {
|
2001-08-02 12:38:29 +00:00
|
|
|
warnx("can't find package '%s' installed or in a file!", pkg);
|
1993-08-26 01:19:55 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
if (chdir(log_dir) == FAIL) {
|
1997-10-08 07:48:21 +00:00
|
|
|
warnx("can't change directory to '%s'!", log_dir);
|
1993-08-26 01:19:55 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
installed = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Suck in the contents list */
|
|
|
|
plist.head = plist.tail = NULL;
|
|
|
|
fp = fopen(CONTENTS_FNAME, "r");
|
|
|
|
if (!fp) {
|
1997-10-08 07:48:21 +00:00
|
|
|
warnx("unable to open %s file", CONTENTS_FNAME);
|
1995-04-26 15:08:02 +00:00
|
|
|
code = 1;
|
|
|
|
goto bail;
|
1993-08-26 01:19:55 +00:00
|
|
|
}
|
|
|
|
/* 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) {
|
1995-04-26 15:08:02 +00:00
|
|
|
char tmp[FILENAME_MAX];
|
1993-08-26 01:19:55 +00:00
|
|
|
|
1995-04-26 15:08:02 +00:00
|
|
|
snprintf(tmp, FILENAME_MAX, "%-19s ", pkg);
|
|
|
|
show_index(tmp, COMMENT_FNAME);
|
1993-08-26 01:19:55 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* Start showing the package contents */
|
1993-09-08 01:46:59 +00:00
|
|
|
if (!Quiet)
|
|
|
|
printf("%sInformation for %s:\n\n", InfoPrefix, pkg);
|
1993-08-26 01:19:55 +00:00
|
|
|
if (Flags & SHOW_COMMENT)
|
1993-09-03 23:01:17 +00:00
|
|
|
show_file("Comment:\n", COMMENT_FNAME);
|
2000-09-25 07:27:05 +00:00
|
|
|
if (Flags & SHOW_REQUIRE)
|
2001-10-10 06:58:42 +00:00
|
|
|
show_plist("Depends on:\n", &plist, PLIST_PKGDEP, FALSE);
|
1994-12-06 00:51:50 +00:00
|
|
|
if ((Flags & SHOW_REQBY) && !isemptyfile(REQUIRED_BY_FNAME))
|
|
|
|
show_file("Required by:\n", REQUIRED_BY_FNAME);
|
1993-08-26 01:19:55 +00:00
|
|
|
if (Flags & SHOW_DESC)
|
1993-09-03 23:01:17 +00:00
|
|
|
show_file("Description:\n", DESC_FNAME);
|
1994-12-06 00:51:50 +00:00
|
|
|
if ((Flags & SHOW_DISPLAY) && fexists(DISPLAY_FNAME))
|
|
|
|
show_file("Install notice:\n", DISPLAY_FNAME);
|
1993-08-26 01:19:55 +00:00
|
|
|
if (Flags & SHOW_PLIST)
|
2001-10-10 06:58:42 +00:00
|
|
|
show_plist("Packing list:\n", &plist, (plist_t)0, TRUE);
|
1993-08-26 01:19:55 +00:00
|
|
|
if ((Flags & SHOW_INSTALL) && fexists(INSTALL_FNAME))
|
1993-09-03 23:01:17 +00:00
|
|
|
show_file("Install script:\n", INSTALL_FNAME);
|
1998-12-16 13:59:31 +00:00
|
|
|
if ((Flags & SHOW_INSTALL) && fexists(POST_INSTALL_FNAME))
|
|
|
|
show_file("Post-Install script:\n", POST_INSTALL_FNAME);
|
1993-08-26 01:19:55 +00:00
|
|
|
if ((Flags & SHOW_DEINSTALL) && fexists(DEINSTALL_FNAME))
|
1993-09-03 23:01:17 +00:00
|
|
|
show_file("De-Install script:\n", DEINSTALL_FNAME);
|
1998-12-16 13:59:31 +00:00
|
|
|
if ((Flags & SHOW_DEINSTALL) && fexists(POST_DEINSTALL_FNAME))
|
|
|
|
show_file("Post-DeInstall script:\n", POST_DEINSTALL_FNAME);
|
1994-12-06 00:51:50 +00:00
|
|
|
if ((Flags & SHOW_MTREE) && fexists(MTREE_FNAME))
|
|
|
|
show_file("mtree file:\n", MTREE_FNAME);
|
1993-08-26 01:19:55 +00:00
|
|
|
if (Flags & SHOW_PREFIX)
|
2001-10-10 06:58:42 +00:00
|
|
|
show_plist("Prefix(s):\n", &plist, PLIST_CWD, FALSE);
|
1993-09-08 01:46:59 +00:00
|
|
|
if (Flags & SHOW_FILES)
|
|
|
|
show_files("Files:\n", &plist);
|
2000-07-07 13:06:32 +00:00
|
|
|
if ((Flags & SHOW_SIZE) && installed)
|
|
|
|
show_size("Package Size:\n", &plist);
|
2001-02-03 20:56:32 +00:00
|
|
|
if ((Flags & SHOW_CKSUM) && installed)
|
|
|
|
show_cksum("Mismatched Checksums:\n", &plist);
|
2000-10-23 07:01:31 +00:00
|
|
|
if (Flags & SHOW_ORIGIN)
|
|
|
|
show_origin("Origin:\n", &plist);
|
2001-10-10 08:21:41 +00:00
|
|
|
if (Flags & SHOW_FMTREV)
|
|
|
|
show_fmtrev("Packing list format revision:\n", &plist);
|
1993-09-08 01:46:59 +00:00
|
|
|
if (!Quiet)
|
|
|
|
puts(InfoPrefix);
|
1993-08-26 01:19:55 +00:00
|
|
|
}
|
|
|
|
free_plist(&plist);
|
1995-04-26 15:08:02 +00:00
|
|
|
bail:
|
1998-02-16 17:16:51 +00:00
|
|
|
leave_playpen();
|
1995-04-26 15:08:02 +00:00
|
|
|
if (isTMP)
|
|
|
|
unlink(fname);
|
|
|
|
return code;
|
1993-08-26 01:19:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
cleanup(int sig)
|
|
|
|
{
|
1998-02-16 17:16:51 +00:00
|
|
|
static int in_cleanup = 0;
|
|
|
|
|
|
|
|
if (!in_cleanup) {
|
|
|
|
in_cleanup = 1;
|
2001-02-08 17:44:00 +00:00
|
|
|
leave_playpen();
|
1998-02-16 17:16:51 +00:00
|
|
|
}
|
1998-09-11 07:26:58 +00:00
|
|
|
if (sig)
|
|
|
|
exit(1);
|
1993-08-26 01:19:55 +00:00
|
|
|
}
|
1999-07-30 23:14:15 +00:00
|
|
|
|
2001-03-26 09:31:41 +00:00
|
|
|
/*
|
|
|
|
* Return an absolute path, additionally removing all .'s, ..'s, and extraneous
|
|
|
|
* /'s, as realpath() would, but without resolving symlinks, because that can
|
|
|
|
* potentially screw up our comparisons later.
|
|
|
|
*/
|
2001-10-10 06:58:42 +00:00
|
|
|
static char *
|
2001-03-26 09:31:41 +00:00
|
|
|
abspath(const char *pathname)
|
|
|
|
{
|
|
|
|
char *tmp, *tmp1, *resolved_path;
|
|
|
|
char *cwd = NULL;
|
|
|
|
int len;
|
|
|
|
|
|
|
|
if (pathname[0] != '/') {
|
|
|
|
cwd = getcwd(NULL, MAXPATHLEN);
|
|
|
|
asprintf(&resolved_path, "%s/%s/", cwd, pathname);
|
|
|
|
} else
|
|
|
|
asprintf(&resolved_path, "%s/", pathname);
|
|
|
|
|
|
|
|
if (resolved_path == NULL)
|
|
|
|
errx(2, NULL);
|
|
|
|
|
|
|
|
if (cwd != NULL)
|
|
|
|
free(cwd);
|
|
|
|
|
|
|
|
while ((tmp = strstr(resolved_path, "//")) != NULL)
|
|
|
|
strcpy(tmp, tmp + 1);
|
|
|
|
|
|
|
|
while ((tmp = strstr(resolved_path, "/./")) != NULL)
|
|
|
|
strcpy(tmp, tmp + 2);
|
|
|
|
|
|
|
|
while ((tmp = strstr(resolved_path, "/../")) != NULL) {
|
|
|
|
*tmp = '\0';
|
|
|
|
if ((tmp1 = strrchr(resolved_path, '/')) == NULL)
|
|
|
|
tmp1 = resolved_path;
|
|
|
|
strcpy(tmp1, tmp + 3);
|
|
|
|
}
|
|
|
|
|
|
|
|
len = strlen(resolved_path);
|
|
|
|
if (len > 1 && resolved_path[len - 1] == '/')
|
|
|
|
resolved_path[len - 1] = '\0';
|
|
|
|
|
|
|
|
return resolved_path;
|
|
|
|
}
|
|
|
|
|
2001-03-23 18:45:24 +00:00
|
|
|
/*
|
|
|
|
* Comparison to see if the path we're on matches the
|
|
|
|
* one we are looking for.
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
cmp_path(const char *target, const char *current, const char *cwd)
|
|
|
|
{
|
2001-03-26 09:31:41 +00:00
|
|
|
char *resolved, *temp;
|
2001-03-23 18:45:24 +00:00
|
|
|
int rval;
|
|
|
|
|
|
|
|
asprintf(&temp, "%s/%s", cwd, current);
|
|
|
|
if (temp == NULL)
|
|
|
|
errx(2, NULL);
|
|
|
|
|
|
|
|
/*
|
2001-03-26 09:31:41 +00:00
|
|
|
* Make sure there's no multiple /'s or other weird things in the PLIST,
|
|
|
|
* since some plists seem to have them and it could screw up our strncmp.
|
2001-03-23 18:45:24 +00:00
|
|
|
*/
|
2001-03-26 09:31:41 +00:00
|
|
|
resolved = abspath(temp);
|
2001-03-23 18:45:24 +00:00
|
|
|
|
2001-03-26 09:31:41 +00:00
|
|
|
if (strcmp(target, resolved) == 0)
|
2001-03-23 18:45:24 +00:00
|
|
|
rval = 1;
|
|
|
|
else
|
|
|
|
rval = 0;
|
|
|
|
|
|
|
|
free(temp);
|
2001-03-26 09:31:41 +00:00
|
|
|
free(resolved);
|
2001-03-23 18:45:24 +00:00
|
|
|
return rval;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Look through package dbs in db_dir and find which
|
|
|
|
* packages installed the files in which_list.
|
|
|
|
*/
|
|
|
|
static int
|
2001-10-10 06:58:42 +00:00
|
|
|
find_pkg(const char *db_dir, struct which_head *which_list)
|
2001-03-23 18:45:24 +00:00
|
|
|
{
|
|
|
|
char **installed;
|
|
|
|
int errcode, i;
|
|
|
|
struct which_entry *wp;
|
|
|
|
|
|
|
|
TAILQ_FOREACH(wp, which_list, next) {
|
2001-10-10 06:58:42 +00:00
|
|
|
const char *msg = "file cannot be found";
|
2001-03-26 09:31:41 +00:00
|
|
|
char *tmp;
|
|
|
|
|
|
|
|
wp->skip = TRUE;
|
2001-03-23 18:45:24 +00:00
|
|
|
/* If it's not a file, we'll see if it's an executable. */
|
|
|
|
if (isfile(wp->file) == FALSE) {
|
|
|
|
if (strchr(wp->file, '/') == NULL) {
|
|
|
|
tmp = vpipe("/usr/bin/which %s", wp->file);
|
2001-03-26 09:31:41 +00:00
|
|
|
if (tmp != NULL) {
|
2001-03-23 18:45:24 +00:00
|
|
|
strlcpy(wp->file, tmp, PATH_MAX);
|
2001-03-26 09:31:41 +00:00
|
|
|
wp->skip = FALSE;
|
|
|
|
free(tmp);
|
|
|
|
} else
|
|
|
|
msg = "file is not in PATH";
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
tmp = abspath(wp->file);
|
|
|
|
if (isfile(tmp)) {
|
|
|
|
strlcpy(wp->file, tmp, PATH_MAX);
|
|
|
|
wp->skip = FALSE;
|
2001-03-23 18:45:24 +00:00
|
|
|
}
|
|
|
|
free(tmp);
|
|
|
|
}
|
2001-03-26 09:31:41 +00:00
|
|
|
if (wp->skip == TRUE)
|
|
|
|
warnx("%s: %s", wp->file, msg);
|
2001-03-23 18:45:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
installed = matchinstalled(MATCH_ALL, NULL, &errcode);
|
|
|
|
if (installed == NULL)
|
|
|
|
return errcode;
|
|
|
|
|
|
|
|
for (i = 0; installed[i] != NULL; i++) {
|
|
|
|
FILE *fp;
|
|
|
|
Package pkg;
|
|
|
|
PackingList itr;
|
|
|
|
char *cwd = NULL;
|
|
|
|
char tmp[PATH_MAX];
|
|
|
|
|
|
|
|
snprintf(tmp, PATH_MAX, "%s/%s/%s", db_dir, installed[i],
|
|
|
|
CONTENTS_FNAME);
|
|
|
|
fp = fopen(tmp, "r");
|
|
|
|
if (fp == NULL) {
|
|
|
|
warn("%s", tmp);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
pkg.head = pkg.tail = NULL;
|
|
|
|
read_plist(&pkg, fp);
|
|
|
|
fclose(fp);
|
|
|
|
for (itr = pkg.head; itr != pkg.tail; itr = itr->next) {
|
|
|
|
if (itr->type == PLIST_CWD) {
|
|
|
|
cwd = itr->name;
|
|
|
|
} else if (itr->type == PLIST_FILE) {
|
|
|
|
TAILQ_FOREACH(wp, which_list, next) {
|
|
|
|
if (wp->skip == TRUE)
|
|
|
|
continue;
|
|
|
|
if (!cmp_path(wp->file, itr->name, cwd))
|
|
|
|
continue;
|
|
|
|
if (wp->package[0] != '\0') {
|
2001-03-26 09:57:26 +00:00
|
|
|
warnx("both %s and %s claim to have installed %s\n",
|
2001-03-23 18:45:24 +00:00
|
|
|
wp->package, installed[i], wp->file);
|
|
|
|
} else {
|
|
|
|
strlcpy(wp->package, installed[i], PATH_MAX);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
free_plist(&pkg);
|
|
|
|
}
|
|
|
|
|
|
|
|
TAILQ_FOREACH(wp, which_list, next) {
|
|
|
|
if (wp->package[0] != '\0') {
|
|
|
|
if (Quiet)
|
|
|
|
puts(wp->package);
|
|
|
|
else
|
|
|
|
printf("%s was installed by package %s\n", \
|
|
|
|
wp->file, wp->package);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
while (!TAILQ_EMPTY(which_list)) {
|
|
|
|
wp = TAILQ_FIRST(which_list);
|
|
|
|
TAILQ_REMOVE(which_list, wp, next);
|
|
|
|
free(wp);
|
|
|
|
}
|
|
|
|
|
|
|
|
free(which_list);
|
|
|
|
return 0;
|
|
|
|
}
|