From: Ivy Foster <i...@escondida.tk>

This allows MYNAME to be used in place of the literal string
"pacman-conf" in usage

Signed-off-by: Ivy Foster <i...@escondida.tk>
---
 src/pacman/pacman-conf.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/pacman/pacman-conf.c b/src/pacman/pacman-conf.c
index 61f4d0a1..739588ae 100644
--- a/src/pacman/pacman-conf.c
+++ b/src/pacman/pacman-conf.c
@@ -21,7 +21,8 @@
 #include <string.h>
 #include "conf.h"
 
-const char *myname = "pacman-conf", *myver = "1.0.0";
+#define MYNAME "pacman-conf"
+#define MYVER "1.0.0"
 
 alpm_list_t *directives = NULL;
 char sep = '\n', *repo_name = NULL;
@@ -37,9 +38,9 @@ static void cleanup(void)
 static void usage(FILE *stream)
 {
        static const char help[] =
-               "pacman-conf: query pacman's configuration file\n"
-               "usage: pacman-conf [options] [directive]\n"
-               "       pacman-conf [ { -l, --repo-list } | { -h, --help } | { 
-V, --version } ]\n"
+               MYNAME ": query pacman's configuration file\n"
+               "usage: " MYNAME " [options] [directive]\n"
+               "       " MYNAME " [ { -l, --repo-list } | { -h, --help } | { 
-V, --version } ]\n"
                "options:\n"
                "    -c, --config=<file>  Read configuration from <file>\n"
                "    -h, --help           Print help\n"
@@ -90,7 +91,7 @@ static void parse_opts(int argc, char **argv)
                                cleanup();
                                exit(0);
                        case 'V':
-                               printf("%s v%s\n", myname, myver);
+                               printf("%s v%s\n", MYNAME, MYVER);
                                cleanup();
                                exit(0);
                                break;
-- 
2.16.1

Reply via email to