aboutsummaryrefslogtreecommitdiff
path: root/plugins/shortcuts
diff options
context:
space:
mode:
authorNunoSempere <nuno.sempere@protonmail.com>2023-05-13 23:50:14 -0400
committerNunoSempere <nuno.sempere@protonmail.com>2023-05-13 23:50:14 -0400
commita8be16b1ee80f5d1d89b66494ec74af999652c2a (patch)
tree58b8179e0d2721d7c62360763d2699b61df46014 /plugins/shortcuts
parentc46e2ba3985846019d3377895e52fc360a6ce061 (diff)
debug shortcuts plugin
Diffstat (limited to 'plugins/shortcuts')
-rw-r--r--plugins/shortcuts/README.md4
-rw-r--r--plugins/shortcuts/shortcuts.c11
-rw-r--r--plugins/shortcuts/shortcuts.h3
3 files changed, 8 insertions, 10 deletions
diff --git a/plugins/shortcuts/README.md b/plugins/shortcuts/README.md
index 724c5d6..9718c4d 100644
--- a/plugins/shortcuts/README.md
+++ b/plugins/shortcuts/README.md
@@ -1,3 +1,7 @@
## About
This code automatically redirects shortcuts to their longer expansions. Similar to DuckDuckGo's bangs (<https://duckduckgo.com/bangs>)
+
+Note that Whoogle (the default search engine) also has its own bangs!
+- See: https://github.com/benbusby/whoogle-search/blob/main/app/utils/bangs.py
+- and https://duckduckgo.com/bang.v255.js
diff --git a/plugins/shortcuts/shortcuts.c b/plugins/shortcuts/shortcuts.c
index bc25bbf..1af4fda 100644
--- a/plugins/shortcuts/shortcuts.c
+++ b/plugins/shortcuts/shortcuts.c
@@ -3,23 +3,18 @@
#include <string.h>
#include "../libre_redirect/str_replace_start.h"
+#include "../libre_redirect/str_init.h"
-#define SHORTCUT_N 20
+#define SHORTCUT_N 41
/* Uncomment for debug */
/* #define DEBUG */
/* Inspired by https://duckduckgo.com/bangs */
-void str_init(char* str, int n)
-{
- for (int i = 0; i < n; i++)
- str[i] = ' ';
- str[n] = '\0';
-} // could also use <https://manpages.ubuntu.com/manpages/impish/man3/strinit.3pub.html>
-
int shortcut_expand(const char* uri, char* output)
{
+ printf("SHORTCUT EXPAND!");
int l1 = strlen(uri);
int l2 = strlen(output);
int len;
diff --git a/plugins/shortcuts/shortcuts.h b/plugins/shortcuts/shortcuts.h
index 00d08bd..5276281 100644
--- a/plugins/shortcuts/shortcuts.h
+++ b/plugins/shortcuts/shortcuts.h
@@ -1,6 +1,5 @@
#pragma once
-#define SHORTCUT_N 20
+#define SHORTCUT_N 41
int shortcut_expand(const char* uri, char* output);
-void str_init(char* str, int n);