OSSP CVS Repository

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

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

--- rc_proc.c    2002/07/05 12:54:56     1.12
+++ rc_proc.c    2002/07/10 19:03:58     1.13
@@ -94,6 +94,9 @@
         }
     }
 
+    /* Stick on the starting shell id line */
+    scriptAppend(pRc->m_pScript, "#! /bin/sh\n", strlen("#! /bin/sh\n"));
+
     /* Read the func file if it was opened successfully */
     /* We unfortunately make the assumption that 0 is an invalid filedesc */
     if (nFdfunc) {
@@ -101,6 +104,7 @@
         while ((nRet = read(nFdfunc, sBuf, RC_READ_BUFSIZE)) > 0) {
             scriptAppend(pRc->m_pScript, sBuf, nRet);
         }
+        scriptAppend(pRc->m_pScript, "\n", sizeof(char));
         if (nRet == -1) /* Handle read errors */
             RC_THROW(RC_ERR_IO);
     }
@@ -129,18 +133,29 @@
             RC_THROW(RC_ERR_IO);
 
         try {
+            /* Append config section if it exists */
+            szSec = scriptSection(pTempscript, configGetval(RC_NCF_VAL));
+            if (szSec) { /* Only operate if the section lookup succeeds */
+                scriptAppend(pRc->m_pScript, szSec, strlen(szSec));
+                scriptAppend(pRc->m_pScript, "\n", sizeof(char));
+                free(szSec);    /* Cleanup */
+                szSec = NULL;   /* Cleanup */
+            }
+
             for (i = 0; pRc->m_pAnal->m_pszSecs[i]; i++) { /* Iterate over */
                 /* Extract a section from the temp script, and append it */
                 szSec = scriptSection(pTempscript, pRc->m_pAnal->m_pszSecs[i]);
 
-                if (szSec) /* Only call append if the section lookup succeeds */
+                if (szSec) { /* Only call if the section lookup succeeds */
                     scriptAppend(pRc->m_pScript, szSec, strlen(szSec));
+                    scriptAppend(pRc->m_pScript, "\n", sizeof(char));
+                }
                 else if (configGetval(RC_DBG_VAL)) /* Only show if debug set */
                     fprintf(stderr, "#Warning: Missing section '%s' in %s!\n",\
                         pRc->m_pAnal->m_pszSecs[i],\
                         pRc->m_pAnal->m_szRcs[nIter]);
 
-                if (szSec) { /* Cleanup section string */
+                if (szSec) { /* Cleanup iterative section string */
                     free(szSec);
                     szSec = NULL;
                 }

CVSTrac 2.0.1