From bb13744bafc43aa54a19f7e806fbc97eb7dbef11 Mon Sep 17 00:00:00 2001 From: logen Date: Mon, 18 Jul 2016 20:01:16 -0700 Subject: [PATCH] Initial Commit --- README.md | 10 ++++++++++ euhelp.c | 27 +++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 README.md create mode 100644 euhelp.c diff --git a/README.md b/README.md new file mode 100644 index 0000000..6e4b54a --- /dev/null +++ b/README.md @@ -0,0 +1,10 @@ +# Euhelp +## Search Open Euphoria Docs quickly + + +``` +$ cc euhelp.c -o euhelp +``` +``` +$ ./euhelp SearchTerm +``` diff --git a/euhelp.c b/euhelp.c new file mode 100644 index 0000000..404d4ec --- /dev/null +++ b/euhelp.c @@ -0,0 +1,27 @@ +#include +#include +#include + +int main(int argc, char *argv[]) +{ +char command[1024]; + +//xdg-open was pissed about escaped quotes so I had to go with %22 +//added %5c in order to open first search result +strcpy(command,"xdg-open https://duckduckgo.com/?q=\%5Csite\%3Ahttp\%3A\%2F\%2Fopeneuphoria.org\%2Fdocs\%2F+\%22"); +if (argc >=1){ +strcat(command, argv[1]); +} + +if (argc >=3){ + printf("Multiple search terms not implemented yet\n If you wish to do this anyway, please use a \"+\" instead of a space \n"); + exit(1); + } + + +strcat(command, "\%22"); +printf("%s", command); + +system(command); +return 0; +}