Index: ossp-pkg/rc/rc.c RCS File: /v/ossp/cvs/ossp-pkg/rc/rc.c,v rcsdiff -q -kk '-r1.20' '-r1.21' -u '/v/ossp/cvs/ossp-pkg/rc/rc.c,v' 2>/dev/null --- rc.c 2002/04/22 12:16:39 1.20 +++ rc.c 2002/04/22 15:22:39 1.21 @@ -34,10 +34,6 @@ #include "rc_const.h" #include "rc_private.h" -/* FIXME BEGIN DEBUG */ -#include "rc_config.h" -#include -/* FIXME END DEBUG */ int main(int argc, char *argv[]) { @@ -64,29 +60,8 @@ exit(1); /* Failure */ } -/* FIXME BEGIN DEBUG */ -{ -int i = 0; -int bCaught = FALSE; -while (!bCaught) { - ex_try { - if (configGetval(i)) { - fprintf(stderr, "D Option %s: ", configGetname(i)); - if (!(strcmp(configGetval(i), "1"))) - fprintf(stderr, "on\n"); - else - fprintf(stderr, "%s\n", configGetval(i)); - } - } - ex_catch(Except) { /* Breaks the otherwise endless while loop above */ - bCaught = TRUE; - } - i++; -} -} -/* FIXME END DEBUG */ - -configDestruct();/* FIXME Remove, allow first scope */ +fprintf(stderr, configSummarize()); +configDestruct(); /* FIXME Remove, allow first scope */ TRACE("No exceptions caught\n"); exit(0); /* Success */ } Index: ossp-pkg/rc/rc.h RCS File: /v/ossp/cvs/ossp-pkg/rc/rc.h,v rcsdiff -q -kk '-r1.19' '-r1.20' -u '/v/ossp/cvs/ossp-pkg/rc/rc.h,v' 2>/dev/null --- rc.h 2002/04/22 12:16:39 1.19 +++ rc.h 2002/04/22 15:22:39 1.20 @@ -68,6 +68,7 @@ /* Config accessor prototypes */ const char *configGetval(rc_opt_t); const char *configGetname(rc_opt_t); +const char *configSummarize(void); /* Command line function prototypes */ rc_return_t clioptConstruct(void); @@ -81,7 +82,6 @@ /* Command line accessor prototypes */ const char *clioptGetval(rc_opt_t); -const char *clioptSummarize(void); /* Option function prototypes */ /*FIXME rc_return_t optConstruct(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.4' '-r1.5' -u '/v/ossp/cvs/ossp-pkg/rc/rc_cliopt.c,v' 2>/dev/null --- rc_cliopt.c 2002/04/22 12:16:39 1.4 +++ rc_cliopt.c 2002/04/22 15:22:39 1.5 @@ -74,15 +74,6 @@ } /*************************************** -* clioptSummarize(void) * -* Command line option summary * -***************************************/ -const char *clioptSummarize(void) -{ - return (NULL); -} - -/*************************************** * clioptProcess(int) * * Switch through available options * * processing the corresponding option * @@ -93,95 +84,68 @@ switch (cliOption) { /* Begin concrete (digital) options */ case RC_USE_VAL: - m_szOptuples[cliOption] = strdup("1"); /* Usage */ - break; + m_szOptuples[cliOption] = strdup("1"); break; /* Usage */ case RC_DBG_VAL: - m_szOptuples[cliOption] = strdup("1"); /* Debug */ - break; + m_szOptuples[cliOption] = strdup("1"); break; /* Debug */ case RC_VER_VAL: - m_szOptuples[cliOption] = strdup("1"); /* Version */ - break; - case RC_EVL_VAL: - m_szOptuples[cliOption] = strdup("1"); /* Eval */ - break; - case RC_HLP_VAL: - m_szOptuples[cliOption] = strdup("1"); /* Help */ - break; - case RC_INF_VAL: - m_szOptuples[cliOption] = strdup("1"); /* Info */ - break; - case RC_LBL_VAL: - m_szOptuples[cliOption] = strdup("1"); /* Label */ - break; - case RC_PRN_VAL: - m_szOptuples[cliOption] = strdup("1"); /* Print */ - break; - case RC_SIL_VAL: - m_szOptuples[cliOption] = strdup("1"); /* Silent */ - break; - case RC_RAW_VAL: - m_szOptuples[cliOption] = strdup("1"); /* Raw */ - break; - case RC_VRB_VAL: - m_szOptuples[cliOption] = strdup("1"); /* Verbose */ - break; - case RC_EXC_VAL: - m_szOptuples[cliOption] = strdup("1"); /* Exec */ - break; + m_szOptuples[cliOption] = strdup("1"); break; /* Version */ + case RC_EVL_VAL: + m_szOptuples[cliOption] = strdup("1"); break; /* Eval */ + case RC_HLP_VAL: + m_szOptuples[cliOption] = strdup("1"); break; /* Help */ + case RC_INF_VAL: + m_szOptuples[cliOption] = strdup("1"); break; /* Info */ + case RC_LBL_VAL: + m_szOptuples[cliOption] = strdup("1"); break; /* Label */ + case RC_PRN_VAL: + m_szOptuples[cliOption] = strdup("1"); break; /* Print */ + case RC_SIL_VAL: + m_szOptuples[cliOption] = strdup("1"); break; /* Silent */ + case RC_RAW_VAL: + m_szOptuples[cliOption] = strdup("1"); break; /* Raw */ + case RC_VRB_VAL: + m_szOptuples[cliOption] = strdup("1"); break; /* Verbose */ + case RC_EXC_VAL: + m_szOptuples[cliOption] = strdup("1"); break; /* Exec */ + /* Begin abstract (nondigital) options */ case RC_LOC_VAL: - m_szOptuples[cliOption] = strdup(szArg); /* Locations */ - break; + m_szOptuples[cliOption] = strdup(szArg); break; /* Locations */ case RC_CNF_VAL: - m_szOptuples[cliOption] = strdup(szArg); /* Conf file */ - break; + m_szOptuples[cliOption] = strdup(szArg); break; /* Conf file */ case RC_FNC_VAL: - m_szOptuples[cliOption] = strdup(szArg); /* Func file */ - break; + m_szOptuples[cliOption] = strdup(szArg); break; /* Func file */ case RC_QRY_VAL: - m_szOptuples[cliOption] = strdup(szArg); /* Format */ - break; + m_szOptuples[cliOption] = strdup(szArg); break; /* Format */ case RC_TMP_VAL: - m_szOptuples[cliOption] = strdup(szArg); /* Temp dir */ - break; + m_szOptuples[cliOption] = strdup(szArg); break; /* Temp dir */ case RC_OWN_VAL: - m_szOptuples[cliOption] = strdup(szArg); /* User name */ - break; + m_szOptuples[cliOption] = strdup(szArg); break; /* User name */ case RC_GRP_VAL: - m_szOptuples[cliOption] = strdup(szArg); /* Group name */ - break; + m_szOptuples[cliOption] = strdup(szArg); break; /* Group name */ case RC_MSK_VAL: - m_szOptuples[cliOption] = strdup(szArg); /* Umask */ - break; + m_szOptuples[cliOption] = strdup(szArg); break; /* Umask */ + case RC_ASS_VAL: - m_szOptuples[cliOption] = strdup(szArg); /* Assign regex */ - break; + m_szOptuples[cliOption] = strdup(szArg); break; /* Assignregex */ case RC_DEF_VAL: - m_szOptuples[cliOption] = strdup(szArg); /* Label regex */ - break; + m_szOptuples[cliOption] = strdup(szArg); break; /* Labelregex */ case RC_REF_VAL: - m_szOptuples[cliOption] = strdup(szArg); /* Ref regex */ - break; + m_szOptuples[cliOption] = strdup(szArg); break; /* Refregex */ case RC_PRM_VAL: - m_szOptuples[cliOption] = strdup(szArg); /* Params regex */ - break; + m_szOptuples[cliOption] = strdup(szArg); break; /* Paramregex */ case RC_TRM_VAL: - m_szOptuples[cliOption] = strdup(szArg); /* Terminal regex */ - break; + m_szOptuples[cliOption] = strdup(szArg); break; /* Termregex */ + case RC_NCF_VAL: - m_szOptuples[cliOption] = strdup(szArg); /* Config name */ - break; + m_szOptuples[cliOption] = strdup(szArg); break; /* Configname */ case RC_CMN_VAL: - m_szOptuples[cliOption] = strdup(szArg); /* Common name */ - break; + m_szOptuples[cliOption] = strdup(szArg); break; /* Commonname */ case RC_DFL_VAL: - m_szOptuples[cliOption] = strdup(szArg); /* Default name */ - break; + m_szOptuples[cliOption] = strdup(szArg); break; /* Defaultname */ case RC_ERR_VAL: - m_szOptuples[cliOption] = strdup(szArg); /* Error name */ - break; - default : - break; + m_szOptuples[cliOption] = strdup(szArg); break; /* Errorname */ + default : break; } return(RC_THROW(RC_OK)); @@ -243,28 +207,35 @@ popt_setotheroptionhelp(optCon, "[options] "); if (argc < 3) { + fprintf(stderr, "Please enter at least one rcfile and section.\n"); popt_printusage(optCon, stderr, 0); return(RC_THROW(RC_ERR_USE)); } /* Now do options processing */ - while ((cliOpt = popt_getnextopt(optCon)) >= 0) - ex_try { - clioptProcess(cliOpt, popt_getoptarg(optCon)); - } - 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); - - 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); + while ((cliOpt = popt_getnextopt(optCon)) >= 0) { /* Loop, each time */ + ex_try { /* eating a new option */ + clioptProcess(cliOpt, popt_getoptarg(optCon)); + } + ex_catch(Except) { + if ((rc_return_t)Except.ex_value == RC_ERR_USE) { + popt_printusage(optCon, stderr, 0); + rethrow; + } + else { /* Some error condition probably deserves attention */ + 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); + rethrow; + } + } } + /* At this point we should be finished parsing options, so now we use */ + /* popt as a transport to read the user specified rcfile and sections. */ szCLIBuf = (char *)popt_getarg(optCon); if ((szCLIBuf == NULL)) { - fprintf(stderr, "Please specify at least one rcfile and section.\n"); + fprintf(stderr, "Please enter at least one rcfile and section.\n"); popt_printusage(optCon, stderr, 0); return(RC_THROW(RC_ERR_USE)); } @@ -281,6 +252,7 @@ popt_freecontext(optCon); return(RC_THROW(RC_OK)); } + /*************************************** * clioptDestruct(void) * * Destruct a command line option * Index: ossp-pkg/rc/rc_cliopt.h RCS File: /v/ossp/cvs/ossp-pkg/rc/Attic/rc_cliopt.h,v co -q -kk -p'1.1' '/v/ossp/cvs/ossp-pkg/rc/Attic/rc_cliopt.h,v' | diff -u - /dev/null -L'ossp-pkg/rc/rc_cliopt.h' 2>/dev/null --- ossp-pkg/rc/rc_cliopt.h +++ /dev/null 2024-04-29 09:55:00.000000000 +0200 @@ -1,40 +0,0 @@ -/* 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_cliopt.h: Run-command processor ISO C public API header file -*/ - -#ifndef __OSSPRC_CLIOPT_H__ -#define __OSSPRC_CLIOPT_H__ - -#include "rc_private.h" -#include "rc_opt.h" - -typedef struct { /* Command line option storage */ - rc_list_t *pOptlist; /* To aggregate options */ -} rc_cliopt_t; - -#endif /* __OSSPRC_CLIOPT_H__ */ Index: ossp-pkg/rc/rc_config.c RCS File: /v/ossp/cvs/ossp-pkg/rc/rc_config.c,v rcsdiff -q -kk '-r1.11' '-r1.12' -u '/v/ossp/cvs/ossp-pkg/rc/rc_config.c,v' 2>/dev/null --- rc_config.c 2002/04/22 12:16:39 1.11 +++ rc_config.c 2002/04/22 15:22:39 1.12 @@ -29,11 +29,13 @@ #include #include +#include #include "rc.h" #include "rc_const.h" /* String constants */ static int m_nLocks = 0; /* Server locks, not thread-safe FIXME */ +static char *m_szSummary = NULL; /* Configuration summary storage */ /*************************************** @@ -109,6 +111,45 @@ return(NULL); /* Not reached */ } +/*************************************** +* configSummarize(void) * +* Configuration summary * +***************************************/ +const char *configSummarize(void) +{ + ex_t Except; + int i = 0; + int bCaught = FALSE; + + while (!bCaught) { + ex_try { /* FIXME Not threadsafe, wrap with crit section */ + if (configGetval(i)) { /* FIXME Is realloc portable here? */ + /* FIXME Unportable kludge to ensure storage FIXME */ + m_szSummary = realloc(m_szSummary, sizeof("OptionXXis") + \ + sizeof(configGetname(i)) + sizeof(configGetval(i) + 8)); + if (!(strcmp(configGetval(i), "1"))) { + strcat(m_szSummary, "Option "); + strcat(m_szSummary, configGetname(i)); + strcat(m_szSummary, " is on.\n"); + } + else { + strcat(m_szSummary, "Option "); + strcat(m_szSummary, configGetname(i)); + strcat(m_szSummary, " is "); + strcat(m_szSummary, configGetval(i)); + strcat(m_szSummary, ".\n"); + } + } + } /* FIXME Not threadsafe, wrap with crit section */ + ex_catch(Except) { /* Breaks the otherwise endless loop above */ + bCaught = TRUE; + } + i++; + } + + return ((const char *)m_szSummary); +} + /************************************************ * configLoad(int, char **) * * Load a configuration * @@ -146,6 +187,8 @@ if (--m_nLocks == 0) { /* If m_nLocks is 0, deallocate */ ex_try { /* FIXME, not thread-safe */ clioptDestruct(); + if (m_szSummary) + free(m_szSummary); } ex_catch(Except) { rethrow; Index: ossp-pkg/rc/rc_opt.h RCS File: /v/ossp/cvs/ossp-pkg/rc/Attic/rc_opt.h,v co -q -kk -p'1.1' '/v/ossp/cvs/ossp-pkg/rc/Attic/rc_opt.h,v' | diff -u - /dev/null -L'ossp-pkg/rc/rc_opt.h' 2>/dev/null --- ossp-pkg/rc/rc_opt.h +++ /dev/null 2024-04-29 09:55:00.000000000 +0200 @@ -1,38 +0,0 @@ -/* 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_opt.h: Run-command processor ISO C public API header file -*/ - -#ifndef __OSSPRC_OPT_H__ -#define __OSSPRC_OPT_H__ - -typedef struct { /* For option storage */ - char *szName; - char *szValue; -} rc_opt_t; - -#endif /* __OSSPRC_OPT_H__ */ Index: ossp-pkg/rc/rc_optimpl.c RCS File: /v/ossp/cvs/ossp-pkg/rc/Attic/rc_optimpl.c,v co -q -kk -p'1.5' '/v/ossp/cvs/ossp-pkg/rc/Attic/rc_optimpl.c,v' | diff -u - /dev/null -L'ossp-pkg/rc/rc_optimpl.c' 2>/dev/null --- ossp-pkg/rc/rc_optimpl.c +++ /dev/null 2024-04-29 09:55:00.000000000 +0200 @@ -1,145 +0,0 @@ -/* OSSP rc - 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_optimpl.c: Run-command processor ISO C source file -*/ - -#include "rc.h" -#include "rc_private.h" -#include "rc_option.h" /* Option methods rely on popt */ -#include "rc_const.h" /* Strings and other constants */ - -/* Third party headers for libraries linked in */ -#include "popt.h" /* OSSP popt options library */ - - -/* Loop through available options */ -rc_return_t coptProcess(int cOpt) -{ - switch (cOpt) { - case 'h': - break; - case 'V': - break; - case 'i': - break; - case 'q': - break; - } - - return(RC_THROW(RC_OK)); -} - -/* Parse command line options */ -rc_return_t coptParse(int argc, char *argv[]) -{ - ex_t Except; - char cOpt = 0; /* For argument parsing */ - char *szCLIBuf = NULL; - popt_context optCon; /* Context for parsing options */ - - struct popt_option optionsTable[] = { - /* Long options with short keys but no arguments */ - { 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 */ - {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, 0, 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 */ - { 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 } - }; - - optCon = popt_getcontext(NULL, argc, (const char **)argv, optionsTable, 0); - popt_setotheroptionhelp(optCon, "[options] "); - - if (argc < 3) { - popt_printusage(optCon, stderr, 0); - return(RC_THROW(RC_ERR_USE)); - } - - /* Now do options processing */ - while ((cOpt = popt_getnextopt(optCon)) >= 0) - ex_try { - coptProcess(cOpt); - } - 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); - - 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); - } - - szCLIBuf = (char *)popt_getarg(optCon); - if ((szCLIBuf == NULL)) { - fprintf(stderr, "Please specify at least one rcfile and section.\n"); - popt_printusage(optCon, stderr, 0); - return(RC_THROW(RC_ERR_USE)); - } - - if (cOpt < -1) { - /* An error occurred during option processing */ - fprintf(stderr, "%s: %s\n", - popt_badoption(optCon, POPT_BADOPTION_NOALIAS), - popt_strerror(cOpt)); - return(RC_THROW(RC_ERR_INT)); - } - - fprintf(stderr, "Run these commands: %s\n", szCLIBuf); - popt_freecontext(optCon); - return(RC_THROW(RC_OK)); -} Index: ossp-pkg/rc/rc_option.c RCS File: /v/ossp/cvs/ossp-pkg/rc/Attic/rc_option.c,v co -q -kk -p'1.5' '/v/ossp/cvs/ossp-pkg/rc/Attic/rc_option.c,v' | diff -u - /dev/null -L'ossp-pkg/rc/rc_option.c' 2>/dev/null --- ossp-pkg/rc/rc_option.c +++ /dev/null 2024-04-29 09:55:00.000000000 +0200 @@ -1,46 +0,0 @@ -/* 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_option.c: Run-command processor ISO C source file -*/ - -#include - -#include "rc.h" -#include "rc_private.h" - - -/* Loop through available options */ -rc_return_t optionProcess(void) -{ - return(RC_THROW(RC_OK)); -} - -/* Parse command line options */ -rc_return_t optionParse(void) -{ - return(RC_THROW(RC_OK)); -} Index: ossp-pkg/rc/rc_option.h RCS File: /v/ossp/cvs/ossp-pkg/rc/Attic/rc_option.h,v co -q -kk -p'1.3' '/v/ossp/cvs/ossp-pkg/rc/Attic/rc_option.h,v' | diff -u - /dev/null -L'ossp-pkg/rc/rc_option.h' 2>/dev/null --- ossp-pkg/rc/rc_option.h +++ /dev/null 2024-04-29 09:55:00.000000000 +0200 @@ -1,64 +0,0 @@ -/* 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_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 -#define RC_VER_VAL 34 -#define RC_EVL_VAL 35 -#define RC_HLP_VAL 36 -#define RC_INF_VAL 37 -#define RC_LBL_VAL 38 -#define RC_PRN_VAL 39 -#define RC_SIL_VAL 40 -#define RC_RAW_VAL 41 -#define RC_VRB_VAL 42 -#define RC_EXC_VAL 43 -#define RC_LOC_VAL 44 -#define RC_CNF_VAL 45 -#define RC_FNC_VAL 46 -#define RC_QRY_VAL 47 -#define RC_TMP_VAL 48 -#define RC_OWN_VAL 49 -#define RC_GRP_VAL 50 -#define RC_MSK_VAL 51 -#define RC_ASS_VAL 52 -#define RC_DEF_VAL 53 -#define RC_REF_VAL 54 -#define RC_PRM_VAL 55 -#define RC_TRM_VAL 56 -#define RC_NCF_VAL 57 -#define RC_CMN_VAL 58 -#define RC_DFL_VAL 59 -#define RC_ERR_VAL 60 - -#endif /* __OSSPRC_OPTION_H__ */