mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-23 14:42:29 +01:00
util: removed usage of external '__progname' because it is not portable
As reported by Milan Čermák, using this variable breaks compilation on Solaris, because it is a hack which is not standard. To ensure portability, we now rely on main's argv[0] which is always available. Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
committed by
Carlos R. Mafra
parent
ff8fc10a65
commit
3de5b8fb42
@@ -43,11 +43,11 @@
|
||||
|
||||
#include "../src/wconfig.h"
|
||||
|
||||
extern char *__progname;
|
||||
static const char *prog_name;
|
||||
|
||||
static noreturn void print_help(int print_usage, int exitval)
|
||||
{
|
||||
printf("Usage: %s [OPTIONS] <domain> <key> <value>\n", __progname);
|
||||
printf("Usage: %s [OPTIONS] <domain> <key> <value>\n", prog_name);
|
||||
if (print_usage) {
|
||||
puts("Write <value> for <key> in <domain>'s database");
|
||||
puts("");
|
||||
@@ -69,10 +69,11 @@ int main(int argc, char **argv)
|
||||
{ NULL, 0, NULL, 0 }
|
||||
};
|
||||
|
||||
prog_name = argv[0];
|
||||
while ((ch = getopt_long(argc, argv, "hv", longopts, NULL)) != -1)
|
||||
switch(ch) {
|
||||
case 'v':
|
||||
printf("%s (Window Maker %s)\n", __progname, VERSION);
|
||||
printf("%s (Window Maker %s)\n", prog_name, VERSION);
|
||||
return 0;
|
||||
/* NOTREACHED */
|
||||
case 'h':
|
||||
@@ -94,7 +95,7 @@ int main(int argc, char **argv)
|
||||
key = WMCreatePLString(argv[1]);
|
||||
value = WMCreatePropListFromDescription(argv[2]);
|
||||
if (!value) {
|
||||
printf("%s: syntax error in value \"%s\"", __progname, argv[2]);
|
||||
printf("%s: syntax error in value \"%s\"", prog_name, argv[2]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user