diff options
author | eik <eik@FreeBSD.org> | 2004-06-29 18:59:19 +0000 |
---|---|---|
committer | eik <eik@FreeBSD.org> | 2004-06-29 18:59:19 +0000 |
commit | 7a7a88ae41089ff6cb4d75e4c2271702d2fc40ba (patch) | |
tree | d736eb1b5c7ccb34088587a0c550492399691ef6 /usr.sbin/pkg_install/lib | |
parent | ffbd0ede95b92fdb9e9a5457126a4eeca1726352 (diff) | |
download | FreeBSD-src-7a7a88ae41089ff6cb4d75e4c2271702d2fc40ba.zip FreeBSD-src-7a7a88ae41089ff6cb4d75e4c2271702d2fc40ba.tar.gz |
- pkg_info: flag -r: (show packages this packages depends on (documentation change))
- pkg_info: new flag -j (show the requirements script)
- pkg_info: fix verbose output when used on packages
- better handling of corrupt entries in /var/db/pkg
- differ between corrupt entires and packages not installed
- various small fixes
PR: 56989, 57016, 57029, 26468
Diffstat (limited to 'usr.sbin/pkg_install/lib')
-rw-r--r-- | usr.sbin/pkg_install/lib/deps.c | 6 | ||||
-rw-r--r-- | usr.sbin/pkg_install/lib/file.c | 6 | ||||
-rw-r--r-- | usr.sbin/pkg_install/lib/lib.h | 4 | ||||
-rw-r--r-- | usr.sbin/pkg_install/lib/match.c | 11 |
4 files changed, 15 insertions, 12 deletions
diff --git a/usr.sbin/pkg_install/lib/deps.c b/usr.sbin/pkg_install/lib/deps.c index 4ebb2cf..9df8448 100644 --- a/usr.sbin/pkg_install/lib/deps.c +++ b/usr.sbin/pkg_install/lib/deps.c @@ -97,7 +97,7 @@ chkifdepends(const char *pkgname1, const char *pkgname2) errcode = 0; /* Check that pkgname2 is actually installed */ - if (!isinstalledpkg(pkgname2)) + if (isinstalledpkg(pkgname2) <= 0) goto exit; errcode = requiredby(pkgname2, &rb_list, FALSE, TRUE); @@ -153,7 +153,7 @@ requiredby(const char *pkgname, struct reqr_by_head **list, Boolean strict, Bool free(rb_entry); } - if (!isinstalledpkg(pkgname)) { + if (isinstalledpkg(pkgname) <= 0) { if (strict == TRUE) warnx("no such package '%s' installed", pkgname); return -1; @@ -173,7 +173,7 @@ requiredby(const char *pkgname, struct reqr_by_head **list, Boolean strict, Bool while (fgets(fbuf, sizeof(fbuf), fp) != NULL) { if (fbuf[strlen(fbuf) - 1] == '\n') fbuf[strlen(fbuf) - 1] = '\0'; - if (filter == TRUE && !isinstalledpkg(fbuf)) { + if (filter == TRUE && isinstalledpkg(fbuf) <= 0) { if (strict == TRUE) warnx("package '%s' is recorded in the '%s' but isn't " "actually installed", fbuf, fname); diff --git a/usr.sbin/pkg_install/lib/file.c b/usr.sbin/pkg_install/lib/file.c index b29993c..107bb15 100644 --- a/usr.sbin/pkg_install/lib/file.c +++ b/usr.sbin/pkg_install/lib/file.c @@ -126,7 +126,8 @@ isURL(const char *fname) return FALSE; while (isspace(*fname)) ++fname; - if (!strncmp(fname, "ftp://", 6) || !strncmp(fname, "http://", 7)) + if (!strncmp(fname, "ftp://", 6) || !strncmp(fname, "http://", 7) || + !strncmp(fname, "https://", 8) || !strncmp(fname, "file://", 7)) return TRUE; return FALSE; } @@ -328,7 +329,8 @@ copy_hierarchy(const char *dir, const char *fname, Boolean to) int unpack(const char *pkg, const char *flist) { - char *comp, suff[80], *cp; + const char *comp, *cp; + char suff[80]; comp = ""; /* diff --git a/usr.sbin/pkg_install/lib/lib.h b/usr.sbin/pkg_install/lib/lib.h index 50c3d40..109483c 100644 --- a/usr.sbin/pkg_install/lib/lib.h +++ b/usr.sbin/pkg_install/lib/lib.h @@ -122,8 +122,8 @@ typedef struct _plist *PackingList; struct _pack { struct _plist *head, *tail; - char *name; - char *origin; + const char *name; + const char *origin; int fmtver_maj, fmtver_mnr; }; typedef struct _pack Package; diff --git a/usr.sbin/pkg_install/lib/match.c b/usr.sbin/pkg_install/lib/match.c index 0cd9853..48d96cd 100644 --- a/usr.sbin/pkg_install/lib/match.c +++ b/usr.sbin/pkg_install/lib/match.c @@ -307,8 +307,9 @@ matchbyorigin(const char *origin, int *retval) } /* - * Return TRUE if the specified package is installed, - * or FALSE otherwise. + * + * Return 1 if the specified package is installed, + * 0 if not, and -1 if an error occured. */ int isinstalledpkg(const char *name) @@ -318,13 +319,13 @@ isinstalledpkg(const char *name) snprintf(buf, sizeof(buf), "%s/%s", LOG_DIR, name); if (!isdir(buf) || access(buf, R_OK) == FAIL) - return FALSE; + return 0; snprintf(buf2, sizeof(buf2), "%s/%s", buf, CONTENTS_FNAME); if (!isfile(buf2) || access(buf2, R_OK) == FAIL) - return FALSE; + return -1; - return TRUE; + return 1; } /* |