ocssw
V2022
|
#include <clo.h>
#include <string.h>
#include <strings.h>
#include <stdlib.h>
#include <assert.h>
#include <ctype.h>
#include <stdio.h>
#include <errno.h>
#include <genutils.h>
Go to the source code of this file.
Macros | |
#define | XML_INDENT_STRING " " |
Macro Definition Documentation
◆ XML_INDENT_STRING
Function Documentation
◆ clo_addAlias()
void clo_addAlias | ( | clo_optionList_t * | list, |
const char * | key, | ||
const char * | alias | ||
) |
◆ clo_addOption()
clo_option_t* clo_addOption | ( | clo_optionList_t * | list, |
const char * | key, | ||
enum clo_dataType_t | dataType, | ||
const char * | defaultVal, | ||
const char * | desc | ||
) |
◆ clo_addOptionAlias()
void clo_addOptionAlias | ( | clo_option_t * | option, |
const char * | alias | ||
) |
◆ clo_addPositionOption()
clo_option_t* clo_addPositionOption | ( | clo_optionList_t * | list | ) |
◆ clo_addToArray()
void clo_addToArray | ( | void *** | array, |
int * | storageSize, | ||
int * | count, | ||
void * | ptr | ||
) |
◆ clo_addXmlProgramMetadata()
◆ clo_clearPositionOptions()
void clo_clearPositionOptions | ( | clo_optionList_t * | list | ) |
◆ clo_clearXmlProgramMetadata()
void clo_clearXmlProgramMetadata | ( | ) |
◆ clo_copyList()
clo_optionList_t* clo_copyList | ( | clo_optionList_t * | list | ) |
◆ clo_copyOption()
clo_option_t* clo_copyOption | ( | clo_option_t * | option | ) |
◆ clo_createList()
clo_optionList_t* clo_createList | ( | ) |
◆ clo_createOption()
clo_option_t* clo_createOption | ( | const char * | key, |
enum clo_dataType_t | dataType, | ||
const char * | defaultVal, | ||
const char * | desc | ||
) |
◆ clo_dataTypeToString()
char* clo_dataTypeToString | ( | enum clo_dataType_t | dataType | ) |
◆ clo_deleteList()
void clo_deleteList | ( | clo_optionList_t * | list | ) |
◆ clo_deleteOption()
void clo_deleteOption | ( | clo_option_t * | option | ) |
◆ clo_dumpOption()
void clo_dumpOption | ( | clo_option_t * | option | ) |
◆ clo_dumpOptions()
void clo_dumpOptions | ( | clo_optionList_t * | list | ) |
◆ clo_envExpandString()
char* clo_envExpandString | ( | const char * | str | ) |
Expand any environment variables referenced in the string Here are some examples:
$HOME/otherDir text/home/www-adminmoreText text${HOME}moreText $HOME/more/home/www-adminthanOne
- Parameters
-
str string to substitute environment variables into
- Returns
- pointer to a newly allocated string that can to be freed with free(3)
◆ clo_findOption()
clo_option_t* clo_findOption | ( | clo_optionList_t * | list, |
const char * | key | ||
) |
◆ clo_getBool()
int clo_getBool | ( | clo_optionList_t * | list, |
const char * | key | ||
) |
Find the option "key" and return the first value. exit is called if "key" is not found. If the option has not been set the default value is returned.
- Parameters
-
list list of options to search key option name to search for
- Returns
- internal pointer to the first boolean value
◆ clo_getBools()
int* clo_getBools | ( | clo_optionList_t * | list, |
const char * | key, | ||
int * | count | ||
) |
Find the option "key" and return the count and boolean array. exit is called if "key" is not found. If the option has not been set the default value is returned. The pointer returned references internally allocated memory stored in the option structure, so it should be valid until the value of option is changed.
- Parameters
-
list list of options to search through key option name to search for count [out] number of items in the array
- Returns
- an array of booleans. This pointer is pointing to internal memory stored in the option structure.
◆ clo_getDouble()
double clo_getDouble | ( | clo_optionList_t * | list, |
const char * | key | ||
) |
Find the option "key" and return the first value. exit is called if "key" is not found. If the option has not been set the default value is returned.
- Parameters
-
list list of options to search key option name to search for
- Returns
- internal pointer to the first double value
◆ clo_getDoubles()
double* clo_getDoubles | ( | clo_optionList_t * | list, |
const char * | key, | ||
int * | count | ||
) |
Find the option "key" and return the count and float array. exit is called if "key" is not found. If the option has not been set the default value is returned. The pointer returned references internally allocated memory stored in the option structure, so it should be valid until the value of option is changed.
- Parameters
-
list list of options to search through key option name to search for count [out] number of items in the array
- Returns
- an array of doubles. This pointer is pointing to internal memory stored in the option structure.
◆ clo_getEnableDumpOptions()
int clo_getEnableDumpOptions | ( | ) |
◆ clo_getEnableExtraOptions()
int clo_getEnableExtraOptions | ( | ) |
◆ clo_getEnableParOption()
int clo_getEnableParOption | ( | ) |
◆ clo_getEnablePositionOptions()
int clo_getEnablePositionOptions | ( | ) |
◆ clo_getFloat()
float clo_getFloat | ( | clo_optionList_t * | list, |
const char * | key | ||
) |
Find the option "key" and return the first value. exit is called if "key" is not found. If the option has not been set the default value is returned.
- Parameters
-
list list of options to search key option name to search for
- Returns
- internal pointer to the first float value
◆ clo_getFloats()
float* clo_getFloats | ( | clo_optionList_t * | list, |
const char * | key, | ||
int * | count | ||
) |
Find the option "key" and return the count and float array. exit is called if "key" is not found. If the option has not been set the default value is returned. The pointer returned references internally allocated memory stored in the option structure, so it should be valid until the value of option is changed.
- Parameters
-
list list of options to search through key option name to search for count [out] number of items in the array
- Returns
- an array of floats. This pointer is pointing to internal memory stored in the option structure.
◆ clo_getHelpStr()
char* clo_getHelpStr | ( | ) |
◆ clo_getIgnoreKeyCase()
int clo_getIgnoreKeyCase | ( | ) |
◆ clo_getInt()
int clo_getInt | ( | clo_optionList_t * | list, |
const char * | key | ||
) |
Find the option "key" and return the first value. exit is called if "key" is not found. If the option has not been set the default value is returned.
- Parameters
-
list list of options to search key option name to search for
- Returns
- internal pointer to the first int value
◆ clo_getInt64()
int64_t clo_getInt64 | ( | clo_optionList_t * | list, |
const char * | key | ||
) |
Find the option "key" and return the first value. exit is called if "key" is not found. If the option has not been set the default value is returned.
- Parameters
-
list list of options to search key option name to search for
- Returns
- internal pointer to the first int value
◆ clo_getInts()
int* clo_getInts | ( | clo_optionList_t * | list, |
const char * | key, | ||
int * | count | ||
) |
Find the option "key" and return the count and int array. exit is called if "key" is not found. If the option has not been set the default value is returned. The pointer returned references internally allocated memory stored in the option structure, so it should be valid until the value of option is changed.
- Parameters
-
list list of options to search through key option name to search for count [out] number of items in the array
- Returns
- an array of ints. This pointer is pointing to internal memory stored in the option structure.
◆ clo_getNumOptions()
int clo_getNumOptions | ( | clo_optionList_t * | list | ) |
◆ clo_getOption()
clo_option_t* clo_getOption | ( | clo_optionList_t * | list, |
int | i | ||
) |
◆ clo_getOptionBool()
int clo_getOptionBool | ( | clo_option_t * | option | ) |
◆ clo_getOptionBools()
int* clo_getOptionBools | ( | clo_option_t * | option, |
int * | count | ||
) |
Return the count and boolean array from the given option. If the option has not been set the default value is returned. The pointer returned references internally allocated memory stored in the option structure, so it should be valid until the value of option is changed.
- Parameters
-
option option to get the information from count [out] pointer where number of booleans in array is written
- Returns
- array of booleans
◆ clo_getOptionDouble()
double clo_getOptionDouble | ( | clo_option_t * | option | ) |
◆ clo_getOptionDoubles()
double* clo_getOptionDoubles | ( | clo_option_t * | option, |
int * | count | ||
) |
Return the count and double array from the given option. If the option has not been set the default value is returned. The pointer returned references internally allocated memory stored in the option structure, so it should be valid until the value of option is changed.
- Parameters
-
option option to get the information from count [out] pointer where number of doubles in array is written
- Returns
- array of doubles
◆ clo_getOptionFloat()
float clo_getOptionFloat | ( | clo_option_t * | option | ) |
◆ clo_getOptionFloats()
float* clo_getOptionFloats | ( | clo_option_t * | option, |
int * | count | ||
) |
Return the count and float array from the given option. If the option has not been set the default value is returned. The pointer returned references internally allocated memory stored in the option structure, so it should be valid until the value of option is changed.
- Parameters
-
option option to get the information from count pointer where number of floats in array is written
- Returns
- array of floats
◆ clo_getOptionInt()
int clo_getOptionInt | ( | clo_option_t * | option | ) |
◆ clo_getOptionInt64()
int64_t clo_getOptionInt64 | ( | clo_option_t * | option | ) |
◆ clo_getOptionInts()
int* clo_getOptionInts | ( | clo_option_t * | option, |
int * | count | ||
) |
Return the count and int array from the given option. If the option has not been set the default value is returned. The pointer returned references internally allocated memory stored in the option structure, so it should be valid until the value of option is changed.
- Parameters
-
option option to get the information from count [out] pointer where number of ints in array is written
- Returns
- array of ints
◆ clo_getOptionRawString()
char* clo_getOptionRawString | ( | clo_option_t * | option | ) |
◆ clo_getOptionString()
char* clo_getOptionString | ( | clo_option_t * | option | ) |
◆ clo_getOptionStrings()
char** clo_getOptionStrings | ( | clo_option_t * | option, |
int * | count | ||
) |
Return the count and string array from the given option. If the option has not been set the default value is returned. The pointer returned references internally allocated memory stored in the option structure, so it should be valid until the value of option is changed.
- Parameters
-
option option to get the information from count [out] pointer where number of strings in array is written
- Returns
- array of strings
◆ clo_getPositionNumOptions()
int clo_getPositionNumOptions | ( | clo_optionList_t * | list | ) |
◆ clo_getPositionOption()
clo_option_t* clo_getPositionOption | ( | clo_optionList_t * | list, |
int | i | ||
) |
◆ clo_getPositionString()
char* clo_getPositionString | ( | clo_optionList_t * | list, |
int | pos | ||
) |
◆ clo_getRawString()
char* clo_getRawString | ( | clo_optionList_t * | list, |
const char * | key | ||
) |
Find the option "key" and return the raw string value. Exit is called if "key" is not found. If the option has not been set the default value is returned. Exit is called if the option has not been set and the default value is NULL.
- Parameters
-
list list to search through key option key to find
- Returns
- internal pointer to the raw string value
◆ clo_getSelectOptionKeys()
char** clo_getSelectOptionKeys | ( | ) |
◆ clo_getString()
char* clo_getString | ( | clo_optionList_t * | list, |
const char * | key | ||
) |
Find the option "key" and return the first value. exit is called if "key" is not found. If the option has not been set the default value is returned.
- Parameters
-
list list of options to search key option name to search for
- Returns
- internal pointer to the first string value
◆ clo_getStrings()
char** clo_getStrings | ( | clo_optionList_t * | list, |
const char * | key, | ||
int * | count | ||
) |
Find the option "key" and return the count and string array. exit is called if "key" is not found. If the option has not been set the default value is returned. The pointer returned references internally allocated memory stored in the option structure, so it should be valid until the value of option is changed.
- Parameters
-
list list of options to search through key option name to search for count [out] number of items in the array
- Returns
- an array of strings. This pointer is pointing to internal memory stored in the option structure.
◆ clo_getVersion()
char* clo_getVersion | ( | ) |
◆ clo_helpOptionCb()
void clo_helpOptionCb | ( | struct clo_option_t * | option | ) |
◆ clo_insertOption()
void clo_insertOption | ( | clo_optionList_t * | list, |
clo_option_t * | option | ||
) |
◆ clo_isOptionSet()
int clo_isOptionSet | ( | clo_option_t * | option | ) |
◆ clo_isSet()
int clo_isSet | ( | clo_optionList_t * | list, |
const char * | key | ||
) |
◆ clo_parOptionCb()
void clo_parOptionCb | ( | clo_option_t * | option | ) |
◆ clo_parseOption()
void clo_parseOption | ( | clo_option_t * | option | ) |
◆ clo_parseOptionString()
void clo_parseOptionString | ( | clo_option_t * | option | ) |
◆ clo_printHelpString()
◆ clo_printOption()
void clo_printOption | ( | clo_option_t * | option | ) |
◆ clo_printOptions()
void clo_printOptions | ( | clo_optionList_t * | list | ) |
◆ clo_printOptionVal()
void clo_printOptionVal | ( | clo_option_t * | option | ) |
◆ clo_printUsage()
void clo_printUsage | ( | clo_optionList_t * | list | ) |
◆ clo_printVals()
void clo_printVals | ( | clo_optionList_t * | list | ) |
◆ clo_printVersion()
◆ clo_readArgs()
void clo_readArgs | ( | clo_optionList_t * | list, |
int | argc, | ||
char * | argv[] | ||
) |
Read command line arguments handling function. First call to readArgsPar with file descending enabled, then disabled to allow Command Line options override
- Parameters
-
list option list to search argc number of elements in argv argv array of command line argument strings
◆ clo_readArgsPar()
void clo_readArgsPar | ( | clo_optionList_t * | list, |
int | argc, | ||
char * | argv[], | ||
int | enableFileDescending | ||
) |
◆ clo_readFile()
void clo_readFile | ( | clo_optionList_t * | list, |
const char * | fileName | ||
) |
◆ clo_readOptions()
void clo_readOptions | ( | clo_optionList_t * | list, |
clo_optionList_t * | readList | ||
) |
◆ clo_readString()
void clo_readString | ( | clo_optionList_t * | list, |
const char * | str, | ||
const char * | source | ||
) |
◆ clo_setEnableDumpOptions()
void clo_setEnableDumpOptions | ( | int | val | ) |
◆ clo_setEnableExtraOptions()
void clo_setEnableExtraOptions | ( | int | val | ) |
◆ clo_setEnableParOption()
void clo_setEnableParOption | ( | int | val | ) |
set whether or not the library will add the par file option this must be set before calling clo_createList()
- Parameters
-
val 1 = enable processing, 0 = disable
◆ clo_setEnablePositionOptions()
void clo_setEnablePositionOptions | ( | int | val | ) |
◆ clo_setHelpStr()
void clo_setHelpStr | ( | const char * | str | ) |
◆ clo_setIgnoreKeyCase()
void clo_setIgnoreKeyCase | ( | int | val | ) |
◆ clo_setOptionString()
int clo_setOptionString | ( | clo_option_t * | option, |
const char * | val, | ||
const char * | source | ||
) |
◆ clo_setSelectOptionKeys()
void clo_setSelectOptionKeys | ( | char ** | keys | ) |
set the list of option keys that will be printed by help and XML output. The last pointer in the array must be NULL. If keys is NULL then all options will be used. The strings are not copied, so don't delete the array or the strings.
- Parameters
-
keys NULL terminated array of strings containing the key names
◆ clo_setString()
int clo_setString | ( | clo_optionList_t * | list, |
const char * | key, | ||
const char * | val, | ||
const char * | source | ||
) |
◆ clo_setVersion()
void clo_setVersion | ( | const char * | str | ) |
◆ clo_setVersion2()
◆ clo_trimDashes()
void clo_trimDashes | ( | char * | str | ) |
◆ clo_trimDashesDup()
char* clo_trimDashesDup | ( | const char * | str | ) |
◆ clo_versionOptionCb()
void clo_versionOptionCb | ( | struct clo_option_t * | option | ) |
◆ clo_writeParameterFile()
int clo_writeParameterFile | ( | clo_optionList_t * | list, |
const char * | filename | ||
) |
◆ clo_writeXmlEndTag()
void clo_writeXmlEndTag | ( | FILE * | fout, |
int | level, | ||
const char * | tag | ||
) |
◆ clo_writeXmlFile()
int clo_writeXmlFile | ( | clo_optionList_t * | list, |
const char * | filename | ||
) |
◆ clo_writeXmlStartTag()
void clo_writeXmlStartTag | ( | FILE * | fout, |
int | level, | ||
const char * | tag | ||
) |