Menu

Preferences

Dirk Krause
← Previous ↑ Home ↑ Administration Next →

Preferences

Overview

Preferences are key/value pairs consisting of text strings.

They are stored in text files named "dk4pref.conf" (DK libraries version 4) or "dk3pref.conf" (version 3). The files can be placed in several subdirectories of the system configuration directory, the shared data directory or the users home directory.

In version 4 the preference name components are separated by dot (i.e. "log.stderr.level"), in version 3 they were separated by slash (i.e. "/log/stderr/level").

For backward compatibility version 4 programs also check for "dk3pref.conf" files and convert the preferences found there to dot separated names. So you can use one preferences file to configure both version 3 and version 4 programs.

Preferences can be overwritten on the command line, use i.e. "--log.stderr.level=progress" for an application using version 4 libraries like bitmap2pp or "--/log/stderr/level=progress" for an application using version 3 libraries like fig2lat.


Search order

Directories marked in red are subject to package management. Do not modify files in these directories or add files. Changes you make here may be overwritten without notice during package updates or may result in package installation conflicts.
Directories marked in blue are places for system-wide setup. Create the directories if necessary.
Directories marked in green are places for per-user configuration.

The group is dktools for all the programs from DK tools. Authors using DK libraries in their programs should use another group name, typically indicating the project name.
Replace program by the name of a specific program you want to configure.

  • ${datadir}/dk3app/dk3pref.conf
  • ${datadir}/dk4app/dk4pref.conf
  • ${sysconfdir}/dk3app/dk3pref.conf
  • ${sysconfdir}/dk4app/dk4pref.conf
  • ${datadir}/dk3app-site/dk3pref.conf
  • ${datadir}/dk4app-site/dk4pref.conf
  • ${sysconfdir}/dk3app-site/dk3pref.conf
  • ${sysconfdir}/dk4app-site/dk4pref.conf
  • ${datadir}/group/dk3pref.conf
  • ${datadir}/group/dk4pref.conf
  • ${sysconfdir}/group/dk3pref.conf
  • ${sysconfdir}/group/dk4pref.conf
  • ${datadir}/group-site/dk3pref.conf
  • ${datadir}/group-site/dk4pref.conf
  • ${sysconfdir}/group-site/dk3pref.conf
  • ${sysconfdir}/group-site/dk4pref.conf
  • ${datadir}/program/dk3pref.conf
  • ${datadir}/program/dk4pref.conf
  • ${sysconfdir}/program/dk3pref.conf
  • ${sysconfdir}/program/dk4pref.conf
  • ${datadir}/program-site/dk3pref.conf
  • ${datadir}/program-site/dk4pref.conf
  • ${sysconfdir}/program-site/dk3pref.conf
  • ${sysconfdir}/program-site/dk4pref.conf
  • ${HOME}/.dk3app/dk3pref.conf
  • ${HOME}/.dk4app/dk4pref.conf
  • ${HOME}/.dk3app/group/dk3pref.conf
  • ${HOME}/.dk4app/group/dk4pref.conf
  • ${HOME}/.dk3app/program/dk3pref.conf
  • ${HOME}/.dk4app/program/dk4pref.conf
  • ./dk3pref.conf
  • ./dk4pref.conf

All files found are processed cumulatively. Settings processed later overwrite settings from earlier files.
So an administrator can configure general settings or settings relevant only for certain programs or program groups. A user can overwrite the default settings configured by the administrator.

DK tools version 4 programs use both the "dk4pref.conf" and "dk3pref.conf" files, version 3 programs use the "dk3pref.conf" files only.


File format

A preference file may consist of:

  • Empty lines,
  • Comments ("#" at start of line),
  • Scope lines (conditions in square brackets) and
  • Data lines (key/value pairs).

A scope section controls whether the following data lines will be used or ignored. At the beginning of the first scope line in a scope section the scope is turned to "inactive".
The scope is turned to "active" if all conditions in a scope line are true. The scope is turned to "inactive" if the scope is started by a minus sign "-" and all the conditions are true.

The following conditions can be used:

Condition Test
user=string Check user name.
application=string Check program name.
application-group=string Check program group name.
host=string Check host name.
language=string Check language.
region=string Check region.
windows Check whether running on a Windows system, DK tools version 4 only.
non-windows Check whether running on a non-Windows system, DK tools version 4 only.

Example files

Version 4 example file dk4pref.conf

# This is a comment.
# Comments have a raute character # as first character in the line.
# Empty lines are ignored.

# Next we do some setup for all users
[user=*]
log.stderr.level=error

# Next we overwrite this for one user
[user=joe]
log.stderr.level=debug

# Now we overwrite this again for all hosts except the host named "pc0815".
# We first open a new scope and include all hosts, in the next line
# we explicitly exclude one host.
[host=*]
[-host=pc0815]
log.stderr.level=progress

# Now we use an and-combination of conditions
[host=pc0815,user=jim,language=en,region=us,application=jimapp]
log.stderr.level=debug

Version 3 example file dk3pref.conf

# This is a comment.
# Comments have a raute character # as first character in the line.
# Empty lines are ignored.

# Next we do some setup for all users
[user=*]
/log/stderr/level=error

# Next we overwrite this for one user
[user=joe]
/log/stderr/level=debug

