tipidee
Software
skarnet.org
The tipidee-config-preprocess internal program
tipidee-config-preprocess is a tool that reads a line-based
configuration file like tipidee.conf
containing !include, !includedir and !included:
directives, and preprocesses it, replacing the lines where these directive
appear with the full contents of included files where appropriate.
tipidee-config-preprocess is not supposed to be invoked
directly by the user. It is automatically invoked by the
tipidee-config program.
Interface
tipidee-config-preprocess file
- tipidee-config-preprocess reads file and
writes its contents to stdout.
- If file contains a line starting with !included:,
this line is not printed.
- If file contains a line starting with !include or
!includedir, this line is replaced with the contents of
appropriately included files.
- tipidee-config-preprocess then exits 0.
Exit codes
If tipidee-config-preprocess exits nonzero,
tipidee-config will immediately exit
with the same error code.
- 0
- success
- 1
- syntax error
- 2
- invalid inclusion (cycle or unauthorized duplicate)
- 100
- wrong usage
- 111
- system call failed
Detailed operation
- tipidee-config-preprocess reads file, looking for lines
that start with a ! (bang). It prints other lines as is to its
stdout.
- A line that starts with ! is not printed. Instead, it
is parsed for an !include, !includedir or !included:
directive.
- !included: directives immediately inform the file currently
being preprocessed.
- !include foo and !includedir bar
directives cause tipidee-config-preprocess to immediately start preprocessing
file foo or all files in directory bar; this can happen
recursively. When it's done preprocessing foo or bar,
tipidee-config-preprocess resumes its current file where it had left it.
- Around inclusions, tipidee-config-preprocess prints special lines
starting with a single ! (bang) and containing line and file
information. This helps tipidee-config
track which file the data it's reading comes from and accurately report
errors.
Notes
- tipidee-config-preprocess does not know anything about the
/etc/tipidee.conf file format.
It was purposefully written to be generic: it only reads lines and
includes files based on !include information, and inserts
! lines into the output stream to help with error reporting.
It can be used as a preprocessor for other tools.