OSSP CVS Repository

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

ossp-pkg/rc/rc_sect.c 1.3 -> 1.4

--- rc_sect.c    2003/05/14 16:36:28     1.3
+++ rc_sect.c    2003/05/15 12:49:11     1.4
@@ -52,6 +52,28 @@
 }
 
 /************************************************
+* sectionCopy(rc_section_t *)                   *
+* Opaque copy constructor                       *
+************************************************/
+rc_section_t *sectionCopy(rc_section_t *pOrigsec)
+{
+    rc_section_t *pSec = NULL;
+
+    /* Today is a rain and no coffee day */
+    pSec = (rc_section_t *)malloc(sizeof(rc_section_t));
+    pSec->nPri   = pOrigsec->nPri;
+    pSec->nUid   = pOrigsec->nUid;
+    pSec->szData = malloc(strlen(pOrigsec->szData) * sizeof(char) + 1);
+    strcpy(pSec->szData, pOrigsec->szData);
+    pSec->Bytes  = pOrigsec->Bytes;
+
+    if (!pSec)
+        RC_THROW(RC_ERR_MEM);
+
+    return(pSec);
+}
+
+/************************************************
 * sectionGetXXX(rc_section_t *)                 *
 * Accessor methods                              *
 ************************************************/
@@ -160,6 +182,22 @@
 }
 
 /************************************************
+* sectionDump(rc_section_t *)                   *
+* Print a section to standard out               *
+************************************************/
+rc_return_t sectionDump(rc_section_t *pSec)
+{
+    /* Don't remove this! It encapsulates the script object, */
+    /*                    which might not be a simple string */
+    if (pSec) {
+        fprintf(stdout, "%s", sectionGetdata(pSec));
+        return(RC_THROW(RC_OK));
+    }
+    else
+        return(RC_THROW(RC_ERR_USE));
+}
+
+/************************************************
 * sectionDelete(rc_section_t *)                 *
 * Destruct a section                            *
 ************************************************/

CVSTrac 2.0.1