From b44a4bae7d5c1098709dfaffd122263e0f4c5bc6 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Wed, 16 Nov 2016 16:28:03 +0100 Subject: standard lib: added getopt.tes for parsing command line options in scripts * this uses an optstring compatible with getopt(3). * It does not use repeated getopt calls to iterate options, though but places the results in registers beginning with "getopt.". E.g. option "C" will result in "getopt.C" being set after the call to setopt. String arguments are supported and are placed in the string part of the getopt registers. * The grosciteco.tes and symbols-extract.tes scripts make use of getopt now, to simplify and clean up their command line handling. --- doc/grosciteco.tes | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'doc/grosciteco.tes') diff --git a/doc/grosciteco.tes b/doc/grosciteco.tes index 7be01fb..262f2c0 100755 --- a/doc/grosciteco.tes +++ b/doc/grosciteco.tes @@ -1,9 +1,14 @@ #!/usr/local/bin/sciteco -m -!* grosciteco.tes *! +!* grosciteco.tes [-t ] [--] *! + +:EMQ[$SCITECOPATH]/getopt.tes !* Process command-line options *! -LR 0X[output-woman] 2LR 0X[output-tec] 2LR 0X[input] HK -EBQ[input] +[optstring]t: M[getopt]"F (0/0) ' +LR 0X[output-woman] 2LR 0X[input] HK +:Q[getopt.t]"< EU[getopt.t]Q[output-woman].tec ' + +EBN[input] ! skip whitespace characters ! @#sw{ @@ -278,6 +283,6 @@ EQ[styles] !* Generate topic index *! J I!*Q[topics]*!^J -EWQ[output-tec] +EWQ[getopt.t] -EX -- cgit v1.2.3