[Midnightbsd-cvs] CVS Commit: show.c: Fix bugs with CWD
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Thu Aug 9 20:27:40 EDT 2007
Log Message:
-----------
Fix bugs with CWD
Modified Files:
--------------
src/usr.sbin/pkg_install/info:
show.c (r1.1.1.2 -> r1.2)
-------------- next part --------------
Index: show.c
===================================================================
RCS file: /home/cvs/src/usr.sbin/pkg_install/info/show.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -Lusr.sbin/pkg_install/info/show.c -Lusr.sbin/pkg_install/info/show.c -u -r1.1.1.2 -r1.2
--- usr.sbin/pkg_install/info/show.c
+++ usr.sbin/pkg_install/info/show.c
@@ -213,6 +213,7 @@
{
PackingList p;
Boolean ign = FALSE;
+ char *prefix = NULL;
const char *dir = ".";
if (!Quiet)
@@ -227,7 +228,12 @@
break;
case PLIST_CWD:
- dir = p->name;
+ if (!prefix)
+ prefix = p->name;
+ if (p->name == NULL)
+ dir = prefix;
+ else
+ dir = p->name;
break;
case PLIST_IGNORE:
@@ -255,6 +261,7 @@
long blksize;
int headerlen;
char *descr;
+ char *prefix = NULL;
descr = getbsize(&headerlen, &blksize);
if (!Quiet)
@@ -274,7 +281,12 @@
break;
case PLIST_CWD:
- dir = p->name;
+ if (!prefix)
+ prefix = p->name;
+ if (p->name == NULL)
+ dir = prefix;
+ else
+ dir = p->name;
break;
case PLIST_IGNORE:
@@ -301,15 +313,21 @@
{
PackingList p;
const char *dir = ".";
+ char *prefix = NULL;
char tmp[FILENAME_MAX];
if (!Quiet)
printf("%s%s", InfoPrefix, title);
for (p = plist->head; p != NULL; p = p->next)
- if (p->type == PLIST_CWD)
- dir = p->name;
- else if (p->type == PLIST_FILE) {
+ if (p->type == PLIST_CWD) {
+ if (!prefix)
+ prefix = p->name;
+ if (p->name == NULL)
+ dir = prefix;
+ else
+ dir = p->name;
+ } else if (p->type == PLIST_FILE) {
snprintf(tmp, FILENAME_MAX, "%s/%s", dir, p->name);
if (!fexists(tmp))
warnx("%s doesn't exist", tmp);
More information about the Midnightbsd-cvs
mailing list