6 |
This shell script is compatible to both the GNU and the POSIX shell |
This shell script is compatible to both the GNU and the POSIX shell |
7 |
and utilities. Care was taken to restrict the programming technics |
and utilities. Care was taken to restrict the programming technics |
8 |
used here in order to achieve POSIX compatibility as far back as POSIX |
used here in order to achieve POSIX compatibility as far back as POSIX |
9 |
P1003.2 Draft 11.2 of September 1991, but including the local |
P1003.2 Draft 11.2 of September 1991. This draft is available at |
10 |
variables in functions that were eliminated only in this draft. This |
http://www.funet.fi/pub/doc/posix/p1003.2/d11.2 in the internet. |
11 |
draft is available at http://www.funet.fi/pub/doc/posix/p1003.2/d11.2 |
|
12 |
in the internet. So `groffer' should be compatible to most actual |
The POSIX draft does not include `local' variables for functions. So |
13 |
Bourne style shells. |
this concept was replaced by global variables with a prefix that |
14 |
|
differs for each function. The prefix is chosen from the function |
15 |
|
name. These quasi-local variables are unset before each return of the |
16 |
|
function. |
17 |
|
|
18 |
Some shells are not fully POSIX compatible. For them the following |
Some shells are not fully POSIX compatible. For them the following |
19 |
restrictions were done. The name of the variable in `for' is chosen as |
restrictions were done. For more information look at the |
20 |
a single character. The content of such a variable is regarded as |
documentation `Portable shells' in the `info' page of `autoconf' |
21 |
non-local. Furthermore `then', `else', and `do' get a line of their own. |
(look-up in Emacs-Help-Manuals). |
22 |
|
|
23 |
|
- The command parts `then', `else', and `do' are written each on a |
24 |
|
line of their own. |
25 |
|
|
26 |
|
- Replace `for i in "$@"' by `for i'. |
27 |
|
|
28 |
|
- Replace `set -- ...' by `set x ...; shift'. After the first |
29 |
|
non-option argument, all arguments including those starting with `-' |
30 |
|
are accepted as non-option. |
31 |
|
|
32 |
|
- The name of the variable in `for' is chosen as a single character. |
33 |
|
The content of such variables is not safe. So it is often stored in |
34 |
|
an additional quasi-local variable. |
35 |
|
|
36 |
The `groffer' script provides its own option parser. It is compatible |
The `groffer' script provides its own option parser. It is compatible |
37 |
to the usual GNU style command line (option clusters, long option |
to the usual GNU style command line (option clusters, long option |
62 |
irrelevant. The `>' sign can be followed by another character that |
irrelevant. The `>' sign can be followed by another character that |
63 |
shows how many of these arguments are possible. |
shows how many of these arguments are possible. |
64 |
|
|
65 |
<>? 0 or 1 of these arguments |
<arg>? 0 or 1 of these arguments |
66 |
<>* arbitrarily many such arguments, incl. none |
<arg>* arbitrarily many such arguments, incl. none |
67 |
<>+ one or more such arguments |
<arg>+ one or more such arguments |
68 |
<> exactly 1 of this argument |
<arg> exactly 1 of this argument |
69 |
|
[...] optional arguments |
70 |
|
|
71 |
A function that starts with an underscore `_' is an internal function |
A function that starts with an underscore `_' is an internal function |
72 |
for some function. The internal functions are defined just after |
for some function. The internal functions are defined just after |