OSSP CVS Repository

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

Check-in Number: 2106
Date: 2002-Apr-25 18:17:57 (local)
2002-Apr-25 16:17:57 (UTC)
User:ms
Branch:
Comment: Begin processor pieces.
Tickets:
Inspections:
Files:
ossp-pkg/rc/Makefile.in      1.25 -> 1.26     2 inserted, 2 deleted
ossp-pkg/rc/rc.c      1.23 -> 1.24     7 inserted, 30 deleted
ossp-pkg/rc/rc.h      1.23 -> 1.24     13 inserted, 1 deleted
ossp-pkg/rc/rc_cliopt.c      1.7 -> 1.8     8 inserted, 7 deleted
ossp-pkg/rc/rc_proc.c      added-> 1.1

ossp-pkg/rc/Makefile.in 1.25 -> 1.26

--- Makefile.in  2002/04/24 16:49:08     1.25
+++ Makefile.in  2002/04/25 16:17:57     1.26
@@ -59,10 +59,10 @@
 TARGET_PROGS    = rc
 TARGET_MANS     = rc.1 rc-sample.5
 
-SRCS            = rc.c rc_config.c rc_cliopt.c \
+SRCS            = rc.c rc_config.c rc_cliopt.c rc_proc.c \
                   rc_version.c rc_pcre.c rc_util.c
 
-OBJS            = rc.o rc_config.o rc_cliopt.o \
+OBJS            = rc.o rc_config.o rc_cliopt.o rc_proc.o \
                   rc_version.o rc_pcre.o rc_util.o
 
 SUBDIRS         = @SUBDIR_EX@ @SUBDIR_POPT@


ossp-pkg/rc/rc.c 1.23 -> 1.24

--- rc.c 2002/04/25 09:51:29     1.23
+++ rc.c 2002/04/25 16:17:57     1.24
@@ -35,29 +35,6 @@
 
 
 /************************************************
-* rcIntro(void)                                 *
-* Introduction to rc: help, usage, or version   *
-************************************************/
-rc_return_t rcIntro(void)
-{
-    ex_t Except;
-
-    ex_try { /* Basic checks of version, usage, and help options */
-        if (configGetval(RC_VER_VAL))
-            fprintf(stdout, "OSSP rc %s\n", RC_VERSION);
-        if (configGetval(RC_USE_VAL))
-            clioptPrintusage();
-        if (configGetval(RC_HLP_VAL))
-            clioptPrintusage(); /* FIXME Replace with real help FIXME */
-    }
-    ex_catch(Except) {
-        rethrow;
-    }
-
-    return(RC_THROW(RC_OK));
-}
-
-/************************************************
 * main(int, char **)                            *
 * Main rc control block                         *
 ************************************************/
@@ -72,15 +49,15 @@
         configDebug();          /* FIXME Remove FIXME */
         configVerify();         /* Test for usage, help, and version options  */
 
-/*        pRc = procNew();
-        procReadrc(pRc);
-        procReadfuncs(pRc);
-        procReadtmp(pRc);
-        for (i = 0; i < clioptGetseclen; procSection(pRc, configGetsec(i)));
+        pRc = procNew();
+        procReadtmp(pRc, configGetval(RC_TMP_VAL));
+/*        procReadfuncs(pRc, configGetval(RC_FNC_VAL));
+        procReadrc(pRc, configGetrcfile());
+        for (i = 0; i < clioptGetseclen; procSection(pRc, configGetsec(i++)));
         procParse(pRc);         /- Script generation               -/
-        procRun(pRc);           /- [Execute|Evaluate|Print] script -/
+        procRun(pRc);*/           /* [Execute|Evaluate|Print] script */
 
-        procDelete(pRc);*/
+        procDelete(pRc);
         configDelete();
     }
     ex_catch(Except) {


ossp-pkg/rc/rc.h 1.23 -> 1.24

--- rc.h 2002/04/25 09:51:29     1.23
+++ rc.h 2002/04/25 16:17:57     1.24
@@ -56,7 +56,9 @@
 } rc_return_t;
 
 /* Rc class */
-typedef void *rc_t;
+typedef struct {
+    int nTmpfile;   /* Temp file descriptor */
+} rc_t;
 
 /* Rc script type */
 typedef char *rc_script_t;
@@ -101,6 +103,16 @@
 rc_return_t clioptSetrcfile(const char *);
 rc_return_t clioptSetsec(const char **);
 
