Avoid using PROGNAME in the programs installed

This commit is contained in:
Pierre Pronchery 2018-02-10 15:29:57 +01:00
parent 01c36e5f8e
commit 5eefc9cbf6
4 changed files with 33 additions and 28 deletions

View File

@ -27,8 +27,8 @@
#define _(string) gettext(string)
/* constants */
#ifndef PROGNAME
# define PROGNAME "panel-embed"
#ifndef PROGNAME_PANEL_EMBED
# define PROGNAME_PANEL_EMBED "panel-embed"
#endif
#ifndef PREFIX
# define PREFIX "/usr/local"
@ -140,7 +140,7 @@ static void _embed_on_child(GPid pid, gint status, gpointer data)
/* error */
static int _error(char const * message, int ret)
{
fprintf(stderr, "%s%s\n", PROGNAME ": ", message);
fprintf(stderr, "%s%s\n", PROGNAME_PANEL_EMBED ": ", message);
return ret;
}
@ -148,7 +148,8 @@ static int _error(char const * message, int ret)
/* usage */
static int _usage(void)
{
fprintf(stderr, _("Usage: %s command [arguments...]\n"), PROGNAME);
fprintf(stderr, _("Usage: %s command [arguments...]\n"),
PROGNAME_PANEL_EMBED);
return 1;
}

View File

@ -31,8 +31,8 @@
#define _(string) gettext(string)
/* constants */
#ifndef PROGNAME
# define PROGNAME "panel-message"
#ifndef PROGNAME_PANEL_MESSAGE
# define PROGNAME_PANEL_MESSAGE "panel-message"
#endif
#ifndef PREFIX
# define PREFIX "/usr/local"
@ -151,7 +151,7 @@ static gboolean _message_on_timeout(gpointer data)
/* error */
static int _error(char const * message, int ret)
{
fputs(PROGNAME ": ", stderr);
fputs(PROGNAME_PANEL_MESSAGE ": ", stderr);
perror(message);
return ret;
}
@ -161,7 +161,8 @@ static int _error(char const * message, int ret)
static int _usage(void)
{
fprintf(stderr, _("Usage: %s [-EIQW][-T title][-t timeout] message\n"
" %s [-N name][-T title][-t timeout] message\n"), PROGNAME, PROGNAME);
" %s [-N name][-T title][-t timeout] message\n"), PROGNAME_PANEL_MESSAGE,
PROGNAME_PANEL_MESSAGE);
return 1;
}

View File

@ -33,9 +33,10 @@
#define N_(string) string
/* constants */
#ifndef PROGNAME
# define PROGNAME "panel-notify"
#ifndef PROGNAME_PANEL_NOTIFY
# define PROGNAME_PANEL_NOTIFY "panel-notify"
#endif
#define PROGNAME PROGNAME_PANEL_NOTIFY
#include "helper.c"
#ifndef PREFIX
@ -84,7 +85,7 @@ static int _notify_embed(GtkIconSize iconsize, int timeout, char * applets[])
PANEL_WINDOW_TYPE_NOTIFICATION, iconsize);
for(i = 0; applets[i] != NULL; i++)
if(_panel_append(&panel, PANEL_POSITION_TOP, applets[i]) != 0)
error_print(PROGNAME);
error_print(PROGNAME_PANEL_NOTIFY);
if((xid = _panel_get_xid(&panel)) == 0)
/* XXX report error */
return -1;
@ -105,7 +106,7 @@ static int _notify_panel(GtkIconSize iconsize, int timeout, char * applets[])
_panel_set_title(&panel, _("Notification"));
for(i = 0; applets[i] != NULL; i++)
if(_panel_append(&panel, PANEL_POSITION_TOP, applets[i]) != 0)
error_print(PROGNAME);
error_print(PROGNAME_PANEL_NOTIFY);
_panel_show(&panel, TRUE);
if(timeout > 0)
panel.timeout = g_timeout_add(timeout * 1000,
@ -140,7 +141,8 @@ static int _usage(void)
" -X Use huge icons\n"
" -x Use icons the size of menus\n"
" -t Time to wait before disappearing (0: unlimited)\n"
" -l Lists the plug-ins available\n"), PROGNAME, PROGNAME);
" -l Lists the plug-ins available\n"), PROGNAME_PANEL_NOTIFY,
PROGNAME_PANEL_NOTIFY);
return 1;
}

View File

@ -31,9 +31,10 @@
#define _(string) gettext(string)
#define N_(string) string
#ifndef PROGNAME
# define PROGNAME "panel-test"
#ifndef PROGNAME_PANEL_TEST
# define PROGNAME_PANEL_TEST "panel-test"
#endif
#define PROGNAME PROGNAME_PANEL_TEST
#include "helper.c"
/* constants */
@ -71,7 +72,7 @@ static int _test(PanelWindowType type, PanelWindowPosition position,
_panel_set_title(&panel, "Applet tester");
for(i = 0; applets[i] != NULL; i++)
if(_panel_append(&panel, PANEL_POSITION_TOP, applets[i]) != 0)
error_print(PROGNAME);
error_print(PROGNAME_PANEL_TEST);
_panel_show(&panel, TRUE);
gtk_main();
_panel_destroy(&panel);
@ -82,8 +83,8 @@ static int _test(PanelWindowType type, PanelWindowPosition position,
/* usage */
static int _usage(void)
{
fputs("Usage: " PROGNAME " [-C|-F|-M][-L|-S|-X|-x][-n] applet...\n"
" " PROGNAME " -l\n"
fputs("Usage: " PROGNAME_PANEL_TEST " [-C|-F|-M][-L|-S|-X|-x][-n] applet...\n"
" " PROGNAME_PANEL_TEST " -l\n"
" -l Lists the plug-ins available\n", stderr);
return 1;
}