[pacman-dev] [PATCH v3 3/5] pacman-conf: Make myname and myver into cpp macros MYNAME and MYVER
iff at escondida.tk
iff at escondida.tk
Sun Feb 11 04:15:11 UTC 2018
From: Ivy Foster <iff at escondida.tk>
This allows MYNAME to be used in place of the literal string
"pacman-conf" in usage
Signed-off-by: Ivy Foster <iff at 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 9136b262..8985b326 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
More information about the pacman-dev
mailing list