discomfitor pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=7cdbe6e029be7fe5db0d12b8af1e17101692943f

commit 7cdbe6e029be7fe5db0d12b8af1e17101692943f
Author: Mike Blumenkrantz <[email protected]>
Date:   Tue Nov 21 12:24:51 2017 -0500

    ecore: reformat ecore_exe_posix.c
---
 src/lib/ecore/ecore_exe_posix.c | 1413 ++++++++++++++++++++-------------------
 1 file changed, 708 insertions(+), 705 deletions(-)

diff --git a/src/lib/ecore/ecore_exe_posix.c b/src/lib/ecore/ecore_exe_posix.c
index 3cbba20f44..bebfce26a1 100644
--- a/src/lib/ecore/ecore_exe_posix.c
+++ b/src/lib/ecore/ecore_exe_posix.c
@@ -49,52 +49,54 @@ struct _ecore_exe_dead_exe
    char *cmd;
 };
 
-static inline void _ecore_exe_exec_it(const char     *exe_cmd,
+static inline void _ecore_exe_exec_it(const char *exe_cmd,
                                       Ecore_Exe_Flags flags);
-static Eina_Bool   _ecore_exe_data_generic_handler(void             *data,
+static Eina_Bool   _ecore_exe_data_generic_handler(void *data,
                                                    Ecore_Fd_Handler 
*fd_handler,
-                                                   Ecore_Exe_Flags   flags);
-static Eina_Bool            _ecore_exe_data_error_handler(void             
*data,
-                                                          Ecore_Fd_Handler 
*fd_handler);
-static Eina_Bool            _ecore_exe_data_read_handler(void             
*data,
-                                                         Ecore_Fd_Handler 
*fd_handler);
-static Eina_Bool            _ecore_exe_data_write_handler(void             
*data,
-                                                          Ecore_Fd_Handler 
*fd_handler);
-static void                 _ecore_exe_flush(Ecore_Exe *obj);
-static Ecore_Exe           *_ecore_exe_is_it_alive(pid_t pid);
-static Eina_Bool            _ecore_exe_make_sure_its_dead(void *data);
-static Eina_Bool            _ecore_exe_make_sure_its_really_dead(void *data);
-static void                 _ecore_exe_dead_attach(Ecore_Exe *obj);
+                                                   Ecore_Exe_Flags flags);
+static Eina_Bool   _ecore_exe_data_error_handler(void *data,
+                                                 Ecore_Fd_Handler *fd_handler);
+static Eina_Bool   _ecore_exe_data_read_handler(void *data,
+                                                Ecore_Fd_Handler *fd_handler);
+static Eina_Bool   _ecore_exe_data_write_handler(void *data,
+                                                 Ecore_Fd_Handler *fd_handler);
+static void        _ecore_exe_flush(Ecore_Exe *obj);
+static Ecore_Exe  *_ecore_exe_is_it_alive(pid_t pid);
+static Eina_Bool   _ecore_exe_make_sure_its_dead(void *data);
+static Eina_Bool   _ecore_exe_make_sure_its_really_dead(void *data);
+static void        _ecore_exe_dead_attach(Ecore_Exe *obj);
 
 static const char *shell = NULL;
 
 /* FIXME: This errno checking stuff should be put elsewhere for everybody to 
use.
  * For now it lives here though, just to make testing easier.
  */
-static int _ecore_exe_check_errno(int         result,
-                                  const char *file,
-                                  int         line);
+static int         _ecore_exe_check_errno(int result,
+                                          const char *file,
+                                          int line);
 
-#define E_IF_NO_ERRNO(result, foo, ok)                                         
                  \
-  while (((ok) = _ecore_exe_check_errno((result) = (foo), __FILE__, __LINE__)) 
== -1) sleep(1);  \
-          if (ok)
+#define E_IF_NO_ERRNO(result, foo, ok)                                         
       \
+  while (((ok) = _ecore_exe_check_errno((result) = (foo), __FILE__, __LINE__)) 
== -1) \
+    sleep(1);                                                                  
       \
+  if (ok)
 
-#define E_NO_ERRNO(result, foo, ok) \
-  while (((ok) = _ecore_exe_check_errno((result) = (foo), __FILE__, __LINE__)) 
== -1) sleep(1)
+#define E_NO_ERRNO(result, foo, ok)                                            
       \
+  while (((ok) = _ecore_exe_check_errno((result) = (foo), __FILE__, __LINE__)) 
== -1) \
+    sleep(1)
 
 #define E_IF_NO_ERRNO_NOLOOP(result, foo, ok) \
   if (((ok) = _ecore_exe_check_errno((result) = (foo), __FILE__, __LINE__)))
 
 static int
-_ecore_exe_check_errno(int         result,
+_ecore_exe_check_errno(int result,
                        const char *file EINA_UNUSED,
-                       int         line EINA_UNUSED)
+                       int line EINA_UNUSED)
 {
    int saved_errno = errno;
 
    if (result == -1)
-   {
-      perror("*** errno reports ");
+     {
+        perror("*** errno reports ");
 /* What is currently supported -
  *
  *   pipe
@@ -150,63 +152,63 @@ _ecore_exe_check_errno(int         result,
  *        // Something failed, cleanup.
  *     }
  */
-      switch (saved_errno)
-      {
-       case EACCES:
-       case EAGAIN:
-       case EINTR:
-         { /* Not now, try later. */
-            ERR("*** Must try again in %s @%u.", file, line);
-            result = -1;
-            break;
-         }
-
-       case EMFILE:
-       case ENFILE:
-       case ENOLCK:
-         { /* Low on resources. */
-            ERR("*** Low on resources in %s @%u.", file,
-                line);
-            result = 0;
-            break;
-         }
-
-       case EIO:
-         { /* I/O error. */
-            ERR("*** I/O error in %s @%u.", file, line);
-            result = 0;
-            break;
-         }
-
-       case EFAULT:
-       case EBADF:
-       case EINVAL:
-       case EROFS:
-       case EISDIR:
-       case EDEADLK:
-       case EPERM:
-       case EBUSY:
-         { /* Programmer fucked up. */
-            ERR("*** NAUGHTY PROGRAMMER!!!\n"
-                "*** SPANK SPANK SPANK!!!\n"
-                "*** Now go fix your code in %s @%u. Tut tut tut!",
-                file, line);
-            result = 0;
-            break;
-         }
-
-       default:
-         { /* Unsupported errno code, please add this one. */
-            ERR("*** NAUGHTY PROGRAMMER!!!\n"
-                "*** SPANK SPANK SPANK!!!\n"
-                "*** Unsupported errno code %d, please add this one.\n"
-                "*** Now go fix your code in %s @%u, from %s @%u. Tut tut 
tut!",
-                saved_errno, __FILE__, __LINE__, file, line);
-            result = 0;
-            break;
-         }
-      }
-   }
+        switch (saved_errno)
+          {
+           case EACCES:
+           case EAGAIN:
+           case EINTR:
+           { /* Not now, try later. */
+             ERR("*** Must try again in %s @%u.", file, line);
+             result = -1;
+             break;
+           }
+
+           case EMFILE:
+           case ENFILE:
+           case ENOLCK:
+           { /* Low on resources. */
+             ERR("*** Low on resources in %s @%u.", file,
+                 line);
+             result = 0;
+             break;
+           }
+
+           case EIO:
+           { /* I/O error. */
+             ERR("*** I/O error in %s @%u.", file, line);
+             result = 0;
+             break;
+           }
+
+           case EFAULT:
+           case EBADF:
+           case EINVAL:
+           case EROFS:
+           case EISDIR:
+           case EDEADLK:
+           case EPERM:
+           case EBUSY:
+           { /* Programmer fucked up. */
+             ERR("*** NAUGHTY PROGRAMMER!!!\n"
+                 "*** SPANK SPANK SPANK!!!\n"
+                 "*** Now go fix your code in %s @%u. Tut tut tut!",
+                 file, line);
+             result = 0;
+             break;
+           }
+
+           default:
+           { /* Unsupported errno code, please add this one. */
+             ERR("*** NAUGHTY PROGRAMMER!!!\n"
+                 "*** SPANK SPANK SPANK!!!\n"
+                 "*** Unsupported errno code %d, please add this one.\n"
+                 "*** Now go fix your code in %s @%u, from %s @%u. Tut tut 
tut!",
+                 saved_errno, __FILE__, __LINE__, file, line);
+             result = 0;
+             break;
+           }
+          }
+     }
    else /* Everything is fine. */
      result = 1;
 
@@ -258,319 +260,319 @@ _impl_ecore_exe_efl_object_finalize(Eo *obj, 
Ecore_Exe_Data *exe)
 
    /*  Create some pipes. */
    if (ok)
-   {
-      E_IF_NO_ERRNO_NOLOOP(result, pipe(statusPipe), ok)
-      {
-      }
-   }
+     {
+        E_IF_NO_ERRNO_NOLOOP(result, pipe(statusPipe), ok)
+        {
+        }
+     }
    if (ok && (flags & ECORE_EXE_PIPE_ERROR))
-   {
-      E_IF_NO_ERRNO_NOLOOP(result, pipe(errorPipe), ok)
-      {
-         exe->child_fd_error = errorPipe[0];
-         exe->child_fd_error_x = errorPipe[1];
-      }
-   }
+     {
+        E_IF_NO_ERRNO_NOLOOP(result, pipe(errorPipe), ok)
+        {
+           exe->child_fd_error = errorPipe[0];
+           exe->child_fd_error_x = errorPipe[1];
+        }
+     }
    if (ok && (flags & ECORE_EXE_PIPE_READ))
-   {
-      E_IF_NO_ERRNO_NOLOOP(result, pipe(readPipe), ok)
-      {
-         exe->child_fd_read = readPipe[0];
-         exe->child_fd_read_x = readPipe[1];
-      }
-   }
+     {
+        E_IF_NO_ERRNO_NOLOOP(result, pipe(readPipe), ok)
+        {
+           exe->child_fd_read = readPipe[0];
+           exe->child_fd_read_x = readPipe[1];
+        }
+     }
    if (ok && (flags & ECORE_EXE_PIPE_WRITE))
-   {
-      E_IF_NO_ERRNO_NOLOOP(result, pipe(writePipe), ok)
-      {
-         exe->child_fd_write = writePipe[1];
-         exe->child_fd_write_x = writePipe[0];
-      }
-   }
+     {
+        E_IF_NO_ERRNO_NOLOOP(result, pipe(writePipe), ok)
+        {
+           exe->child_fd_write = writePipe[1];
+           exe->child_fd_write_x = writePipe[0];
+        }
+     }
    if (ok)
-   {
-      pid_t pid = 0;
-      volatile int vfork_exec_errno = 0;
-
-      /* FIXME: I should double check this.  After a quick look around, this 
is already done, but via a more modern method. */
-      /* signal(SIGPIPE, SIG_IGN);    We only want EPIPE on errors */
-      pid = fork();
-
-      if (pid == -1)
-      {
-         ERR("Failed to fork process");
-         pid = 0;
-      }
-      else if (pid == 0) /* child */
-      {
+     {
+        pid_t pid = 0;
+        volatile int vfork_exec_errno = 0;
+
+        /* FIXME: I should double check this.  After a quick look around, this 
is already done, but via a more modern method. */
+        /* signal(SIGPIPE, SIG_IGN);    We only want EPIPE on errors */
+        pid = fork();
+
+        if (pid == -1)
+          {
+             ERR("Failed to fork process");
+             pid = 0;
+          }
+        else if (pid == 0) /* child */
+          {
 #ifdef HAVE_SYSTEMD
-         unsetenv("NOTIFY_SOCKET");
+             unsetenv("NOTIFY_SOCKET");
 #endif
-         if (run_pri != ECORE_EXE_PRIORITY_INHERIT)
-         {
-#ifdef PRIO_PROCESS            
-            if ((run_pri >= -20) && (run_pri <= 19))
-              setpriority(PRIO_PROCESS, 0, run_pri);
+             if (run_pri != ECORE_EXE_PRIORITY_INHERIT)
+               {
+#ifdef PRIO_PROCESS
+                  if ((run_pri >= -20) && (run_pri <= 19))
+                    setpriority(PRIO_PROCESS, 0, run_pri);
 #else
 #warning "Your OS/libc does not provide PRIO_PROCESS (and possibly 
setpriority())"
 #warning "This is a POSIX-1.2001 standard and it is highly encouraged that you"
 #warning "Have support for this"
 #endif
-         }
-         if (ok && (flags & ECORE_EXE_ISOLATE_IO))
-           {
-              int devnull;
-
-              /* we want to isolatie the stdin/out/err of the process so
-               * it can't share those of the parent, so close and replace with
-               * /dev/null */
-              devnull = open("/dev/null", O_RDONLY);
-              if (devnull >= 0)
-                {
-                   E_NO_ERRNO(result, close(STDIN_FILENO), ok);
-                   E_NO_ERRNO(result, dup2(devnull, STDIN_FILENO), ok);
-                   E_NO_ERRNO(result, close(devnull), ok);
-                }
-
-              devnull = open("/dev/null", O_WRONLY);
-              if (devnull >= 0)
-                {
-                   E_NO_ERRNO(result, close(STDOUT_FILENO), ok);
-                   E_NO_ERRNO(result, dup2(devnull, STDOUT_FILENO), ok);
-                   E_NO_ERRNO(result, close(devnull), ok);
-                }
-
-              devnull = open("/dev/null", O_WRONLY);
-              if (devnull >= 0)
-                {
-                   E_NO_ERRNO(result, close(STDERR_FILENO), ok);
-                   E_NO_ERRNO(result, dup2(devnull, STDERR_FILENO), ok);
-                   E_NO_ERRNO(result, close(devnull), ok);
-                }
-           }
-         else
-           {
-              /* dup2 STDERR, STDIN, and STDOUT.  dup2() allegedly closes the
-               * second pipe if it's open. On the other hand, there was the
-               * Great FD Leak Scare of '06, so let's be paranoid. */
-              if (ok && (flags & ECORE_EXE_PIPE_ERROR))
-                {
-                   E_NO_ERRNO(result, close(STDERR_FILENO), ok);
-                   E_NO_ERRNO(result, dup2(errorPipe[1], STDERR_FILENO), ok);
-                }
-              if (ok && (flags & ECORE_EXE_PIPE_READ))
-                {
-                   E_NO_ERRNO(result, close(STDOUT_FILENO), ok);
-                   E_NO_ERRNO(result, dup2(readPipe[1], STDOUT_FILENO), ok);
-                }
-              if (ok && (flags & ECORE_EXE_PIPE_WRITE))
-                {
-                   E_NO_ERRNO(result, close(STDIN_FILENO), ok);
-                   E_NO_ERRNO(result, dup2(writePipe[0], STDIN_FILENO), ok);
-                }
-           }
+               }
+             if (ok && (flags & ECORE_EXE_ISOLATE_IO))
+               {
+                  int devnull;
 
-         if (ok)
-         {
-            /* Setup the status pipe. */
-             E_NO_ERRNO(result, close(statusPipe[0]), ok);
-             E_IF_NO_ERRNO(result, eina_file_close_on_exec(statusPipe[1], 
EINA_TRUE), ok) /* close on exec shows success */
-             {
-                /* Run the actual command. */
-                 _ecore_exe_exec_it(exe_cmd, flags); /* no return */
-             }
-         }
-
-         /* Something went 'orribly wrong. */
-         vfork_exec_errno = errno;
-
-         /* Close the pipes. */
-         if (flags & ECORE_EXE_PIPE_ERROR)
-           E_NO_ERRNO(result, close(errorPipe[1]), ok);
-         if (flags & ECORE_EXE_PIPE_READ)
-           E_NO_ERRNO(result, close(readPipe[1]), ok);
-         if (flags & ECORE_EXE_PIPE_WRITE)
-           E_NO_ERRNO(result, close(writePipe[0]), ok);
-         E_NO_ERRNO(result, close(statusPipe[1]), ok);
-
-         _exit(-1);
-      }
-      else   /* parent */
-      {
-         /* Close the unused pipes. */
-          E_NO_ERRNO(result, close(statusPipe[1]), ok);
-
-          /* FIXME: after having a good look at the current e fd
-           * handling, investigate fcntl(dataPipe[x], F_SETSIG, ...) */
-          /* FIXME: above F_SETSIG etc. - this is async SIGIO based IO
-           * which is also linux specific so we probably don't want to
-           * do this as long as select() is working fine. the only time
-           * we really want to think of SIGIO async IO is when it all
-           * actually works basically everywhere and we can turn all
-           * IO into DMA async activities (i.e. you do a read() then
-           * the read is complete not on return but when you get a
-           * SIGIO - the read() just starts the transfer and it is
-           * completed in the background by DMA (or whatever mechanism
-           * the kernel choses)) */
-
-          /* Wait for it to start executing. */
-          /* FIXME: this doesn't seem very nice - we sit and block
-           * waiting on a child process... even though it's just
-           * the segment between the fork() and the exec) it just feels
-           * wrong */
-          for (;; )
+                  /* we want to isolatie the stdin/out/err of the process so
+                   * it can't share those of the parent, so close and replace 
with
+                   * /dev/null */
+                  devnull = open("/dev/null", O_RDONLY);
+                  if (devnull >= 0)
+                    {
+                       E_NO_ERRNO(result, close(STDIN_FILENO), ok);
+                       E_NO_ERRNO(result, dup2(devnull, STDIN_FILENO), ok);
+                       E_NO_ERRNO(result, close(devnull), ok);
+                    }
+
+                  devnull = open("/dev/null", O_WRONLY);
+                  if (devnull >= 0)
+                    {
+                       E_NO_ERRNO(result, close(STDOUT_FILENO), ok);
+                       E_NO_ERRNO(result, dup2(devnull, STDOUT_FILENO), ok);
+                       E_NO_ERRNO(result, close(devnull), ok);
+                    }
+
+                  devnull = open("/dev/null", O_WRONLY);
+                  if (devnull >= 0)
+                    {
+                       E_NO_ERRNO(result, close(STDERR_FILENO), ok);
+                       E_NO_ERRNO(result, dup2(devnull, STDERR_FILENO), ok);
+                       E_NO_ERRNO(result, close(devnull), ok);
+                    }
+               }
+             else
+               {
+                  /* dup2 STDERR, STDIN, and STDOUT.  dup2() allegedly closes 
the
+                   * second pipe if it's open. On the other hand, there was the
+                   * Great FD Leak Scare of '06, so let's be paranoid. */
+                  if (ok && (flags & ECORE_EXE_PIPE_ERROR))
+                    {
+                       E_NO_ERRNO(result, close(STDERR_FILENO), ok);
+                       E_NO_ERRNO(result, dup2(errorPipe[1], STDERR_FILENO), 
ok);
+                    }
+                  if (ok && (flags & ECORE_EXE_PIPE_READ))
+                    {
+                       E_NO_ERRNO(result, close(STDOUT_FILENO), ok);
+                       E_NO_ERRNO(result, dup2(readPipe[1], STDOUT_FILENO), 
ok);
+                    }
+                  if (ok && (flags & ECORE_EXE_PIPE_WRITE))
+                    {
+                       E_NO_ERRNO(result, close(STDIN_FILENO), ok);
+                       E_NO_ERRNO(result, dup2(writePipe[0], STDIN_FILENO), 
ok);
+                    }
+               }
+
+             if (ok)
+               {
+                  /* Setup the status pipe. */
+                  E_NO_ERRNO(result, close(statusPipe[0]), ok);
+                  E_IF_NO_ERRNO(result, eina_file_close_on_exec(statusPipe[1], 
EINA_TRUE), ok) /* close on exec shows success */
+                  {
+                     /* Run the actual command. */
+                     _ecore_exe_exec_it(exe_cmd, flags); /* no return */
+                  }
+               }
+
+             /* Something went 'orribly wrong. */
+             vfork_exec_errno = errno;
+
+             /* Close the pipes. */
+             if (flags & ECORE_EXE_PIPE_ERROR)
+               E_NO_ERRNO(result, close(errorPipe[1]), ok);
+             if (flags & ECORE_EXE_PIPE_READ)
+               E_NO_ERRNO(result, close(readPipe[1]), ok);
+             if (flags & ECORE_EXE_PIPE_WRITE)
+               E_NO_ERRNO(result, close(writePipe[0]), ok);
+             E_NO_ERRNO(result, close(statusPipe[1]), ok);
+
+             _exit(-1);
+          }
+        else /* parent */
           {
-             char buf;
-
-             E_NO_ERRNO(result, read(statusPipe[0], &buf, 1), ok);
-             if (result == 0)
-             {
-                if (vfork_exec_errno != 0)
-                {
-                   n = vfork_exec_errno;
-                   ERR("Could not start \"%s\"", exe_cmd);
-                   pid = 0;
-                }
-                break;
-             }
+             /* Close the unused pipes. */
+             E_NO_ERRNO(result, close(statusPipe[1]), ok);
+
+             /* FIXME: after having a good look at the current e fd
+              * handling, investigate fcntl(dataPipe[x], F_SETSIG, ...) */
+             /* FIXME: above F_SETSIG etc. - this is async SIGIO based IO
+              * which is also linux specific so we probably don't want to
+              * do this as long as select() is working fine. the only time
+              * we really want to think of SIGIO async IO is when it all
+              * actually works basically everywhere and we can turn all
+              * IO into DMA async activities (i.e. you do a read() then
+              * the read is complete not on return but when you get a
+              * SIGIO - the read() just starts the transfer and it is
+              * completed in the background by DMA (or whatever mechanism
+              * the kernel choses)) */
+
+             /* Wait for it to start executing. */
+             /* FIXME: this doesn't seem very nice - we sit and block
+              * waiting on a child process... even though it's just
+              * the segment between the fork() and the exec) it just feels
+              * wrong */
+             for (;; )
+               {
+                  char buf;
+
+                  E_NO_ERRNO(result, read(statusPipe[0], &buf, 1), ok);
+                  if (result == 0)
+                    {
+                       if (vfork_exec_errno != 0)
+                         {
+                            n = vfork_exec_errno;
+                            ERR("Could not start \"%s\"", exe_cmd);
+                            pid = 0;
+                         }
+                       break;
+                    }
+               }
+
+             /* Close the status pipe. */
+             E_NO_ERRNO(result, close(statusPipe[0]), ok);
           }
 
-          /* Close the status pipe. */
-          E_NO_ERRNO(result, close(statusPipe[0]), ok);
-      }
-
-      if (pid)
-      {
-         /* Setup the exe structure. */
-          exe->start_bytes = -1;
-          exe->end_bytes = -1;
-          exe->start_lines = -1;
-          exe->end_lines = -1;
-          exe->pid = pid;
-          exe->flags = flags;
-          if (exe->cmd)
+        if (pid)
           {
-             if (flags & ECORE_EXE_PIPE_ERROR) /* Setup the error stuff. */
-             {
-                E_IF_NO_ERRNO(result,
-                              fcntl(exe->child_fd_error, F_SETFL,
-                                    O_NONBLOCK), ok) {
-                }
-                E_IF_NO_ERRNO(result,
-                              eina_file_close_on_exec(exe->child_fd_error, 
EINA_TRUE),
-                              ok) {
-                }
-                E_IF_NO_ERRNO(result,
-                              eina_file_close_on_exec(exe->child_fd_error_x, 
EINA_TRUE),
-                              ok) {
-                }
-                {
-                   exe->error_fd_handler =
-                     ecore_main_fd_handler_add(exe->child_fd_error,
-                                               ECORE_FD_READ,
-                                               _ecore_exe_data_error_handler,
-                                               obj, NULL, NULL);
-                   if (!exe->error_fd_handler)
-                     ok = 0;
-                }
-             }
-             if (ok && (flags & ECORE_EXE_PIPE_READ)) /* Setup the read stuff. 
*/
-             {
-                E_IF_NO_ERRNO(result,
-                              fcntl(exe->child_fd_read, F_SETFL,
-                                    O_NONBLOCK), ok) {
-                }
-                E_IF_NO_ERRNO(result,
-                              eina_file_close_on_exec(exe->child_fd_read, 
EINA_TRUE),
-                              ok) {
-                }
-                E_IF_NO_ERRNO(result,
-                              eina_file_close_on_exec(exe->child_fd_read_x, 
EINA_TRUE),
-                              ok) {
-                }
-                {
-                   exe->read_fd_handler =
-                     ecore_main_fd_handler_add(exe->child_fd_read,
-                                               ECORE_FD_READ,
-                                               _ecore_exe_data_read_handler,
-                                               obj, NULL, NULL);
-                   if (!exe->read_fd_handler)
-                     ok = 0;
-                }
-             }
-             if (ok && (flags & ECORE_EXE_PIPE_WRITE)) /* Setup the write 
stuff. */
-             {
-                E_IF_NO_ERRNO(result,
-                              fcntl(exe->child_fd_write, F_SETFL,
-                                    O_NONBLOCK), ok) {
-                }
-                E_IF_NO_ERRNO(result,
-                              eina_file_close_on_exec(exe->child_fd_write, 
EINA_TRUE),
-                              ok) {
-                }
-                E_IF_NO_ERRNO(result,
-                              eina_file_close_on_exec(exe->child_fd_write_x, 
EINA_TRUE),
-                              ok) {
-                }
-                {
-                   exe->write_fd_handler =
-                     ecore_main_fd_handler_add(exe->child_fd_write,
-                                               ECORE_FD_WRITE,
-                                               _ecore_exe_data_write_handler,
-                                               obj, NULL, NULL);
-                   if (exe->write_fd_handler)
-                     ecore_main_fd_handler_active_set(exe->write_fd_handler, 
0);  /* Nothing to write to start with. */
-                   else
-                     ok = 0;
-                }
-             }
-
-             _ecore_exe_exes = eina_list_append(_ecore_exe_exes, obj);
-             n = 0;
+             /* Setup the exe structure. */
+             exe->start_bytes = -1;
+             exe->end_bytes = -1;
+             exe->start_lines = -1;
+             exe->end_lines = -1;
+             exe->pid = pid;
+             exe->flags = flags;
+             if (exe->cmd)
+               {
+                  if (flags & ECORE_EXE_PIPE_ERROR) /* Setup the error stuff. 
*/
+                    {
+                       E_IF_NO_ERRNO(result,
+                                     fcntl(exe->child_fd_error, F_SETFL,
+                                           O_NONBLOCK), ok) {
+                       }
+                       E_IF_NO_ERRNO(result,
+                                     
eina_file_close_on_exec(exe->child_fd_error, EINA_TRUE),
+                                     ok) {
+                       }
+                       E_IF_NO_ERRNO(result,
+                                     
eina_file_close_on_exec(exe->child_fd_error_x, EINA_TRUE),
+                                     ok) {
+                       }
+                       {
+                          exe->error_fd_handler =
+                            ecore_main_fd_handler_add(exe->child_fd_error,
+                                                      ECORE_FD_READ,
+                                                      
_ecore_exe_data_error_handler,
+                                                      obj, NULL, NULL);
+                          if (!exe->error_fd_handler)
+                            ok = 0;
+                       }
+                    }
+                  if (ok && (flags & ECORE_EXE_PIPE_READ)) /* Setup the read 
stuff. */
+                    {
+                       E_IF_NO_ERRNO(result,
+                                     fcntl(exe->child_fd_read, F_SETFL,
+                                           O_NONBLOCK), ok) {
+                       }
+                       E_IF_NO_ERRNO(result,
+                                     
eina_file_close_on_exec(exe->child_fd_read, EINA_TRUE),
+                                     ok) {
+                       }
+                       E_IF_NO_ERRNO(result,
+                                     
eina_file_close_on_exec(exe->child_fd_read_x, EINA_TRUE),
+                                     ok) {
+                       }
+                       {
+                          exe->read_fd_handler =
+                            ecore_main_fd_handler_add(exe->child_fd_read,
+                                                      ECORE_FD_READ,
+                                                      
_ecore_exe_data_read_handler,
+                                                      obj, NULL, NULL);
+                          if (!exe->read_fd_handler)
+                            ok = 0;
+                       }
+                    }
+                  if (ok && (flags & ECORE_EXE_PIPE_WRITE)) /* Setup the write 
stuff. */
+                    {
+                       E_IF_NO_ERRNO(result,
+                                     fcntl(exe->child_fd_write, F_SETFL,
+                                           O_NONBLOCK), ok) {
+                       }
+                       E_IF_NO_ERRNO(result,
+                                     
eina_file_close_on_exec(exe->child_fd_write, EINA_TRUE),
+                                     ok) {
+                       }
+                       E_IF_NO_ERRNO(result,
+                                     
eina_file_close_on_exec(exe->child_fd_write_x, EINA_TRUE),
+                                     ok) {
+                       }
+                       {
+                          exe->write_fd_handler =
+                            ecore_main_fd_handler_add(exe->child_fd_write,
+                                                      ECORE_FD_WRITE,
+                                                      
_ecore_exe_data_write_handler,
+                                                      obj, NULL, NULL);
+                          if (exe->write_fd_handler)
+                            
ecore_main_fd_handler_active_set(exe->write_fd_handler, 0);  /* Nothing to 
write to start with. */
+                          else
+                            ok = 0;
+                       }
+                    }
+
+                  _ecore_exe_exes = eina_list_append(_ecore_exe_exes, obj);
+                  n = 0;
+               }
+             else
+               ok = 0;
           }
-          else
-            ok = 0;
-      }
-      else
-        ok = 0;
-   }
+        else
+          ok = 0;
+     }
 
    if (!ok) /* Something went wrong, so pull down everything. */
-   {
-      if (exe->pid) ecore_exe_terminate(obj);
-      obj = NULL;
-   }
+     {
+        if (exe->pid) ecore_exe_terminate(obj);
+        obj = NULL;
+     }
    else
-   {
-      Ecore_Exe_Event_Add *e;
+     {
+        Ecore_Exe_Event_Add *e;
 
-      e = _ecore_exe_event_add_new();
-      if (e)
-        {
-           e->exe = obj;
-           /* Send the event. */
-           ecore_event_add(ECORE_EXE_EVENT_ADD, e,
-                           _ecore_exe_event_add_free, NULL);
-        }
-      /* INF("Running as %d for %s.\n", exe->pid, exe->cmd); */
-   }
+        e = _ecore_exe_event_add_new();
+        if (e)
+          {
+             e->exe = obj;
+             /* Send the event. */
+             ecore_event_add(ECORE_EXE_EVENT_ADD, e,
+                             _ecore_exe_event_add_free, NULL);
+          }
+        /* INF("Running as %d for %s.\n", exe->pid, exe->cmd); */
+     }
 
    errno = n;
    return obj;
 }
 
 Eina_Bool
