xbps-uhelper: added -d flag to enable debugging.

This commit is contained in:
Juan RP 2010-12-18 10:26:12 +01:00
parent bc28aa77d8
commit e01399c242

View File

@ -81,6 +81,7 @@ usage(void)
" version\t\t<pkgname>\n" " version\t\t<pkgname>\n"
"\n" "\n"
" Options shared by all actions:\n" " Options shared by all actions:\n"
" -d\t\tDebugging messages to stderr.\n"
" -r\t\t\t<rootdir>\n" " -r\t\t\t<rootdir>\n"
" -V\t\tPrints the xbps release version\n" " -V\t\tPrints the xbps release version\n"
"\n" "\n"
@ -105,15 +106,18 @@ main(int argc, char **argv)
prop_dictionary_t dict; prop_dictionary_t dict;
const char *version; const char *version;
char *plist, *pkgname, *pkgver, *in_chroot_env, *hash; char *plist, *pkgname, *pkgver, *in_chroot_env, *hash;
bool in_chroot = false; bool debug = false, in_chroot = false;
int i, c, rv = 0; int i, c, rv = 0;
while ((c = getopt(argc, argv, "Var:")) != -1) { while ((c = getopt(argc, argv, "Vdr:")) != -1) {
switch (c) { switch (c) {
case 'r': case 'r':
/* To specify the root directory */ /* To specify the root directory */
xbps_set_rootdir(optarg); xbps_set_rootdir(optarg);
break; break;
case 'd':
debug = true;
break;
case 'V': case 'V':
printf("%s\n", XBPS_RELVER); printf("%s\n", XBPS_RELVER);
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
@ -129,7 +133,7 @@ main(int argc, char **argv)
if (argc < 1) if (argc < 1)
usage(); usage();
xbps_init(true); xbps_init(debug);
plist = xbps_xasprintf("%s/%s/%s", xbps_get_rootdir(), plist = xbps_xasprintf("%s/%s/%s", xbps_get_rootdir(),
XBPS_META_PATH, XBPS_REGPKGDB); XBPS_META_PATH, XBPS_REGPKGDB);