# Now we overwrite this again for all hosts except the host named "pc0815".
# We first open a new scope and include all hosts, in the next line
# we explicitly exclude one host.
[host=*]
[-host=pc0815]
/log/stderr/level=progress

# Now we use an and-combination of conditions
[host=pc0815,user=jim,language=en,region=us,application=jimapp]
/log/stderr/level=debug

Known preference names

Preference names for DK libraries version 4

Name Purpose
Internationalization
ui.language Users preferred language in lower case characters, i.e. "de", "en", …
ui.region Users preferred region in lower case characters, i.e. "de", "us", …
ui.lang Language, region and optionally encoding as specified in the LANG environment variable, i.e. "de_DE.UTF-8".
This preference is available for backward compatibility with DK tools version 3. The encoding specified here is ignored.
input.encoding Expected input encoding when processing standard input.
One from:
  • plain
  • win1252
  • utf-8
  • utf-16
    Two variants allow to specify endianness:
    • utf-16-be (big-endian, most significant byte first)
    • utf-16-le (little-endian, least significant byte first)
  • c32
    Two variants allow to specify endianness:
    • c32-be (big-endian)
    • c32-le (little-endian)
input.file.encoding Expected input encoding when processing a file.
dir.charmap Directory containing data files for text to LaTeX conversion.
Supported by dk-t2l, wxd2lat and plpdftex.
Used by the dk4uc2l\_open\_app\_ex1() function in the dk4uc2la module.
Sizes
db.key.max-size Size
Maximum key size for text input.
Supported by dk-dbco.
Used by the dk4dbi\_open\_app() function in the dk4dbia module.
db.value.max-size Size
Maximum key size for text input.
Supported by dk-dbco.
Used by the dk4dbi\_open\_app() function in the dk4dbia module.
Log output
log.stderr.level Log priority required for logging to stderr.
log.stderr.time Boolean, controls whether or not timestamps are shown when logging to stderr.
log.file.level Log priority required for logging to file.
log.file.time Boolean, controls whether or not timestamps are shown when logging to file.
log.file.keep Log priority required for keeping the log file when the program exits.
GUI
window.restore-maximized Restore window in maximized state if it was maximized on previous application exit.
Supported by the GUI applications.
Used by the RestorePosition() method of the Dk4WxFrame class.
window.restore-iconized Restore window in iconized state if it was iconized on previous application exit.
Supported by the GUI applications.
Used by the RestorePosition() method of the Dk4WxFrame class.
window.restore-size Attempt to restore the window size.
Supported by the GUI applications.
Used by the RestorePosition() method of the Dk4WxFrame class.

Preference names for DK libraries version 3

Name Purpose
Internationalization
/ui/lang Language, region and optionally encoding as specified in the LANG environment variable, i.e. "de_DE.UTF-8".
This preference is available for backward compatibility with DK tools version 3. The encoding specified here is ignored.
/input/encoding/stdin Expected input encoding when processing standard input.
One from:
  • plain
  • utf-8
  • utf-16
    Two variants allow to specify endianness:
    • utf-16-be (big-endian, most significant byte first)
    • utf-16-le (little-endian, least significant byte first)
  • c32
    Two variants allow to specify endianness:
    • c32-be (big-endian)
    • c32-le (little-endian)
/input/encoding/file Expected input encoding when processing a file.
/dir/charmap Directory containing data files for text to LaTeX conversion.
Log output
/log/stderr/level Log priority required for logging to stderr.
/log/file/level Log priority required for logging to file.
/log/file/keep Log priority required for keeping the log file when the program exits.

Preferences used by specific programs

Name Purpose
Sizes
line.size Line buffer size in programs processing input line by line.
Supported by dk-fic.
text-db.key.max-size Size
Maximum key size for text input.
Supported by dk-db2t.
text-db.value.max-size Size
Maximum value size for text input.
Supported by dk-db2t.
Message digests
message.digest Default message digest and encoding. Digest type and encoding are separated by a dot. The digest type is one from: "md5", "sha-1", "sha-224", "sha-256", "sha-384", "sha-512", or "ripemd-160". The encoding is one from "hex" (ASCII-Hex encoding) or "a85" (ASCII-85 encoding).
Supported by dk-ls.
Random data generation
rand.egd.name EGD socket name.
Programs using the OpenSSL pseudo random number generator (PRNG) or another PRNG can attempt to seed the PRNG using data from this socket if an entropy gathering daemon (EGD) is running.
The built-in configured sources of entropy are tried first, the EGD socket is only used if the built-in routines failed to seed the PRNG.
If an "EGDSOCKET" environment variable exists the socket specified there is attempted first.
Supported by dk-pwgen, used only if the environment variable EGDSOCKET is not defined or not usable.
Printing
/print/paper-size Name of the default paper size for printing, i.e. "A4" or "Legal". The paper size must be configured in a dk3paper.conf file, see %%a href=admin-paper.html text="dk3paper.conf - Paper sizes" title="Go to "Administration → Configuration files → dk3paper.conf - Paper sizes" page" target=_blank%% (library version 3 only).
Previously supported by bmeps.
/print/ps/level PostScript level, "2" or "3".
Supported by fig2lat.
← Previous ↑ Home ↑ Administration Next →

Related

Wiki: Administration
Wiki: bitmap2pp manual

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.