summaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
authorAnton Luka Šijanec <anton@sijanec.eu>2022-01-31 19:16:55 +0100
committerAnton Luka Šijanec <anton@sijanec.eu>2022-01-31 19:16:55 +0100
commitf26b60718163cfe454df368099ca1901acafc047 (patch)
tree5446a485e682f281ee6b46e02ea41d397b05f186 /src/main.c
parentunicode queries now work 0.0.19 (diff)
downloadsear.c-f26b60718163cfe454df368099ca1901acafc047.tar
sear.c-f26b60718163cfe454df368099ca1901acafc047.tar.gz
sear.c-f26b60718163cfe454df368099ca1901acafc047.tar.bz2
sear.c-f26b60718163cfe454df368099ca1901acafc047.tar.lz
sear.c-f26b60718163cfe454df368099ca1901acafc047.tar.xz
sear.c-f26b60718163cfe454df368099ca1901acafc047.tar.zst
sear.c-f26b60718163cfe454df368099ca1901acafc047.zip
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index 32c7e96..f57e398 100644
--- a/src/main.c
+++ b/src/main.c
@@ -26,6 +26,32 @@
#endif
#include <lib.c>
#include <url.c>
+#define ABS(x) (((x) < 0) ? -(x) : (x))
+enum sc_return {
+ SC_BADCALL = -1, /* calling the function the wrong way, I could actually just crash */
+ SC_EMPTYRESPONSE = -2, /* something weird, do not retry */
+ SC_CAPTCHA = -3, /* engine responded with a CAPTCHA, redirect to a different server */
+ SC_NOIMGCLASS = -4, /* couldn't find image class name from definition, do not retry */
+ SC_NOCLASS = -5, /* couldn't find result class name from def, do not retry */
+ SC_NOHREF = -6 /* a result did not contain a href attribute */
+};
+const char * sc_return_str (enum sc_return r) {
+ switch (r) {
+ case SC_BADCALL:
+ return "SC_BADCALL";
+ case SC_EMPTYRESPONSE:
+ return "SC_EMPTYRESPONSE";
+ case SC_CAPTCHA:
+ return "SC_CAPTCHA";
+ case SC_NOIMGCLASS:
+ return "SC_NOIMGCLASS";
+ case SC_NOCLASS:
+ return "SC_NOCLASS";
+ case SC_NOHREF:
+ return "SC_NOHREF";
+ }
+ return "SC_BADRETURN";
+}
unsigned char sc_hp[] = { /* html page null terminated format string, from file src/hp.html */
#include <hp.xxd>
};