aboutsummaryrefslogtreecommitdiff
path: root/coreutils/stty.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2002-06-06 11:35:29 +0000
committerEric Andersen <andersen@codepoet.org>2002-06-06 11:35:29 +0000
commitfc059090b6954348ee4510ff0dac097bf3a9b682 (patch)
treefd8d6a15ce94758dfe995259c291954be3666f76 /coreutils/stty.c
parentff7661d9de75d0d92d76fc276b285f4138edf8c8 (diff)
downloadbusybox-w32-fc059090b6954348ee4510ff0dac097bf3a9b682.tar.gz
busybox-w32-fc059090b6954348ee4510ff0dac097bf3a9b682.tar.bz2
busybox-w32-fc059090b6954348ee4510ff0dac097bf3a9b682.zip
last_patch41 from vodz to fix stty -F and similar
Diffstat (limited to 'coreutils/stty.c')
-rw-r--r--coreutils/stty.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/coreutils/stty.c b/coreutils/stty.c
index 2e00a496d..a67a17c0f 100644
--- a/coreutils/stty.c
+++ b/coreutils/stty.c
@@ -572,14 +572,34 @@ extern int main(int argc, char **argv)
572 572
573 speed_was_set = 0; 573 speed_was_set = 0;
574 require_set_attr = 0; 574 require_set_attr = 0;
575 k = optind; 575 k = 0;
576 while (k < argc) { 576 while (++k < argc) {
577 int match_found = 0; 577 int match_found = 0;
578 int reversed = 0; 578 int reversed = 0;
579 int i; 579 int i;
580 580
581 if (argv[k][0] == '-') { 581 if (argv[k][0] == '-') {
582 char *find_dev_opt;
583
582 ++argv[k]; 584 ++argv[k];
585
586 /* Handle "-a", "-ag", "-aF/dev/foo", "-aF /dev/foo", etc.
587 Find the options that have been parsed. This is really
588 gross, but it's needed because stty SETTINGS look like options to
589 getopt(), so we need to work around things in a really horrible
590 way. If any new options are ever added to stty, the short option
591 MUST NOT be a letter which is the first letter of one of the
592 possible stty settings.
593 */
594 find_dev_opt = strchr(argv[k], 'F'); /* find -*F* */
595 if(find_dev_opt) {
596 if(find_dev_opt[1]==0) /* -*F /dev/foo */
597 k++; /* skip /dev/foo */
598 continue; /* else -*F/dev/foo - no skip */
599 }
600 if(argv[k][0]=='a' || argv[k][0]=='g')
601 continue;
602 /* Is not options - is reverse params */
583 reversed = 1; 603 reversed = 1;
584 } 604 }
585 for (i = 0; i < NUM_mode_info; ++i) 605 for (i = 0; i < NUM_mode_info; ++i)
@@ -661,7 +681,6 @@ extern int main(int argc, char **argv)
661 } else 681 } else
662 error_msg_and_die("invalid argument `%s'", argv[k]); 682 error_msg_and_die("invalid argument `%s'", argv[k]);
663 } 683 }
664 k++;
665 } 684 }
666 685
667 if (require_set_attr) { 686 if (require_set_attr) {