|
Lines 28-34
Link Here
|
| 28 |
#include "lib.h" |
28 |
#include "lib.h" |
| 29 |
#include "info.h" |
29 |
#include "info.h" |
| 30 |
|
30 |
|
| 31 |
static char Options[] = "acdDe:fikrRpLqImvhl:"; |
31 |
static char Options[] = "acdDe:fhiIkl:LmpqrRt:v"; |
| 32 |
|
32 |
|
| 33 |
int Flags = 0; |
33 |
int Flags = 0; |
| 34 |
Boolean AllInstalled = FALSE; |
34 |
Boolean AllInstalled = FALSE; |
|
Lines 44-49
Link Here
|
| 44 |
{ |
44 |
{ |
| 45 |
int ch; |
45 |
int ch; |
| 46 |
char **pkgs, **start; |
46 |
char **pkgs, **start; |
|
|
47 |
char *pkgs_split; |
| 47 |
|
48 |
|
| 48 |
pkgs = start = argv; |
49 |
pkgs = start = argv; |
| 49 |
if (argc == 1) { |
50 |
if (argc == 1) { |
|
Lines 143-151
Link Here
|
| 143 |
Flags = SHOW_COMMENT | SHOW_DESC | SHOW_REQBY; |
144 |
Flags = SHOW_COMMENT | SHOW_DESC | SHOW_REQBY; |
| 144 |
|
145 |
|
| 145 |
/* Get all the remaining package names, if any */ |
146 |
/* Get all the remaining package names, if any */ |
| 146 |
while (*argv) |
147 |
while (*argv) { |
| 147 |
*pkgs++ = *argv++; |
148 |
if( (pkgs_split = rindex(*argv, (int) '/')) != NULL ) { |
| 148 |
|
149 |
while( !isalpha(*(pkgs_split+1)) ) { |
|
|
150 |
*pkgs_split = '\0'; |
| 151 |
if ( (pkgs_split = rindex(*argv, (int) '/')) == NULL) |
| 152 |
pkgs_split = *argv; |
| 153 |
} |
| 154 |
if(pkgs_split != NULL) { |
| 155 |
if (*pkgs_split == '/') |
| 156 |
pkgs_split++; |
| 157 |
*pkgs = pkgs_split; |
| 158 |
pkgs++; |
| 159 |
} |
| 160 |
} |
| 161 |
else { |
| 162 |
*pkgs = *argv; |
| 163 |
pkgs++; |
| 164 |
} |
| 165 |
argv++; |
| 166 |
} |
| 149 |
/* If no packages, yelp */ |
167 |
/* If no packages, yelp */ |
| 150 |
if (pkgs == start && !AllInstalled && !CheckPkg) |
168 |
if (pkgs == start && !AllInstalled && !CheckPkg) |
| 151 |
warnx("missing package name(s)"), usage(); |
169 |
warnx("missing package name(s)"), usage(); |
|
Lines 158-164
Link Here
|
| 158 |
{ |
176 |
{ |
| 159 |
fprintf(stderr, "%s\n%s\n%s\n", |
177 |
fprintf(stderr, "%s\n%s\n%s\n", |
| 160 |
"usage: pkg_info [-cdDikrRpLqImv] [-e package] [-l prefix]", |
178 |
"usage: pkg_info [-cdDikrRpLqImv] [-e package] [-l prefix]", |
| 161 |
" pkg-name [pkg-name ...]", |
179 |
" [-t template] pkg-name [pkg-name ...]", |
| 162 |
" pkg_info -a [flags]"); |
180 |
" pkg_info -a [flags]"); |
| 163 |
exit(1); |
181 |
exit(1); |
| 164 |
} |
182 |
} |