aboutsummaryrefslogblamecommitdiff
path: root/src/espik_common_handler.c
blob: b5b2432bafd371fb5a0418c4fae1e21df6bf469f (plain) (tree)
1
2
3
4
5
6
7
8
9
10







                      

                  
                         
                                 
                  
                        
                        
 
                                                                    
 
                   
                      
                      
 
                          



                                    

                                                                            



                                           
 
                                                     






                                
                      
                   
 
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

#include <Ecore.h>
#include <Ecore_Con.h>

#include <wchar.h>

#include "espik_global.h"
#include "espik_common_handler.h"
#include "espik.h"
#include "espik_error.h"
#include "espik_debug.h"

int	kb_get (void* data __UNUSED__, Ecore_Fd_Handler* fd_handler)
{
	char*	kb;
	int	count;
	espik_enter();

	kb = malloc (200);

	do
	{
		memset (kb, 0, 200);
		count = read (ecore_main_fd_handler_fd_get (fd_handler), kb,
			      198);

		if (count > 1)
		{
			del_backslash (kb);

			espik_debug_print ("%s", kb);
		}
	}
	while (count >= 198);

	if (count == -1)
		perror ("read");

	espik_leave();
	return (1);
}