+/* Processor function prototypes */
+rc_t *procNew(void);
+rc_return_t procDelete(rc_t *);
+rc_return_t procReadfuncs(rc_t *, char *);
+rc_return_t procReadtmp(rc_t *, char *);
+rc_return_t procReadrc(rc_t *, char *);
+rc_return_t procSection(rc_t *, char *);
+rc_return_t procParse(rc_t *);
+rc_return_t procRun(rc_t *);
+
     /* Option function prototypes */
     /*FIXME rc_return_t optNew(rc_opt_t **);
     rc_return_t optDelete(rc_opt_t **);*/


ossp-pkg/rc/rc_cliopt.c 1.7 -> 1.8

--- rc_cliopt.c  2002/04/24 16:47:07     1.7
+++ rc_cliopt.c  2002/04/25 16:17:57     1.8
@@ -180,19 +180,20 @@
 
 rc_return_t clioptSetsec(const char *pkszSec[])
 {
-    int i = 0;
+    int nSecs  = 0;
+    int nIndex = 0;
 
     if (m_pszSec)                                    /* Forbid overwriting */
         return(RC_THROW(RC_ERR_USE));                /* an existing rcfile */
     else if (pkszSec) {
-        for (i = 0; pkszSec[i]; i++);                /* Count the sections */
-        m_pszSec = malloc(sizeof (char **) * i + 1); /* Allocate using i   */
+        for (nSecs = 0; pkszSec[nSecs]; nSecs++);    /* Count the sections */
+        m_pszSec = malloc(sizeof (char **) * nSecs + 1);
 
-        for (i = 0; pkszSec[i]; i++) {
-            m_pszSec[i] = malloc(strlen(pkszSec[i]));
-            memcpy(m_pszSec[i], pkszSec[i], strlen(pkszSec[i]));
+        for (nIndex = 0; pkszSec[nIndex]; nIndex++) {
+            m_pszSec[nIndex] = malloc(strlen(pkszSec[nIndex]));
+            memcpy(m_pszSec[nIndex], pkszSec[nIndex], strlen(pkszSec[nIndex]));
         }
-        m_pszSec[i] = NULL; /* Used later for finding the end of array */
+        m_pszSec[nIndex] = NULL; /* Used later to find the end of the array */
     }
     else
         return(RC_THROW(RC_ERR_USE));   /* Incoming sections are NULL? */


ossp-pkg/rc/rc_proc.c -> 1.1

*** /dev/null    Sat Nov 23 01:24:58 2024
--- -    Sat Nov 23 01:25:02 2024
***************
*** 0 ****
--- 1,67 ----
+ /*  OSSP rc - Run-command processor
+ **  Copyright (c) 2002 Ralf S. Engelschall
+ **  Copyright (c) 2002 Cable & Wireless Deutschland GmbH
+ **  Copyright (c) 2002 The OSSP Project <http://www.ossp.org/>
+ **
+ **  This file is part of OSSP rc, a portable Run-command processor
+ **  which can be found at http://www.ossp.org/pkg/lib/rc/
+ **
+ **  Permission to use, copy, modify, and distribute this software for
+ **  any purpose with or without fee is hereby granted, provided that
+ **  the above copyright notice and this permission notice appear in all
+ **  copies.
+ **
+ **  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ **  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ **  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ **  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
+ **  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ **  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ **  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ **  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ **  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ **  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ **  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ **  SUCH DAMAGE.
+ **
+ **  rc_proc.c: Run-command processor ISO C source file
+ */
+ 
+ #include <stdlib.h>
+ 
+ #include "rc.h"         /* Public interfaces            */
+ 
+ 
+ /************************************************
+ * procNew(void)                                 *
+ * Construct a processor                         *
+ ************************************************/
+ rc_t *procNew(void)
+ {
+     rc_t *pNewrc = NULL;
+ 
+     pNewrc = malloc(sizeof(rc_t));
+     return(pNewrc);
+ }
+ 
+ /************************************************
+ * procReadtmp(rc_t *, char *)                   *
+ * Open and store a temp file                    *
+ ************************************************/
+ rc_return_t procReadtmp(rc_t *pRc, char *szTmpname)
+ {
+     fprintf(stderr, "%s!!!\n", szTmpname);
+ 
+     return(RC_THROW(RC_OK));
+ }
+ 
+ /************************************************
+ * procDelete(rc_t *)                            *
+ * Destruct a processor                          *
+ ************************************************/
+ rc_return_t procDelete(rc_t *pRc)
+ {
+     free(pRc);
+ 
+     return(RC_THROW(RC_OK));
+ }

CVSTrac 2.0.1