Index: ossp-pkg/rc/rc.c RCS File: /v/ossp/cvs/ossp-pkg/rc/rc.c,v rcsdiff -q -kk '-r1.11' '-r1.12' -u '/v/ossp/cvs/ossp-pkg/rc/rc.c,v' 2>/dev/null --- rc.c 2002/02/07 15:37:54 1.11 +++ rc.c 2002/02/08 18:36:40 1.12 @@ -31,37 +31,30 @@ #include #include "rc.h" - -#ifdef HAVE_CONFIG_H -#include "rc_config.h" -#endif - -/* Third party headers for libraries linked in */ -#include "ex.h" /* OSSP ex exception library */ +#include "rc_private.h" int main(int argc, char *argv[]) { ex_t Except; int bCaught = 0; + rc_config_t *pConf = NULL; ex_try { - parseopts(argc, argv); + configInit(&pConf); + configFill(pConf, argc, argv); } ex_catch(Except) { - if ((rc_return_t)Except.ex_value != RC_ERR_USE) - fprintf(stderr, "Nonusage exception: %d\n",\ - (rc_return_t)Except.ex_value); bCaught = 1; + fprintf(stderr, "Class '%s' threw exception %s in %s:%s():%d.\n",\ + (char *)Except.ex_class, *(int *)Except.ex_value,\ + Except.ex_file, Except.ex_func, Except.ex_line); + exit(1); /* Failure */ } - if (!bCaught) { - fprintf(stderr, "No exceptions caught.\n"); - exit(0); /* Success */ - } - else - fprintf(stderr, "Class '%s' threw exception %d in %s:%s():%d.\n",\ - (char *)Except.ex_class, *(int *)Except.ex_value,\ - Except.ex_file, Except.ex_func, Except.ex_line); + if (!bCaught) + fprintf(stderr, "main: No exceptions caught.\n"); - exit(1); /* Failure */ + if (pConf) /* If a configuration exists, then burn it */ + configDestruct(pConf); + exit(0); /* Success */ } Index: ossp-pkg/rc/rc.h RCS File: /v/ossp/cvs/ossp-pkg/rc/rc.h,v rcsdiff -q -kk '-r1.9' '-r1.10' -u '/v/ossp/cvs/ossp-pkg/rc/rc.h,v' 2>/dev/null --- rc.h 2002/02/07 12:38:32 1.9 +++ rc.h 2002/02/08 18:36:40 1.10 @@ -43,6 +43,7 @@ #define TRUE (!FALSE) #endif +#include "rc_private.h" /* Unique identifier to use with OSSP ex library */ extern const char ossprc_id[]; @@ -54,12 +55,22 @@ RC_ERR_MEM, /* Memory error */ RC_ERR_SYS, /* System error (see errno) */ RC_ERR_IO, /* Input/output error */ - RC_ERR_FMT, /* Formatting error */ RC_ERR_INT /* Internal error */ } rc_return_t; -/* Function prototypes */ -rc_return_t parseopts(int, char **); +/* Option function prototypes */ +rc_return_t parseOpts(int, char **); +rc_return_t procOpts(char, char *); + +/* Config function prototypes */ +rc_return_t configInit(rc_config_t **); +rc_return_t configFill(rc_config_t *, int, char **); +rc_return_t configDestruct(rc_config_t *); + +/* Util function prototypes */ +char *strErr(rc_return_t); + +/* Other function prototypes */ /*rc_result_t rc_Err (void); rc_result_t rc_Warn (void); Index: ossp-pkg/rc/rc_config.c RCS File: /v/ossp/cvs/ossp-pkg/rc/rc_config.c,v co -q -kk -p'1.1' '/v/ossp/cvs/ossp-pkg/rc/rc_config.c,v' | diff -u /dev/null - -L'ossp-pkg/rc/rc_config.c' 2>/dev/null --- ossp-pkg/rc/rc_config.c +++ - 2024-05-07 19:07:56.571372671 +0200 @@ -0,0 +1,106 @@ +/* rc - OSSP Run-command processor +** Copyright (c) 2002 Cable & Wireless Deutschland GmbH +** Copyright (c) 2002 The OSSP Project +** Copyright (c) 2002 Ralf S. Engelschall +** +** This file is part of OSSP rc, a portable Run-command processor +** which can be found at http://www.ossp.org/pkg/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_config.c: Run-command processor ISO C source file +*/ + +#include +#include +#include + +#include "rc.h" +#include "rc_private.h" +#include "rc_const.h" /* String constants */ +#include "rc_option.h" /* Option operations rely on popt */ +#include "val.h" /* OSSP val library holds config */ + + +/*************************************** +* configInit(rc_config_t) * +* Initialize a configuration * +***************************************/ +rc_return_t configInit(rc_config_t **ppConfig) +{ + ex_t Except; + + *ppConfig = malloc(sizeof(rc_config_t)); + if (!*ppConfig) + return(RC_THROW(RC_ERR_MEM)); + + ex_try { + val_create(&(*ppConfig)->pVal); + } + ex_catch(Except) { + rethrow; + } + + return(RC_THROW(RC_OK)); +} + +/************************************************ +* configFill(rc_config_t, int, char **) * +* Fill a configuration * +************************************************/ +rc_return_t configFill(rc_config_t *pConfig, int argc, char *argv[]) +{ + ex_t Except; + char *pTestopt = NULL; + const char *pFuncpath = "/sfw/etc/rc.func"; + + ex_try { + val_reg(pConfig->pVal, RC_FNC_NAME, VAL_TYPE_PTR, RC_FNC_DESC, NULL); + val_set(pConfig->pVal, RC_FNC_NAME, pFuncpath); + val_get(pConfig->pVal, RC_FNC_NAME, &pTestopt); + fprintf(stderr, "%s\n", pTestopt); + } + ex_catch(Except) { + rethrow; + } + + return(RC_THROW(RC_OK)); +} + +/*************************************** +* configDestruct(rc_config_t) * +* Destruct a configuration * +***************************************/ +rc_return_t configDestruct(rc_config_t *pConfig) +{ + ex_t Except; + + assert(pConfig); + free(pConfig); + + ex_try { + val_destroy(pConfig->pVal); + } + ex_catch(Except) { + rethrow; + return(RC_THROW(RC_ERR_INT)); + } + + return(RC_THROW(RC_OK)); +} Index: ossp-pkg/rc/rc_const.h RCS File: /v/ossp/cvs/ossp-pkg/rc/rc_const.h,v rcsdiff -q -kk '-r1.1' '-r1.2' -u '/v/ossp/cvs/ossp-pkg/rc/rc_const.h,v' 2>/dev/null --- rc_const.h 2002/02/07 12:35:25 1.1 +++ rc_const.h 2002/02/08 18:36:40 1.2 @@ -63,4 +63,44 @@ #define RC_DFL_DESC "Name of the default section in a rcfile." #define RC_ERR_DESC "Name of the error section in a rcfile." +#define RC_USE_NAME "usage" +#define RC_DBG_NAME "debug" +#define RC_VER_NAME "version" +#define RC_EVL_NAME "eval" +#define RC_HLP_NAME "help" +#define RC_INF_NAME "info" +#define RC_LBL_NAME "labels" +#define RC_PRN_NAME "print" +#define RC_SIL_NAME "silent" +#define RC_RAW_NAME "raw" +#define RC_VRB_NAME "verbose" +#define RC_EXC_NAME "exec" + +#define RC_LOC_NAME "locate" +#define RC_CNF_NAME "conf" +#define RC_FNC_NAME "func" +#define RC_QRY_NAME "query" +#define RC_TMP_NAME "tmp" + +#define RC_OWN_NAME "RequireOwner" +#define RC_GRP_NAME "RequireGroup" +#define RC_MSK_NAME "RequireUmask" +#define RC_ASS_NAME "ParseEnvAss" +#define RC_DEF_NAME "ParseSectionDef" +#define RC_REF_NAME "ParseSectionRef" +#define RC_PRM_NAME "ParseSectionParam" +#define RC_TRM_NAME "ParseTerminal" +#define RC_NCF_NAME "NameConfig" +#define RC_CMN_NAME "NameCommon" +#define RC_DFL_NAME "NameDefault" +#define RC_ERR_NAME "NameError" + +#define RC_ERRSTR_OK "Okay" +#define RC_ERRSTR_USE "Usage" +#define RC_ERRSTR_MEM "Memory" +#define RC_ERRSTR_SYS "System" +#define RC_ERRSTR_IO "Input/Output" +#define RC_ERRSTR_INT "Internal" +#define RC_ERRSTR_UNK "Unrecognized" + #endif /* __OSSPRC_CONST_H__ */ Index: ossp-pkg/rc/rc_option.c RCS File: /v/ossp/cvs/ossp-pkg/rc/Attic/rc_option.c,v rcsdiff -q -kk '-r1.1' '-r1.2' -u '/v/ossp/cvs/ossp-pkg/rc/Attic/rc_option.c,v' 2>/dev/null --- rc_option.c 2002/02/07 12:38:32 1.1 +++ rc_option.c 2002/02/08 18:36:40 1.2 @@ -30,84 +30,90 @@ #include #include "rc.h" -#include "rc_option.h" /* Values and other for popt */ -#include "rc_const.h" /* Strings and other constants */ - -#ifdef HAVE_CONFIG_H -#include "rc_config.h" -#endif +#include "rc_private.h" +#include "rc_option.h" /* Option operations rely on popt */ +#include "rc_const.h" /* Strings and other constants */ /* Third party headers for libraries linked in */ -#include "ex.h" /* OSSP ex exception library */ #include "popt.h" /* OSSP popt options library */ -/* Define the ability to throw OSSP ex exceptions */ -#define RC_THROW(rv) \ - ( (rv) != RC_OK && (ex_catching && !ex_shielding) \ - ? (ex_throw(ossprc_id, NULL, (rv)), (rv)) : (rv)) - /* Unique identifier to use with OSSP ex library */ const char ossprc_id[] = "OSSP rc"; -rc_return_t parseopts(int argc, char *argv[]) +/* Loops through available options and fills a configuration if encountered */ +rc_return_t procOpts(char cOpt, char *pcCLI) +{ + int nPos = 0; /* For tracking options */ + + switch (cOpt) { + case 'h': + pcCLI[nPos++] = 'h'; + break; + case 'V': + pcCLI[nPos++] = 'V'; + break; + case 'i': + pcCLI[nPos++] = 'i'; + break; + case 'q': + pcCLI[nPos++] = 'q'; + break; + } + + return(RC_THROW(RC_OK)); +} + +rc_return_t parseOpts(int argc, char *argv[]) { + ex_t Except; + int bCaught = 0; + char pcBuf[BUFSIZ+1]; + int nBufpos = 0; /* For tracking options */ char cOpt = 0; /* For argument parsing */ - int iBufpos = 0; /* For tracking options */ char *szCLIBuf = NULL; char *szFuncfile = NULL; /* Rc.func file name and location */ int nIter = 0; - char pcBuf[BUFSIZ+1]; popt_context optCon; /* Context for parsing options */ struct popt_option optionsTable[] = { /* Long options with short keys but no arguments */ - { "usage", '?', POPT_ARG_NONE, 0, RC_USE_VAL, RC_USE_DESC, NULL }, - { "debug", 'd', POPT_ARG_NONE, 0, RC_DBG_VAL, RC_DBG_DESC, NULL }, - { "version", 'V', POPT_ARG_NONE, 0, RC_VER_VAL, RC_VER_DESC, NULL }, - { "eval", 'e', POPT_ARG_NONE, 0, RC_EVL_VAL, RC_EVL_DESC, NULL }, - { "help", 'h', POPT_ARG_NONE, 0, RC_HLP_VAL, RC_HLP_DESC, NULL }, - { "info", 'i', POPT_ARG_NONE, 0, RC_INF_VAL, RC_INF_DESC, NULL }, - { "labels", 'l', POPT_ARG_NONE, 0, RC_LBL_VAL, RC_LBL_DESC, NULL }, - { "print", 'p', POPT_ARG_NONE, 0, RC_PRN_VAL, RC_PRN_DESC, NULL }, - { "silent", 's', POPT_ARG_NONE, 0, RC_SIL_VAL, RC_SIL_DESC, NULL }, - { "raw", 'r', POPT_ARG_NONE, 0, RC_RAW_VAL, RC_RAW_DESC, NULL }, - { "verbose", 'v', POPT_ARG_NONE, 0, RC_VRB_VAL, RC_VRB_DESC, NULL }, - { "exec", 'x', POPT_ARG_NONE, 0, RC_EXC_VAL, RC_EXC_DESC, NULL }, + { RC_USE_NAME, '?', POPT_ARG_NONE, 0, RC_USE_VAL, RC_USE_DESC, NULL }, + { RC_DBG_NAME, 'd', POPT_ARG_NONE, 0, RC_DBG_VAL, RC_DBG_DESC, NULL }, + { RC_VER_NAME, 'V', POPT_ARG_NONE, 0, RC_VER_VAL, RC_VER_DESC, NULL }, + { RC_EVL_NAME, 'e', POPT_ARG_NONE, 0, RC_EVL_VAL, RC_EVL_DESC, NULL }, + { RC_HLP_NAME, 'h', POPT_ARG_NONE, 0, RC_HLP_VAL, RC_HLP_DESC, NULL }, + { RC_INF_NAME, 'i', POPT_ARG_NONE, 0, RC_INF_VAL, RC_INF_DESC, NULL }, + { RC_LBL_NAME, 'l', POPT_ARG_NONE, 0, RC_LBL_VAL, RC_LBL_DESC, NULL }, + { RC_PRN_NAME, 'p', POPT_ARG_NONE, 0, RC_PRN_VAL, RC_PRN_DESC, NULL }, + { RC_SIL_NAME, 's', POPT_ARG_NONE, 0, RC_SIL_VAL, RC_SIL_DESC, NULL }, + { RC_RAW_NAME, 'r', POPT_ARG_NONE, 0, RC_RAW_VAL, RC_RAW_DESC, NULL }, + { RC_VRB_NAME, 'v', POPT_ARG_NONE, 0, RC_VRB_VAL, RC_VRB_DESC, NULL }, + { RC_EXC_NAME, 'x', POPT_ARG_NONE, 0, RC_EXC_VAL, RC_EXC_DESC, NULL }, /* Single argument long options with short keys */ - { "locate", 'L', POPT_ARG_STRING, 0, RC_LOC_VAL, RC_LOC_DESC, "regx" }, - { "conf", 'c', POPT_ARG_STRING, 0, RC_CNF_VAL, RC_CNF_DESC, "path" }, - { "func", 'f', POPT_ARG_STRING, &szFuncfile,\ - RC_FNC_VAL, RC_FNC_DESC, "path" }, - { "query", 'q', POPT_ARG_STRING, 0, RC_QRY_VAL, RC_QRY_DESC, "varx" }, - { "tmp", 't', POPT_ARG_STRING, 0, RC_TMP_VAL, RC_TMP_DESC, "path" }, + {RC_LOC_NAME, 'L', POPT_ARG_STRING, 0, RC_LOC_VAL, RC_LOC_DESC, "regx"}, + {RC_CNF_NAME, 'c', POPT_ARG_STRING, 0, RC_CNF_VAL, RC_CNF_DESC, "path"}, + + {RC_FNC_NAME, 'f', POPT_ARG_STRING, &szFuncfile,\ + RC_FNC_VAL, RC_FNC_DESC, "path"}, + + {RC_QRY_NAME, 'q', POPT_ARG_STRING, 0, RC_QRY_VAL, RC_QRY_DESC, "varx"}, + {RC_TMP_NAME, 't', POPT_ARG_STRING, 0, RC_TMP_VAL, RC_TMP_DESC, "path"}, /* Single argument long options without short keys */ - { "RequireOwner", 0, POPT_ARG_STRING, 0,\ - RC_OWN_VAL, RC_OWN_DESC, "user" }, - { "RequireGroup", 0, POPT_ARG_STRING, 0,\ - RC_GRP_VAL, RC_GRP_DESC, "group" }, - { "RequireUmask", 0, POPT_ARG_INT, 0,\ - RC_MSK_VAL, RC_MSK_DESC, "umask" }, - { "ParseEnvAss", 0, POPT_ARG_STRING, 0,\ - RC_ASS_VAL, RC_ASS_DESC, "regx" }, - { "ParseSectionDef", 0, POPT_ARG_STRING, 0,\ - RC_DEF_VAL, RC_DEF_DESC, "regx" }, - { "ParseSectionRef", 0, POPT_ARG_STRING, 0,\ - RC_REF_VAL, RC_REF_DESC, "regx" }, - { "ParseSectionParam", 0, POPT_ARG_STRING, 0,\ - RC_PRM_VAL, RC_PRM_DESC, "regx" }, - { "ParseTerminal", 0, POPT_ARG_STRING, 0,\ - RC_TRM_VAL, RC_TRM_DESC, "regx" }, - { "NameConfig", 0, POPT_ARG_STRING, 0,\ - RC_NCF_VAL, RC_NCF_DESC, "name" }, - { "NameCommon", 0, POPT_ARG_STRING, 0,\ - RC_CMN_VAL, RC_CMN_DESC, "name" }, - { "NameDefault", 0, POPT_ARG_STRING, 0,\ - RC_DFL_VAL, RC_DFL_DESC, "name" }, - { "NameError", 0, POPT_ARG_STRING, 0,\ - RC_ERR_VAL, RC_ERR_DESC, "name" }, + { RC_OWN_NAME, 0, POPT_ARG_STRING, 0, RC_OWN_VAL, RC_OWN_DESC, "user" }, + { RC_GRP_NAME, 0, POPT_ARG_STRING, 0, RC_GRP_VAL, RC_GRP_DESC, "group"}, + { RC_MSK_NAME, 0, POPT_ARG_INT, 0, RC_MSK_VAL, RC_MSK_DESC, "umask"}, + { RC_ASS_NAME, 0, POPT_ARG_STRING, 0, RC_ASS_VAL, RC_ASS_DESC, "regx" }, + { RC_DEF_NAME, 0, POPT_ARG_STRING, 0, RC_DEF_VAL, RC_DEF_DESC, "regx" }, + { RC_REF_NAME, 0, POPT_ARG_STRING, 0, RC_REF_VAL, RC_REF_DESC, "regx" }, + { RC_PRM_NAME, 0, POPT_ARG_STRING, 0, RC_PRM_VAL, RC_PRM_DESC, "regx" }, + { RC_TRM_NAME, 0, POPT_ARG_STRING, 0, RC_TRM_VAL, RC_TRM_DESC, "regx" }, + { RC_NCF_NAME, 0, POPT_ARG_STRING, 0, RC_NCF_VAL, RC_NCF_DESC, "name" }, + { RC_CMN_NAME, 0, POPT_ARG_STRING, 0, RC_CMN_VAL, RC_CMN_DESC, "name" }, + { RC_DFL_NAME, 0, POPT_ARG_STRING, 0, RC_DFL_VAL, RC_DFL_DESC, "name" }, + { RC_ERR_NAME, 0, POPT_ARG_STRING, 0, RC_ERR_VAL, RC_ERR_DESC, "name" }, POPT_AUTOHELP { NULL, 0, 0, NULL, 0 } @@ -122,22 +128,21 @@ } /* Now do options processing */ - while ((cOpt = popt_getnextopt(optCon)) >= 0) { - switch (cOpt) { - case 'h': - pcBuf[iBufpos++] = 'h'; - break; - case 'V': - pcBuf[iBufpos++] = 'V'; - break; - case 'i': - pcBuf[iBufpos++] = 'i'; - break; - case 'q': - pcBuf[iBufpos++] = 'q'; - break; - } + while ((cOpt = popt_getnextopt(optCon)) >= 0) + ex_try { + procOpts(cOpt, pcBuf); + } + ex_catch(Except) { + if ((rc_return_t)Except.ex_value != RC_ERR_USE) + fprintf(stderr, "Nonusage exception: %d\n",\ + (rc_return_t)Except.ex_value); + bCaught = 1; + fprintf(stderr, "Class '%s' threw exception %d in %s:%s():%d.\n",\ + (char *)Except.ex_class, *(int *)Except.ex_value,\ + Except.ex_file, Except.ex_func, Except.ex_line); } + if (!bCaught) + fprintf(stderr, "parseOpts: No exceptions caught.\n"); szCLIBuf = (char *)popt_getarg(optCon); if ((szCLIBuf == NULL)) { @@ -156,7 +161,7 @@ /* Print out options, szCLIBuf chosen */ fprintf(stderr, "Options chosen: "); - for (nIter = 0; nIter < iBufpos ; nIter++) + for (nIter = 0; nIter < nBufpos ; nIter++) fprintf(stderr, "-%c ", pcBuf[nIter]); if (szFuncfile) fprintf(stderr, "-f %s ", szFuncfile); Index: ossp-pkg/rc/rc_option.h RCS File: /v/ossp/cvs/ossp-pkg/rc/Attic/rc_option.h,v rcsdiff -q -kk '-r1.1' '-r1.2' -u '/v/ossp/cvs/ossp-pkg/rc/Attic/rc_option.h,v' 2>/dev/null --- rc_option.h 2002/02/07 12:38:32 1.1 +++ rc_option.h 2002/02/08 18:36:40 1.2 @@ -1,3 +1,35 @@ +/* rc - OSSP Run-command processor +** Copyright (c) 2002 Cable & Wireless Deutschland GmbH +** Copyright (c) 2002 The OSSP Project +** Copyright (c) 2002 Ralf S. Engelschall +** +** This file is part of OSSP rc, a portable Run-command processor +** which can be found at http://www.ossp.org/pkg/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_option.h: Run-command processor ISO C public header file +*/ + +#ifndef __OSSPRC_OPTION_H__ +#define __OSSPRC_OPTION_H__ + /* Option values used with popt */ #define RC_USE_VAL 32 #define RC_DBG_VAL 33 @@ -28,3 +60,5 @@ #define RC_CMN_VAL 58 #define RC_DFL_VAL 59 #define RC_ERR_VAL 60 + +#endif /* __OSSPRC_OPTION_H__ */ Index: ossp-pkg/rc/rc_pcre.c RCS File: /v/ossp/cvs/ossp-pkg/rc/rc_pcre.c,v rcsdiff -q -kk '-r1.2' '-r1.3' -u '/v/ossp/cvs/ossp-pkg/rc/rc_pcre.c,v' 2>/dev/null --- rc_pcre.c 2002/02/04 21:46:00 1.2 +++ rc_pcre.c 2002/02/08 18:36:40 1.3 @@ -42,7 +42,7 @@ ----------------------------------------------------------------------------- */ #ifdef HAVE_CONFIG_H -#include "rc_config.h" +#include "ac_config.h" #endif #include Index: ossp-pkg/rc/rc_util.c RCS File: /v/ossp/cvs/ossp-pkg/rc/rc_util.c,v co -q -kk -p'1.1' '/v/ossp/cvs/ossp-pkg/rc/rc_util.c,v' | diff -u /dev/null - -L'ossp-pkg/rc/rc_util.c' 2>/dev/null --- ossp-pkg/rc/rc_util.c +++ - 2024-05-07 19:07:56.620424990 +0200 @@ -0,0 +1,43 @@ +/* rc - OSSP Run-command processor +** Copyright (c) 2002 Cable & Wireless Deutschland GmbH +** Copyright (c) 2002 The OSSP Project +** Copyright (c) 2002 Ralf S. Engelschall +** +** This file is part of OSSP rc, a portable Run-command processor +** which can be found at http://www.ossp.org/pkg/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_util.c: Run-command processor ISO C source file +*/ + +#include "rc.h" /* Error definitions */ +#include "rc_const.h" /* String definitions */ + +/* Translate an error code to a string */ +char *strErr(rc_return_t rv) +{ + if (rv == RC_OK) return RC_ERRSTR_OK; + else if (rv == RC_ERR_USE) return RC_ERRSTR_USE; + else if (rv == RC_ERR_MEM) return RC_ERRSTR_MEM; + else if (rv == RC_ERR_SYS) return RC_ERRSTR_SYS; + else if (rv == RC_ERR_IO) return RC_ERRSTR_IO; + else if (rv == RC_ERR_INT) return RC_ERRSTR_INT; + else return RC_ERRSTR_UNK; +}