diff --git a/eesh/E.h b/eesh/E.h index 6bb208ec..e1d24b04 100644 --- a/eesh/E.h +++ b/eesh/E.h @@ -1,6 +1,6 @@ /* * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors - * Copyright (C) 2004-2008 Kim Woelders + * Copyright (C) 2004-2023 Kim Woelders * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -21,21 +21,11 @@ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +#ifndef EESH_E_H +#define EESH_E_H 1 #include "config.h" #include -#include -#include -#include -#include -#include -#include -#include -#include - -#if HAVE_STRDUP -#define USE_LIBC_STRDUP 1 /* Use libc strdup if present */ -#endif typedef struct { Window win; @@ -58,10 +48,6 @@ void ClientDestroy(Client * c); #define EMALLOC(type, num) (type*)Emalloc((num)*sizeof(type)) #define EREALLOC(type, ptr, num) (type*)Erealloc(ptr, (num)*sizeof(type)) -#if USE_LIBC_STRDUP -#define Estrdup(s) ((s) ? strdup(s) : NULL) -#else -char *Estrdup(const char *s); -#endif - extern Display *disp; + +#endif /* EESH_E_H */ diff --git a/eesh/comms.c b/eesh/comms.c index fccfaa5f..f275c71a 100644 --- a/eesh/comms.c +++ b/eesh/comms.c @@ -1,6 +1,6 @@ /* * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors - * Copyright (C) 2004-2008 Kim Woelders + * Copyright (C) 2004-2023 Kim Woelders * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -21,6 +21,11 @@ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +#include "config.h" +#include +#include +#include +#include #include "E.h" static Window root_win; diff --git a/eesh/main.c b/eesh/main.c index 308468a0..5c7a43ea 100644 --- a/eesh/main.c +++ b/eesh/main.c @@ -21,16 +21,21 @@ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +#include "config.h" +#include +#include +#include +#include +#include #include +#include #include "E.h" Display *disp; static char buf[10240]; static int stdin_state; -static char *display_name; static Client *e; -static Window my_win, comms_win; static void process_line(char *line) @@ -84,6 +89,7 @@ int main(int argc, char **argv) { XEvent ev; + Window my_win, comms_win; Client *me; int i; fd_set fd; @@ -93,7 +99,6 @@ main(int argc, char **argv) const char *space; mode = 0; - display_name = NULL; #ifdef __clang_analyzer__ /* Seems not to understand asm FD_ZERO() */ memset(&fd, 0, sizeof(fd)); @@ -105,31 +110,14 @@ main(int argc, char **argv) if (*s != '-') break; - if (!strcmp(argv[i], "-e")) - { - mode = -1; - } - else if (!strcmp(argv[i], "-ewait")) - { - mode = 1; - } - else if (!strcmp(argv[i], "-display")) - { - if (i != (argc - 1)) - { - display_name = argv[++i]; - display_name = Estrdup(display_name); - } - } - else if ((!strcmp(argv[i], "-h")) || - (!strcmp(argv[i], "-help")) || (!strcmp(argv[i], "--help"))) + if (!strcmp(argv[i], "-h") || + !strcmp(argv[i], "-help") || !strcmp(argv[i], "--help")) { printf ("eesh sends commands to E\n\n" "Examples:\n" - " eesh Command to Send to E then wait for a reply then exit\n" - " eesh -ewait \"Command to Send to E then wait for a reply then exit\"\n" - " eesh -e \"Command to Send to Enlightenment then exit\"\n\n"); + " eesh window_list all : Show window list\n" + " eesh win_op Pager-0 move 10 20 : Move Pager-0 to position 10,20\n\n"); printf("Use eesh by itself to enter the \"interactive mode\"\n" " Ctrl-D will exit interactive mode\n" " Use \"help\" from inside interactive mode for further assistance\n"); @@ -137,9 +125,7 @@ main(int argc, char **argv) } } - /* Open a connection to the diplay nominated by the DISPLAY variable */ - /* Or set with the -display option */ - disp = XOpenDisplay(display_name); + disp = XOpenDisplay(NULL); if (!disp) { fprintf(stderr, "Failed to connect to X server\n"); @@ -239,20 +225,3 @@ main(int argc, char **argv) return 0; } - -#if !USE_LIBC_STRDUP -char * -Estrdup(const char *s) -{ - char *ss; - int sz; - - if (!s) - return NULL; - sz = strlen(s); - ss = EMALLOC(char, sz + 1); - memcpy(ss, s, sz + 1); - - return ss; -} -#endif