Classes | Macros | Enumerations | Functions | Variables
CONF: Configuration handling

Location of configfile: $XDG_CONFIG_HOME/$CFG_NAME/configfile. More...

Classes

union  conf_entry_val
 Configuration array entry value. More...
 
struct  conf
 Configuration array entry. More...
 

Macros

#define MAIN_ERR_PREFIX   "CONF: "
 Message prefix for CONF module.
 
#define CONF_PERM   (posix_mode_t) (POSIX_S_IRUSR | POSIX_S_IWUSR)
 Permissions for config file.
 
#define CONF_NUM   57
 Number of entries in global configuration array.
 

Enumerations

enum  conf_entry {
  CONF_POS_X = 0, CONF_POS_Y = 1, CONF_SIZE_X = 2, CONF_SIZE_Y = 3,
  CONF_TILE_X = 4, CONF_TILE_Y = 5, CONF_SERVER = 6, CONF_SERVICE = 7,
  CONF_ENC = 8, CONF_AUTH = 9, CONF_IMMEDAUTH = 10, CONF_USER = 11,
  CONF_PASS = 12, CONF_CAC = 13, CONF_FROM = 14, CONF_REPLYTO = 15,
  CONF_FQDN = 16, CONF_NEWSRC = 17, CONF_SCORERC = 18, CONF_INTRO = 19,
  CONF_ORGANIZATION = 20, CONF_TVIEW = 21, CONF_ONLYUR = 22, CONF_CANCELKEY = 23,
  CONF_EDITOR = 24, CONF_PPROC = 25, CONF_INEWS = 26, CONF_QUOTESTYLE = 27,
  CONF_QUOTEUNIFY = 28, CONF_TESTGRP_ERE = 29, CONF_TESTGRP_KWORDS = 30, CONF_TLS_OWNCERTS = 31,
  CONF_CRL_CHECK = 32, CONF_CRL_UPD_IV = 33, CONF_CRL_UPD_TS = 34, CONF_CRL_UPD_C = 35,
  CONF_UTVIEW_AN = 36, CONF_INV_ORDER = 37, CONF_NO_OVER = 38, CONF_DIST_SUGG = 39,
  CONF_COMPRESSION = 40, CONF_SIGFILE = 41, CONF_TS_LTIME = 42, CONF_TS_COMMENT = 43,
  CONF_FLOWED_CRLF = 44, CONF_FORCE_UNICODE = 45, CONF_SEARCH_CASE_IS = 46, CONF_ENABLE_UAGENT = 47,
  CONF_INITIAL_GREETING = 48, CONF_REFRESH_INTERVAL = 49, CONF_UNREAD_IN_NEXT_GROUP = 50, CONF_COLOR_SIGNATURE = 51,
  CONF_COLOR_EXTERNAL = 52, CONF_COLOR_LEVEL1 = 53, CONF_COLOR_LEVEL2 = 54, CONF_COLOR_LEVEL3 = 55,
  CONF_COLOR_LEVEL4 = 56
}
 IDs for use as index in configuration array. More...
 
enum  conf_entry_type { CONF_TYPE_INT, CONF_TYPE_STRING }
 Data types of configuration array entries. More...
 

Functions

void conf_delete (struct conf *cfg)
 Delete configuration. More...
 
int conf_load (struct conf *cfg)
 Load configuration from config file. More...
 
int conf_store (struct conf *cfg)
 Store configuration to config file. More...
 
int conf_string_replace (struct conf *cfg, const char *s)
 Replace configuration string. More...
 
int conf_integer_check (enum conf_entry id, int min, int max)
 Check integer value against lower and upper bounds. More...
 

Variables

struct conf config [CONF_NUM]
 Global configuration. More...
 
int conf_ephemeral_passwd = 0
 Flag indicating that password should not be stored in configfile. More...
 

Detailed Description

Location of configfile: $XDG_CONFIG_HOME/$CFG_NAME/configfile.

Any line starting with # is treated as a comment (not parsed and ignored).

To add a new entry:

Enumeration Type Documentation

◆ conf_entry

enum conf_entry

IDs for use as index in configuration array.

Attention
Don't forget to modify the number of entries CONF_NUM after adding or removing a configuration entry!
Note
A C90 compiler is required to assign the values starting from zero without holes by default. We force the default behaviour explicitly only to make it more obvious for humans what values are used.
Enumerator
CONF_POS_X 

Main window X position

CONF_POS_Y 

Main window Y position

CONF_SIZE_X 

Main window X size

CONF_SIZE_Y 

Main window Y size

CONF_TILE_X 

Main window X tiling

CONF_TILE_Y 

Main window Y tiling

CONF_SERVER 

NNTP server hostname or IP address

CONF_SERVICE 

NNTP service name or TCP port

CONF_ENC 

NNTP connection encryption algorithm

CONF_AUTH 

NNTP server authentication algorithm

CONF_IMMEDAUTH 

Flag for immediate authentication

CONF_USER 

NNTP server authentication account

CONF_PASS 

NNTP server authentication password

CONF_CAC 

Clamp article count to this value

CONF_FROM 

"From" name and E-Mail address

CONF_REPLYTO 

"Reply-To" name and E-Mail address

