summaryrefslogtreecommitdiff
path: root/doc/tipidee-config-preprocess.html
blob: 9b6ea3807bc332ec02a4ae5058be4f93eff15038 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<html>
  <head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta http-equiv="Content-Language" content="en" />
    <title>tipidee: the tipidee-config-preprocess internal program</title>
    <meta name="Description" content="tipidee: the tipidee-config-preprocess internal program" />
    <meta name="Keywords" content="tipidee tipidee web server configuration text compilation preprocessing internal libexec preprocessor include" />
    <!-- <link rel="stylesheet" type="text/css" href="//skarnet.org/default.css" /> -->
  </head>
<body>

<p>
<a href="index.html">tipidee</a><br />
<a href="//skarnet.org/software/">Software</a><br />
<a href="//skarnet.org/">skarnet.org</a>
</p>

<h1> The <tt>tipidee-config-preprocess</tt> internal program </h1>

<p>
 <tt>tipidee-config-preprocess</tt> is a tool that reads a line-based
configuration file like <a href="tipidee.conf.html">tipidee.conf</a>
containing <tt>!include</tt>, <tt>!includedir</tt> and <tt>!included:</tt>
directives, and preprocesses it, replacing the lines where these directive
appear with the full contents of included files where appropriate.
</p>

<p>
 <tt>tipidee-config-preprocess</tt> is not supposed to be invoked
directly by the user. It is automatically invoked by the
<a href="tipidee-config.html">tipidee-config</a> program.
</p>

<h2> Interface </h2>

<pre>
     tipidee-config-preprocess <em>file</em>
</pre>

<ul>
 <li> tipidee-config-preprocess reads <em>file</em> and
writes its contents to stdout. </li>
 <li> If <em>file</em> contains a line starting with <tt>!included:</tt>,
this line is not printed. </li>
 <li> If <em>file</em> contains a line starting with <tt>!include</tt> or
<tt>!includedir</tt>, this line is replaced with the contents of
appropriately included files. </li>
 <li> tipidee-config-preprocess then exits 0. </li>
</ul>

<h2> Exit codes </h2>

<p>
If tipidee-config-preprocess exits nonzero, 
<a href="tipidee-config.html">tipidee-config</a> will immediately exit
with the same error code.
</p>

<dl>
 <dt> 0 </dt> <dd> success </dd>
 <dt> 1 </dt> <dd> syntax error </dd>
 <dt> 2 </dt> <dd> invalid inclusion (cycle or unauthorized duplicate) </dd>
 <dt> 100 </dt> <dd> wrong usage </dd>
 <dt> 111 </dt> <dd> system call failed </dd>
</dl>

<h2> Detailed operation </h2>

<ul>
 <li> tipidee-config-preprocess reads <em>file</em>, looking for lines
that start with a <tt>!</tt> (bang). It prints other lines as is to its
stdout. </li>
 <li> A line that starts with <tt>!</tt> is not printed. Instead, it
is parsed for an <tt>!include</tt>, <tt>!includedir</tt> or <tt>!included:</tt>
directive. </li>
 <li> <tt>!included:</tt> directives immediately inform the file currently
being preprocessed. </li>
 <li> <tt>!include <em>foo</em></tt> and <tt>!includedir <em>bar</em></tt>
directives cause tipidee-config-preprocess to immediately start preprocessing
file <em>foo</em> or all files in directory <em>bar</em>; this can happen
recursively. When it's done preprocessing <em>foo</em> or <em>bar</em>,
tipidee-config-preprocess resumes its current file where it had left it. </li>
 <li> Around inclusions, tipidee-config-preprocess prints special lines
starting with a single <tt>!</tt> (bang) and containing line and file
information. This helps <a href="tipidee-config.html">tipidee-config</a>
track which file the data it's reading comes from and accurately report
errors. </li>
</ul>

<h2> Notes </h2>

<ul>
 <li> tipidee-config-preprocess does not know anything about the
<a href="tipidee.conf.html"><tt>/etc/tipidee.conf</tt></a> file format.
It was purposefully written to be generic: it only reads lines and
includes files based on <tt>!include</tt> information, and inserts
<tt>!</tt> lines into the output stream to help with error reporting.
It can be used as a preprocessor for other tools. </li>
</ul>

</body>
</html>