xbps-bin: add -v flag, used when installing/removing currently.

--HG--
extra : convert_revision : d543b52213bf3d35b17ef29ff74a879bc4342cef
This commit is contained in:
Juan RP 2009-02-17 00:08:03 +01:00
parent 8d5e1ab017
commit fb998feacf
8 changed files with 83 additions and 63 deletions

View file

@ -57,7 +57,7 @@ xbps_unregister_pkg(const char *pkgname)
}
static int
xbps_remove_binary_pkg_meta(const char *pkgname, const char *destdir)
xbps_remove_binary_pkg_meta(const char *pkgname, const char *destdir, int flags)
{
struct dirent *dp;
DIR *dirp;
@ -88,8 +88,9 @@ xbps_remove_binary_pkg_meta(const char *pkgname, const char *destdir)
}
if ((rv = unlink(path)) == -1) {
printf("WARNING: can't remove %s (%s)\n",
pkgname, strerror(errno));
if (flags & XBPS_UNPACK_VERBOSE)
printf("WARNING: can't remove %s (%s)\n",
pkgname, strerror(errno));
}
(void)memset(&path, 0, sizeof(path));
}
@ -100,7 +101,7 @@ xbps_remove_binary_pkg_meta(const char *pkgname, const char *destdir)
}
int
xbps_remove_binary_pkg(const char *pkgname, const char *destdir)
xbps_remove_binary_pkg(const char *pkgname, const char *destdir, int flags)
{
FILE *flist;
char path[PATH_MAX - 1], line[LINE_MAX - 1], *p, *buf;
@ -193,19 +194,23 @@ xbps_remove_binary_pkg(const char *pkgname, const char *destdir)
rv = 0;
goto next;
}
printf("WARNING: can't remove directory"
" %s (%s)\n", path, strerror(errno));
if (flags & XBPS_UNPACK_VERBOSE)
printf("WARNING: can't remove "
"directory %s (%s)\n",
path, strerror(errno));
goto next;
}
printf("Removed directory: %s\n", path);
if (flags & XBPS_UNPACK_VERBOSE)
printf("Removed directory: %s\n", path);
goto next;
}
printf("WARNING: can't remove file %s (%s)\n", path,
strerror(errno));
if (flags & XBPS_UNPACK_VERBOSE)
printf("WARNING: can't remove file %s (%s)\n", path,
strerror(errno));
goto next;
}
printf("Removed file: %s\n", path);
if (flags & XBPS_UNPACK_VERBOSE)
printf("Removed file: %s\n", path);
next:
free(p);
p = NULL;
@ -226,7 +231,7 @@ next:
out:
free(buf);
rv = xbps_remove_binary_pkg_meta(pkgname, destdir);
rv = xbps_remove_binary_pkg_meta(pkgname, destdir, flags);
return rv;
}