diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2010-07-16 13:09:56 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2010-07-16 13:09:56 +0300 |
commit | bc70de7b3302d5a81515b901cae376b8b51d2004 (patch) | |
tree | d36d6743e65697f6923b79d0ea8f9f9bf4ef7398 /awklib/eg/lib/getopt.awk | |
parent | b9e4a1fd4c8c8753ab8a9887bab55f03efe1e3e2 (diff) | |
download | egawk-bc70de7b3302d5a81515b901cae376b8b51d2004.tar.gz egawk-bc70de7b3302d5a81515b901cae376b8b51d2004.tar.bz2 egawk-bc70de7b3302d5a81515b901cae376b8b51d2004.zip |
Move to gawk-3.1.0.
Diffstat (limited to 'awklib/eg/lib/getopt.awk')
-rw-r--r-- | awklib/eg/lib/getopt.awk | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/awklib/eg/lib/getopt.awk b/awklib/eg/lib/getopt.awk index dae20e5f..93753052 100644 --- a/awklib/eg/lib/getopt.awk +++ b/awklib/eg/lib/getopt.awk @@ -1,28 +1,26 @@ -# getopt --- do C library getopt(3) function in awk +# getopt.awk --- do C library getopt(3) function in awk # -# arnold@gnu.org -# Public domain +# Arnold Robbins, arnold@gnu.org, Public Domain # # Initial version: March, 1991 # Revised: May, 1993 # External variables: -# Optind -- index of ARGV for first non-option argument +# Optind -- index in ARGV of first non-option argument # Optarg -- string value of argument to current option -# Opterr -- if non-zero, print our own diagnostic +# Opterr -- if nonzero, print our own diagnostic # Optopt -- current option letter -# Returns +# Returns: # -1 at end of options # ? for unrecognized option # <c> a character representing the current option -# Private Data -# _opti index in multi-flag option, e.g., -abc -function getopt(argc, argv, options, optl, thisopt, i) +# Private Data: +# _opti -- index in multi-flag option, e.g., -abc +function getopt(argc, argv, options, thisopt, i) { - optl = length(options) - if (optl == 0) # no options given + if (length(options) == 0) # no options given return -1 if (argv[Optind] == "--") { # all done |