From 9f3913c4c01d098cf0d76cded86dbf6e051e87fc Mon Sep 17 00:00:00 2001 From: Jeroen Roovers Date: Sun, 26 Jan 2020 17:26:41 +0100 Subject: [PATCH] xhydra: Fix various global declarations More -fno-common fixes: - Rename HYDRA_BIN to hydra_bin so it does not get confused for a macro - support.h: Declare some variables as extern - main.c: Define same variables here --- hydra-gtk/src/callbacks.c | 4 ++-- hydra-gtk/src/main.c | 18 +++++++++--------- hydra-gtk/src/support.h | 6 +++--- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/hydra-gtk/src/callbacks.c b/hydra-gtk/src/callbacks.c index f586208..15fdec8 100644 --- a/hydra-gtk/src/callbacks.c +++ b/hydra-gtk/src/callbacks.c @@ -66,7 +66,7 @@ int hydra_get_options(char *options[]) { gchar *tmp; GString *a; - options[0] = HYDRA_BIN; + options[0] = hydra_bin; /* get the port */ widget = lookup_widget(GTK_WIDGET(wndMain), "spnPort"); @@ -599,7 +599,7 @@ int *popen_re_unbuffered(char *command) { (void) hydra_get_options(options); - execv(HYDRA_BIN, options); + execv(hydra_bin, options); g_warning("%s %i: popen_rw_unbuffered: execv() returned", __FILE__, __LINE__); diff --git a/hydra-gtk/src/main.c b/hydra-gtk/src/main.c index 931493b..0e54d15 100644 --- a/hydra-gtk/src/main.c +++ b/hydra-gtk/src/main.c @@ -17,12 +17,12 @@ char *hydra_path1 = "./hydra"; char *hydra_path2 = "/usr/local/bin/hydra"; char *hydra_path3 = "/usr/bin/hydra"; - +char *hydra_bin; +GtkWidget *wndMain; +guint message_id; int main(int argc, char *argv[]) { - extern GtkWidget *wndMain; int i; - extern guint message_id; GtkWidget *output; GtkTextBuffer *outputbuf; @@ -35,22 +35,22 @@ int main(int argc, char *argv[]) { message_id = 0; /* locate the hydra binary */ - HYDRA_BIN = NULL; + hydra_bin = NULL; for (i = 0; i < argc - 1; i++) { if (!strcmp(argv[i], "--hydra-path")) { - HYDRA_BIN = argv[i + 1]; + hydra_bin = argv[i + 1]; break; } } - if ((HYDRA_BIN != NULL) && (g_file_test(HYDRA_BIN, G_FILE_TEST_IS_EXECUTABLE))) { + if ((hydra_bin != NULL) && (g_file_test(hydra_bin, G_FILE_TEST_IS_EXECUTABLE))) { /* just for obfuscation *g* */ } else if (g_file_test(hydra_path1, G_FILE_TEST_IS_EXECUTABLE)) { - HYDRA_BIN = hydra_path1; + hydra_bin = hydra_path1; } else if (g_file_test(hydra_path2, G_FILE_TEST_IS_EXECUTABLE)) { - HYDRA_BIN = hydra_path2; + hydra_bin = hydra_path2; } else if (g_file_test(hydra_path3, G_FILE_TEST_IS_EXECUTABLE)) { - HYDRA_BIN = hydra_path3; + hydra_bin = hydra_path3; } else { g_error("Please tell me where hydra is, use --hydra-path\n"); return -1; diff --git a/hydra-gtk/src/support.h b/hydra-gtk/src/support.h index 4fc185d..3602939 100644 --- a/hydra-gtk/src/support.h +++ b/hydra-gtk/src/support.h @@ -40,6 +40,6 @@ GdkPixbuf *create_pixbuf(const gchar * filename); void glade_set_atk_action_description(AtkAction * action, const gchar * action_name, const gchar * description); -GtkWidget *wndMain; -char *HYDRA_BIN; -guint message_id; +extern GtkWidget *wndMain; +extern char *hydra_bin; +extern guint message_id;