aboutsummaryrefslogtreecommitdiff
path: root/coreutils
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
parentff7661d9de75d0d92d76fc276b285f4138edf8c8 (diff)
downloadbusybox-fc059090b6954348ee4510ff0dac097bf3a9b682.tar.gz
last_patch41 from vodz to fix stty -F and similar
Diffstat (limited to 'coreutils')
-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)
speed_was_set = 0;
require_set_attr = 0;
- k = optind;
- while (k < argc) {
+ k = 0;
+ while (++k < argc) {
int match_found = 0;
int reversed = 0;
int i;
if (argv[k][0] == '-') {
+ char *find_dev_opt;
+
++argv[k];
+
+ /* Handle "-a", "-ag", "-aF/dev/foo", "-aF /dev/foo", etc.
+ Find the options that have been parsed. This is really
+ gross, but it's needed because stty SETTINGS look like options to
+ getopt(), so we need to work around things in a really horrible
+ way. If any new options are ever added to stty, the short option
+ MUST NOT be a letter which is the first letter of one of the
+ possible stty settings.
+ */
+ find_dev_opt = strchr(argv[k], 'F'); /* find -*F* */
+ if(find_dev_opt) {
+ if(find_dev_opt[1]==0) /* -*F /dev/foo */
+ k++; /* skip /dev/foo */
+ continue; /* else -*F/dev/foo - no skip */
+ }
+ if(argv[k][0]=='a' || argv[k][0]=='g')
+ continue;
+ /* Is not options - is reverse params */
reversed = 1;
}
for (i = 0; i < NUM_mode_info; ++i)
@@ -661,7 +681,6 @@ extern int main(int argc, char **argv)
} else
error_msg_and_die("invalid argument `%s'", argv[k]);
}
- k++;
}
if (require_set_attr) {