-_impl_ecore_exe_send(Ecore_Exe  *obj EINA_UNUSED,
-               Ecore_Exe_Data *exe,
-               const void *data,
-               int         size)
+_impl_ecore_exe_send(Ecore_Exe *obj EINA_UNUSED,
+                     Ecore_Exe_Data *exe,
+                     const void *data,
+                     int size)
 {
    void *buf;
 
    if (exe->child_fd_write == -1)
      {
         ERR("Ecore_Exe %p created without ECORE_EXE_PIPE_WRITE! "
-              "Cannot send %d bytes from %p", exe, size, data);
+            "Cannot send %d bytes from %p", exe, size, data);
         return EINA_FALSE;
      }
 
@@ -582,18 +584,18 @@ _impl_ecore_exe_send(Ecore_Exe  *obj EINA_UNUSED,
    exe->write_data_size += size;
 
    if (exe->write_fd_handler)
-      ecore_main_fd_handler_active_set(exe->write_fd_handler, ECORE_FD_WRITE);
+     ecore_main_fd_handler_active_set(exe->write_fd_handler, ECORE_FD_WRITE);
 
    return EINA_TRUE;
 }
 
 void
 _impl_ecore_exe_auto_limits_set(Ecore_Exe *obj EINA_UNUSED,
-                          Ecore_Exe_Data *exe,
-                          int        start_bytes,
-                          int        end_bytes,
-                          int        start_lines,
-                          int        end_lines)
+                                Ecore_Exe_Data *exe,
+                                int start_bytes,
+                                int end_bytes,
+                                int start_lines,
+                                int end_lines)
 {
    /* FIXME: sanitize the input. */
    exe->start_bytes = start_bytes;
@@ -642,9 +644,9 @@ _impl_ecore_exe_auto_limits_set(Ecore_Exe *obj EINA_UNUSED,
 }
 
 Ecore_Exe_Event_Data *
-_impl_ecore_exe_event_data_get(Ecore_Exe      *obj,
-                         Ecore_Exe_Data *exe,
-                         Ecore_Exe_Flags flags)
+_impl_ecore_exe_event_data_get(Ecore_Exe *obj,
+                               Ecore_Exe_Data *exe,
+                               Ecore_Exe_Flags flags)
 {
    Ecore_Exe_Event_Data *e = NULL;
    int is_buffered = 0;
@@ -653,130 +655,130 @@ _impl_ecore_exe_event_data_get(Ecore_Exe      *obj,
 
    /* Sort out what sort of event we are. */
    if (flags & ECORE_EXE_PIPE_READ)
-   {
-      flags = ECORE_EXE_PIPE_READ;
-      if (exe->flags & ECORE_EXE_PIPE_READ_LINE_BUFFERED)
-        is_buffered = 1;
-   }
+     {
+        flags = ECORE_EXE_PIPE_READ;
+        if (exe->flags & ECORE_EXE_PIPE_READ_LINE_BUFFERED)
+          is_buffered = 1;
+     }
    else
-   {
-      flags = ECORE_EXE_PIPE_ERROR;
-      if (exe->flags & ECORE_EXE_PIPE_ERROR_LINE_BUFFERED)
-        is_buffered = 1;
-   }
+     {
+        flags = ECORE_EXE_PIPE_ERROR;
+        if (exe->flags & ECORE_EXE_PIPE_ERROR_LINE_BUFFERED)
+          is_buffered = 1;
+     }
 
    /* Get the data. */
    if (flags & ECORE_EXE_PIPE_READ)
-   {
-      inbuf = exe->read_data_buf;
-      inbuf_num = exe->read_data_size;
-      exe->read_data_buf = NULL;
-      exe->read_data_size = 0;
-   }
+     {
+        inbuf = exe->read_data_buf;
+        inbuf_num = exe->read_data_size;
+        exe->read_data_buf = NULL;
+        exe->read_data_size = 0;
+     }
    else
-   {
-      inbuf = exe->error_data_buf;
-      inbuf_num = exe->error_data_size;
-      exe->error_data_buf = NULL;
-      exe->error_data_size = 0;
-   }
+     {
+        inbuf = exe->error_data_buf;
+        inbuf_num = exe->error_data_size;
+        exe->error_data_buf = NULL;
+        exe->error_data_size = 0;
+     }
 
    e = calloc(1, sizeof(Ecore_Exe_Event_Data));
    if (e)
-   {
-      e->exe = obj;
-      e->data = inbuf;
-      e->size = inbuf_num;
-
-      if (is_buffered) /* Deal with line buffering. */
-      {
-         int max = 0;
-         int count = 0;
-         int i;
-         int last = 0;
-         char *c;
-
-         c = (char *)inbuf;
-         for (i = 0; i < inbuf_num; i++) /* Find the lines. */
-         {
-            if (inbuf[i] == '\n')
-            {
-               if (count >= max)
+     {
+        e->exe = obj;
+        e->data = inbuf;
+        e->size = inbuf_num;
+
+        if (is_buffered) /* Deal with line buffering. */
+          {
+             int max = 0;
+             int count = 0;
+             int i;
+             int last = 0;
+             char *c;
+
+             c = (char *)inbuf;
+             for (i = 0; i < inbuf_num; i++) /* Find the lines. */
                {
-                  Ecore_Exe_Event_Data_Line *lines;
-
-                  /* In testing, the lines seem to arrive in batches of 500 to 
1000 lines at most, roughly speaking. */
-                   max += 10; /* FIXME: Maybe keep track of the largest number 
of lines ever sent, and add half that many instead of 10. */
-                   lines = realloc(e->lines, sizeof(Ecore_Exe_Event_Data_Line) 
* (max + 1)); /* Allow room for the NULL termination. */
-                   if (!lines)
-                   {
-                      ERR("Out of memory adding exe data lines to event");
-                      break;
-                   }
-                   e->lines = lines;
+                  if (inbuf[i] == '\n')
+                    {
+                       if (count >= max)
+                         {
+                            Ecore_Exe_Event_Data_Line *lines;
+
+                            /* In testing, the lines seem to arrive in batches 
of 500 to 1000 lines at most, roughly speaking. */
+                            max += 10; /* FIXME: Maybe keep track of the 
largest number of lines ever sent, and add half that many instead of 10. */
+                            lines = realloc(e->lines, 
sizeof(Ecore_Exe_Event_Data_Line) * (max + 1)); /* Allow room for the NULL 
termination. */
+                            if (!lines)
+                              {
+                                 ERR("Out of memory adding exe data lines to 
event");
+                                 break;
+                              }
+                            e->lines = lines;
+                         }
+                       /* raster said to leave the line endings as line 
endings, however -
+                        * This is line buffered mode, we are not dealing with 
binary here, but lines.
+                        * If we are not dealing with binary, we must be 
dealing with ASCII, unicode, or some other text format.
+                        * Thus the user is most likely gonna deal with this 
text as strings.
+                        * Thus the user is most likely gonna pass this data to 
str functions.
+                        * rasters way - the endings are always gonna be '\n';  
onefangs way - they will always be '\0'
+                        * We are handing them the string length as a 
convenience.
+                        * Thus if they really want it in raw format, they can 
e->lines[i].line[e->lines[i].size - 1] = '\n'; easily enough.
+                        * In the default case, we can do this conversion 
quicker than the user can, as we already have the index and pointer.
+                        * Let's make it easy on them to use these as standard 
C strings.
+                        *
+                        * onefang is proud to announce that he has just set a 
new personal record for the
+                        * most over documentation of a simple assignment 
statement.  B-)
+                        */
+                       inbuf[i] = '\0';
+                       e->lines[count].line = c;
+                       e->lines[count].size = i - last;
+                       last = i + 1;
+                       c = (char *)&inbuf[last];
+                       count++;
+                    }
                }
-               /* raster said to leave the line endings as line endings, 
however -
-                * This is line buffered mode, we are not dealing with binary 
here, but lines.
-                * If we are not dealing with binary, we must be dealing with 
ASCII, unicode, or some other text format.
-                * Thus the user is most likely gonna deal with this text as 
strings.
-                * Thus the user is most likely gonna pass this data to str 
functions.
-                * rasters way - the endings are always gonna be '\n';  
onefangs way - they will always be '\0'
-                * We are handing them the string length as a convenience.
-                * Thus if they really want it in raw format, they can 
e->lines[i].line[e->lines[i].size - 1] = '\n'; easily enough.
-                * In the default case, we can do this conversion quicker than 
the user can, as we already have the index and pointer.
-                * Let's make it easy on them to use these as standard C 
strings.
-                *
-                * onefang is proud to announce that he has just set a new 
personal record for the
-                * most over documentation of a simple assignment statement.  
B-)
-                */
-               inbuf[i] = '\0';
-               e->lines[count].line = c;
-               e->lines[count].size = i - last;
-               last = i + 1;
-               c = (char *)&inbuf[last];
-               count++;
-            }
-         }
-         if (i > last) /* Partial line left over, save it for next time. */
-         {
-            if (count != 0) e->size = last;
-            if (flags & ECORE_EXE_PIPE_READ)
-            {
-               exe->read_data_size = i - last;
-               exe->read_data_buf = malloc(exe->read_data_size);
-               if (exe->read_data_buf)
-                 memcpy(exe->read_data_buf, c, exe->read_data_size);
-               else
-                 {
-                    exe->read_data_size = 0;
-                    ERR("Out of memory in allocating exe pipe data");
-                 }
-            }
-            else
-            {
-               exe->error_data_size = i - last;
-               exe->error_data_buf = malloc(exe->error_data_size);
-               if (exe->error_data_buf)
-                 memcpy(exe->error_data_buf, c, exe->error_data_size);
-               else
-                 {
-                    exe->error_data_size = 0;
-                    ERR("Out of memory in allocating exe pipe data");
-                 }
-            }
-         }
-         if (count == 0) /* No lines to send, cancel the event. */
-         {
-            _ecore_exe_event_exe_data_free(NULL, e);
-            e = NULL;
-         }
-         else /* NULL terminate the array, so that people know where the end 
is. */
-         {
-            e->lines[count].line = NULL;
-            e->lines[count].size = 0;
-         }
-      }
-   }
+             if (i > last) /* Partial line left over, save it for next time. */
+               {
+                  if (count != 0) e->size = last;
+                  if (flags & ECORE_EXE_PIPE_READ)
+                    {
+                       exe->read_data_size = i - last;
+                       exe->read_data_buf = malloc(exe->read_data_size);
+                       if (exe->read_data_buf)
+                         memcpy(exe->read_data_buf, c, exe->read_data_size);
+                       else
+                         {
+                            exe->read_data_size = 0;
+                            ERR("Out of memory in allocating exe pipe data");
+                         }
+                    }
+                  else
+                    {
+                       exe->error_data_size = i - last;
+                       exe->error_data_buf = malloc(exe->error_data_size);
+                       if (exe->error_data_buf)
+                         memcpy(exe->error_data_buf, c, exe->error_data_size);
+                       else
+                         {
+                            exe->error_data_size = 0;
+                            ERR("Out of memory in allocating exe pipe data");
+                         }
+                    }
+               }
+             if (count == 0) /* No lines to send, cancel the event. */
+               {
+                  _ecore_exe_event_exe_data_free(NULL, e);
+                  e = NULL;
+               }
+             else /* NULL terminate the array, so that people know where the 
end is. */
+               {
+                  e->lines[count].line = NULL;
+                  e->lines[count].size = 0;
+               }
+          }
+     }
 
    return e;
 }
@@ -794,19 +796,19 @@ _impl_ecore_exe_efl_object_destructor(Eo *obj, 
Ecore_Exe_Data *exe)
      exe->pre_free_cb(data, obj);
 
    if (exe->doomsday_clock)
-   {
-      struct _ecore_exe_dead_exe *dead;
-
-      ecore_timer_del(exe->doomsday_clock);
-      exe->doomsday_clock = NULL;
-      dead = exe->doomsday_clock_dead;
-      if (dead)
-      {
-         IF_FREE(dead->cmd);
-         free(dead);
-         exe->doomsday_clock_dead = NULL;
-      }
-   }
+     {
+        struct _ecore_exe_dead_exe *dead;
+
+        ecore_timer_del(exe->doomsday_clock);
+        exe->doomsday_clock = NULL;
+        dead = exe->doomsday_clock_dead;
+        if (dead)
+          {
+             IF_FREE(dead->cmd);
+             free(dead);
+             exe->doomsday_clock_dead = NULL;
+          }
+     }
    IF_FN_DEL(ecore_main_fd_handler_del, exe->write_fd_handler);
    IF_FN_DEL(ecore_main_fd_handler_del, exe->read_fd_handler);
    IF_FN_DEL(ecore_main_fd_handler_del, exe->error_fd_handler);
@@ -871,13 +873,13 @@ _impl_ecore_exe_kill(Ecore_Exe *obj EINA_UNUSED, 
Ecore_Exe_Data *exe)
    struct _ecore_exe_dead_exe *dead;
    dead = calloc(1, sizeof(struct _ecore_exe_dead_exe));
    if (dead)
-   {
-      dead->pid = exe->pid;
-      dead->cmd = strdup(exe->cmd);
-      IF_FN_DEL(ecore_timer_del, exe->doomsday_clock);
-      exe->doomsday_clock =
-        ecore_timer_add(10.0, _ecore_exe_make_sure_its_really_dead, dead);
-   }
+     {
+        dead->pid = exe->pid;
+        dead->cmd = strdup(exe->cmd);
+        IF_FN_DEL(ecore_timer_del, exe->doomsday_clock);
+        exe->doomsday_clock =
+          ecore_timer_add(10.0, _ecore_exe_make_sure_its_really_dead, dead);
+     }
 
    INF("Sending KILL signal to %s (%d).", exe->cmd, exe->pid);
    kill(exe->pid, SIGKILL);
@@ -885,8 +887,8 @@ _impl_ecore_exe_kill(Ecore_Exe *obj EINA_UNUSED, 
Ecore_Exe_Data *exe)
 
 void
 _impl_ecore_exe_signal(Ecore_Exe *obj EINA_UNUSED,
-                 Ecore_Exe_Data *exe,
-                 int        num)
+                       Ecore_Exe_Data *exe,
+                       int num)
 {
    if (num == 1)
      kill(exe->pid, SIGUSR1);
@@ -1007,7 +1009,7 @@ _ecore_exe_doomsday_clock_get(Ecore_Exe *obj)
 }
 
 void
-_ecore_exe_doomsday_clock_set(Ecore_Exe   *obj,
+_ecore_exe_doomsday_clock_set(Ecore_Exe *obj,
                               Ecore_Timer *dc)
 {
    Ecore_Exe_Data *exe = efl_data_scope_get(obj, MY_CLASS);
@@ -1016,7 +1018,7 @@ _ecore_exe_doomsday_clock_set(Ecore_Exe   *obj,
 }
 
 static inline void
-_ecore_exe_exec_it(const char     *exe_cmd,
+_ecore_exe_exec_it(const char *exe_cmd,
                    Ecore_Exe_Flags flags)
 {
    char use_sh = 1;
@@ -1031,55 +1033,55 @@ _ecore_exe_exec_it(const char     *exe_cmd,
     * If we don't find them, we can call the exe directly.
     */
    if (!strpbrk(exe_cmd, "|&;<>()$`\\\"'*?#"))
-   {
-      char *token;
-      char pre_command = 1;
-      int num_tokens = 0;
-      int len;
-
-      len = strlen(exe_cmd);
-      buf = alloca(len + 1);
-      strcpy(buf, exe_cmd);
-      buf[len] = 0;
-
-      token = strtok(buf, " \t\n\v");
-      while (token)
-      {
-         if (token[0] == '~')
-           break;
-         if (pre_command)
-         {
-            if (token[0] == '[')
-              break;
-            if (strchr(token, '='))
-              break;
-            else
-              pre_command = 0;
-         }
-         num_tokens++;
-         token = strtok(NULL, " \t\n\v");
-      }
-      if ((!token) && (num_tokens))
-      {
-         int i = 0;
-
-         len = strlen(exe_cmd);
-         buf = alloca(len + 1);
-         strcpy(buf, exe_cmd);
-         buf[len] = 0;
-
-         token = strtok(buf, " \t\n\v");
-         use_sh = 0;
-         args = alloca((num_tokens + 1) * sizeof(char *));
-         for (i = 0; i < num_tokens; i++)
-         {
-            if (token)
-              args[i] = token;
-            token = strtok(NULL, " \t\n\v");
-         }
-         args[num_tokens] = NULL;
-      }
-   }
+     {
+        char *token;
+        char pre_command = 1;
+        int num_tokens = 0;
+        int len;
+
+        len = strlen(exe_cmd);
+        buf = alloca(len + 1);
+        strcpy(buf, exe_cmd);
+        buf[len] = 0;
+
+        token = strtok(buf, " \t\n\v");
+        while (token)
+          {
+             if (token[0] == '~')
+               break;
+             if (pre_command)
+               {
+                  if (token[0] == '[')
+                    break;
+                  if (strchr(token, '='))
+                    break;
+                  else
+                    pre_command = 0;
+               }
+             num_tokens++;
+             token = strtok(NULL, " \t\n\v");
+          }
+        if ((!token) && (num_tokens))
+          {
+             int i = 0;
+
+             len = strlen(exe_cmd);
+             buf = alloca(len + 1);
+             strcpy(buf, exe_cmd);
+             buf[len] = 0;
+
+             token = strtok(buf, " \t\n\v");
+             use_sh = 0;
+             args = alloca((num_tokens + 1) * sizeof(char *));
+             for (i = 0; i < num_tokens; i++)
+               {
+                  if (token)
+                    args[i] = token;
+                  token = strtok(NULL, " \t\n\v");
+               }
+             args[num_tokens] = NULL;
+          }
+     }
 
 #ifdef HAVE_PRCTL
    if ((flags & ECORE_EXE_TERM_WITH_PARENT))
@@ -1090,34 +1092,34 @@ _ecore_exe_exec_it(const char     *exe_cmd,
 
    if (!(flags & ECORE_EXE_NOT_LEADER)) setsid();
    if ((flags & ECORE_EXE_USE_SH))
-   {
-      errno = 0;
-      execl("/bin/sh", "/bin/sh", "-c", exe_cmd, (char *)NULL);
-   }
+     {
+        errno = 0;
+        execl("/bin/sh", "/bin/sh", "-c", exe_cmd, (char *)NULL);
+     }
    else if (use_sh) /* We have to use a shell to run this. */
-   {
-      if (!shell) /* Find users preferred shell. */
-      {
+     {
+        if (!shell) /* Find users preferred shell. */
+          {
 #if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
-         if (getuid() == geteuid())
+             if (getuid() == geteuid())
 #endif
-           shell = getenv("SHELL");
-         if (!shell)
-           shell = "/bin/sh";
-      }
-      errno = 0;
-      execl(shell, shell, "-c", exe_cmd, (char *)NULL);
-   }
-   else
-   { /* We can run this directly. */
-      if (!args)
-      {
-         ERR("arg[0] is NULL!");
-         return;
-      }
-      errno = 0;
-      if (args[0]) execvp(args[0], args);
-   }
+             shell = getenv("SHELL");
+             if (!shell)
+               shell = "/bin/sh";
+          }
+        errno = 0;
+        execl(shell, shell, "-c", exe_cmd, (char *)NULL);
+     }
+   else /* We can run this directly. */
+     {
+        if (!args)
+          {
+             ERR("arg[0] is NULL!");
+             return;
+          }
+        errno = 0;
+        if (args[0]) execvp(args[0], args);
+     }
 
    save_errno = errno;
    errno = save_errno;
@@ -1125,9 +1127,9 @@ _ecore_exe_exec_it(const char     *exe_cmd,
 }
 
 static Eina_Bool
-_ecore_exe_data_generic_handler(void             *data,
+_ecore_exe_data_generic_handler(void *data,
                                 Ecore_Fd_Handler *fd_handler,
-                                Ecore_Exe_Flags   flags)
+                                Ecore_Exe_Flags flags)
 {
    Ecore_Exe *obj = data;
    int child_fd;
@@ -1139,139 +1141,139 @@ _ecore_exe_data_generic_handler(void             
*data,
 
    /* Sort out what sort of handler we are. */
    if (flags & ECORE_EXE_PIPE_READ)
-   {
-      flags = ECORE_EXE_PIPE_READ;
-      event_type = ECORE_EXE_EVENT_DATA;
-      eo_event = ECORE_EXE_EVENT_DATA_GET;
-      child_fd = exe->child_fd_read;
-   }
+     {
+        flags = ECORE_EXE_PIPE_READ;
+        event_type = ECORE_EXE_EVENT_DATA;
+        eo_event = ECORE_EXE_EVENT_DATA_GET;
+        child_fd = exe->child_fd_read;
+     }
    else
-   {
-      flags = ECORE_EXE_PIPE_ERROR;
-      event_type = ECORE_EXE_EVENT_ERROR;
-      eo_event = ECORE_EXE_EVENT_DATA_ERROR;
-      child_fd = exe->child_fd_error;
-   }
+     {
+        flags = ECORE_EXE_PIPE_ERROR;
+        event_type = ECORE_EXE_EVENT_ERROR;
+        eo_event = ECORE_EXE_EVENT_DATA_ERROR;
+        child_fd = exe->child_fd_error;
+     }
 
    if ((fd_handler)
        && (ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_READ)))
-   {
-      unsigned char *inbuf, *temp;
-      int inbuf_num;
-
-      /* Get any left over data from last time. */
-      if (flags & ECORE_EXE_PIPE_READ)
-      {
-         inbuf = exe->read_data_buf;
-         inbuf_num = exe->read_data_size;
-         exe->read_data_buf = NULL;
-         exe->read_data_size = 0;
-      }
-      else
-      {
-         inbuf = exe->error_data_buf;
-         inbuf_num = exe->error_data_size;
-         exe->error_data_buf = NULL;
-         exe->error_data_size = 0;
-      }
-
-      for (;; )
-      {
-         int num, lost_exe;
-         char buf[READBUFSIZ];
-
-         lost_exe = 0;
-         errno = 0;
-         if ((num = read(child_fd, buf, READBUFSIZ)) < 1)
-         {
-            /* FIXME: SPEED/SIZE TRADE OFF - add a smaller READBUFSIZE
-             * (currently 64k) to inbuf, use that instead of buf, and
-             * save ourselves a memcpy(). */
-              lost_exe = ((errno == EIO) ||
-                          (errno == EBADF) ||
-                          (errno == EPIPE) ||
-                          (errno == EINVAL) || (errno == ENOSPC));
-              if ((errno != EAGAIN) && (errno != EINTR))
-                perror("_ecore_exe_generic_handler() read problem ");
-         }
-         if (num > 0) /* data got read. */
-         {
-            temp = inbuf;
-            inbuf = realloc(inbuf, inbuf_num + num);
-            if (inbuf)
-              {
-                 memcpy(inbuf + inbuf_num, buf, num);
-                 inbuf_num += num;
-              }
-            else // realloc fails and returns NULL.
-              {
-                 ERR("Out of memory in exe generic data handler");
-                 inbuf = temp;
-              }
-         }
-         else
-         { /* No more data to read. */
-            if (inbuf)
-            {
-               Ecore_Exe_Event_Data *e;
-
-               /* Stash the data away for later. */
-               if (flags & ECORE_EXE_PIPE_READ)
-               {
-                  exe->read_data_buf = inbuf;
-                  exe->read_data_size = inbuf_num;
-               }
-               else
+     {
+        unsigned char *inbuf, *temp;
+        int inbuf_num;
+
+        /* Get any left over data from last time. */
+        if (flags & ECORE_EXE_PIPE_READ)
+          {
+             inbuf = exe->read_data_buf;
+             inbuf_num = exe->read_data_size;
+             exe->read_data_buf = NULL;
+             exe->read_data_size = 0;
+          }
+        else
+          {
+             inbuf = exe->error_data_buf;
+             inbuf_num = exe->error_data_size;
+             exe->error_data_buf = NULL;
+             exe->error_data_size = 0;
+          }
+
+        for (;; )
+          {
+             int num, lost_exe;
+             char buf[READBUFSIZ];
+
+             lost_exe = 0;
+             errno = 0;
+             if ((num = read(child_fd, buf, READBUFSIZ)) < 1)
                {
-                  exe->error_data_buf = inbuf;
-                  exe->error_data_size = inbuf_num;
+                  /* FIXME: SPEED/SIZE TRADE OFF - add a smaller READBUFSIZE
+                   * (currently 64k) to inbuf, use that instead of buf, and
+                   * save ourselves a memcpy(). */
+                  lost_exe = ((errno == EIO) ||
+                              (errno == EBADF) ||
+                              (errno == EPIPE) ||
+                              (errno == EINVAL) || (errno == ENOSPC));
+                  if ((errno != EAGAIN) && (errno != EINTR))
+                    perror("_ecore_exe_generic_handler() read problem ");
                }
-
-               if (!(exe->flags & ECORE_EXE_PIPE_AUTO))
+             if (num > 0) /* data got read. */
                {
-                  e = ecore_exe_event_data_get(obj, flags);
-                  if (e) /* Send the event. */
+                  temp = inbuf;
+                  inbuf = realloc(inbuf, inbuf_num + num);
+                  if (inbuf)
                     {
-                       ecore_event_add(event_type, e,
-                             _ecore_exe_event_exe_data_free,
-                             NULL);
-                       efl_event_callback_call(obj, eo_event, e);
+                       memcpy(inbuf + inbuf_num, buf, num);
+                       inbuf_num += num;
+                    }
+                  else // realloc fails and returns NULL.
+                    {
+                       ERR("Out of memory in exe generic data handler");
+                       inbuf = temp;
                     }
                }
-            }
-            if (lost_exe)
-            {
-               if (flags & ECORE_EXE_PIPE_READ)
-               {
-                  if (exe->read_data_size)
-                    INF("There are %d bytes left unsent from the dead exe %s.",
-                        exe->read_data_size, exe->cmd);
-               }
-               else
+             else /* No more data to read. */
                {
-                  if (exe->error_data_size)
-                    INF("There are %d bytes left unsent from the dead exe %s.",
-                        exe->error_data_size, exe->cmd);
+                  if (inbuf)
+                    {
+                       Ecore_Exe_Event_Data *e;
+
+                       /* Stash the data away for later. */
+                       if (flags & ECORE_EXE_PIPE_READ)
+                         {
+                            exe->read_data_buf = inbuf;
+                            exe->read_data_size = inbuf_num;
+                         }
+                       else
+                         {
+                            exe->error_data_buf = inbuf;
+                            exe->error_data_size = inbuf_num;
+                         }
+
+                       if (!(exe->flags & ECORE_EXE_PIPE_AUTO))
+                         {
+                            e = ecore_exe_event_data_get(obj, flags);
+                            if (e) /* Send the event. */
+                              {
+                                 ecore_event_add(event_type, e,
+                                                 
_ecore_exe_event_exe_data_free,
+                                                 NULL);
+                                 efl_event_callback_call(obj, eo_event, e);
+                              }
+                         }
+                    }
+                  if (lost_exe)
+                    {
+                       if (flags & ECORE_EXE_PIPE_READ)
+                         {
+                            if (exe->read_data_size)
+                              INF("There are %d bytes left unsent from the 
dead exe %s.",
+                                  exe->read_data_size, exe->cmd);
+                         }
+                       else
+                         {
+                            if (exe->error_data_size)
+                              INF("There are %d bytes left unsent from the 
dead exe %s.",
+                                  exe->error_data_size, exe->cmd);
+                         }
+                       /* Thought about this a bit.  If the exe has actually
+                        * died, this won't do any harm as it must have died
+                        * recently and the pid has not had a chance to recycle.
+                        * It is also a paranoid catchall, coz the usual 
ecore_signal
+                        * mechanism should kick in.  But let's give it a good
+                        * kick in the head anyway.
+                        */
+                       ecore_exe_terminate(obj);
+                    }
+                  break;
                }
-               /* Thought about this a bit.  If the exe has actually
-                * died, this won't do any harm as it must have died
-                * recently and the pid has not had a chance to recycle.
-                * It is also a paranoid catchall, coz the usual ecore_signal
-                * mechanism should kick in.  But let's give it a good
-                * kick in the head anyway.
-                */
-               ecore_exe_terminate(obj);
-            }
-            break;
-         }
-      }
-   }
+          }
+     }
 
    return ECORE_CALLBACK_RENEW;
 }
 
 static Eina_Bool
-_ecore_exe_data_error_handler(void             *data,
+_ecore_exe_data_error_handler(void *data,
                               Ecore_Fd_Handler *fd_handler)
 {
    return _ecore_exe_data_generic_handler(data, fd_handler,
@@ -1279,7 +1281,7 @@ _ecore_exe_data_error_handler(void             *data,
 }
 
 static Eina_Bool
-_ecore_exe_data_read_handler(void             *data,
+_ecore_exe_data_read_handler(void *data,
                              Ecore_Fd_Handler *fd_handler)
 {
    return _ecore_exe_data_generic_handler(data, fd_handler,
@@ -1287,7 +1289,7 @@ _ecore_exe_data_read_handler(void             *data,
 }
 
 static Eina_Bool
-_ecore_exe_data_write_handler(void             *data,
+_ecore_exe_data_write_handler(void *data,
                               Ecore_Fd_Handler *fd_handler EINA_UNUSED)
 {
    Ecore_Exe *obj = data;
@@ -1297,7 +1299,7 @@ _ecore_exe_data_write_handler(void             *data,
 
    if ((exe->write_fd_handler) &&
        (ecore_main_fd_handler_active_get
-        (exe->write_fd_handler, ECORE_FD_WRITE)))
+          (exe->write_fd_handler, ECORE_FD_WRITE)))
      _ecore_exe_flush(obj);
 
    /* If we have sent all there is to send, and we need to close the pipe, 
then close it. */
@@ -1375,3 +1377,4 @@ _ecore_exe_dead_attach(Ecore_Exe *obj)
         exe->doomsday_clock_dead = dead;
      }
 }
+

-- 


Reply via email to