diff options
author | Eric Andersen <andersen@codepoet.org> | 2000-08-21 22:02:34 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2000-08-21 22:02:34 +0000 |
commit | a1f16bba72c78eca9359692e354fa35c0f3366c1 (patch) | |
tree | f95f7cd59b05597b5719ae6f50ea81b62b70294a /docs | |
parent | e2205f093bbdd251de8b2efe1f63925510fcbad5 (diff) | |
download | busybox-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')
-rw-r--r-- | docs/busybox.pod | 46 | ||||
-rw-r--r-- | docs/busybox.sgml | 55 |
2 files changed, 99 insertions, 2 deletions
diff --git a/docs/busybox.pod b/docs/busybox.pod index 916ccb6f0..4fba7eafa 100644 --- a/docs/busybox.pod +++ b/docs/busybox.pod | |||
@@ -57,7 +57,7 @@ Currently defined functions include: | |||
57 | 57 | ||
58 | ar, basename, cat, chgrp, chmod, chown, chroot, chvt, clear, cp, cut, date, | 58 | ar, basename, cat, chgrp, chmod, chown, chroot, chvt, clear, cp, cut, date, |
59 | dc, dd, deallocvt, df, dirname, dmesg, du, dumpkmap, dutmp, echo, false, fbset, | 59 | dc, dd, deallocvt, df, dirname, dmesg, du, dumpkmap, dutmp, echo, false, fbset, |
60 | fdflush, find, free, freeramdisk, fsck.minix, grep, gunzip, gzip, halt, | 60 | fdflush, find, free, freeramdisk, fsck.minix, getopt, grep, gunzip, gzip, halt, |
61 | head, hostid, hostname, id, init, insmod, kill, killall, length, ln, | 61 | head, hostid, hostname, id, init, insmod, kill, killall, length, ln, |
62 | loadacm, loadfont, loadkmap, logger, logname, ls, lsmod, makedevs, mkdir, | 62 | loadacm, loadfont, loadkmap, logger, logname, ls, lsmod, makedevs, mkdir, |
63 | mkfifo, mkfs.minix, mknod, mkswap, mktemp, more, mount, mt, mv, nc, | 63 | mkfifo, mkfs.minix, mknod, mkswap, mktemp, more, mount, mt, mv, nc, |
@@ -614,6 +614,48 @@ Options: | |||
614 | 614 | ||
615 | ------------------------------- | 615 | ------------------------------- |
616 | 616 | ||
617 | =item getopt | ||
618 | |||
619 | Usage: getopt [OPTIONS]... | ||
620 | |||
621 | Parse command options | ||
622 | |||
623 | Options: | ||
624 | |||
625 | -a, --alternative Allow long options starting with single -\n" | ||
626 | -l, --longoptions=longopts Long options to be recognized\n" | ||
627 | -n, --name=progname The name under which errors are reported\n" | ||
628 | -o, --options=optstring Short options to be recognized\n" | ||
629 | -q, --quiet Disable error reporting by getopt(3)\n" | ||
630 | -Q, --quiet-output No normal output\n" | ||
631 | -s, --shell=shell Set shell quoting conventions\n" | ||
632 | -T, --test Test for getopt(1) version\n" | ||
633 | -u, --unqote Do not quote the output\n" | ||
634 | |||
635 | Example: | ||
636 | $ cat getopt.test | ||
637 | #!/bin/sh | ||
638 | GETOPT=`getopt -o ab:c:: --long a-long,b-long:,c-long:: \ | ||
639 | -n 'example.busybox' -- "$@"` | ||
640 | if [ $? != 0 ] ; then exit 1 ; fi | ||
641 | eval set -- "$GETOPT" | ||
642 | while true ; do | ||
643 | case $1 in | ||
644 | -a|--a-long) echo "Option a" ; shift ;; | ||
645 | -b|--b-long) echo "Option b, argument \`$2'" ; shift 2 ;; | ||
646 | -c|--c-long) | ||
647 | case "$2" in | ||
648 | "") echo "Option c, no argument"; shift 2 ;; | ||
649 | *) echo "Option c, argument \`$2'" ; shift 2 ;; | ||
650 | esac ;; | ||
651 | --) shift ; break ;; | ||
652 | *) echo "Internal error!" ; exit 1 ;; | ||
653 | esac | ||
654 | done | ||
655 | |||
656 | |||
657 | ------------------------------- | ||
658 | |||
617 | =item grep | 659 | =item grep |
618 | 660 | ||
619 | Usage: grep [OPTIONS]... PATTERN [FILE]... | 661 | Usage: grep [OPTIONS]... PATTERN [FILE]... |
@@ -2052,4 +2094,4 @@ Enrique Zanardi <ezanardi@ull.es> | |||
2052 | 2094 | ||
2053 | =cut | 2095 | =cut |
2054 | 2096 | ||
2055 | # $Id: busybox.pod,v 1.61 2000/08/21 21:18:52 andersen Exp $ | 2097 | # $Id: busybox.pod,v 1.62 2000/08/21 22:02:34 andersen Exp $ |
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> |