Index: ossp-pkg/rc/Makefile.in
RCS File: /v/ossp/cvs/ossp-pkg/rc/Makefile.in,v
rcsdiff -q -kk '-r1.25' '-r1.26' -u '/v/ossp/cvs/ossp-pkg/rc/Makefile.in,v' 2>/dev/null
--- 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@
Index: ossp-pkg/rc/rc.c
RCS File: /v/ossp/cvs/ossp-pkg/rc/rc.c,v
rcsdiff -q -kk '-r1.23' '-r1.24' -u '/v/ossp/cvs/ossp-pkg/rc/rc.c,v' 2>/dev/null
--- 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) {
Index: ossp-pkg/rc/rc.h
RCS File: /v/ossp/cvs/ossp-pkg/rc/rc.h,v
rcsdiff -q -kk '-r1.23' '-r1.24' -u '/v/ossp/cvs/ossp-pkg/rc/rc.h,v' 2>/dev/null
--- 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 **);*/
Index: ossp-pkg/rc/rc_cliopt.c
RCS File: /v/ossp/cvs/ossp-pkg/rc/rc_cliopt.c,v
rcsdiff -q -kk '-r1.7' '-r1.8' -u '/v/ossp/cvs/ossp-pkg/rc/rc_cliopt.c,v' 2>/dev/null
--- 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? */
Index: ossp-pkg/rc/rc_proc.c
RCS File: /v/ossp/cvs/ossp-pkg/rc/rc_proc.c,v
co -q -kk -p'1.1' '/v/ossp/cvs/ossp-pkg/rc/rc_proc.c,v' | diff -u /dev/null - -L'ossp-pkg/rc/rc_proc.c' 2>/dev/null
--- ossp-pkg/rc/rc_proc.c
+++ - 2025-05-20 13:32:34.672886230 +0200
@@ -0,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
+**
+** 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
+
+#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));
+}