Enlightenment CVS committal

Author  : onefang
Project : e17
Module  : libs/ecore

Dir     : e17/libs/ecore/src/lib/ecore


Modified Files:
        Ecore.h ecore_exe.c 


Log Message:
When I cloned the pipe read stuff to make pipe error, I didn't realise that
ECORE_FD_ERROR is not the stderr equivilant of ECORE_FD_READ.  I just cloned, 
and changed READ's to ERROR's.

imho ECORE_FD_ERROR is missnamed, and should at least be better documented.
See man select_tut, especially the entry on exceptfds.

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore/Ecore.h,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -3 -r1.46 -r1.47
--- Ecore.h     16 Jan 2006 13:21:52 -0000      1.46
+++ Ecore.h     24 Jan 2006 13:58:18 -0000      1.47
@@ -91,7 +91,7 @@
    ECORE_EXE_PIPE_ERROR = 4, /**< Exe Pipe error mask */
    ECORE_EXE_PIPE_READ_LINE_BUFFERED = 8, /**< Reads are buffered until a 
newline and delivered 1 event per line */
    ECORE_EXE_PIPE_ERROR_LINE_BUFFERED = 16, /**< Errors are buffered until a 
newline and delivered 1 event per line */
-   ECORE_EXE_PIPE_AUTO = 32, /**< FIXME: stdout and stderr are buffered 
automatically */
+   ECORE_EXE_PIPE_AUTO = 32, /**< stdout and stderr are buffered automatically 
*/
    ECORE_EXE_RESPAWN = 64 /**< FIXME: Exe is restarted if it dies */
      };
    typedef enum _Ecore_Exe_Flags Ecore_Exe_Flags;
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore/ecore_exe.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -3 -r1.49 -r1.50
--- ecore_exe.c 20 Jan 2006 15:52:12 -0000      1.49
+++ ecore_exe.c 24 Jan 2006 13:58:18 -0000      1.50
@@ -272,7 +272,7 @@
    if (exe == NULL) return NULL;
    
    if ( (flags & ECORE_EXE_PIPE_AUTO) && (! (flags & ECORE_EXE_PIPE_ERROR)) && 
(! (flags & ECORE_EXE_PIPE_READ)) )
-      flags |= ECORE_EXE_PIPE_READ;   /* We need something to auto pipe. */
+      flags |= ECORE_EXE_PIPE_READ | ECORE_EXE_PIPE_ERROR;   /* We need 
something to auto pipe. */
 
    /*  Create some pipes. */
    if (ok)   E_IF_NO_ERRNO_NOLOOP(result, pipe(statusPipe), ok)
