Functions dealing with user settings. More...
#include "global.h"
#include "actions.h"
Go to the source code of this file.
Data Structures | |
struct | opt__list_t |
An option entry. More... | |
Defines | |
#define | FILTER__ALL (-1) |
Filter value to print all entries. | |
#define | OPT__YES (1) |
Generic yes/no/auto config values. | |
#define | OPT__NO (0) |
Enumerations | |
A list of supported settings/options. | |
enum | opt__settings_e { OPT__PATH = 0, OPT__LOG_MAXREV, OPT__LOG_OUTPUT, OPT__COLORDIFF, OPT__DIR_SORT, OPT__STATUS_COLOR, OPT__STOP_ON_CHANGE, OPT__FILTER, OPT__CHANGECHECK, OPT__ALL_REMOVED, OPT__VERBOSE, OPT__DEBUG_OUTPUT, OPT__DEBUG_BUFFER, OPT__GROUP_STATS, OPT__CONFLICT, OPT__MERGE_OPT, OPT__MERGE_PRG, OPT__DIFF_PRG, OPT__DIFF_OPT, OPT__DIFF_EXTRA, OPT__WARNINGS, OPT__SOFTROOT, OPT__COMMIT_TO, OPT__EMPTY_MESSAGE, OPT__MKDIR_BASE, OPT__AUTHOR, OPT__EMPTY_COMMIT, OPT__DELAY, OPT__COPYFROM_EXP, OPT__WAA_PATH, OPT__CONF_PATH, OPT__CONFIG_DIR, OPT__COUNT } |
Printing of paths. | |
enum | opt_paths_t { PATH_WCRELATIVE = 0, PATH_PARMRELATIVE, PATH_ABSOLUTE, PATH_CACHEDENVIRON, PATH_FULLENVIRON } |
Path-printing enumeration. More... | |
List of constants for \ref o_delay option. | |
enum | opt__delay_e { DELAY_CHECKOUT = 1 << 0, DELAY_COMMIT = 1 << 1, DELAY_UPDATE = 1 << 2, DELAY_REVERT = 1 << 3 } |
List of constants for \ref o_chcheck option. | |
enum | opt__chcheck_e { CHCHECK_NONE = 0, CHCHECK_FILE = 1 << 0, CHCHECK_DIRS = 1 << 1, CHCHECK_ALLFILES = 1 << 2 } |
List of constants for \ref o_verbose option. | |
enum | opt__verbosity_e { VERBOSITY_VERYQUIET = 0, VERBOSITY_QUIET = 1 << 0, VERBOSITY_SHOWCHG = 1 << 1, VERBOSITY_SHOWSIZE = 1 << 2, VERBOSITY_SHOWNAME = 1 << 3, VERBOSITY_DEFAULT, VERBOSITY_DEFAULT_v = VERBOSITY_DEFAULT | (VERBOSITY_DEFAULT << 1), VERBOSITY_SHOWTIME = 1 << 4, VERBOSITY_COPYFROM = 1 << 5, VERBOSITY_TOP_URL = 1 << 6, VERBOSITY_GROUP = 1 << 7, VERBOSITY_ALL_URLS = 1 << 8, VERBOSITY_STACKTRACE = 1 << 16 } |
List of constants for \ref o_conflict option. | |
enum | opt__conflict_e { CONFLICT_STOP = 0, CONFLICT_LOCAL, CONFLICT_REMOTE, CONFLICT_BOTH, CONFLICT_MERGE } |
Functions | |
static unsigned | opt__verbosity () |
static int | opt__is_verbose (void) |
Greater than zero if additional details are wanted, or negative for quiet operation. | |
Variables | |
work_t | opt__work |
For showing/changing options. | |
List of priority levels for settings loading. | |
| |
#define | OPT__MAX_LINE_LEN (512) |
Maximum length of a line in a settings file. | |
enum | opt__prio_e { PRIO_DEFAULT = 0, PRIO_ETC_FILE, PRIO_USER_FILE, PRIO_ETC_WC, PRIO_USER_WC, PRIO_ENV, PRIO_PRE_CMDLINE, PRIO_CMDLINE, PRIO_MUSTHAVE } |
typedef int( | opt___parse_t )(struct opt__list_t *, char *, enum opt__prio_e) |
An option string parsing function. | |
struct opt__list_t | opt__list [OPT__COUNT] |
The list of all options. | |
static | __attribute__ ((const)) FASTCALL int opt__get_int(enum opt__settings_e which) |
Read the integer value of an option. | |
static FASTCALL void | opt__set_int (enum opt__settings_e which, enum opt__prio_e prio, int val) |
Set the integer value of an option. | |
static FASTCALL void | opt__set_string (enum opt__settings_e which, enum opt__prio_e prio, char *stg) |
Set the string value of an option. | |
int | opt__parse_option (enum opt__settings_e which, enum opt__prio_e prio, char *string) |
Parse the string for the option. | |
int | opt__parse (char *key, char *value, enum opt__prio_e prio, int quiet_errors) |
Find the option, and parse the string. | |
int | opt__load_env (char **env) |
Load options from the environment. | |
int | opt__load_settings (char *path, char *name, enum opt__prio_e prio) |
Load options from a file. | |
int | opt__doesnt_say_off (const char *string) |
Returns 0 if the string is an off value (like off , false , or no ). | |
char * | opt__variable_from_option (enum opt__settings_e which) |
Return the variable name from an option. |
Functions dealing with user settings.
Definition in file options.h.
#define FILTER__ALL (-1) |
Filter value to print all entries.
Definition at line 372 of file options.h.
Referenced by main(), ops__calc_filter_bit(), and waa__find_common_base2().
#define OPT__MAX_LINE_LEN (512) |
#define OPT__NO (0) |
Definition at line 377 of file options.h.
Referenced by ci__work().
#define OPT__YES (1) |
Generic yes/no/auto config values.
Definition at line 376 of file options.h.
Referenced by opt__doesnt_say_off(), and waa___recurse_tree().
typedef int( opt___parse_t)(struct opt__list_t *, char *, enum opt__prio_e) |
enum opt__chcheck_e |
enum opt__conflict_e |
enum opt__delay_e |
enum opt__prio_e |
enum opt__settings_e |
OPT__PATH |
Option how paths should be shown. See also opt_paths_t and Displaying paths. |
OPT__LOG_MAXREV |
The maximum number of revisions on |
OPT__LOG_OUTPUT |
The option bits for log output. |
OPT__COLORDIFF |
Whether to pipe to colordiff. Currently yes/no/auto; possibly path/"auto"/"no"? See Using colordiff. |
OPT__DIR_SORT |
Should directory listings be sorted? See Directory sorting. |
OPT__STATUS_COLOR |
Should the status output be colored? See Using colordiff. |
OPT__STOP_ON_CHANGE |
Stop on change. |
OPT__FILTER |
The filter mask as given with -f. |
OPT__CHANGECHECK |
Whichs change checks to perform, Change detection. |
OPT__ALL_REMOVED |
Whether all removed entries should be printed as removed, or only the base directory. |
OPT__VERBOSE |
Verbosity flags, see Verbosity flags. |
OPT__DEBUG_OUTPUT |
Path for debug output. |
OPT__DEBUG_BUFFER |
Size of debug buffer. |
OPT__GROUP_STATS |
Show grouping statistics. |
OPT__CONFLICT |
How conflicts on update should be handled. |
OPT__MERGE_OPT |
Default options for the merge program. |
OPT__MERGE_PRG |
Name of the merge binary to be used. |
OPT__DIFF_PRG |
Which program should be called. |
OPT__DIFF_OPT |
Default options for the diff program. |
OPT__DIFF_EXTRA |
Extra options for the diff program. |
OPT__WARNINGS |
Set warning levels. |
OPT__SOFTROOT |
WAA root directory; per definition no PATH_SEPARATOR at the end. |
OPT__COMMIT_TO |
Which URL to commit to. |
OPT__EMPTY_MESSAGE |
Whether an empty commit message is allowed. |
OPT__MKDIR_BASE |
Whether the base directory in the repos should be created, if it does not already. |
OPT__AUTHOR |
The author for commit. See Author. |
OPT__EMPTY_COMMIT |
Whether commits without changes should be done. See Doing empty commits. |
OPT__DELAY |
Should commit wait for the next full second? If shells would export See Waiting for a time change after working copy operations. |
OPT__COPYFROM_EXP |
Do expensive copyfrom checks? See Avoiding expensive compares on copyfrom-detect. |
OPT__WAA_PATH |
The base path of the WAA. See o_waa. |
OPT__CONF_PATH |
The base path of the configuration area. |
OPT__CONFIG_DIR |
The config directory to use. |
OPT__COUNT |
End of enum marker. |
enum opt__verbosity_e |
enum opt_paths_t |
static __attribute__ | ( | (const) | ) | [inline, static] |
Read the integer value of an option.
Get the priority for an option.
Read the string value of an option.
Definition at line 211 of file options.h.
References opt__list, and opt__list_t::prio.
int opt__doesnt_say_off | ( | const char * | string | ) |
Returns 0
if the string is an off value (like off
, false
, or no
).
Returns 0
if the string is an off value (like off
, false
, or no
).
Invalid values are handled by returning 1
, ie. they don't say off
.
Definition at line 723 of file options.c.
References opt___find_string(), and OPT__YES.
Referenced by df__work().
static int opt__is_verbose | ( | void | ) | [inline, static] |
Greater than zero if additional details are wanted, or negative for quiet operation.
Definition at line 351 of file options.h.
References opt__verbosity(), and VERBOSITY_DEFAULT.
Referenced by _STOP(), cm___dump_list(), cm___match(), cm__detect(), cm__work(), delay__work(), df___direct_diff(), df__do_diff(), ign___test_all_patterns(), ign___test_single_pattern(), ign__print_group_stats(), ign__work(), log__work(), prp__l_work(), st___meta_string(), st__print_status(), url___dump(), url__work(), Version(), and wa__warn().
int opt__load_env | ( | char ** | env | ) |
Load options from the environment.
Load options from the environment.
Looks for environment variables with the given ENV_PREFIX
, and tries to parse them as options.
Invalid names are ignored, invalid values not.
Definition at line 652 of file options.c.
References DEBUGP, ENV_PREFIX, opt__parse(), PRIO_ENV, and STOPIF.
Referenced by main().
int opt__load_settings | ( | char * | path, | |
char * | name, | |||
enum opt__prio_e | prio | |||
) |
Load options from a file.
Will use hlp__vpathcopy(), with parameters swapped (prio first).
Load options from a file.
Ignores empty lines; comment lines are defined by an #
as first non-whitespace character.
Definition at line 591 of file options.c.
References DEBUGP, hlp__string_from_filep(), opt__parse(), SFF_COMMENT, SFF_GET_LINENUM, SFF_RESET_LINENUM, SFF_WHITESPACE, and STOPIF.
Referenced by main(), and waa__find_common_base2().
int opt__parse | ( | char * | key, | |
char * | value, | |||
enum opt__prio_e | prio, | |||
int | quiet_errors | |||
) |
Find the option, and parse the string.
Find the option, and parse the string.
If the value is NULL
, try to split the key on a =
. Then find the matching option, and set its value (depending on the given priority).
Definition at line 536 of file options.c.
References DEBUGP, hlp__skip_ws(), hlp__strncmp_uline_eq_dash(), opt__list_t::name, OPT__COUNT, opt__parse_option(), STOPIF, and STOPIF_CODE_ERR.
Referenced by main(), opt__load_env(), and opt__load_settings().
int opt__parse_option | ( | enum opt__settings_e | which, | |
enum opt__prio_e | prio, | |||
char * | string | |||
) |
Parse the string for the option.
Parse the string for the option.
If the given priority is at least equal to the current value, parse the strng and set the value.
Definition at line 509 of file options.c.
References hlp__skip_ws(), opt__list_t::name, opt__list_t::parse, opt__list_t::prio, and STOPIF.
Referenced by main(), and opt__parse().
static FASTCALL void opt__set_int | ( | enum opt__settings_e | which, | |
enum opt__prio_e | prio, | |||
int | val | |||
) | [inline, static] |
Set the integer value of an option.
Definition at line 219 of file options.h.
References opt__list_t::i_val, opt__list, and opt__list_t::prio.
Referenced by _DEBUGP(), ci__work(), cm__detect(), delay__work(), ign__work(), info__work(), log__work(), main(), sigUSR1(), sigUSR2(), up__work(), waa___init_path(), waa__find_common_base2(), and waa__init().
static FASTCALL void opt__set_string | ( | enum opt__settings_e | which, | |
enum opt__prio_e | prio, | |||
char * | stg | |||
) | [inline, static] |
Set the string value of an option.
Will not get modified, unless a reader changes data.
Definition at line 233 of file options.h.
References opt__list_t::cp_val, opt__list, and opt__list_t::prio.
Referenced by main(), and waa__init().
char* opt__variable_from_option | ( | enum opt__settings_e | which | ) |
Return the variable name from an option.
Return the variable name from an option.
getenv()
over all options? Definition at line 737 of file options.c.
References ENV_PREFIX, and opt__list_t::name.
Referenced by waa__init().
static unsigned opt__verbosity | ( | ) | [inline, static] |
Definition at line 341 of file options.h.
References OPT__VERBOSE.
Referenced by ci__callback(), ci__work(), main(), opt__is_verbose(), rev___revert_to_base(), sigUSR1(), sigUSR2(), st__print_status(), sync__work(), and up__work().
struct opt__list_t opt__list[OPT__COUNT] |
The list of all options.
Must be accessible.
The list of all options.
As delimiter should '_'
be used; as the comparision is done via hlp__strncmp_uline_eq_dash(), the user can also use '-'.
Definition at line 192 of file options.c.
Referenced by __attribute__(), opt__set_int(), and opt__set_string().