Date: Tue, 11 Jan 2000 23:59:27 -0800 (PST) From: "Rodney W. Grimes" <freebsd@gndrsh.dnsmgr.net> To: obrien@FreeBSD.org Cc: fullermd@futuresouth.com (Matthew D. Fuller), cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/usr.sbin/pkg_install/delete perform.c Message-ID: <200001120759.XAA27450@gndrsh.dnsmgr.net> In-Reply-To: <20000111230829.A86450@dragon.nuxi.com> from "David O'Brien" at "Jan 11, 2000 11:08:29 pm"
next in thread | previous in thread | raw e-mail | index | archive | help
> On Tue, Jan 11, 2000 at 06:45:45PM -0600, Matthew D. Fuller wrote: > > Wasn't there a discussion some time ago about making pkg_delete accept a > > '/var/db/pkg/package-name-version' argument to allow use of filename > > Use a script: > > #!/bin/sh - > OPTS="" > while : Blehh... use a real patch: (This fixes two things, it rips all trailing slashes off of the package name, not just the last one since some one asked for that, and it will take full paths to the package, ripping off the path portion that matches /var/db/pkg (or what is in env(PKG_DBDIR)). Index: delete/perform.c =================================================================== RCS file: /home/ncvs/src/usr.sbin/pkg_install/delete/perform.c,v retrieving revision 1.20 diff -u -r1.20 perform.c --- delete/perform.c 1999/08/28 01:18:01 1.20 +++ delete/perform.c 2000/01/12 07:54:55 @@ -62,15 +62,26 @@ if (!pkg || !(len = strlen(pkg))) return 1; - if (pkg[len - 1] == '/') + while ((pkg[len - 1] == '/') && (len >= 0)) { pkg[len - 1] = '\0'; + len--; + } + if (len == 0) + return 1; /* Reset some state */ if (Plist.head) free_plist(&Plist); - sprintf(LogDir, "%s/%s", (tmp = getenv(PKG_DBDIR)) ? tmp : DEF_LOG_DIR, - pkg); + sprintf(LogDir, "%s", (tmp = getenv(PKG_DBDIR)) ? tmp : DEF_LOG_DIR); + printf("LogDir: %s\n", LogDir); + + if (strstr(pkg, LogDir) == pkg) + strcpy(LogDir, pkg); + else + sprintf(LogDir, "%s/%s", LogDir, pkg); + + printf("LogDir: %s\n", LogDir); if (!fexists(LogDir)) { warnx("no such package '%s' installed", pkg); -- Rod Grimes - KD7CAX @ CN85sl - (RWG25) rgrimes@gndrsh.dnsmgr.net To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200001120759.XAA27450>