From owner-cvs-all Tue Jan 11 23:59:35 2000 Delivered-To: cvs-all@freebsd.org Received: from gndrsh.dnsmgr.net (GndRsh.dnsmgr.net [198.145.92.4]) by hub.freebsd.org (Postfix) with ESMTP id F256C1548E; Tue, 11 Jan 2000 23:59:28 -0800 (PST) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.9.3/8.9.3) id XAA27450; Tue, 11 Jan 2000 23:59:27 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <200001120759.XAA27450@gndrsh.dnsmgr.net> Subject: Re: cvs commit: src/usr.sbin/pkg_install/delete perform.c In-Reply-To: <20000111230829.A86450@dragon.nuxi.com> from "David O'Brien" at "Jan 11, 2000 11:08:29 pm" To: obrien@FreeBSD.org Date: Tue, 11 Jan 2000 23:59:27 -0800 (PST) Cc: fullermd@futuresouth.com (Matthew D. Fuller), cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org X-Mailer: ELM [version 2.4ME+ PL54 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk > 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