summaryrefslogtreecommitdiff
path: root/src/util/vercmp.c
diff options
context:
space:
mode:
authorJason St. John <jstjohn@purdue.edu>2013-09-03 15:20:50 -0400
committerAllan McRae <allan@archlinux.org>2013-09-04 09:51:20 +1000
commita86015f73fdda878287a2ad21011594862bf506a (patch)
tree61a580ebc898312361abe79f5bfa99441698ddec /src/util/vercmp.c
parent4245c6b222703dda7bd6000e180c777f480e4420 (diff)
downloadpacman-a86015f73fdda878287a2ad21011594862bf506a.tar.xz
Improve --help switch output for pacman utils
Unify the formatting of the --help switch for pacman utils, if it exists. All of the pacman utils will now output help text using the following format: util-name (pacman) v<pacman version> one line description of util's purpose Usage: util-name [options] -b, --bar whatever --bar does -f, --foo whatever --foo does -h, --help display this help message The --help switch does not exist for a couple of the utils, so the help/usage text for those will be displayed when the util is run with no arguments. Reported-by: Karol Błażewicz <karol.blazewicz at gmail.com> Signed-off-by: Jason St. John <jstjohn@purdue.edu> Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'src/util/vercmp.c')
-rw-r--r--src/util/vercmp.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/util/vercmp.c b/src/util/vercmp.c
index f4356fb4..41a4f8e2 100644
--- a/src/util/vercmp.c
+++ b/src/util/vercmp.c
@@ -1,5 +1,6 @@
/*
- * vercmp.c
+ * vercmp.c - Compare package version numbers using pacman's version
+ * comparison logic
*
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
* Copyright (c) 2002-2005 by Judd Vinet <jvinet@zeroflux.org>
@@ -22,19 +23,19 @@
#include <stdio.h> /* printf */
#include <string.h>
-#define BASENAME "vercmp"
-
/* forward declaration, comes from version.o in libalpm source that is linked
* in directly so we don't have any library deps */
int alpm_pkg_vercmp(const char *a, const char *b);
static void usage(void)
{
- fprintf(stderr, "usage: %s <ver1> <ver2>\n\n", BASENAME);
- fprintf(stderr, "output values:\n");
- fprintf(stderr, " < 0 : if ver1 < ver2\n");
- fprintf(stderr, " 0 : if ver1 == ver2\n");
- fprintf(stderr, " > 0 : if ver1 > ver2\n");
+ fprintf(stderr, "vercmp (pacman) v" PACKAGE_VERSION "\n\n"
+ "Compare package version numbers using pacman's version comparison logic.\n\n"
+ "Usage: vercmp <ver1> <ver2>\n\n"
+ "Output values:\n"
+ " < 0 : if ver1 < ver2\n"
+ " 0 : if ver1 == ver2\n"
+ " > 0 : if ver1 > ver2\n");
}
int main(int argc, char *argv[])