lsg.c: Make the output of lopsubgen reproducible.
[lopsub.git] / lopsub.7.m4
1 .\" groff -m man -Thtml <file>
2 .\" See groff_www(7), groff(7) and groff_man(7)
3
4 .\" save current font, switch to monospace font, output, switch back
5 .de MONO
6 .nr mE \\n(.f
7 .ft CW
8 \\$*
9 .ft \\n(mE
10 ..
11
12 .\" make text on the same line appear alternately in monospace and roman
13 .de MONO_ROMAN
14 . if \\n[.$] \{\
15 . ds an-result \&\f[CW]\\$1\f[R]\"
16 . shift
17 . while (\\n[.$] >= 2) \{\
18 . as an-result \/\\$1\f[CW]\,\\$2\f[R]\"
19 . shift 2
20 . \}
21 . if \\n[.$] .as an-result \/\\$1\"
22 \\*[an-result]
23 . ft R
24 . \}
25 ..
26
27 . if !'\*(.T'html' \
28 . do ftr CW I
29 . \}
30
31 .TH lopsub 7 "DATE()" GIT_VERSION()
32 .SH NAME
33 lopsub \- Long option parser for subcommands
34
35 .SH About
36
37 .B Lopsub
38 is an open source library written in
39 .B C
40 which aims to ease the task of creating, documenting and parsing
41 the options of Unix command line utilities. It is suitable for
42 simple commands as well as complex command line utilities with many
43 subcommands where each subcommand has its own set of options. Options
44 and documentation are kept together in a single file which can be
45 translated to
46 .B C
47 code (to be included in the application), or to a manual page.
48 The library supports single-character short options and GNU-style
49 long options. The public API is well documented and stable.
50
51 To make use of the library, the programmer provides a so-called
52 .I suite file
53 which describes the options of the application in an intuitive
54 syntax. At build time the suite file is translated into
55 .B C
56 code by the
57 .MONO lopsubgen
58 utility which also ships with the
59 .B lopsub
60 package. The generated code defines an instance of an opaque
61 .B C
62 structure and exposes a reference to this structure which can be passed to
63 the
64 .I option parser
65 at run time, together with the usual argument vector. The
66 option parser is part of the
67 .B lopsub
68 .IR library ,
69 so applications need to link with
70 .MONO_ROMAN -llopsub .
71 In addition to the option parser, the library offers many more
72 features. For example, there is a function for merging two different
73 .I parse results
74 to generate an effective configuration. This is useful for applications
75 which can be configured through command line options and via a
76 config file.
77
78 The suite file can also be processed into roff format to create
79 a manual page. Conversion into html can easily be performed with
80 tools like
81 .MONO grohtml
82 (part of
83 .BR "GNU roff" )
84 or
85 .MONO_ROMAN man2html .
86
87 .B Lopsub
88 does not rely on the system's
89 .MONO getopt()
90 or
91 .MONO getopt_long()
92 functions of the C library and is thus portable across different
93 flavors of Unix. It is known to work on
94 .BR Linux ,
95 .B NetBSD
96 and
97 .BR FreeBSD .
98
99 .SH License
100 The
101 .B lopsub library
102 is licensed under the
103 .B LGPLv3
104 while the
105 .MONO lopsubgen
106 utility is licensed under the
107 .BR GPLv3 .
108 The examples and all code generated by the utilities, however, is
109 licensed under the public domain. You are free to do anything you
110 like with the generated code, including incorporating it into or
111 linking it with proprietary software.
112
113 .SH Quick Start
114 Compile and run the minimal example included at the end of
115 .UR ./lopsub-suite.5.html
116 lopsub-suite(5)
117 .UE .
118 Examine
119 .MONO lopsubex.c
120 and
121 .MONO lopsubex.suite
122 in the source tree and run the
123 .MONO lopsubex
124 command.
125
126 .SH API documentation
127 See
128 .UR ./lopsub-api.html
129 .UE .
130 Alternatively, examine
131 .MONO lopsub.h
132 or
133 .MONO_ROMAN lopsub.h.m4 .
134
135 .SH Resources
136
137 \(bu
138 git clone URL:
139 .UR git://git.tuebingen.mpg.de/lopsub.git
140 .UE
141
142 \(bu
143 gitweb:
144 .UR http://git.tuebingen.mpg.de/lopsub.git
145 .UE
146
147 \(bu
148 The author's homepage:
149 .UR http://people.tuebingen.mpg.de/maan/
150 .UE
151
152 \(bu
153 Send feedback to
154 .MT maan@tuebingen.mpg.de
155 Andre Noll
156 .ME
157