aboutsummaryrefslogtreecommitdiff
path: root/plugins/libre_redirect
diff options
context:
space:
mode:
authorNunoSempere <nuno.semperelh@protonmail.com>2024-03-23 17:54:15 -0300
committerNunoSempere <nuno.semperelh@protonmail.com>2024-03-23 17:54:15 -0300
commite322621698d4700fad670670634fd4e0b7629d74 (patch)
tree0b8de7ec6ee7cd8607ca833bc9d2d7332b0e0fcc /plugins/libre_redirect
parent5097a1982bb7687b778255c9321407642320d24a (diff)
tweak usage of str replacement code
Diffstat (limited to 'plugins/libre_redirect')
-rw-r--r--plugins/libre_redirect/libre_redirect.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/plugins/libre_redirect/libre_redirect.c b/plugins/libre_redirect/libre_redirect.c
index a4fabdf..55ddb84 100644
--- a/plugins/libre_redirect/libre_redirect.c
+++ b/plugins/libre_redirect/libre_redirect.c
@@ -6,15 +6,13 @@
#define LIBRE_N 50
/* Inspired by https://libredirect.github.io/, but in C. */
-
-// Use string manipulation over urls
int libre_redirect(const char* uri, char* output)
{
int len_uri = strlen(uri);
int len_output = strlen(output);
if ((len_output - len_uri) < LIBRE_N) {
- printf("Not enough memory\n");
+ fprintf(stderr, "Not enough memory\n");
return 1; // not enough memory.
} else {
char* annoying_sites[] = {
@@ -52,14 +50,14 @@ int libre_redirect(const char* uri, char* output)
case 0: // no match found
break;
case 1: // str_replace_start somehow failed
- printf("str_replace_start failed\n");
+ fprintf(stderr, "str_replace_start failed\n");
return 1;
break;
case 2: // match succeeded
return 2;
break;
default:
- printf("Unreachable state");
+ fprintf(stderr, "Unreachable state\n");
}
}
strcpy(output, uri);