xbps-{bin,repo,pkgdb}: added -V flag that prints the current XBPS

release version as defined in xbps_api.h.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091018084204-1xzyptqkjm5dwfjc
This commit is contained in:
Juan RP 2009-10-18 10:42:04 +02:00
parent 866e758dd2
commit fdc561dfb2
3 changed files with 16 additions and 4 deletions

View File

@ -57,7 +57,8 @@ usage(void)
" update\t\t<pkgname>\n" " update\t\t<pkgname>\n"
" Options shared by all targets:\n" " Options shared by all targets:\n"
" -r\t\t<rootdir>\n" " -r\t\t<rootdir>\n"
" -v\t\t<verbose>\n" " -v\t\tShows verbose messages\n"
" -V\t\tPrints the xbps release version\n"
" Options used by the (auto)remove and install target:\n" " Options used by the (auto)remove and install target:\n"
" -f\t\tForce installation or removal of packages.\n" " -f\t\tForce installation or removal of packages.\n"
" \t\tBeware with this option if you use autoremove!\n" " \t\tBeware with this option if you use autoremove!\n"
@ -93,7 +94,7 @@ main(int argc, char **argv)
int c, flags = 0, rv = 0; int c, flags = 0, rv = 0;
bool force = false, verbose = false; bool force = false, verbose = false;
while ((c = getopt(argc, argv, "Cfr:v")) != -1) { while ((c = getopt(argc, argv, "CVfr:v")) != -1) {
switch (c) { switch (c) {
case 'f': case 'f':
flags |= XBPS_FLAG_FORCE; flags |= XBPS_FLAG_FORCE;
@ -107,6 +108,9 @@ main(int argc, char **argv)
verbose = true; verbose = true;
flags |= XBPS_FLAG_VERBOSE; flags |= XBPS_FLAG_VERBOSE;
break; break;
case 'V':
printf("%s\n", XBPS_RELVER);
exit(EXIT_SUCCESS);
case '?': case '?':
default: default:
usage(); usage();

View File

@ -72,6 +72,7 @@ usage(void)
"\n" "\n"
" Options shared by all actions:\n" " Options shared by all actions:\n"
" -r\t\t\t<rootdir>\n" " -r\t\t\t<rootdir>\n"
" -V\t\tPrints the xbps release version\n"
"\n" "\n"
" Examples:\n" " Examples:\n"
" $ xbps-pkgdb getpkgname foo-2.0\n" " $ xbps-pkgdb getpkgname foo-2.0\n"
@ -94,7 +95,7 @@ main(int argc, char **argv)
bool in_chroot = false; bool in_chroot = false;
int c, rv = 0; int c, rv = 0;
while ((c = getopt(argc, argv, "ar:")) != -1) { while ((c = getopt(argc, argv, "Var:")) != -1) {
switch (c) { switch (c) {
case 'r': case 'r':
/* To specify the root directory */ /* To specify the root directory */
@ -103,6 +104,9 @@ main(int argc, char **argv)
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
xbps_set_rootdir(root); xbps_set_rootdir(root);
break; break;
case 'V':
printf("%s\n", XBPS_RELVER);
exit(EXIT_SUCCESS);
case '?': case '?':
default: default:
usage(); usage();

View File

@ -61,6 +61,7 @@ usage(void)
" show\t<pkgname>\n" " show\t<pkgname>\n"
" Options shared by all actions:\n" " Options shared by all actions:\n"
" -r\t\t<rootdir>\n" " -r\t\t<rootdir>\n"
" -V\t\tPrints xbps release version\n"
"\n" "\n"
" Examples:\n" " Examples:\n"
" $ xbps-repo add /path/to/directory\n" " $ xbps-repo add /path/to/directory\n"
@ -151,13 +152,16 @@ main(int argc, char **argv)
char dpkgidx[PATH_MAX], *plist, *root = NULL; char dpkgidx[PATH_MAX], *plist, *root = NULL;
int c, rv = 0; int c, rv = 0;
while ((c = getopt(argc, argv, "r:")) != -1) { while ((c = getopt(argc, argv, "Vr:")) != -1) {
switch (c) { switch (c) {
case 'r': case 'r':
/* To specify the root directory */ /* To specify the root directory */
root = optarg; root = optarg;
xbps_set_rootdir(root); xbps_set_rootdir(root);
break; break;
case 'V':
printf("%s\n", XBPS_RELVER);
exit(EXIT_SUCCESS);
case '?': case '?':
default: default:
usage(); usage();