diff options
author | Bertrand Jacquin (Beber) <beber.mailing@gmail.com> | 2006-04-30 04:26:18 +0200 |
---|---|---|
committer | beber <beber@meathook.melee> | 2006-04-30 04:26:18 +0200 |
commit | 94b16bcb2059b81b6fd05ab3b62577158d85ed59 (patch) | |
tree | ad30c013423e308c39ad2c2a3817f3edc895d76e /src/espik_common_handler.c | |
parent | indent macros (diff) | |
download | espik-94b16bcb2059b81b6fd05ab3b62577158d85ed59.tar.xz |
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
Diffstat (limited to 'src/espik_common_handler.c')
-rw-r--r-- | src/espik_common_handler.c | 38 |
1 files changed, 11 insertions, 27 deletions
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 <Ecore.h> +#include <readline/readline.h> + #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); } |