diff options
author | Carsten Haitzler (Rasterman) <raster@rasterman.com> | 2020-01-16 11:59:12 +0000 |
---|---|---|
committer | Carsten Haitzler (Rasterman) <raster@rasterman.com> | 2020-01-16 11:59:12 +0000 |
commit | 63ae3290fb6b167aa671e195064d3a3523a0dd9b (patch) | |
tree | 4c9074195b214420a36ea9fe5f2620d0df14c578 /src/bin | |
parent | 37620211e5c93fe6b4c26fe7a1f02d143dd9fa60 (diff) | |
download | enlightenment-63ae3290fb6b167aa671e195064d3a3523a0dd9b.tar.gz |
e system - remove test tool as we can't use it anymore
it'll just be a fight between e and a cmdline tool - so no more test
tool needed. this is off the ground.
Diffstat (limited to 'src/bin')
-rw-r--r-- | src/bin/system/e_system_test.c | 147 | ||||
-rw-r--r-- | src/bin/system/meson.build | 6 |
2 files changed, 0 insertions, 153 deletions
diff --git a/src/bin/system/e_system_test.c b/src/bin/system/e_system_test.c deleted file mode 100644 index 2cdd7687a7..0000000000 --- a/src/bin/system/e_system_test.c +++ /dev/null @@ -1,147 +0,0 @@ -#include <stdio.h> -#include <unistd.h> -#include <stdlib.h> -#include <string.h> -#include <Eina.h> -#include <Ecore.h> - -typedef struct -{ - char cmd[24]; - int size; -} Message_Head; - -static Ecore_Exe *exe; - -static Eina_Bool -_cb_exe_del(void *data EINA_UNUSED, int ev_type EINA_UNUSED, void *event EINA_UNUSED) -{ - ecore_main_loop_quit(); - return EINA_TRUE; -} - -static Eina_Binbuf *buf = NULL; - -static Eina_Bool -_message_read(void) -{ - Message_Head *head; - const void *bdata = eina_binbuf_string_get(buf); - const unsigned char *data = bdata; - size_t len = eina_binbuf_length_get(buf); - Eina_Binbuf *buf2; - - if (!data) return EINA_FALSE; - if (len < sizeof(Message_Head)) return EINA_FALSE; - head = (Message_Head *)bdata; - if (len < (sizeof(Message_Head) + head->size)) return EINA_FALSE; - printf("CMD: [%s]", head->cmd); - if (head->size == 0) printf("\n\n"); - else printf(" [%s]\n\n", data + sizeof(Message_Head)); - buf2 = eina_binbuf_new(); - eina_binbuf_append_length(buf2, - data + sizeof(Message_Head) + head->size, - len - (sizeof(Message_Head) + head->size)); - eina_binbuf_free(buf); - buf = buf2; - return EINA_TRUE; -} - -static Eina_Bool -_cb_exe_data(void *data EINA_UNUSED, int ev_type EINA_UNUSED, void *event) -{ - Ecore_Exe_Event_Data *ev = event; - - eina_binbuf_append_length(buf, ev->data, ev->size); - while (_message_read()); - return EINA_TRUE; -} - -static void -_cb_input(void *data EINA_UNUSED, Ecore_Thread *th) -{ - char b[4096], *msg = NULL; - - for (;;) - { - while (fgets(b, sizeof(b) - 1, stdin)) - { - b[sizeof(b) - 1] = 0; - size_t len = strlen(b); - for (len = len - 1; len > 0; len--) - { - if (b[len] == '\n') b[len] = '\0'; - else if (b[len] == '\r') b[len] = '\0'; - else break; - } - msg = strdup(b); - if (msg) ecore_thread_feedback(th, msg); - } - } -} - -static void -_cb_input_message(void *data EINA_UNUSED, Ecore_Thread *th EINA_UNUSED, void *msg_data) -{ - char *msg = msg_data; - char *spc, *params = NULL; - Message_Head head; - - head.size = 0; - spc = strchr(msg, ' '); - if (spc) - { - *spc = '\0'; - params = spc + 1; - head.size = strlen(params) + 1; - } - strcpy(head.cmd, msg); - ecore_exe_send(exe, &head, sizeof(Message_Head)); - if (head.size > 0) ecore_exe_send(exe, params, strlen(params) + 1); -} - -static void -_cb_input_end(void *data EINA_UNUSED, Ecore_Thread *th EINA_UNUSED) -{ -} - -static void -_cb_input_cancel(void *data EINA_UNUSED, Ecore_Thread *th EINA_UNUSED) -{ -} - -int -main(int argc, const char **argv) -{ - const char *backend; - - if (argc < 2) - { - printf("use: %s /usr/local/lib/enlightenment/utils/enlightenment_system\n" - " or the path to the enlightenment_system tool wherever it is\n", - argv[0]); - return -1; - } - backend = argv[1]; - - eina_init(); - ecore_init(); - - buf = eina_binbuf_new(); - ecore_event_handler_add(ECORE_EXE_EVENT_DEL, _cb_exe_del, NULL); - ecore_event_handler_add(ECORE_EXE_EVENT_DATA, _cb_exe_data, NULL); - exe = ecore_exe_pipe_run(backend, - ECORE_EXE_NOT_LEADER | - ECORE_EXE_TERM_WITH_PARENT | - ECORE_EXE_PIPE_READ | - ECORE_EXE_PIPE_WRITE, NULL); - ecore_thread_feedback_run(_cb_input, _cb_input_message, - _cb_input_end, _cb_input_cancel, NULL, EINA_TRUE); - - ecore_main_loop_begin(); - - ecore_shutdown(); - eina_shutdown(); - return 0; -} - diff --git a/src/bin/system/meson.build b/src/bin/system/meson.build index f681e1ace0..d570fa4d6e 100644 --- a/src/bin/system/meson.build +++ b/src/bin/system/meson.build @@ -21,9 +21,3 @@ executable('enlightenment_system', src, install : true ) suid_exes += join_paths(dir_e_utils, 'enlightenment_system') -executable('enlightenment_system_test', [ 'e_system_test.c' ], - include_directories: include_directories('../../..'), - dependencies : [ dep_eina, dep_ecore ], - install_dir : dir_e_utils, - install : true - ) |