diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2015-07-08 20:46:52 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2015-07-08 20:46:52 -0400 |
commit | fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 (patch) | |
tree | bdda434976bc09c864f2e4fa6f16ba1952b1e555 /pkg/system/help/lroff/getarg.x | |
download | iraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz |
Initial commit
Diffstat (limited to 'pkg/system/help/lroff/getarg.x')
-rw-r--r-- | pkg/system/help/lroff/getarg.x | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/pkg/system/help/lroff/getarg.x b/pkg/system/help/lroff/getarg.x new file mode 100644 index 00000000..b85c5462 --- /dev/null +++ b/pkg/system/help/lroff/getarg.x @@ -0,0 +1,35 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include <chars.h> +include "lroff.h" + +.help lgetarg +.nf _________________________________________________________________________ +LGETARG -- Get an integer argument to a directive. If no argument is found, +return the default value. We are called with IP pointing to the start of +the argument field to be searched. Leave IP pointing to the next argument +field. +.endhelp ____________________________________________________________________ + +int procedure lgetarg (input_line, ip, default_value) + +char input_line[ARB] +int ip, default_value +int argument +int ctoi() + +begin + if (ctoi (input_line, ip, argument) == 0) + argument = default_value + + # Eat comma argument delimiter, if multiple arguments. Also eat + # trailing whitespace, in case a string argument follows. + while (input_line[ip] == BLANK) + ip = ip + 1 + if (input_line[ip] == ',') + ip = ip + 1 + while (input_line[ip] == BLANK) + ip = ip + 1 + + return (argument) +end |