From ba55b228a38071cd6d4be39f0c409fc5c08f3d19 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Mon, 27 Nov 2017 19:40:13 +0000 Subject: [PATCH] Move gtkwin.c's cmdline_error() into gtkmain.c. Not all gtkwin-based tools use it. Only the ones with one session per process, which parse a command line describing that session and might reasonably want to report errors in that command line by writing to standard error and exiting the program. In other words, precisely the ones that link in gtkmain.c and not gtkapp.c. So gtkmain.c is a more sensible place to put that error-reporting function. --- unix/gtkmain.c | 11 +++++++++++ unix/gtkwin.c | 11 ----------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/unix/gtkmain.c b/unix/gtkmain.c index 751a80ff..a3cdb270 100644 --- a/unix/gtkmain.c +++ b/unix/gtkmain.c @@ -298,6 +298,17 @@ static void version(FILE *fp) { static const char *geometry_string; +void cmdline_error(const char *p, ...) +{ + va_list ap; + fprintf(stderr, "%s: ", appname); + va_start(ap, p); + vfprintf(stderr, p, ap); + va_end(ap); + fputc('\n', stderr); + exit(1); +} + int do_cmdline(int argc, char **argv, int do_everything, int *allow_launch, Conf *conf) { diff --git a/unix/gtkwin.c b/unix/gtkwin.c index 418d6875..f0c3c3fb 100644 --- a/unix/gtkwin.c +++ b/unix/gtkwin.c @@ -3789,17 +3789,6 @@ void modalfatalbox(const char *p, ...) exit(1); } -void cmdline_error(const char *p, ...) -{ - va_list ap; - fprintf(stderr, "%s: ", appname); - va_start(ap, p); - vfprintf(stderr, p, ap); - va_end(ap); - fputc('\n', stderr); - exit(1); -} - const char *get_x_display(void *frontend) { return gdk_get_display();