diff --git a/config.h b/config.h index d6ff1ad..a4ecef2 100644 --- a/config.h +++ b/config.h @@ -30,7 +30,7 @@ #define ZOOM 1.4 /* Starting zoom level.*/ #define ZOOM_VAL .1 /* Zooming value in zoomin/zoomout functions */ #define BG_COLOR "#FEFEFE" /*"#1E1E2E" */ -#define DEBUG false +#define DEBUG true typedef enum { goback, diff --git a/plugins/libre_redirect/libre_redirect.c b/plugins/libre_redirect/libre_redirect.c index 97def55..957789b 100644 --- a/plugins/libre_redirect/libre_redirect.c +++ b/plugins/libre_redirect/libre_redirect.c @@ -3,7 +3,7 @@ #include #include #define LIBRE_N 12 -#define DEBUG false +#define DEBUG true /* Inspired by https://libredirect.github.io/, but in C. */ @@ -40,7 +40,7 @@ int libre_redirect(const char* uri, char* output){ "https://simplytranslate.org/" }; - for(int i=1; i<4; i++){ + for(int i=0; i<4; i++){ int replace_check = str_replace_start(tmp_uri, sites[i], alternatives[i], output); if(replace_check == 2){ if(DEBUG) printf("tmp_uri: %s\n", tmp_uri); @@ -57,7 +57,7 @@ int libre_redirect(const char* uri, char* output){ } strcpy(output, tmp_uri); } - + if(DEBUG) printf("No match found\n\n"); return 0; } diff --git a/plugins/libre_redirect/str_replace_start.c b/plugins/libre_redirect/str_replace_start.c index b8bf050..c5c5e2a 100755 --- a/plugins/libre_redirect/str_replace_start.c +++ b/plugins/libre_redirect/str_replace_start.c @@ -1,7 +1,7 @@ #include #include #include -#define DEBUG false +#define DEBUG true /* See also: @@ -16,17 +16,18 @@ int str_replace_start(const char* string, const char* target, const char* replac int l3 = strlen(replacement); int l4 = strlen(output); if(DEBUG) printf("%d,%d,%d,%d\n", l1, l2, l3, l4); + // if(DEBUG) printf("%s,%s,%s,%s\n", string, target, replacement, output); if((l4 < (l1 - l2 + l3)) || l4 < l1 ){ // Not enough memory in output string. if(DEBUG) printf("String not long enough.\n"); return 1; } - else if(l1 < l2){ + /* else if(l1 < l2){ // Not even possible that there is a match. if(DEBUG) printf("Target larger than string.\n"); strcpy(output, string); - } + } */ else { if(DEBUG) printf("Looking for a match for %s in %s.\n", target, string); int match = true;