diff options
author | sijanec <anton@sijanec.eu> | 2021-04-01 23:30:37 +0200 |
---|---|---|
committer | sijanec <anton@sijanec.eu> | 2021-04-01 23:30:37 +0200 |
commit | 579048eaf89784ec1da8592d96311fafd49aea1a (patch) | |
tree | 61bf0c50c656f2b16ed8901ec3b07fb468ffb916 /src/main.c | |
download | sear.c-579048eaf89784ec1da8592d96311fafd49aea1a.tar sear.c-579048eaf89784ec1da8592d96311fafd49aea1a.tar.gz sear.c-579048eaf89784ec1da8592d96311fafd49aea1a.tar.bz2 sear.c-579048eaf89784ec1da8592d96311fafd49aea1a.tar.lz sear.c-579048eaf89784ec1da8592d96311fafd49aea1a.tar.xz sear.c-579048eaf89784ec1da8592d96311fafd49aea1a.tar.zst sear.c-579048eaf89784ec1da8592d96311fafd49aea1a.zip |
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..c42d5c0 --- /dev/null +++ b/src/main.c @@ -0,0 +1,43 @@ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <stdarg.h> +#include <printf.h> +#include <ctype.h> +#include <time.h> +#include <pthread.h> +#include <stdatomic.h> +#include <i18n.h> +#include <sys/types.h> +#include <sys/select.h> +#include <sys/socket.h> +#include <libxml/nanohttp.h> +#include <libxml/HTMLparser.h> +#include <libxml/HTMLtree.h> +#include <libxml/tree.h> +#include <libxml/xpath.h> +#include <lib.c> +#include <url.c> +unsigned char sc_hp[] = { /* html page null terminated format string, from file src/hp.html */ +#include <hp.xxd> +}; +#define SC_HTTP_PORT 7327 /* SEAR on mobile keyboard */ +#define SC_HTTP_RBUFSIZE 4096 /* initial size of http read buffer, increasning by K */ +#define SC_HTTP_USER_AGENT "Nokia WAP Gateway 4.1 CD1/ECD13_D/4.1.04)" /* so google and others sends a minimal response */ +#define SC_HTTP_HEADERS "User-Agent: " SC_HTTP_USER_AGENT "\r\n" +#include <structs.c> +#include <log.c> +#include <api.c> +/* this is new in my programs. I am now using _sizeof for the actual alloced size of the array and _length for the count of elements in array. this is done to decrease number of calls to realloc&amis */ +int main (int argc, char ** argv) { + int rs = 0; + struct sc_cache * c = sc_cache_init(); + if (!c) { + rs = 1; + goto rc; + } + sc_query_google("slovenia", c); +rc: + sc_cache_free(c); + return rs; +} |