blob: 2dcb47fb9bfb9e311fd342a1b0b54f73a5d8e341 (
plain) (
tree)
|
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <Ecore.h>
#include "espik_global.h"
#include "espik_common_handler.h"
#include "espik.h"
#include "espik_error.h"
#include "espik_debug.h"
#define INPUT_LENGHT 200
int kb_get (void* data __UNUSED__, Ecore_Fd_Handler* fd_handler)
{
char kb[INPUT_LENGHT];
int count;
espik_enter();
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);
espik_debug_print ("%s", kb);
}
}
while (count >= INPUT_LENGHT - 2);
if (count == -1)
{
perror ("read");
espik_shutdown();
return (0);
}
if (count == 0)
{
espik_shutdown();
return (0);
}
espik_leave();
return (1);
}
|