blob: 2dcb47fb9bfb9e311fd342a1b0b54f73a5d8e341 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
#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);
}
|