From 94b16bcb2059b81b6fd05ab3b62577158d85ed59 Mon Sep 17 00:00:00 2001 From: "Bertrand Jacquin (Beber)" Date: Sun, 30 Apr 2006 04:26:18 +0200 Subject: Rewrite m4 macros to be less bizarre, and make them work in 100 % case. Add a dependance on readline Some code cleanup Some delete of unused code --- src/espik_common_handler.c | 38 +++++++++++--------------------------- 1 file changed, 11 insertions(+), 27 deletions(-) (limited to 'src/espik_common_handler.c') diff --git a/src/espik_common_handler.c b/src/espik_common_handler.c index 479babd..db5780f 100644 --- a/src/espik_common_handler.c +++ b/src/espik_common_handler.c @@ -5,6 +5,8 @@ #include +#include + #include "espik_global.h" #include "espik.h" #include "espik_error.h" @@ -15,11 +17,11 @@ static int count_num_recv = 0; -int server_data (void* data __UNUSED__, int ev_type __UNUSED__, - Ecore_Con_Event_Server_Data* ev) +int server_data (void *data __UNUSED__, int ev_type __UNUSED__, + Ecore_Con_Event_Server_Data *ev) { - unsigned int i; - char* msg; + unsigned int i; + char *msg; msg = strdup((char*)ev->data); //msg = convert_unicode_utf((const wchar_t*)ev->data); @@ -53,37 +55,19 @@ int server_data (void* data __UNUSED__, int ev_type __UNUSED__, return (0); } -int kb_get (void* data __UNUSED__, Ecore_Fd_Handler* fd_handler) +int kb_get (void *data __UNUSED__, Ecore_Fd_Handler *fd_handler __UNUSED__) { - char kb[INPUT_LENGHT]; - int count; + char *kb; - do - { - memset (kb, 0, INPUT_LENGHT); - count = read (ecore_main_fd_handler_fd_get (fd_handler), kb, - INPUT_LENGHT - 2); - - if (count > 1) - { - del_backslash (kb); - printf ("%s", kb); - } - } - while (count >= INPUT_LENGHT - 2); + kb = readline ("> "); - if (count == -1) + if (!kb) { - perror ("read"); espik_shutdown(); return (0); } - if (count == 0) - { - espik_shutdown(); - return (0); - } + printf ("%s\n", kb); return (1); } -- cgit v1.2.3