From 3f29d939ee6d20789eff0fb779592f64fc4bf892 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Wed, 22 Feb 2017 22:10:05 +0000 Subject: [PATCH] Unix buildinfo: stop saying 'GTK' in pure CLI utilities. Unix PSCP, PSFTP, Plink and PuTTYgen now just report their build platform as '64-bit Unix' or '32-bit Unix', without mentioning irrelevant details of what flavour of GTK the other tools in the suite might have been built against. (In particular, they now won't imply anything outright untrue if there was no GTK present at build time at all!) --- cmdgen.c | 3 +++ fuzzterm.c | 3 +++ testbn.c | 3 +++ unix/gtkapp.c | 2 ++ unix/gtkask.c | 2 ++ unix/gtkmain.c | 2 ++ unix/unix.h | 14 +++++++++++--- unix/uxplink.c | 2 ++ unix/uxsftp.c | 2 ++ 9 files changed, 30 insertions(+), 3 deletions(-) diff --git a/cmdgen.c b/cmdgen.c index f1cf9770..9d9d011a 100644 --- a/cmdgen.c +++ b/cmdgen.c @@ -227,6 +227,9 @@ static char *readpassphrase(const char *filename) #define DEFAULT_RSADSA_BITS 2048 +/* For Unix in particular, but harmless if this main() is reused elsewhere */ +const int buildinfo_gtk_relevant = FALSE; + int main(int argc, char **argv) { char *infile = NULL; diff --git a/fuzzterm.c b/fuzzterm.c index 21e7b12a..15b5d635 100644 --- a/fuzzterm.c +++ b/fuzzterm.c @@ -6,6 +6,9 @@ #include "putty.h" #include "terminal.h" +/* For Unix in particular, but harmless if this main() is reused elsewhere */ +const int buildinfo_gtk_relevant = FALSE; + int main(int argc, char **argv) { char blk[512]; diff --git a/testbn.c b/testbn.c index 2ea4f459..05f62767 100644 --- a/testbn.c +++ b/testbn.c @@ -33,6 +33,9 @@ int random_byte(void) #define fromxdigit(c) ( (c)>'9' ? ((c)&0xDF) - 'A' + 10 : (c) - '0' ) +/* For Unix in particular, but harmless if this main() is reused elsewhere */ +const int buildinfo_gtk_relevant = FALSE; + int main(int argc, char **argv) { char *buf; diff --git a/unix/gtkapp.c b/unix/gtkapp.c index 249be2d3..8b2a794f 100644 --- a/unix/gtkapp.c +++ b/unix/gtkapp.c @@ -127,6 +127,8 @@ https://wiki.gnome.org/Projects/GTK%2B/OSX/Bundling has some links. char *x_get_default(const char *key) { return NULL; } +const int buildinfo_gtk_relevant = TRUE; + #if !GTK_CHECK_VERSION(3,0,0) /* This front end only works in GTK 3. If that's not what we've got, * it's easier to just turn this program into a trivial stub by ifdef diff --git a/unix/gtkask.c b/unix/gtkask.c index c2b582e9..8493807b 100644 --- a/unix/gtkask.c +++ b/unix/gtkask.c @@ -473,6 +473,8 @@ static int setup_gtk(const char *display) return ret; } +const int buildinfo_gtk_relevant = TRUE; + char *gtk_askpass_main(const char *display, const char *wintitle, const char *prompt, int *success) { diff --git a/unix/gtkmain.c b/unix/gtkmain.c index c681b93d..c80da702 100644 --- a/unix/gtkmain.c +++ b/unix/gtkmain.c @@ -542,6 +542,8 @@ GtkWidget *make_gtk_toplevel_window(void *frontend) extern int cfgbox(Conf *conf); +const int buildinfo_gtk_relevant = TRUE; + int main(int argc, char **argv) { Conf *conf; diff --git a/unix/unix.h b/unix/unix.h index ea848d37..7ab2ca24 100644 --- a/unix/unix.h +++ b/unix/unix.h @@ -31,21 +31,29 @@ #define JUST_USE_GTK_CLIPBOARD_UTF8 /* low-level gdk_selection_* fails */ #define DEFAULT_CLIPBOARD GDK_SELECTION_CLIPBOARD /* OS X has no PRIMARY */ -#define BUILDINFO_PLATFORM "OS X (GTK)" +#define BUILDINFO_PLATFORM_GTK "OS X (GTK)" #define BUILDINFO_GTK #elif defined NOT_X_WINDOWS -#define BUILDINFO_PLATFORM "Unix (pure GTK)" +#define BUILDINFO_PLATFORM_GTK "Unix (pure GTK)" #define BUILDINFO_GTK #else -#define BUILDINFO_PLATFORM "Unix (GTK + X11)" +#define BUILDINFO_PLATFORM_GTK "Unix (GTK + X11)" #define BUILDINFO_GTK #endif +/* BUILDINFO_PLATFORM varies its expansion between the GTK and + * pure-CLI utilities, so that Unix Plink, PSFTP etc don't announce + * themselves incongruously as having something to do with GTK. */ +#define BUILDINFO_PLATFORM_CLI "Unix" +extern const int buildinfo_gtk_relevant; +#define BUILDINFO_PLATFORM (buildinfo_gtk_relevant ? \ + BUILDINFO_PLATFORM_GTK : BUILDINFO_PLATFORM_CLI) + char *buildinfo_gtk_version(void); struct Filename { diff --git a/unix/uxplink.c b/unix/uxplink.c index a2607fbb..2d4259b9 100644 --- a/unix/uxplink.c +++ b/unix/uxplink.c @@ -607,6 +607,8 @@ void frontend_net_error_pending(void) {} const int share_can_be_downstream = TRUE; const int share_can_be_upstream = TRUE; +const int buildinfo_gtk_relevant = FALSE; + int main(int argc, char **argv) { int sending; diff --git a/unix/uxsftp.c b/unix/uxsftp.c index 794cc9cb..56f7a136 100644 --- a/unix/uxsftp.c +++ b/unix/uxsftp.c @@ -622,6 +622,8 @@ void frontend_net_error_pending(void) {} void platform_psftp_pre_conn_setup(void) {} +const int buildinfo_gtk_relevant = FALSE; + /* * Main program: do platform-specific initialisation and then call * psftp_main(). -- 2.45.1