options.h File Reference

Functions dealing with user settings. More...

#include "global.h"
#include "actions.h"
Include dependency graph for options.h:
This graph shows which files directly or indirectly include this file:

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.

They are ordered for use by "-v"; the later don't matter that much, though.



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.

Detailed Description

Functions dealing with user settings.

Definition in file options.h.


Define Documentation

#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)

Maximum length of a line in a settings file.

Definition at line 255 of file options.h.

#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 Documentation

typedef int( opt___parse_t)(struct opt__list_t *, char *, enum opt__prio_e)

An option string parsing function.

Definition at line 169 of file options.h.


Enumeration Type Documentation

Enumerator:
CHCHECK_NONE 
CHCHECK_FILE 
CHCHECK_DIRS 
CHCHECK_ALLFILES 

Definition at line 302 of file options.h.

Enumerator:
CONFLICT_STOP 
CONFLICT_LOCAL 
CONFLICT_REMOTE 
CONFLICT_BOTH 
CONFLICT_MERGE 

Definition at line 361 of file options.h.

Enumerator:
DELAY_CHECKOUT 
DELAY_COMMIT 
DELAY_UPDATE 
DELAY_REVERT 

Definition at line 291 of file options.h.

Enumerator:
PRIO_DEFAULT 

Default value in program.

PRIO_ETC_FILE 

Value from /etc/fsvs/config, or at least from $FSVS_CONF/config.

PRIO_USER_FILE 

Value read from ~/.fsvs/config.

PRIO_ETC_WC 

Value read from $FSVS_CONF/$wc_dir/Config.

PRIO_USER_WC 

Value read from ~/$wc_dir/Config.

PRIO_ENV 

Value read from environment variable.

PRIO_PRE_CMDLINE 

Value assumed from external state, but overrideable.

Example: colors for log output; should not be printed when redirected into a file, except if explicitly told so on the command line.

PRIO_CMDLINE 

Value given on commandline.

PRIO_MUSTHAVE 

Internal requirement.

Definition at line 140 of file options.h.

Enumerator:
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 log output.

See "fsvs log" revision limit.

OPT__LOG_OUTPUT 

The option bits for log output.

See "fsvs log" output format.

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.

See Checking for changes in a script

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.

See -d and -D -- debugging.

OPT__DEBUG_BUFFER 

Size of debug buffer.

See -d and -D -- debugging.

OPT__GROUP_STATS 

Show grouping statistics.

See Getting grouping/ignore statistics.

OPT__CONFLICT 

How conflicts on update should be handled.

See How to resolve conflicts on update.

OPT__MERGE_OPT 

Default options for the merge program.

See Options regarding the "merge" program.

OPT__MERGE_PRG 

Name of the merge binary to be used.

See Options regarding the "merge" program.

OPT__DIFF_PRG 

Which program should be called.

See Options relating to the "diff" action.

OPT__DIFF_OPT 

Default options for the diff program.

See Options relating to the "diff" action.

OPT__DIFF_EXTRA 

Extra options for the diff program.

See Options relating to the "diff" action.

OPT__WARNINGS 

Set warning levels.

See Setting warning behaviour

OPT__SOFTROOT 

WAA root directory; per definition no PATH_SEPARATOR at the end.

See Using an alternate root directory.

OPT__COMMIT_TO 

Which URL to commit to.

See Destination URL for commit.

OPT__EMPTY_MESSAGE 

Whether an empty commit message is allowed.

See Avoid commits without a commit message.

OPT__MKDIR_BASE 

Whether the base directory in the repos should be created, if it does not already.

See Creating directories in the repository above the URL.

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 $- we could do an auto value as well.

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.

See Path definitions for the config and WAA area.

OPT__CONFIG_DIR 

The config directory to use.

See Configuration directory for the subversion libraries.

OPT__COUNT 

End of enum marker.

Definition at line 23 of file options.h.

Enumerator:
VERBOSITY_VERYQUIET 
VERBOSITY_QUIET 
VERBOSITY_SHOWCHG 
VERBOSITY_SHOWSIZE 
VERBOSITY_SHOWNAME 
VERBOSITY_DEFAULT 
VERBOSITY_DEFAULT_v 
VERBOSITY_SHOWTIME 
VERBOSITY_COPYFROM 
VERBOSITY_TOP_URL 
VERBOSITY_GROUP 
VERBOSITY_ALL_URLS 
VERBOSITY_STACKTRACE 

Definition at line 315 of file options.h.

Path-printing enumeration.

Enumerator:
PATH_WCRELATIVE 

pd_wcroot

PATH_PARMRELATIVE 

pd_parm

PATH_ABSOLUTE 

pd_absolute

PATH_CACHEDENVIRON 

pd_env

PATH_FULLENVIRON 

pd_env

Definition at line 274 of file options.h.


Function Documentation

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

char* opt__variable_from_option ( enum opt__settings_e  which  ) 

Return the variable name from an option.

Return the variable name from an option.

Todo:
Maybe the variable reading should be changed to use this code, and loop via getenv() over all options?

Definition at line 737 of file options.c.

References ENV_PREFIX, and opt__list_t::name.

Referenced by waa__init().

Here is the caller graph for this function:

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().

Here is the caller graph for this function:


Variable Documentation

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().

For showing/changing options.

Definition at line 383 of file options.h.


Generated for fsvs by  doxygen 1.6.1