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
This commit is contained in:
Jeroen Roovers 2020-01-26 17:26:41 +01:00
commit 9f3913c4c0
3 changed files with 14 additions and 14 deletions

View file

@ -66,7 +66,7 @@ int hydra_get_options(char *options[]) {
gchar *tmp; gchar *tmp;
GString *a; GString *a;
options[0] = HYDRA_BIN; options[0] = hydra_bin;
/* get the port */ /* get the port */
widget = lookup_widget(GTK_WIDGET(wndMain), "spnPort"); widget = lookup_widget(GTK_WIDGET(wndMain), "spnPort");
@ -599,7 +599,7 @@ int *popen_re_unbuffered(char *command) {
(void) hydra_get_options(options); (void) hydra_get_options(options);
execv(HYDRA_BIN, options); execv(hydra_bin, options);
g_warning("%s %i: popen_rw_unbuffered: execv() returned", __FILE__, __LINE__); g_warning("%s %i: popen_rw_unbuffered: execv() returned", __FILE__, __LINE__);

View file

@ -17,12 +17,12 @@
char *hydra_path1 = "./hydra"; char *hydra_path1 = "./hydra";
char *hydra_path2 = "/usr/local/bin/hydra"; char *hydra_path2 = "/usr/local/bin/hydra";
char *hydra_path3 = "/usr/bin/hydra"; char *hydra_path3 = "/usr/bin/hydra";
char *hydra_bin;
GtkWidget *wndMain;
guint message_id;
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
extern GtkWidget *wndMain;
int i; int i;
extern guint message_id;
GtkWidget *output; GtkWidget *output;
GtkTextBuffer *outputbuf; GtkTextBuffer *outputbuf;
@ -35,22 +35,22 @@ int main(int argc, char *argv[]) {
message_id = 0; message_id = 0;
/* locate the hydra binary */ /* locate the hydra binary */
HYDRA_BIN = NULL; hydra_bin = NULL;
for (i = 0; i < argc - 1; i++) { for (i = 0; i < argc - 1; i++) {
if (!strcmp(argv[i], "--hydra-path")) { if (!strcmp(argv[i], "--hydra-path")) {
HYDRA_BIN = argv[i + 1]; hydra_bin = argv[i + 1];
break; 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* */ /* just for obfuscation *g* */
} else if (g_file_test(hydra_path1, G_FILE_TEST_IS_EXECUTABLE)) { } 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)) { } 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)) { } else if (g_file_test(hydra_path3, G_FILE_TEST_IS_EXECUTABLE)) {
HYDRA_BIN = hydra_path3; hydra_bin = hydra_path3;
} else { } else {
g_error("Please tell me where hydra is, use --hydra-path\n"); g_error("Please tell me where hydra is, use --hydra-path\n");
return -1; return -1;

View file

@ -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); void glade_set_atk_action_description(AtkAction * action, const gchar * action_name, const gchar * description);
GtkWidget *wndMain; extern GtkWidget *wndMain;
char *HYDRA_BIN; extern char *hydra_bin;
guint message_id; extern guint message_id;