1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-01-04 12:54:20 +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

@@ -129,7 +129,7 @@ static char *font_options[] = {
NULL
};
extern char *__progname;
static const char *prog_name;
WMPropList *PixmapPath = NULL;
@@ -138,7 +138,7 @@ char *ThemePath = NULL;
static noreturn void print_help(int print_usage, int exitval)
{
printf("Usage: %s [-t] [-p] [-h] [-v] [file]\n", __progname);
printf("Usage: %s [-t] [-p] [-h] [-v] [file]\n", prog_name);
if (print_usage) {
puts("Retrieves style/theme configuration and outputs to ~/GNUstep/Library/WindowMaker/Themes/file.themed/style or to stdout");
puts("");
@@ -299,10 +299,11 @@ int main(int argc, char **argv)
{ NULL, 0, NULL, 0 }
};
prog_name = argv[0];
while ((ch = getopt_long(argc, argv, "ptvh", 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':
@@ -329,7 +330,7 @@ int main(int argc, char **argv)
style_file = argv[argc - 1];
if (make_pack && !style_file) {
printf("%s: you must supply a name for the theme pack\n", __progname);
printf("%s: you must supply a name for the theme pack\n", prog_name);
return 1;
}
@@ -339,7 +340,7 @@ int main(int argc, char **argv)
prop = WMReadPropListFromFile(path);
if (!prop) {
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;
}