Initial revision
[cfd] / common.texi
CommitLineData
b91e2391 1\input texinfo.tex @c -*-texinfo-*-
2@c
3@c $Id: common.texi,v 1.1 1999/05/05 19:23:47 mdw Exp $
4@c
5@c Documentation for `common'
6@c
7@c (c) 1997 Mark Wooding
8@c
9
10@c ----- Licensing notice ---------------------------------------------------
11@c
12@c This file is part of the Common Files Distribution (`common').
13@c
14@c `Common' is free software; you can redistribute it and/or modify
15@c it under the terms of the GNU General Public License as published by
16@c the Free Software Foundation; either version 2 of the License, or
17@c (at your option) any later version.
18@c
19@c `Common' is distributed in the hope that it will be useful,
20@c but WITHOUT ANY WARRANTY; without even the implied warranty of
21@c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22@c GNU General Public License for more details.
23@c
24@c You should have received a copy of the GNU General Public License
25@c along with `common'; if not, write to the Free Software Foundation,
26@c Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27
28@c ----- Standard boilerplate header ----------------------------------------
29
30@c --- Formatting header ---
31
32@c %**start of header
33@setfilename common.info
34@settitle The Common Files Distribution
35@paragraphindent 0
36@iftex
37@input texinice
38@afourpaper
39@end iftex
40@include version.texi
41@c %**end of header
42
43@c --- Info directory entry ---
44
45@direntry
46* Common: (common). The Common Files Distribution.
47@end direntry
48
49@c ----- Introductory stuff and copyright pages -----------------------------
50@c
51@c Yes indeed, by the way: I'm willing to allow a translation approved
52@c by the FSF, not me. I can't be bothered to vet translations.
53
54@c --- Info version ---
55
56@ifinfo
57
58This file documents version @value{VERSION} of the Common Files Distribution.
59
60Copyright (c) 1997 Mark Wooding
61
62Permission is granted to make and distribute verbatim copies of this
63manual provided the copyright notice and this permission notice are
64preserved on all copies.
65
66@ignore
67Permission is granted to process this file through TeX and print the
68results, provided the printed document carries a copying permission
69notice identical to this one except for the removal of this paragraph
70(this paragraph not being relevant to the printed manual).
71
72@end ignore
73Permission is granted to copy and distribute modified versions of this
74manual under the conditions for verbatim copying, provided also that the
75sections entitled `Copying' and `GNU General Public License' are
76included exactly as in the original, and provided that the entire
77resulting derived work is distributed under the terms of a permission
78notice identical to this one.
79
80Permission is granted to copy and distribute translations of this manual
81into another language, under the above conditions for modified versions,
82except that this permission notice may be stated in a translation
83approved by the Free Software Foundation.
84
85@end ifinfo
86
87@c --- Printed version ---
88
89@titlepage
90@title The Common Files Distribution
91@subtitle version @value{VERSION}
92@author Mark Wooding
93@page
94@vskip 0pt plus 1 filll
95
96Permission is granted to make and distribute verbatim copies of this
97manual provided the copyright notice and this permission notice are
98preserved on all copies.
99
100Permission is granted to copy and distribute modified versions of this
101manual under the conditions for verbatim copying, provided also that the
102sections entitled `Copying' and `GNU General Public License' are
103included exactly as in the original, and provided that the entire
104resulting derived work is distributed under the terms of a permission
105notice identical to this one.
106
107Permission is granted to copy and distribute translations of this manual
108into another language, under the above conditions for modified versions,
109except that this permission notice may be stated in a translation
110approved by the Free Software Foundation.
111
112@end titlepage
113
114
115@c --------------------------------------------------------------------------
116@ifinfo
117@node Top, Copying, (dir), (dir)
118@unnumbered The Common Files Distribution
119
120
121The Common Files Distribution provides a convenient way to manage files
122shared between a number of developments.
123
124This manual documents version @value{VERSION} of the Common Files
125Distribution.
126
127@end ifinfo
128
129@menu
130* Copying::
131* Introduction::
132* The file repository::
133* Text libraries::
134
135 --- The Detailed Node Listing ---
136
137The file repository
138
139* The mklinks command::
140* The findlinks command::
141
142Text libraries
143
144* Anatomy:: Structure of a text library.
145* The txtlib program::
146@end menu
147
148@c --------------------------------------------------------------------------
149@node Copying, Introduction, Top, Top
150@unnumbered The GNU General Public License
151
152@include gpl.texi
153
154@c --------------------------------------------------------------------------
155@node Introduction, The file repository, Copying, Top
156@unnumbered Introduction
157
158
159When you have a number of development trees, managing files which are common
160to all of them starts to become a real pain. When a new version of some file
161comes out, checking out all your source directories, replacing the old
162version with the new one, and committing all the changes back gets to be
163very tiresome rather quickly.
164
165The Common File Distribution attempts to be a solution to some of the
166problems caused sharing files between source trees. It provides a single
167repository for shared files, and lets you create links to the shared copies
168from your source trees. It also provides a simple method for constructing
169text files from small bits of `text libraries'.
170
171The whole lot is held together by a collection of small shell scripts. They
172can easily be modified to suit the requirements of an individual site, or
173used as the basis of other similar scripts.
174
175
176@c --------------------------------------------------------------------------
177@node The file repository, Text libraries, Introduction, Top
178@chapter The file repository
179
180
181When the Common File Distribution is installed, it creates a repository where
182shared files can be placed, and it places a few standard GNU files there. By
183default, the repository is @file{@var{prefix}/share/common}, although this
184can be set using the @code{--datadir} option to the configuration script.
185
186You can place your own files in the repository if you like. If you do,
187they'll be treated in exactly the same way as ones in the distribution.
188
189The command @code{mklinks} reads a list of filenames and creates symbolic
190links to the corresponding names in the repository. This ensures that when a
191file in the repository gets updated, any source trees automatically use the
192new version. Obviously, when you build a source distribution, you must
193ensure that links are followed, rather than saved as links; the @code{h}
194option to @code{tar} does this (this is the default in Automake; @pxref{Top,
195, Overview, automake, GNU Automake}).
196
197The command @code{findlinks} scans the current directory (and its
198subdirectories) for files whose names match those in the repository.
199
200@menu
201* The mklinks command::
202* The findlinks command::
203@end menu
204
205
206
207@node The mklinks command, The findlinks command, The file repository, The file repository
208@section The @code{mklinks} command
209
210Links into the file repository are made with the @code{mklinks} command:
211
212@example
213mklinks [@var{file}]...
214@end example
215
216If you don't specify any @code{file}s, it reads @file{.links} from the
217current directory; you can pass @samp{-} to read standard input. The program
218expects the files to contain a list of filenames; for each name read, it
219creates a symbolic link to the appropriate file in the repository.
220
221You can create a list of files which probably need linking using the
222@code{findlinks} command. @xref{The findlinks command}.
223
224
225
226@node The findlinks command, , The mklinks command, The file repository
227@section The @code{findlinks} command
228
229The @code{findlinks} searches the current directory and any subdirectories
230and writes to standard output a list of files whose names match files in the
231file repository. It takes no arguments, although typically output will be
232redirected to the file @file{.links}, which the @code{mklinks} command reads
233by default:
234
235@example
236findlinks >.links
237@end example
238
239
240@c --------------------------------------------------------------------------
241@node Text libraries, , The file repository, Top
242@chapter Text libraries
243
244
245Just being able to share files isn't always good enough: it's sometimes
246useful to able to share small parts of files. The Common Files Distribution
247comes with a simple system for extracting requested parts from a @dfn{text
248library}.
249
250
251@menu
252* Anatomy:: Structure of a text library.
253* The txtlib program::
254@end menu
255
256
257
258@node Anatomy, The txtlib program, Text libraries, Text libraries
259@section Anatomy of a library file
260
261Text libraries contain a @dfn{header} followed by a number of @dfn{chunks}.
262The start of a chunk is marked by a line containing a string of the form
263@samp{*@@-@var{name}-@@*}; the chunk continues until the start of the next
264chunk, or the end of the file. The header is simply the text preceding the
265first chunk.
266
267Here's a simple example of a text library.
268
269@example
270% -*-tex-*-
271%
272% Collection of useful macros
273%
274
275% *@@-todo-@@*
276
277\newcommand\todo[1]@{%
278 \par%
279 \dimen@@\linewidth%
280 \advance\dimen@@-\tw@@\fboxsep%
281 \advance\dimen@@-\tw@@\fboxrule%
282 \fbox@{\expandafter\parbox\expandafter@{\the\dimen@@@}@{%
283 \begin@{note@}[To do:]%
284 #1%
285 \end@{note@}%
286 @}@}%
287 \par%
288@}
289
290% *@@-indexing-@@*
291
292\newindex@{default@}@{idx@}@{ind@}@{Index@}
293\atdef^@{\index@}
294\atdef_@{\index*@}
295@end example
296
297The file contains a short header containing a line to tell Emacs what mode
298to use when editing it and a brief description of the file. It contains two
299chunks, named @code{todo} and @code{indexing}
300
301
302@node The txtlib program, , Anatomy, Text libraries
303@section The @code{txtlib} program
304
305The @code{txtlib} program can be used to perform some simple operations on
306text libraries:
307
308@example
309txtlib [-x] [-o @var{file}] @var{library}...
310txtlib -l @var{library}...
311@end example
312
313By default, or if the @code{-x} option is given, @code{txtlib} extracts
314chunks from libraries. It reads a list of chunk names from standard input,
315one per line. It then examines each @var{library} named on the command line,
316and extracts the requested chunks, writing them to standard output, or to a
317named file. Note that the chunks are extracted in the order they appear in
318the libraries, not the order in which their chunk names were listed.
319
320If the @code{-l} option is given, @code{txtlib} scans each @var{library} in
321turn, writing the names of all the chunks it finds to standard output.
322
323
324
325
326@c --------------------------------------------------------------------------
327
328@contents
329@bye