head 1.39; access; symbols OSSP_RC_0_7_3:1.39 OSSP_RC_0_7_2:1.36 OSSP_RC_0_7_1:1.34 OSSP_RC_ALPHA_06:1.20 OSSP_RC_EXBROKEN:1.17; locks; strict; comment @ * @; 1.39 date 2003.07.11.14.03.53; author ms; state Exp; branches; next 1.38; 1.38 date 2003.07.11.13.47.13; author ms; state Exp; branches; next 1.37; 1.37 date 2003.07.11.12.01.31; author ms; state Exp; branches; next 1.36; 1.36 date 2003.07.11.09.18.20; author ms; state Exp; branches; next 1.35; 1.35 date 2003.07.11.08.49.36; author ms; state Exp; branches; next 1.34; 1.34 date 2003.07.07.13.30.51; author ms; state Exp; branches; next 1.33; 1.33 date 2003.07.07.12.55.42; author ms; state Exp; branches; next 1.32; 1.32 date 2003.07.02.15.31.38; author ms; state Exp; branches; next 1.31; 1.31 date 2003.07.02.14.45.25; author ms; state Exp; branches; next 1.30; 1.30 date 2003.06.27.14.26.13; author ms; state Exp; branches; next 1.29; 1.29 date 2003.06.26.18.45.14; author ms; state Exp; branches; next 1.28; 1.28 date 2003.06.23.16.09.47; author ms; state Exp; branches; next 1.27; 1.27 date 2003.06.23.14.43.48; author ms; state Exp; branches; next 1.26; 1.26 date 2003.06.23.11.27.54; author ms; state Exp; branches; next 1.25; 1.25 date 2003.06.18.14.35.29; author ms; state Exp; branches; next 1.24; 1.24 date 2003.06.13.18.33.07; author ms; state Exp; branches; next 1.23; 1.23 date 2003.06.12.14.24.32; author ms; state Exp; branches; next 1.22; 1.22 date 2003.06.12.13.27.44; author ms; state Exp; branches; next 1.21; 1.21 date 2003.06.11.16.18.48; author ms; state Exp; branches; next 1.20; 1.20 date 2003.05.28.18.43.34; author ms; state Exp; branches; next 1.19; 1.19 date 2003.05.28.18.27.21; author ms; state Exp; branches; next 1.18; 1.18 date 2003.05.27.15.02.56; author ms; state Exp; branches; next 1.17; 1.17 date 2003.05.26.08.36.40; author ms; state Exp; branches; next 1.16; 1.16 date 2003.05.23.14.14.09; author ms; state Exp; branches; next 1.15; 1.15 date 2003.05.21.12.49.21; author ms; state Exp; branches; next 1.14; 1.14 date 2003.05.16.12.37.10; author ms; state Exp; branches; next 1.13; 1.13 date 2002.08.02.20.09.59; author ms; state Exp; branches; next 1.12; 1.12 date 2002.08.01.13.25.32; author ms; state Exp; branches; next 1.11; 1.11 date 2002.08.01.08.09.04; author ms; state Exp; branches; next 1.10; 1.10 date 2002.07.30.16.33.51; author ms; state Exp; branches; next 1.9; 1.9 date 2002.07.29.15.07.01; author ms; state Exp; branches; next 1.8; 1.8 date 2002.06.27.15.35.58; author ms; state Exp; branches; next 1.7; 1.7 date 2002.06.26.14.11.16; author ms; state Exp; branches; next 1.6; 1.6 date 2002.05.22.13.29.40; author ms; state Exp; branches; next 1.5; 1.5 date 2002.04.24.16.47.07; author ms; state Exp; branches; next 1.4; 1.4 date 2002.04.11.16.52.45; author ms; state Exp; branches; next 1.3; 1.3 date 2002.03.26.17.11.06; author ms; state Exp; branches; next 1.2; 1.2 date 2002.02.08.18.36.40; author ms; state Exp; branches; next 1.1; 1.1 date 2002.02.07.12.35.25; author ms; state Exp; branches; next ; desc @@ 1.39 log @Back out regex fix, because the changed PCRE PCRE_DOLLAR_ENDONLY flag broke rc file parsing. @ text @/* OSSP rc - Run-Command Processor ** Copyright (c) 2002-2003 Ralf S. Engelschall ** Copyright (c) 2002-2003 Cable & Wireless Deutschland GmbH ** Copyright (c) 2002-2003 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/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_const.h: Run-Command Processor ISO C public header file */ #ifndef __OSSPRC_CONST_H__ #define __OSSPRC_CONST_H__ /* Generic text, should include newline termination */ #define RC_LST_TEXT "OSSP rc:Failure, please enter just one rcfile name and at least one section label.\n" #define RC_EEP_TEXT "OSSP rc:Failure, the exec, eval, and print options may not be combined.\n" #define RC_SLO_TEXT "OSSP rc:Failure, the silent option may not be combined with output options.\n" #define RC_RUT_TEXT "OSSP rc:Failure, failed to set the user id. Please become the root user and try again.\n" #define RC_SUM_TEXT "OSSP rc:Info, option argument summary.\n" /* Generic text, should not include newline termination */ #define RC_VST_TEXT "# Start of run command script operations." #define RC_EVF_TEXT "# Evaluating code from functions file." #define RC_EVN_TEXT "# Evaluating section %s of rcfile %s." #define RC_EXF_TEXT "# Executing code from functions file." #define RC_EXN_TEXT "# Executing section %s of rcfile %s." #define RC_PNF_TEXT "# Printing code from functions file." #define RC_PRN_TEXT "# Printing section %s of rcfile %s." /* Option descriptions used with popt, should not include termination */ #define RC_USE_DESC "Print a short usage summary, then exit." #define RC_DBG_DESC "Don't remove temporary files, and write debug messages to stderr." #define RC_VER_DESC "Print the version and copyright, then exit." #define RC_EVL_DESC "Output the command(s) in a format suitable for shell evaluation, but do not run them." #define RC_HLP_DESC "Print this help, then exit." #define RC_INF_DESC "Print a comprehensive summary of the rc environment." #define RC_LBL_DESC "Learn what section labels a rcfile has." #define RC_PRN_DESC "Output the command(s) in a format suitable for human reading, but do not run them." #define RC_PAR_DESC "Parse the run command names along with each of their matching section names." #define RC_SIL_DESC "Be silent, and disable output to stdout." #define RC_RAW_DESC "Output text using no terminal control sequences." #define RC_VRB_DESC "Output text verbosely." #define RC_EXC_DESC "Execute the commands through an interpreter." #define RC_LOC_DESC "Specifiy the location(s) to search for rcfiles, and ignore parts according to the regex." #define RC_CNF_DESC "Specify the location(s) of the configuration files." #define RC_FNC_DESC "Specify the single location of the extra functions file." #define RC_QRY_DESC "Query the effective value of configuration variables." #define RC_TMP_DESC "Specify the single location for temporary files." #define RC_OWN_DESC "Username used to verify run command rights at runtime." #define RC_GRP_DESC "Group name used to verify run command rights at runtime." #define RC_MSK_DESC "Umask used to verify run command rights at runtime." #define RC_ASS_DESC "Regex used to match name value assignments in a rcfile." #define RC_DEF_DESC "Regex used to match a section label in a rcfile." #define RC_REF_DESC "Regex used to match a section reference in a rcfile." #define RC_PRM_DESC "Regex used to match the parameter(s) of a section label." #define RC_TRM_DESC "Regex used to match the terminal(s) in a rcfile." #define RC_NCF_DESC "Name of the config section in a rcfile." #define RC_CMN_DESC "Name of the common section in a rcfile." #define RC_DFL_DESC "Name of the default section in a rcfile." #define RC_ERR_DESC "Name of the error section in a rcfile." /* Error messages with newline termination */ #define RC_ERRTXT_ALL "Error condition in %s:%s():%d.\n" #define RC_ERRTXT_USE "OSSP rc:Failure, API usage is wrong.\n" #define RC_ERRTXT_MEM "OSSP rc:Failure, memory allocation.\n" #define RC_ERRTXT_SYS "OSSP rc:Failure, underlying system.\n" #define RC_ERRTXT_IO "OSSP rc:Failure, input output.\n" #define RC_ERRTXT_INT "OSSP rc:Failure, internal problem.\n" #define RC_ERRTXT_FNC "OSSP rc:Failure, function file %s could not be opened.\n" #define RC_ERRTXT_LOC "OSSP rc:Failure, location dir %s could not be opened.\n" #define RC_ERRTXT_TMP "OSSP rc:Failure, temporary dir %s could not be opened.\n" #define RC_ERRTXT_RCF "OSSP rc:Failure, one or more rc files could not be opened.\n" #define RC_ERRTXT_CFG "OSSP rc:Failure, configuration problem.\n" #define RC_ERRTXT_ROOT "OSSP rc:Failure, you must be root to run these commands.\n" #define RC_ERRTXT_GEN "OSSP rc:Failure, generic problem of class '%s',.\n" /* Option friendly names, should not include newline termination */ #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_PAR_NAME "parse" #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" /* Error and warning strings, should not include newline termination */ #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_FNC "Funcfile" #define RC_ERRSTR_LOC "Location" #define RC_ERRSTR_TMP "Tempdir" #define RC_ERRSTR_RCF "Rcfile" #define RC_ERRSTR_TRM "Terminate" #define RC_ERRSTR_CFG "Config/Options" #define RC_ERRSTR_ROOT "Permissions" #define RC_ERRSTR_UNK "Unrecognized" #define RC_WRNSTR_OWR "Overwrite" #define RC_WRNSTR_NUL "NULLPointer" #define RC_GLOB_WILD "all" /* Nontranslatable machine strings, do not translate */ #define RC_ECHO_STR "echo " #define RC_BANG_STR "#! /bin/sh\n" /* Default values, do not include newlines and special chars must be escaped */ #define RC_DEF_ON "1" /* Digital switch */ #define RC_DEF_OFF "0" /* Digital switch */ #define RC_DEF_TMP "/tmp" /* Temporary directory name */ #define RC_DEF_DEF "^%(\\w+)[ \t]*(.*?)\\n(.*?)^$" /* Section definition */ #define RC_DEF_NCF "config" /* Config section name */ #define RC_DEF_CMN "common" /* Common section name */ #define RC_DEF_UIG "-u" /* Section user string */ #define RC_DEF_UID -1 /* Section user value */ #define RC_DEF_PRG "-p" /* Section priority string */ #define RC_DEF_PRI 200 /* Section priority value */ /* Handling temporary and output during evaluation mode */ #define RC_EVL_TMP "rc.XXXXXX" /* Temporary file template */ #define RC_EVL_SUF ".tmp" /* Temporary file suffix */ #define RC_EVL_OUT ". %s; rm -f %s 2>/dev/null || true\n" /* Command line output */ #define RC_EVL_DBG ". %s\n" /* Command line debug output */ #endif /* __OSSPRC_CONST_H__ */ @ 1.38 log @Debug regex. @ text @d160 1 a160 1 #define RC_DEF_DEF "(?:^|\\n)%(\\w+)[ \\t]*(.*?)\\n(.*?)(?:\\n%|$)" /* Section definition */ @ 1.37 log @More error message improvements in consistency. @ text @d160 1 a160 1 #define RC_DEF_DEF "(?:^|\\n)%(\\w+)[ \t]*(.*?)\\n(.*?)(?:\\n%|$)" /* Section definition */ @ 1.36 log @Replace embedded text strings from code to constants header. Address two functional problems identified by Thomas and Ralf, namely missing error message identifiers and confusing period punctuation with info option. @ text @d34 5 a38 6 #define RC_NON_TEXT "No options exist.\n" #define RC_LST_TEXT "Please enter just one rcfile name and at least one section label.\n" #define RC_EEP_TEXT "The exec, eval, and print options may not be combined.\n" #define RC_SLO_TEXT "The silent option may not be combined with output options.\n" #define RC_SUM_TEXT "Option argument summary.\n" #define RC_RUT_TEXT "Failed to set the user id. Please become the root user and try again.\n" d85 12 a96 12 #define RC_ERRTXT_USE "OSSP rc:API usage is wrong.\n" #define RC_ERRTXT_MEM "OSSP rc:Memory allocation failure.\n" #define RC_ERRTXT_SYS "OSSP rc:Underlying system failure.\n" #define RC_ERRTXT_IO "OSSP rc:Input output failure.\n" #define RC_ERRTXT_INT "OSSP rc:Internal failure.\n" #define RC_ERRTXT_FNC "OSSP rc:Function file %s could not be opened.\n" #define RC_ERRTXT_LOC "OSSP rc:Location dir %s could not be opened.\n" #define RC_ERRTXT_TMP "OSSP rc:Temporary dir %s could not be opened.\n" #define RC_ERRTXT_RCF "OSSP rc:One or more rc files could not be opened.\n" #define RC_ERRTXT_CFG "OSSP rc:Configuration failure.\n" #define RC_ERRTXT_ROOT "OSSP rc:You must be root to run these commands.\n" #define RC_ERRTXT_GEN "OSSP rc:Generic failure condition of class '%s',.\n" @ 1.35 log @Fix embedded newline regex matching bug. @ text @d84 15 @ 1.34 log @More header corrections and improvements. @ text @d146 1 a146 1 #define RC_DEF_DEF "^%(\\w+)[ \t]*(.*?)\\n(.*?)^$" /* Section definition */ @ 1.33 log @Correct and update copyrights and source headers. @ text @d1 1 a1 1 /* OSSP rc - Run-command processor d6 1 a6 1 ** This file is part of OSSP rc, a portable Run-command processor d27 1 a27 1 ** rc_const.h: Run-command processor ISO C public header file @ 1.32 log @Add temporary directory option error logic. @ text @d2 3 a4 3 ** Copyright (c) 2002 Cable & Wireless Deutschland GmbH ** Copyright (c) 2002 The OSSP Project ** Copyright (c) 2002 Ralf S. Engelschall @ 1.31 log @Remember the error string for new root permissions. @ text @d126 2 a127 1 #define RC_ERRSTR_DIR "Location" @ 1.30 log @Implement common section parsing and running on execution mode. @ text @d119 15 a133 14 #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_FNC "Funcfile" #define RC_ERRSTR_DIR "Location" #define RC_ERRSTR_RCF "Rcfile" #define RC_ERRSTR_TRM "Terminate" #define RC_ERRSTR_CFG "Config/Options" #define RC_ERRSTR_UNK "Unrecognized" #define RC_WRNSTR_OWR "Overwrite" #define RC_WRNSTR_NUL "NULLPointer" @ 1.29 log @Break off before fully implementing common section run ops, but after reorganization of class data, and additional member functions for section and script manipulation. @ text @a49 3 /* Single word user text, should not include termination */ #define RC_CFG_TEXT "config" @ 1.28 log @Complete error handling method according to all defined error values. @ text @d44 1 a44 1 #define RC_EVN_TEXT "# Evaluating section %s of script %s." d46 1 a46 1 #define RC_EXN_TEXT "# Executing section %s of script %s." d48 1 a48 1 #define RC_PRN_TEXT "# Printing section %s of script %s." d51 1 a51 1 #define RC_CMN_TEXT "common" d149 1 @ 1.27 log @Edit examples and group them according to the three run modes, and improve most basic error message. @ text @d132 1 @ 1.26 log @Do not remove eval mode temp files when the debugging option is active. @ text @d35 1 a35 1 #define RC_LST_TEXT "Please enter just one rcfile and at least one section.\n" @ 1.25 log @Removed analyzer class, removed label class, implemented list class, implemented file class, cleanup and restructure. @ text @d154 4 a157 3 #define RC_EVL_TMP "rc.XXXXXX" /* Temporary file template */ #define RC_EVL_SUF ".tmp" /* Temporary file suffix */ #define RC_EVL_OUT ". %s; rm -f %s 2>/dev/null || true\n" /* Command line output */ @ 1.24 log @Sweeping cleanups. Reduced the analyzer to almost nothing. Removed unused method prototypes. Added 'parse' mode option that doesn't work yet. Removed procReadtmp. Change the way we build path names from the locations directory. @ text @d40 9 a48 3 #define RC_EVN_TEXT "# Evaluating section %s of script %s.\n" #define RC_EXN_TEXT "# Executing section %s of script %s.\n" #define RC_PRN_TEXT "# Printing section %s of script %s.\n" @ 1.23 log @Fix shebang handling. @ text @d56 1 d90 1 @ 1.22 log @Complete verbose mode implementation. @ text @d132 1 @ 1.21 log @Implement limited verbosity on eval modus, and begin mergin the label object and the section object. @ text @d44 3 d129 3 @ 1.20 log @Back out change, trying to get the default regex for label defs correct. @ text @d40 3 @ 1.19 log @Slightly correct section definition default. @ text @d128 1 a128 1 #define RC_DEF_DEF "^%(\\w+)[ \t]+(.*?)\\n(.*?)^$" /* Section definition */ @ 1.18 log @Fix mktemp(3) bug, causing ignorance of user suggested temp file path. @ text @d128 1 a128 1 #define RC_DEF_DEF "^%(\\w+)[ \t]*(.*?)\\n(.*?)^$" /* Section definition */ @ 1.17 log @Fix eval mode by replacing empty tempdir parameters. @ text @d136 1 a136 1 #define RC_EVL_TMP "rc.XXXX" /* Temporary file template */ @ 1.16 log @Mostly finish setuid(2) work in section parsing of userid, and exec mode. @ text @d127 1 @ 1.15 log @Implement eval mode. @ text @d39 1 @ 1.14 log @Bugfix and cleanup priority scheduling, and add similar userid parameter handling. @ text @d133 5 @ 1.13 log @Intermediate priority implementation flush. Build is broken. @ text @d128 2 @ 1.12 log @Added generic parsing of section arguments, adjusted defaults and tests. @ text @d128 2 @ 1.11 log @Rooted out magic numbers and made new default value section for strings. @ text @d126 1 a126 1 #define RC_DEF_DEF "^%(\\w+).*?\\n(.*?)^$" /* Section definition */ @ 1.10 log @Begin coding inspection of options for combination usage errors. @ text @d73 1 d106 1 d122 6 @ 1.9 log @Synchronize error and warning reporting with new return code additions. @ text @d36 2 @ 1.8 log @Added 'all' wildcard rcfile globbing and removed location hardcoding and rcfile prefix hardcoding. @ text @d109 4 d114 2 @ 1.7 log @Intermediate committal, lots of additions, compiles and works very limited. @ text @d111 1 a111 1 #define RC_CONF_WILD "all" @ 1.6 log @Fix the build, comment missing pieces, and synchronize throughout. @ text @a112 3 /* FIXME Tie to shtool generation */ #define RC_VERSION "77.77" @ 1.5 log @Command line option configuration and some processor operations. @ text @d111 2 @ 1.4 log @Flush the toilet. @ text @d33 6 a38 1 /* Option descriptions used with popt */ @ 1.3 log @Vacation flush, mostly build configuration details. Its not building very clean right now. @ text @d106 3 @ 1.2 log @Further abstraction and building in of the configuration logic. We now store configuration variables using OSSP val, also. PR: Submitted by: Reviewed by: Approved by: Obtained from: @ text @d1 1 a1 1 /* rc - OSSP Run-command processor @ 1.1 log @Filename changes. PR: Submitted by: Reviewed by: Approved by: Obtained from: @ text @d66 40 @