OSSP CVS Repository

ossp - Check-in [3478]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 3478
Date: 2003-Jun-30 17:58:49 (local)
2003-Jun-30 15:58:49 (UTC)
User:ms
Branch:
Comment: Repaired print run mode before adding %common logic.
Tickets:
Inspections:
Files:
ossp-pkg/rc/00TODO      1.49 -> 1.50     2 inserted, 0 deleted
ossp-pkg/rc/rc_proc.c      1.53 -> 1.54     19 inserted, 20 deleted

ossp-pkg/rc/00TODO 1.49 -> 1.50

--- 00TODO       2003/06/26 18:45:14     1.49
+++ 00TODO       2003/06/30 15:58:49     1.50
@@ -26,6 +26,8 @@
     used in selecting files. Location is not properly used. See rc_anal.c.
   when a section is not found, the config is also not executed
   Eval mode is temporarily broken
+  Eval and print mode, when -u given '#u' printed, but not always
+    This is a problem if the following section is printed without '#u'
 
 Document
   Refs, pri, user, group, ci, go only in normal (not special) sections.


ossp-pkg/rc/rc_proc.c 1.53 -> 1.54

--- rc_proc.c    2003/06/30 15:27:38     1.53
+++ rc_proc.c    2003/06/30 15:58:49     1.54
@@ -168,7 +168,6 @@
     char *szExec    = NULL;             /* Used only during exec mode      */
     char *szVerbose = NULL;             /* Used when handling verbose mode */
     char *pszVec[RC_EXEC_MAXARGS];      /* For passing in to execv(3)      */
-    rc_script_t   *pBangscript = NULL;  /* Common script with the shebang  */
     rc_script_t   *pFatscript  = NULL;  /* To build a comprehensive script */
     rc_section_t **ppSectmp    = NULL;  /* Used with priority scheduling   */
     short          nTotalsecs  = vectorCount(configGetsecs()); /* Sections */
@@ -323,8 +322,9 @@
                     size_t nSection = 0;
 
                     /* Allocate space just for string to prepare for verbose */
-                    nSizverb = (strlen(RC_EXN_TEXT) + strlen(RC_DEF_NCF) * 2 \
-                        + strlen(RC_ECHO_STR) + strlen("\"\"") + 1) * sizeof (char);
+                    nSizverb = (strlen(RC_EXN_TEXT) + strlen(RC_DEF_NCF) + \
+                        strlen(sectionGetparent(ppSectmp[nTmp])) + strlen(RC_ECHO_STR) + \
+                        strlen("\"\"") + 1) * sizeof (char);
                     szVerbose = malloc(nSizverb);
                     sprintf(szVerbose, RC_EXN_TEXT, RC_DEF_NCF, sectionGetparent(ppSectmp[nTmp]));
 
@@ -469,10 +469,6 @@
     else if (configGetval(RC_PRN_VAL)) {                        /* Print  */
         /* Allocate a block of section pointers to use as a temporary */
         ppSectmp = calloc(pRc->m_pList->m_nFiles, sizeof(rc_section_t *));
-        pBangscript = scriptNew();
-        scriptnAppend(pBangscript, RC_BANG_STR, strlen(RC_BANG_STR));
-        scriptDump(pBangscript); /* Dump the shebang */
-        scriptDelete(pBangscript);
 
         /* Conditionally output initial notice in verbal mode */
         if (configGetval(RC_VRB_VAL))
@@ -481,17 +477,6 @@
         if (configGetval(RC_VRB_VAL))
             fprintf(stderr, "%s\n", RC_PNF_TEXT);
         scriptDump(pRc->m_pScriptfunc); /* Dump the funcs script */
-        /* Conditionally print config section notice in verbal mode */
-        if (configGetval(RC_VRB_VAL)) {
-            nBytes = (strlen(RC_PRN_TEXT) + strlen(RC_DEF_NCF) * 2 + 2) * sizeof (char);
-            szVerbose = malloc(nBytes);
-            sprintf(szVerbose, RC_PRN_TEXT, RC_DEF_NCF, RC_DEF_NCF);
-            strcat(szVerbose, "\n");
-            fprintf(stderr, szVerbose);
-            free(szVerbose);
-            szVerbose = NULL;
-        }
-        scriptDump(pRc->m_pScriptcnf);  /* Dump the config script */
 
         for (nSecs = 0; nSecs < nTotalsecs; nSecs++) {
             for (nRcs = 0; nRcs < pRc->m_pList->m_nFiles; nRcs++) {
@@ -505,12 +490,26 @@
             }
             qsort((void *)ppSectmp, (size_t)pRc->m_pList->m_nFiles, sizeof(rc_section_t *), priCompare);
             for (nTmp = 0; nTmp < pRc->m_pList->m_nFiles && ppSectmp[nTmp]; nTmp++) {
-                /* Conditionally print each section notice in verbal mode */
                 if (configGetval(RC_VRB_VAL)) {
+                    /* Conditionally print config section notice in verbal mode */
+                    nBytes = (strlen(RC_PRN_TEXT) + strlen(RC_DEF_NCF) + \
+                        strlen(sectionGetparent(ppSectmp[nTmp])) + 2) * sizeof (char);
+                    szVerbose = malloc(nBytes);
+                    sprintf(szVerbose, RC_PRN_TEXT, RC_DEF_NCF, sectionGetparent(ppSectmp[nTmp]));
+                    strcat(szVerbose, "\n");
+                    fprintf(stderr, szVerbose);
+                    free(szVerbose);
+                    szVerbose = NULL;
+                }
+                scriptDump(pRc->m_pScriptcnf);  /* Dump the config script */
+
+                if (configGetval(RC_VRB_VAL)) {
+                    /* Conditionally print each section notice in verbal mode */
                     szTmp = (char *)sectionGetname(ppSectmp[nTmp]);
-                    nBytes = (strlen(RC_PRN_TEXT) + strlen(szTmp) + 1) * sizeof (char);
+                    nBytes = (strlen(RC_PRN_TEXT) + strlen(szTmp) + 2) * sizeof (char);
                     szVerbose = malloc(nBytes);
                     sprintf(szVerbose, RC_PRN_TEXT, szTmp, sectionGetparent(ppSectmp[nTmp]));
+                    strcat(szVerbose, "\n");
                     fprintf(stderr, "%s", szVerbose);
                     free(szVerbose);
                     szVerbose = NULL;

CVSTrac 2.0.1