@@ -304,7 +304,7 @@
          else if (pid == 0)   /* child */
             {
                /* dup2 STDERR, STDIN, and STDOUT.  dup2() allegedly closes the 
second pipe if it's open. */
-              if (flags & ECORE_EXE_PIPE_ERROR)           E_NO_ERRNO(result, 
dup2(errorPipe[1], STDERR_FILENO), ok);
+              if (ok && (flags & ECORE_EXE_PIPE_ERROR))   E_NO_ERRNO(result, 
dup2(errorPipe[1], STDERR_FILENO), ok);
                if (ok && (flags & ECORE_EXE_PIPE_READ))    E_NO_ERRNO(result, 
dup2(readPipe[1],  STDOUT_FILENO), ok);
                if (ok && (flags & ECORE_EXE_PIPE_WRITE))   E_NO_ERRNO(result, 
dup2(writePipe[0], STDIN_FILENO),  ok);
 
@@ -377,7 +377,7 @@
                           E_IF_NO_ERRNO(result, fcntl(exe->child_fd_error, 
F_SETFL, O_NONBLOCK), ok)
                              {
                                 exe->error_fd_handler = 
ecore_main_fd_handler_add(exe->child_fd_error,
-                                              ECORE_FD_ERROR, 
_ecore_exe_data_error_handler, exe,
+                                              ECORE_FD_READ, 
_ecore_exe_data_error_handler, exe,
                                               NULL, NULL);
                                 if (exe->error_fd_handler == NULL)
                                   ok = 0;
@@ -558,7 +558,7 @@
  * Gets the auto pipe data for the given process handle
  *
  * @param   exe The given process handle.
- * @param   flags   Is this a ECORE_FD_READ or ECORE_FD_ERROR? 
+ * @param   flags   Is this a ECORE_EXE_PIPE_READ or ECORE_EXE_PIPE_ERROR? 
  * @ingroup Ecore_Exe_Basic_Group
  */
 EAPI Ecore_Exe_Event_Data *
@@ -577,21 +577,21 @@
      }
 
    /* Sort out what sort of event we are. */
-   if (flags & ECORE_FD_READ)
+   if (flags & ECORE_EXE_PIPE_READ)
       {
-         flags = ECORE_FD_READ;
+         flags = ECORE_EXE_PIPE_READ;
          if (exe->flags & ECORE_EXE_PIPE_READ_LINE_BUFFERED)
             is_buffered = 1;
       }
    else
       {
-         flags = ECORE_FD_ERROR;
+         flags = ECORE_EXE_PIPE_ERROR;
          if (exe->flags & ECORE_EXE_PIPE_ERROR_LINE_BUFFERED)
             is_buffered = 1;
       }
 
    /* Get the data. */
-   if (flags & ECORE_FD_READ)
+   if (flags & ECORE_EXE_PIPE_READ)
       {
          inbuf = exe->read_data_buf;
          inbuf_num = exe->read_data_size;
@@ -667,7 +667,7 @@
               if (i > last) /* Partial line left over, save it for next time. 
*/
                  {
                     e->size = last;
-                     if (flags & ECORE_FD_READ)
+                     if (flags & ECORE_EXE_PIPE_READ)
                        {
                           exe->read_data_size = i - last;
                           exe->read_data_buf = malloc(exe->read_data_size);
@@ -1179,7 +1179,7 @@
 }
 
 static int
-_ecore_exe_data_generic_handler(void *data, Ecore_Fd_Handler *fd_handler, 
Ecore_Fd_Handler_Flags flags)
+_ecore_exe_data_generic_handler(void *data, Ecore_Fd_Handler *fd_handler, 
Ecore_Exe_Flags flags)
 {
    Ecore_Exe *exe;
    int child_fd;
@@ -1189,9 +1189,9 @@
    exe = data;
 
    /* Sort out what sort of handler we are. */
-   if (flags & ECORE_FD_READ)
+   if (flags & ECORE_EXE_PIPE_READ)
       {
-         flags = ECORE_FD_READ;
+         flags = ECORE_EXE_PIPE_READ;
         event_type = ECORE_EXE_EVENT_DATA;
         child_fd = exe->child_fd_read;
          if (exe->flags & ECORE_EXE_PIPE_READ_LINE_BUFFERED)
@@ -1199,20 +1199,20 @@
       }
    else
       {
-         flags = ECORE_FD_ERROR;
+         flags = ECORE_EXE_PIPE_ERROR;
         event_type = ECORE_EXE_EVENT_ERROR;
         child_fd = exe->child_fd_error;
          if (exe->flags & ECORE_EXE_PIPE_ERROR_LINE_BUFFERED)
             is_buffered = 1;
       }
 
-   if ((fd_handler) && (ecore_main_fd_handler_active_get(fd_handler, flags)))
+   if ((fd_handler) && (ecore_main_fd_handler_active_get(fd_handler, 
ECORE_FD_READ)))
       {
          unsigned char *inbuf;
         int inbuf_num;
 
          /* Get any left over data from last time. */
-         if (flags & ECORE_FD_READ)
+         if (flags & ECORE_EXE_PIPE_READ)
            {
                inbuf = exe->read_data_buf;
                inbuf_num = exe->read_data_size;
@@ -1257,7 +1257,7 @@
                           Ecore_Exe_Event_Data *e;
 
                            /* Stash the data away for later. */
-                           if (flags & ECORE_FD_READ)
+                           if (flags & ECORE_EXE_PIPE_READ)
                              {
                                  exe->read_data_buf = inbuf;
                                  exe->read_data_size = inbuf_num;
@@ -1278,7 +1278,7 @@
                        }
                     if (lost_exe)
                        {
-                           if (flags & ECORE_FD_READ)
+                           if (flags & ECORE_EXE_PIPE_READ)
                              {
                                  if (exe->read_data_size)
                                     printf("There are %d bytes left unsent 
from the dead exe %s.\n", exe->read_data_size, exe->cmd);
@@ -1308,13 +1308,13 @@
 static int
 _ecore_exe_data_error_handler(void *data, Ecore_Fd_Handler *fd_handler)
 {
-   return _ecore_exe_data_generic_handler(data, fd_handler, ECORE_FD_ERROR);
+   return _ecore_exe_data_generic_handler(data, fd_handler, 
ECORE_EXE_PIPE_ERROR);
 }
 
 static int
 _ecore_exe_data_read_handler(void *data, Ecore_Fd_Handler *fd_handler)
 {
-   return _ecore_exe_data_generic_handler(data, fd_handler, ECORE_FD_READ);
+   return _ecore_exe_data_generic_handler(data, fd_handler, 
ECORE_EXE_PIPE_READ);
 }
 
 static int




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to