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>
This commit is contained in:
parent
923dc0b2c3
commit
06647a4f76
@ -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)
|
||||
@ -80,10 +81,30 @@ main(int argc, char **argv)
|
||||
argc -= optind;
|
||||
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)
|
||||
|
@ -44,6 +44,7 @@ main(int argc, char **argv)
|
||||
{
|
||||
int ch;
|
||||
char **pkgs, **start;
|
||||
char *pkgs_split;
|
||||
|
||||
pkgs = start = argv;
|
||||
if (argc == 1) {
|
||||
@ -144,7 +145,28 @@ main(int argc, char **argv)
|
||||
|
||||
/* 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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user