| 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 | |
| 58 | This file documents version @value{VERSION} of the Common Files Distribution. |
| 59 | |
| 60 | Copyright (c) 1997 Mark Wooding |
| 61 | |
| 62 | Permission is granted to make and distribute verbatim copies of this |
| 63 | manual provided the copyright notice and this permission notice are |
| 64 | preserved on all copies. |
| 65 | |
| 66 | @ignore |
| 67 | Permission is granted to process this file through TeX and print the |
| 68 | results, provided the printed document carries a copying permission |
| 69 | notice 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 |
| 73 | Permission is granted to copy and distribute modified versions of this |
| 74 | manual under the conditions for verbatim copying, provided also that the |
| 75 | sections entitled `Copying' and `GNU General Public License' are |
| 76 | included exactly as in the original, and provided that the entire |
| 77 | resulting derived work is distributed under the terms of a permission |
| 78 | notice identical to this one. |
| 79 | |
| 80 | Permission is granted to copy and distribute translations of this manual |
| 81 | into another language, under the above conditions for modified versions, |
| 82 | except that this permission notice may be stated in a translation |
| 83 | approved 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 | |
| 96 | Permission is granted to make and distribute verbatim copies of this |
| 97 | manual provided the copyright notice and this permission notice are |
| 98 | preserved on all copies. |
| 99 | |
| 100 | Permission is granted to copy and distribute modified versions of this |
| 101 | manual under the conditions for verbatim copying, provided also that the |
| 102 | sections entitled `Copying' and `GNU General Public License' are |
| 103 | included exactly as in the original, and provided that the entire |
| 104 | resulting derived work is distributed under the terms of a permission |
| 105 | notice identical to this one. |
| 106 | |
| 107 | Permission is granted to copy and distribute translations of this manual |
| 108 | into another language, under the above conditions for modified versions, |
| 109 | except that this permission notice may be stated in a translation |
| 110 | approved 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 | |
| 121 | The Common Files Distribution provides a convenient way to manage files |
| 122 | shared between a number of developments. |
| 123 | |
| 124 | This manual documents version @value{VERSION} of the Common Files |
| 125 | Distribution. |
| 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 | |
| 137 | The file repository |
| 138 | |
| 139 | * The mklinks command:: |
| 140 | * The findlinks command:: |
| 141 | |
| 142 | Text 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 | |
| 159 | When you have a number of development trees, managing files which are common |
| 160 | to all of them starts to become a real pain. When a new version of some file |
| 161 | comes out, checking out all your source directories, replacing the old |
| 162 | version with the new one, and committing all the changes back gets to be |
| 163 | very tiresome rather quickly. |
| 164 | |
| 165 | The Common File Distribution attempts to be a solution to some of the |
| 166 | problems caused sharing files between source trees. It provides a single |
| 167 | repository for shared files, and lets you create links to the shared copies |
| 168 | from your source trees. It also provides a simple method for constructing |
| 169 | text files from small bits of `text libraries'. |
| 170 | |
| 171 | The whole lot is held together by a collection of small shell scripts. They |
| 172 | can easily be modified to suit the requirements of an individual site, or |
| 173 | used 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 | |
| 181 | When the Common File Distribution is installed, it creates a repository where |
| 182 | shared files can be placed, and it places a few standard GNU files there. By |
| 183 | default, the repository is @file{@var{prefix}/share/common}, although this |
| 184 | can be set using the @code{--datadir} option to the configuration script. |
| 185 | |
| 186 | You can place your own files in the repository if you like. If you do, |
| 187 | they'll be treated in exactly the same way as ones in the distribution. |
| 188 | |
| 189 | The command @code{mklinks} reads a list of filenames and creates symbolic |
| 190 | links to the corresponding names in the repository. This ensures that when a |
| 191 | file in the repository gets updated, any source trees automatically use the |
| 192 | new version. Obviously, when you build a source distribution, you must |
| 193 | ensure that links are followed, rather than saved as links; the @code{h} |
| 194 | option to @code{tar} does this (this is the default in Automake; @pxref{Top, |
| 195 | , Overview, automake, GNU Automake}). |
| 196 | |
| 197 | The command @code{findlinks} scans the current directory (and its |
| 198 | subdirectories) 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 | |
| 210 | Links into the file repository are made with the @code{mklinks} command: |
| 211 | |
| 212 | @example |
| 213 | mklinks [@var{file}]... |
| 214 | @end example |
| 215 | |
| 216 | If you don't specify any @code{file}s, it reads @file{.links} from the |
| 217 | current directory; you can pass @samp{-} to read standard input. The program |
| 218 | expects the files to contain a list of filenames; for each name read, it |
| 219 | creates a symbolic link to the appropriate file in the repository. |
| 220 | |
| 221 | You 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 | |
| 229 | The @code{findlinks} searches the current directory and any subdirectories |
| 230 | and writes to standard output a list of files whose names match files in the |
| 231 | file repository. It takes no arguments, although typically output will be |
| 232 | redirected to the file @file{.links}, which the @code{mklinks} command reads |
| 233 | by default: |
| 234 | |
| 235 | @example |
| 236 | findlinks >.links |
| 237 | @end example |
| 238 | |
| 239 | |
| 240 | @c -------------------------------------------------------------------------- |
| 241 | @node Text libraries, , The file repository, Top |
| 242 | @chapter Text libraries |
| 243 | |
| 244 | |
| 245 | Just being able to share files isn't always good enough: it's sometimes |
| 246 | useful to able to share small parts of files. The Common Files Distribution |
| 247 | comes with a simple system for extracting requested parts from a @dfn{text |
| 248 | library}. |
| 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 | |
| 261 | Text libraries contain a @dfn{header} followed by a number of @dfn{chunks}. |
| 262 | The 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 |
| 264 | chunk, or the end of the file. The header is simply the text preceding the |
| 265 | first chunk. |
| 266 | |
| 267 | Here'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 | |
| 297 | The file contains a short header containing a line to tell Emacs what mode |
| 298 | to use when editing it and a brief description of the file. It contains two |
| 299 | chunks, named @code{todo} and @code{indexing} |
| 300 | |
| 301 | |
| 302 | @node The txtlib program, , Anatomy, Text libraries |
| 303 | @section The @code{txtlib} program |
| 304 | |
| 305 | The @code{txtlib} program can be used to perform some simple operations on |
| 306 | text libraries: |
| 307 | |
| 308 | @example |
| 309 | txtlib [-x] [-o @var{file}] @var{library}... |
| 310 | txtlib -l @var{library}... |
| 311 | @end example |
| 312 | |
| 313 | By default, or if the @code{-x} option is given, @code{txtlib} extracts |
| 314 | chunks from libraries. It reads a list of chunk names from standard input, |
| 315 | one per line. It then examines each @var{library} named on the command line, |
| 316 | and extracts the requested chunks, writing them to standard output, or to a |
| 317 | named file. Note that the chunks are extracted in the order they appear in |
| 318 | the libraries, not the order in which their chunk names were listed. |
| 319 | |
| 320 | If the @code{-l} option is given, @code{txtlib} scans each @var{library} in |
| 321 | turn, writing the names of all the chunks it finds to standard output. |
| 322 | |
| 323 | |
| 324 | |
| 325 | |
| 326 | @c -------------------------------------------------------------------------- |
| 327 | |
| 328 | @contents |
| 329 | @bye |