aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2000-09-23 22:36:24 +0000
committerEric Andersen <andersen@codepoet.org>2000-09-23 22:36:24 +0000
commit0102a9fd48fe9ed16a1e2ad372cfa0fb65e87208 (patch)
tree5f6b62f627ebb6971d30363bbfb926fc9e0beb8d
parent2da90d3b58472a4df63796ea679fde1f7d2b7a78 (diff)
downloadbusybox-0102a9fd48fe9ed16a1e2ad372cfa0fb65e87208.tar.gz
Fix an obscure option parsing bug.
-rw-r--r--archival/tar.c5
-rw-r--r--tar.c5
2 files changed, 8 insertions, 2 deletions
diff --git a/archival/tar.c b/archival/tar.c
index ade77a59d..6dcda53ef 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -149,6 +149,7 @@ extern int tar_main(int argc, char **argv)
int createFlag = FALSE;
int verboseFlag = FALSE;
int tostdoutFlag = FALSE;
+ int firstOpt = TRUE;
int stopIt;
@@ -156,7 +157,9 @@ extern int tar_main(int argc, char **argv)
usage(tar_usage);
/* do normal option parsing */
- while (--argc > 0 && strspn(*(++argv), "-cxt") >0 ) {
+ while (--argc > 0 && ((*argv && **(++argv) == '-') ||
+ (firstOpt==TRUE && strspn(*argv, "-cxt") ))) {
+ firstOpt=FALSE;
stopIt=FALSE;
while (stopIt==FALSE && *argv && **argv) {
switch (**argv) {
diff --git a/tar.c b/tar.c
index ade77a59d..6dcda53ef 100644
--- a/tar.c
+++ b/tar.c
@@ -149,6 +149,7 @@ extern int tar_main(int argc, char **argv)
int createFlag = FALSE;
int verboseFlag = FALSE;
int tostdoutFlag = FALSE;
+ int firstOpt = TRUE;
int stopIt;
@@ -156,7 +157,9 @@ extern int tar_main(int argc, char **argv)
usage(tar_usage);
/* do normal option parsing */
- while (--argc > 0 && strspn(*(++argv), "-cxt") >0 ) {
+ while (--argc > 0 && ((*argv && **(++argv) == '-') ||
+ (firstOpt==TRUE && strspn(*argv, "-cxt") ))) {
+ firstOpt=FALSE;
stopIt=FALSE;
while (stopIt==FALSE && *argv && **argv) {
switch (**argv) {