summaryrefslogtreecommitdiff
path: root/docs/busybox.sgml
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2000-08-21 22:02:34 +0000
committerEric Andersen <andersen@codepoet.org>2000-08-21 22:02:34 +0000
commita1f16bba72c78eca9359692e354fa35c0f3366c1 (patch)
treef95f7cd59b05597b5719ae6f50ea81b62b70294a /docs/busybox.sgml
parente2205f093bbdd251de8b2efe1f63925510fcbad5 (diff)
downloadbusybox-w32-a1f16bba72c78eca9359692e354fa35c0f3366c1.tar.gz
busybox-w32-a1f16bba72c78eca9359692e354fa35c0f3366c1.tar.bz2
busybox-w32-a1f16bba72c78eca9359692e354fa35c0f3366c1.zip
Added getopt(1) from "Alfred M. Szmidt" <ams@trillian.itslinux.org>
-Erik
Diffstat (limited to 'docs/busybox.sgml')
-rw-r--r--docs/busybox.sgml55
1 files changed, 55 insertions, 0 deletions
diff --git a/docs/busybox.sgml b/docs/busybox.sgml
index 864dbe0ac..f53be8d6f 100644
--- a/docs/busybox.sgml
+++ b/docs/busybox.sgml
@@ -1063,6 +1063,61 @@
1063 </screen> 1063 </screen>
1064 </para> 1064 </para>
1065 </sect1> 1065 </sect1>
1066
1067 <sect1 id="getopt">
1068 <title>getopt</title>
1069
1070 <para>
1071 Usage: getopt [OPTIONS]...
1072 </para>
1073
1074 <para>
1075 Parse command options
1076 </para>
1077
1078 <para>
1079 <screen>
1080 -a, --alternative Allow long options starting with single -\n"
1081 -l, --longoptions=longopts Long options to be recognized\n"
1082 -n, --name=progname The name under which errors are reported\n"
1083 -o, --options=optstring Short options to be recognized\n"
1084 -q, --quiet Disable error reporting by getopt(3)\n"
1085 -Q, --quiet-output No normal output\n"
1086 -s, --shell=shell Set shell quoting conventions\n"
1087 -T, --test Test for getopt(1) version\n"
1088 -u, --unqote Do not quote the output\n"
1089 </screen>
1090 </para>
1091
1092
1093 <para>
1094 Example:
1095 </para>
1096
1097 <para>
1098 <screen>
1099 $ cat getopt.test
1100 #!/bin/sh
1101 GETOPT=`getopt -o ab:c:: --long a-long,b-long:,c-long:: \
1102 -n 'example.busybox' -- "$@"`
1103 if [ $? != 0 ] ; then exit 1 ; fi
1104 eval set -- "$GETOPT"
1105 while true ; do
1106 case $1 in
1107 -a|--a-long) echo "Option a" ; shift ;;
1108 -b|--b-long) echo "Option b, argument \`$2'" ; shift 2 ;;
1109 -c|--c-long)
1110 case "$2" in
1111 "") echo "Option c, no argument"; shift 2 ;;
1112 *) echo "Option c, argument \`$2'" ; shift 2 ;;
1113 esac ;;
1114 --) shift ; break ;;
1115 *) echo "Internal error!" ; exit 1 ;;
1116 esac
1117 done
1118 </screen>
1119 </para>
1120 </sect1>
1066 1121
1067 <sect1 id="grep"> 1122 <sect1 id="grep">
1068 <title>grep</title> 1123 <title>grep</title>