Using PROGNAME with the terminal emulator as well
This commit is contained in:
parent
4e922b4adb
commit
d22045ab7f
|
@ -26,6 +26,9 @@
|
||||||
#define _(string) gettext(string)
|
#define _(string) gettext(string)
|
||||||
|
|
||||||
/* constants */
|
/* constants */
|
||||||
|
#ifndef PROGNAME
|
||||||
|
# define PROGNAME "terminal"
|
||||||
|
#endif
|
||||||
#ifndef PREFIX
|
#ifndef PREFIX
|
||||||
# define PREFIX "/usr/local"
|
# define PREFIX "/usr/local"
|
||||||
#endif
|
#endif
|
||||||
|
@ -62,7 +65,7 @@ static int _terminal(char const * shell)
|
||||||
/* error */
|
/* error */
|
||||||
static int _error(char const * message, int ret)
|
static int _error(char const * message, int ret)
|
||||||
{
|
{
|
||||||
fputs("terminal: ", stderr);
|
fputs(PROGNAME ": ", stderr);
|
||||||
perror(message);
|
perror(message);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -71,7 +74,7 @@ static int _error(char const * message, int ret)
|
||||||
/* usage */
|
/* usage */
|
||||||
static int _usage(void)
|
static int _usage(void)
|
||||||
{
|
{
|
||||||
fputs(_("Usage: terminal [shell]\n"), stderr);
|
fprintf(stderr, _("Usage: %s [shell]\n"), PROGNAME);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,9 @@ static char const _license[] =
|
||||||
#define N_(string) (string)
|
#define N_(string) (string)
|
||||||
|
|
||||||
/* constants */
|
/* constants */
|
||||||
|
#ifndef PROGNAME
|
||||||
|
# define PROGNAME "terminal"
|
||||||
|
#endif
|
||||||
#ifndef PREFIX
|
#ifndef PREFIX
|
||||||
# define PREFIX "/usr/local"
|
# define PREFIX "/usr/local"
|
||||||
#endif
|
#endif
|
||||||
|
@ -286,7 +289,7 @@ static int _terminal_open_tab(Terminal * terminal)
|
||||||
if(g_spawn_async(NULL, argv, NULL, flags, NULL, NULL, &p->pid, &error)
|
if(g_spawn_async(NULL, argv, NULL, flags, NULL, NULL, &p->pid, &error)
|
||||||
== FALSE)
|
== FALSE)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s: %s: %s\n", "terminal", argv[1],
|
fprintf(stderr, "%s: %s: %s\n", PROGNAME, argv[1],
|
||||||
error->message);
|
error->message);
|
||||||
g_error_free(error);
|
g_error_free(error);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -301,14 +304,14 @@ static int _terminal_open_tab(Terminal * terminal)
|
||||||
/* terminal_open_window */
|
/* terminal_open_window */
|
||||||
static int _terminal_open_window(Terminal * terminal)
|
static int _terminal_open_window(Terminal * terminal)
|
||||||
{
|
{
|
||||||
char * argv[] = { BINDIR "/terminal", "terminal", NULL };
|
char * argv[] = { BINDIR "/" PROGNAME, PROGNAME, NULL };
|
||||||
GSpawnFlags flags = G_SPAWN_FILE_AND_ARGV_ZERO;
|
GSpawnFlags flags = G_SPAWN_FILE_AND_ARGV_ZERO;
|
||||||
GError * error = NULL;
|
GError * error = NULL;
|
||||||
|
|
||||||
if(g_spawn_async(NULL, argv, NULL, flags, NULL, NULL, NULL, &error)
|
if(g_spawn_async(NULL, argv, NULL, flags, NULL, NULL, NULL, &error)
|
||||||
== FALSE)
|
== FALSE)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s: %s: %s\n", "terminal", argv[0],
|
fprintf(stderr, "%s: %s: %s\n", PROGNAME, argv[0],
|
||||||
error->message);
|
error->message);
|
||||||
g_error_free(error);
|
g_error_free(error);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -362,14 +365,14 @@ static void _terminal_on_child_watch(GPid pid, gint status, gpointer data)
|
||||||
if(WIFEXITED(status))
|
if(WIFEXITED(status))
|
||||||
{
|
{
|
||||||
if(WEXITSTATUS(status) != 0)
|
if(WEXITSTATUS(status) != 0)
|
||||||
fprintf(stderr, "%s: %s%u\n", "terminal",
|
fprintf(stderr, "%s: %s%u\n", PROGNAME,
|
||||||
_("xterm exited with status "),
|
_("xterm exited with status "),
|
||||||
WEXITSTATUS(status));
|
WEXITSTATUS(status));
|
||||||
_terminal_close_tab(terminal, i);
|
_terminal_close_tab(terminal, i);
|
||||||
}
|
}
|
||||||
else if(WIFSIGNALED(status))
|
else if(WIFSIGNALED(status))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s: %s%u\n", "terminal",
|
fprintf(stderr, "%s: %s%u\n", PROGNAME,
|
||||||
_("xterm exited with signal "),
|
_("xterm exited with signal "),
|
||||||
WTERMSIG(status));
|
WTERMSIG(status));
|
||||||
_terminal_close_tab(terminal, i);
|
_terminal_close_tab(terminal, i);
|
||||||
|
@ -526,6 +529,6 @@ static void _terminal_on_help_about(gpointer data)
|
||||||
/* terminal_on_help_contents */
|
/* terminal_on_help_contents */
|
||||||
static void _terminal_on_help_contents(gpointer data)
|
static void _terminal_on_help_contents(gpointer data)
|
||||||
{
|
{
|
||||||
desktop_help_contents(PACKAGE, "terminal");
|
desktop_help_contents(PACKAGE, PROGNAME);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue
Block a user