OSSP CVS Repository

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

Check-in Number: 3479
Date: 2003-Jun-30 18:14:58 (local)
2003-Jun-30 16:14:58 (UTC)
User:ms
Branch:
Comment: Implement common section handling in print run mode.
Tickets:
Inspections:
Files:
ossp-pkg/rc/rc_proc.c      1.54 -> 1.55     28 inserted, 2 deleted
ossp-pkg/rc/rc_test/rc.samba      1.7 -> 1.8     3 inserted, 0 deleted

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

--- rc_proc.c    2003/06/30 15:58:49     1.54
+++ rc_proc.c    2003/06/30 16:14:58     1.55
@@ -360,8 +360,10 @@
                             ppSectmp[nTmp]->m_szParent), configGetval(RC_CMN_VAL));
                         if (pComsec) { /* If we have a common section to load,  */
                             szTmp = (char *)sectionGetname(pComsec);
-                            nSecverb = (strlen(RC_EXN_TEXT) + strlen(szTmp) * 2 \
-                                + strlen(RC_ECHO_STR) + strlen("\"\"") + 1) * sizeof (char);
+                            nSecverb = (strlen(RC_EXN_TEXT) + strlen(szTmp) + \
+                                strlen (sectionGetparent(pComsec)) + \
+                                strlen(RC_ECHO_STR) + strlen("\"\"") + 1) * \
+                                sizeof (char);
                             realloc(szVerbose, nSecverb);
                             sprintf(szVerbose, RC_EXN_TEXT, szTmp, sectionGetparent(pComsec));
                             nSection = (strlen(szTmp) + 1) * sizeof (char);
@@ -503,6 +505,30 @@
                 }
                 scriptDump(pRc->m_pScriptcnf);  /* Dump the config script */
 
+                /* Examine our list, and try to take the corresponding */
+                /* common section data from it to add to your script   */
+                {
+                    rc_section_t *pComsec = NULL;
+                    pComsec = rcfileGetsec(listGetrcfile(pRc->m_pList, \
+                        ppSectmp[nTmp]->m_szParent), configGetval(RC_CMN_VAL));
+                    if (pComsec) { /* Do we have a common section to load? */
+                        if (configGetval(RC_VRB_VAL)) {
+                            szTmp = (char *)sectionGetname(pComsec);
+                            nBytes = (strlen(RC_EXN_TEXT) + strlen(szTmp) + \
+                                strlen (sectionGetparent(pComsec)) + \
+                                strlen(RC_ECHO_STR) + strlen("\"\"") + 1) * \
+                                sizeof (char);
+                            szVerbose = malloc(nBytes);
+                            sprintf(szVerbose, RC_PRN_TEXT, szTmp, sectionGetparent(pComsec));
+                            strcat(szVerbose, "\n");
+                            fprintf(stderr, "%s", szVerbose);
+                            free(szVerbose);
+                            szVerbose = NULL;
+                        }
+                    sectionDump(pComsec);
+                    }
+                }
+
                 if (configGetval(RC_VRB_VAL)) {
                     /* Conditionally print each section notice in verbal mode */
                     szTmp = (char *)sectionGetname(ppSectmp[nTmp]);


ossp-pkg/rc/rc_test/rc.samba 1.7 -> 1.8

--- rc.samba     2003/06/23 15:46:06     1.7
+++ rc.samba     2003/06/30 16:14:58     1.8
@@ -13,6 +13,9 @@
     id -un
     whois cw.com
 
+%common
+    echo "Hier, der common section von samba ausgeprinted"
+
 %destroy -u sw-n
     id -un
     ldd /usr/lib/libpcap.so

CVSTrac 2.0.1