diff options
author | msmith <msmith@FreeBSD.org> | 1999-01-11 06:41:32 +0000 |
---|---|---|
committer | msmith <msmith@FreeBSD.org> | 1999-01-11 06:41:32 +0000 |
commit | d141889dddbf47c0830a1864cd283ada0754c6e8 (patch) | |
tree | 80abade00f02b7ec6de90f25817c052679c93375 /sys/boot/common/commands.c | |
parent | 192ad366a1277ebc36c037b0a2b9b7bb1ea780c0 (diff) | |
download | FreeBSD-src-d141889dddbf47c0830a1864cd283ada0754c6e8.zip FreeBSD-src-d141889dddbf47c0830a1864cd283ada0754c6e8.tar.gz |
No builtin command resets getopt before using it, causing
problems in case a wrong option was given previously, and no option
is given to the next command.
PR: kern/9371
Submitted by: "Daniel C. Sobral" <dcs@newsguy.com>
Diffstat (limited to 'sys/boot/common/commands.c')
-rw-r--r-- | sys/boot/common/commands.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/boot/common/commands.c b/sys/boot/common/commands.c index 8984937..fe0eb54 100644 --- a/sys/boot/common/commands.c +++ b/sys/boot/common/commands.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: commands.c,v 1.7 1998/10/31 02:53:09 msmith Exp $ + * $Id: commands.c,v 1.8 1999/01/09 02:34:48 msmith Exp $ */ #include <stand.h> @@ -299,6 +299,7 @@ command_echo(int argc, char *argv[]) nl = 0; optind = 1; + optreset = 1; while ((ch = getopt(argc, argv, "n")) != -1) { switch(ch) { case 'n': @@ -343,6 +344,7 @@ command_read(int argc, char *argv[]) timeout = -1; prompt = NULL; optind = 1; + optreset = 1; while ((c = getopt(argc, argv, "p:t:")) != -1) { switch(c) { @@ -394,6 +396,7 @@ command_lsdev(int argc, char *argv[]) verbose = 0; optind = 1; + optreset = 1; while ((ch = getopt(argc, argv, "v")) != -1) { switch(ch) { case 'v': |