#include <Ecore.h>
#include <unistd.h>
 
struct context
{
};
 
static void
{
   printf("prepare_cb called.\n");
}
 
{
   struct context *ctxt = data;
   char buf[1024];
   size_t nbytes;
   int fd;
 
     {
        printf("An error has occurred. Stop watching this fd and quit.\n");
        ctxt->handler = NULL;
     }
 
   nbytes = read(fd, buf, sizeof(buf));
   if (nbytes == 0)
     {
        printf("Nothing to read, exiting...\n");
        ctxt->handler = NULL;
     }
   buf[nbytes - 1] = '\0';
 
   printf("Read %zd bytes from input: \"%s\"\n", nbytes - 1, buf);
 
}
 
{
   printf("Timer expired after 5 seconds...\n");
 
}
 
int
main(void)
{
   struct context ctxt = {0};
 
     {
        printf("ERROR: Cannot init Ecore!\n");
        return -1;
     }
 
                                            _fd_handler_cb,
                                            &ctxt, NULL, NULL);
 
   printf("Starting the main loop. Type anything and hit <enter> to "
          "activate the fd_handler callback, or CTRL+d to shutdown.\n");
 
 
   if (ctxt.handler)
 
   if (ctxt.timer)
 
 
   return 0;
}
 
void ecore_main_fd_handler_prepare_callback_set(Ecore_Fd_Handler *fd_handler, Ecore_Fd_Prep_Cb func, const void *data)
Sets the prepare callback with data for a given Ecore_Fd_Handler.
Definition: ecore_main.c:1589
struct _Ecore_Fd_Handler Ecore_Fd_Handler
A handle for Fd handlers.
Definition: Ecore_Common.h:1380
int ecore_main_fd_handler_fd_get(Ecore_Fd_Handler *fd_handler)
Retrieves the file descriptor that the given handler is handling.
Definition: ecore_main.c:1614
Ecore_Fd_Handler * ecore_main_fd_handler_add(int fd, Ecore_Fd_Handler_Flags flags, Ecore_Fd_Cb func, const void *data, Ecore_Fd_Cb buf_func, const void *buf_data)
Adds a callback for activity on the given file descriptor.
Definition: ecore_main.c:1436
Eina_Bool ecore_main_fd_handler_active_get(Ecore_Fd_Handler *fd_handler, Ecore_Fd_Handler_Flags flags)
Gets which flags are active on an FD handler.
Definition: ecore_main.c:1630
void * ecore_main_fd_handler_del(Ecore_Fd_Handler *fd_handler)
Marks an FD handler for deletion.
Definition: ecore_main.c:1467
@ ECORE_FD_READ
Fd Read mask.
Definition: Ecore_Common.h:1388
@ ECORE_FD_ERROR
Fd Error mask.
Definition: Ecore_Common.h:1390
EAPI int ecore_shutdown(void)
Shuts down connections, signal handlers sockets etc.
Definition: ecore.c:366
EAPI int ecore_init(void)
Sets up connections, signal handlers, sockets etc.
Definition: ecore.c:225
#define ECORE_CALLBACK_RENEW
Return value to keep a callback.
Definition: Ecore_Common.h:153
void ecore_main_loop_quit(void)
Quits the main loop once all the events currently on the queue have been processed.
Definition: ecore_main.c:1308
#define ECORE_CALLBACK_CANCEL
Return value to remove a callback.
Definition: Ecore_Common.h:152
void ecore_main_loop_begin(void)
Runs the application main loop.
Definition: ecore_main.c:1298
Ecore_Timer * ecore_timer_add(double in, Ecore_Task_Cb func, const void *data)
Creates a timer to call the given function in the given period of time.
Definition: ecore_timer.c:189
void * ecore_timer_del(Ecore_Timer *timer)
Deletes the specified timer from the timer list.
Definition: ecore_timer.c:238
Eo Ecore_Timer
A handle for timers.
Definition: Ecore_Common.h:3065
unsigned char Eina_Bool
Type to mimic a boolean.
Definition: eina_types.h:527
#define EINA_UNUSED
Used to indicate that a function parameter is purposely unused.
Definition: eina_types.h:339