3 getflags, usage \- command-line parsing for shell scripts
10 parses the options in its command-line arguments
11 according to the environment variable
13 This variable should be a list of comma-separated options.
14 Each option can be a single letter, indicating that it does
15 not take arguments, or a letter followed by the space-separated
16 names of its arguments.
20 script on standard output which initializes the
23 for every option mentioned in
25 If the option is not present on the command-line, the script
26 sets that option's flag variable to an empty list.
27 Otherwise, the script sets that option's flag variable with
28 a list containing the option's arguments or,
29 if the option takes no arguments,
32 The script also sets the variable
34 to the list of arguments following the options.
35 The final line in the script sets the
37 variable, to the empty string on success
40 when there is an error parsing the command line.
43 prints a usage message to standard error.
44 It creates the message using
48 which should contain the string to be printed explaining
56 Parse the arguments for
60 flagfmt='b,s,f binary,r res,x width'
61 args='name | pid list'
62 if(! ifs=() eval `{aux/getflags $*} || ~ $#* 0){
68 .B /sys/src/cmd/aux/getflags.c
70 .B /sys/src/cmd/aux/usage.c