didn't get the argument parsing right; fix stty -tostop
authorKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Sat, 4 May 1991 01:19:51 +0000 (17:19 -0800)
committerKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Sat, 4 May 1991 01:19:51 +0000 (17:19 -0800)
SCCS-vsn: bin/stty/stty.c 5.22

usr/src/bin/stty/stty.c

index 5c5a4c9..a095631 100644 (file)
@@ -12,7 +12,7 @@ char copyright[] =
 #endif /* not lint */
 
 #ifndef lint
 #endif /* not lint */
 
 #ifndef lint
-static char sccsid[] = "@(#)stty.c     5.21 (Berkeley) %G%";
+static char sccsid[] = "@(#)stty.c     5.22 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <sys/types.h>
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -35,7 +35,7 @@ main(argc, argv)
        char **argv;
 {
        extern char *optarg;
        char **argv;
 {
        extern char *optarg;
-       extern int optind;
+       extern int opterr, optind;
        extern struct cchar cchars1[], cchars2[];
        extern struct modes cmodes[], imodes[], lmodes[], omodes[];
        register struct modes *mp;
        extern struct cchar cchars1[], cchars2[];
        extern struct modes cmodes[], imodes[], lmodes[], omodes[];
        register struct modes *mp;
@@ -47,6 +47,7 @@ main(argc, argv)
 
        ctl = STDIN_FILENO;
        fmt = NOTSET;
 
        ctl = STDIN_FILENO;
        fmt = NOTSET;
+       opterr = 0;
        while ((ch = getopt(argc, argv, "aef:g")) != EOF)
                switch(ch) {
                case 'a':               /* undocumented: POSIX compatibility */
        while ((ch = getopt(argc, argv, "aef:g")) != EOF)
                switch(ch) {
                case 'a':               /* undocumented: POSIX compatibility */
@@ -63,9 +64,7 @@ main(argc, argv)
                        fmt = GFLAG;
                        break;
                case '?':
                        fmt = GFLAG;
                        break;
                case '?':
-                       usage();
                default:
                default:
-                       --optind;
                        goto args;
                }
 
                        goto args;
                }