CONF_FQDN 

Fully qualified domain name (FQDN)

CONF_NEWSRC 

Pathname of shared newsrc file

CONF_SCORERC 

Pathname of shared scorerc file

CONF_INTRO 

Introduction line format

CONF_ORGANIZATION 

Organization name poster is part of

CONF_TVIEW 

Flag for threaded view

CONF_ONLYUR 

Flag for only unread articles

CONF_CANCELKEY 

Secret for Cancel-Key

CONF_EDITOR 

Pathname of external editor

CONF_PPROC 

Pathname of external postprocessor

CONF_INEWS 

Pathname of external inews

CONF_QUOTESTYLE 

Quoting style (for citation)

CONF_QUOTEUNIFY 

Unification of quoting style

CONF_TESTGRP_ERE 

ERE pattern to match test groups

CONF_TESTGRP_KWORDS 

Keywords to set for test groups

CONF_TLS_OWNCERTS 

Use local TLS root certificates

CONF_CRL_CHECK 

Use TLS certificate CRL check

CONF_CRL_UPD_IV 

TLS certificate CRL update interval

CONF_CRL_UPD_TS 

TLS certificate CRL update timestamp

CONF_CRL_UPD_C 

TLS certificate CRL update choice

CONF_UTVIEW_AN 

Sort unthreaded view by article num.

CONF_INV_ORDER 

Sort articles with inverted order

CONF_NO_OVER 

NNTP driver doesn't use overview

CONF_DIST_SUGG 

Use distribution suggestions

CONF_COMPRESSION 

NNTP driver negotiates compression

CONF_SIGFILE 

Signature file

CONF_TS_LTIME 

Use local time for timestamps

CONF_TS_COMMENT 

Generate timestamps with TZ comment

CONF_FLOWED_CRLF 

Generate empty line after paragraphs

CONF_FORCE_UNICODE 

Force Unicode for outgoing articles

CONF_SEARCH_CASE_IS 

Search case-insensitive

CONF_ENABLE_UAGENT 

Enable User-Agent header field

CONF_INITIAL_GREETING 

Initial greeting phrase

CONF_REFRESH_INTERVAL 

Group list refresh interval

CONF_UNREAD_IN_NEXT_GROUP 

Skip to next group for unread article

CONF_COLOR_SIGNATURE 

Signature color

CONF_COLOR_EXTERNAL 

External citation color

CONF_COLOR_LEVEL1 

Citation color level 1

CONF_COLOR_LEVEL2 

Citation color level 2

CONF_COLOR_LEVEL3 

Citation color level 3

CONF_COLOR_LEVEL4 

Citation color level 4

Definition at line 30 of file conf.h.

◆ conf_entry_type

Data types of configuration array entries.

Enumerator
CONF_TYPE_INT 

Entry is of integer type

CONF_TYPE_STRING 

Entry is of string type

Definition at line 93 of file conf.h.

Function Documentation

◆ conf_delete()

void conf_delete ( struct conf cfg)

Delete configuration.

This function will free the memory allocated for the configuration array entries with string type.

Parameters
[in]cfgPointer to configuration array

Definition at line 726 of file conf.c.

Referenced by conf_load().

◆ conf_integer_check()

int conf_integer_check ( enum conf_entry  id,
int  min,
int  max 
)

Check integer value against lower and upper bounds.

Parameters
[in]idID of integer value to check
[in]minLower limit
[in]maxUpper limit
Attention
The parameter id must be associated with an integer value!

The integer value associated with id is compared against the specified limits.
If the value is lower than min or greater than max , it is clamped to the limits. Otherwise the value is unchanged.

Returns
  • New value

Definition at line 958 of file conf.c.

References config, conf_entry_val::i, and conf::val.

◆ conf_load()

int conf_load ( struct conf cfg)

Load configuration from config file.

Parameters
[in]cfgPointer to configuration array

For configuration entries with string type, this function allocates memory. On success the caller is responsible to free this memory with the function conf_delete() .

Returns
  • 0 on success
  • Negative value on error

Definition at line 762 of file conf.c.

References conf_delete().

◆ conf_store()

int conf_store ( struct conf cfg)

Store configuration to config file.

Parameters
[in]cfgPointer to configuration array
Returns
  • 0 on success
  • Negative value on error

Definition at line 818 of file conf.c.

◆ conf_string_replace()

int conf_string_replace ( struct conf cfg,
const char *  s 
)

Replace configuration string.

Parameters
[in]cfgPointer to configuration array entry
[in]sPointer to new string

cfg must point to a configuration entry of string type. The current string will be replaced with s .

Returns
  • 0 on success
  • Negative value on error

Definition at line 912 of file conf.c.

References CONF_TYPE_STRING, conf_entry_val::s, secure_clear_string(), conf::type, and conf::val.

Variable Documentation

◆ conf_ephemeral_passwd

int conf_ephemeral_passwd = 0

Flag indicating that password should not be stored in configfile.

If this flag is nonzero a call to conf_store() will delete the password from the configuration before writing it to disk.

Definition at line 70 of file conf.c.

◆ config

struct conf config[CONF_NUM]

Generated at 2024-04-27 using  doxygen