Bug 16074

Summary: pkg_delete feature
Product: Base System Reporter: dan <dan>
Component: binAssignee: dan <dan>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.0-CURRENT   
Hardware: Any   
OS: Any   

Description dan freebsd_committer freebsd_triage 2000-01-12 01:30:00 UTC
Request for pkg_delete feature to handle /var/db/pkg/pkgname as a valid
package name.

How-To-Repeat: n/a
Comment 1 dan freebsd_committer freebsd_triage 2000-01-12 01:32:15 UTC
Responsible Changed
From-To: freebsd-bugs->dan

Assigning me my own PR 

Comment 2 fullermd 2000-01-12 02:06:16 UTC
> >Description:
> Request for pkg_delete feature to handle /var/db/pkg/pkgname as a valid
> package name.

Just sent diffs to the cvs-all/cvs-commiters mailing lists with patches
to do this (pkg_info also).  See below for posterity.


Index: delete/main.c
===================================================================
RCS file: /usr/cvs/src/usr.sbin/pkg_install/delete/main.c,v
retrieving revision 1.14
diff -u -r1.14 main.c
--- main.c	1999/08/28 01:18:01	1.14
+++ main.c	2000/01/12 02:00:25
@@ -41,6 +41,7 @@
 {
     int ch, error;
     char **pkgs, **start;
+    char *pkgs_split;
 
     pkgs = start = argv;
     while ((ch = getopt(argc, argv, Options)) != -1)
@@ -81,9 +82,29 @@
     argv += optind;
 
     /* Get all the remaining package names, if any */
-    /* Get all the remaining package names, if any */
     while (*argv)
-	*pkgs++ = *argv++;
+    {
+        if( (pkgs_split = rindex(*argv, (int) '/')) != NULL )
+        {
+            while( !isalpha(*(pkgs_split+1)) )
+            {
+                *pkgs_split = '\0';
+                pkgs_split = rindex(*argv, (int) '/');
+            }
+            if(pkgs_split != NULL)
+            {
+                pkgs_split++;
+                *pkgs = pkgs_split;
+                pkgs++;
+            }
+        }
+        else
+        {
+            *pkgs = *argv;
+            pkgs++;
+        }
+        argv++;
+    }
 
     /* If no packages, yelp */
     if (pkgs == start)
Index: info/main.c
===================================================================
RCS file: /usr/cvs/src/usr.sbin/pkg_install/info/main.c,v
retrieving revision 1.20
diff -u -r1.20 main.c
--- main.c	2000/01/07 13:25:53	1.20
+++ main.c	2000/01/12 02:00:26
@@ -44,6 +44,7 @@
 {
     int ch;
     char **pkgs, **start;
+    char *pkgs_split;
 
     pkgs = start = argv;
     if (argc == 1) {
@@ -144,7 +145,28 @@
 
     /* Get all the remaining package names, if any */
     while (*argv)
-	*pkgs++ = *argv++;
+    {
+        if( (pkgs_split = rindex(*argv, (int) '/')) != NULL )
+        {
+            while( !isalpha(*(pkgs_split+1)) )
+            {
+                *pkgs_split = '\0';
+                pkgs_split = rindex(*argv, (int) '/');
+            }
+            if(pkgs_split != NULL)
+            {
+                pkgs_split++;
+                *pkgs = pkgs_split;
+                pkgs++;
+            }
+        }
+        else
+        {
+            *pkgs = *argv;
+            pkgs++;
+        }
+        argv++;
+    }
 
     /* If no packages, yelp */
     if (pkgs == start && !AllInstalled && !CheckPkg)




-- 
Matthew Fuller     (MF4839)     |    fullermd@over-yonder.net
Unix Systems Administrator      |    fullermd@futuresouth.com
Specializing in FreeBSD         |    http://www.over-yonder.net/

"The only reason I'm burning my candle at both ends, is because I
      haven't figured out how to light the middle yet"
Comment 3 dan freebsd_committer freebsd_triage 2000-01-15 01:16:18 UTC
State Changed
From-To: open->closed

Feature committed. 
Comment 4 dan freebsd_committer freebsd_triage 2000-01-15 01:17:10 UTC
State Changed
From-To: closed->open

Oops.  Re-open to remind me to MFC. 
Comment 5 dan freebsd_committer freebsd_triage 2000-02-08 16:53:41 UTC
State Changed
From-To: open->closed

I committed this long ago.