diff options
author | dan <dan@FreeBSD.org> | 2000-01-15 01:15:37 +0000 |
---|---|---|
committer | dan <dan@FreeBSD.org> | 2000-01-15 01:15:37 +0000 |
commit | cbb57f023094c6b6cc6a225a9297fc629eaf5928 (patch) | |
tree | 9a1fcad5d60a8aedb9df3e2445f811265eb0d1ae /usr.sbin/pkg_install/delete/main.c | |
parent | 1b86060031b502ab415a36e1c0718118bb2f6564 (diff) | |
download | FreeBSD-src-cbb57f023094c6b6cc6a225a9297fc629eaf5928.zip FreeBSD-src-cbb57f023094c6b6cc6a225a9297fc629eaf5928.tar.gz |
Teach pkg_delete and pkg_info how to deal with full pathnames
(/var/db/pkg/foo-1.0, instead of just foo-1.0).
Submitted by: Matthew D. Fuller <fullermd@futuresouth.com>
Diffstat (limited to 'usr.sbin/pkg_install/delete/main.c')
-rw-r--r-- | usr.sbin/pkg_install/delete/main.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/usr.sbin/pkg_install/delete/main.c b/usr.sbin/pkg_install/delete/main.c index 6956f70..7567286 100644 --- a/usr.sbin/pkg_install/delete/main.c +++ b/usr.sbin/pkg_install/delete/main.c @@ -41,6 +41,7 @@ main(int argc, char **argv) { int ch, error; char **pkgs, **start; + char *pkgs_split; pkgs = start = argv; while ((ch = getopt(argc, argv, Options)) != -1) @@ -81,9 +82,29 @@ main(int argc, char **argv) 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) |