OSSP CVS Repository

ossp - Difference in ossp-pkg/rc/rc_proc.c versions 1.13 and 1.14
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/rc/rc_proc.c 1.13 -> 1.14

--- rc_proc.c    2002/07/10 19:03:58     1.13
+++ rc_proc.c    2002/07/30 16:36:41     1.14
@@ -189,17 +189,33 @@
 ************************************************/
 rc_return_t procRun(rc_proc_t *pRc)
 {
-    /* This will evaluate, execute, or print the script to stdout */
-    if (configGetval(RC_EVL_VAL))       /* Evaluate */
+    char *pszVec[RC_EXEC_MAXARGS];
+
+    /****************************************************/
+    /* This will execute, evaluate, or print the script */
+    /* Exec  - Fork and execute each command            */
+    /* Eval  - Print machine evaluatable format         */
+    /* Print - Print human readable format              */
+    /****************************************************/
+    if (configGetval(RC_EVL_VAL))        /* Evaluate */
         fprintf(stderr, "Error: Evaluate is not implemented yet.\n"); /* FIX */
-    else if (configGetval(RC_EXC_VAL))  /* Execute  */
-        fprintf(stderr, "Error: Execute is not implemented yet.\n");  /* FIX */
-    else if (configGetval(RC_PRN_VAL))  /* Print    */
+
+    else if (configGetval(RC_EXC_VAL)) { /* Execute  */
+            pszVec[0] = "/bin/sh";
+            pszVec[1] = "-c";
+            pszVec[2] = (char *)scriptTostring(pRc->m_pScript);
+            pszVec[3] = NULL;   /* Add a NULL to mark the end of the chain */
+        if (execvp(*pszVec, pszVec) == -1)  /* launch                   */
+            TRACE("Bad, execvp in child returned -1");
+    }
+
+    else if (configGetval(RC_PRN_VAL))   /* Print    */
         scriptDump(pRc->m_pScript);
-    else                                /* Something is wrong here, there is */
+
+    else                                 /* Something is wrong here */
         fprintf(stderr, "Error: Placeholder, until problem with ex_ is fixed.\n");
 /* FIXME!!: Ralf, following segfaults in ex */
-/*        return(RC_THROW(RC_ERR_INT));*/   /* probably no default in the config */
+/*        return(RC_THROW(RC_ERR_INT));*/
 
     return(RC_THROW(RC_OK));
 }

CVSTrac 2.0.1