1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 04:20:27 +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:
Christophe CURIS
2014-10-26 00:31:42 +02:00
committed by Carlos R. Mafra
parent ff8fc10a65
commit 3de5b8fb42
12 changed files with 90 additions and 78 deletions

View File

@@ -38,11 +38,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 [-h] [-v] [file]\n", __progname);
printf("Usage: %s [-h] [-v] [file]\n", prog_name);
if (print_usage) {
puts("Reads icon configuration from FILE and updates Window Maker.");
puts("");
@@ -65,10 +65,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':
@@ -91,13 +92,13 @@ int main(int argc, char **argv)
all_windows = WMReadPropListFromFile(path);
if (!all_windows) {
printf("%s: could not load WindowMaker configuration file \"%s\".\n", __progname, path);
printf("%s: could not load WindowMaker configuration file \"%s\".\n", prog_name, path);
return 1;
}
iconset = WMReadPropListFromFile(argv[0]);
if (!iconset) {
printf("%s: could not load icon set file \"%s\".\n", __progname, argv[0]);
printf("%s: could not load icon set file \"%s\".\n", prog_name, argv[0]);
return 1;
}