summaryrefslogtreecommitdiff
path: root/ruby.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-12-06 09:04:03 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-12-06 09:04:03 +0000
commitdee96209bfbb957538c7adeb01a65f3830749179 (patch)
tree3289aa4829f7fcb044cfa70341caaafd1aa086b0 /ruby.c
parent4263bb432accd9bd98654c3e8cc312414e7db906 (diff)
19991206
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@576 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ruby.c')
-rw-r--r--ruby.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/ruby.c b/ruby.c
index 19879859fc..b5c632b4e3 100644
--- a/ruby.c
+++ b/ruby.c
@@ -289,6 +289,7 @@ process_sflag()
rb_ary_shift(rb_argv);
}
}
+ sflag = 0;
}
static void proc_options _((int argc, char **argv));
@@ -303,8 +304,10 @@ moreswitches(s)
argc = 2; argv[0] = argv[2] = 0;
while (*s && !ISSPACE(*s))
s++;
- argv[1] = ALLOCA_N(char, s - p + 2);
- sprintf(argv[1], "-%s", p);
+ argv[1] = ALLOCA_N(char, s-p+2);
+ argv[1][0] = '-';
+ strncpy(argv[1]+1, p, s-p);
+ argv[1][s-p+1] = '\0';
proc_options(argc, argv);
while (*s && ISSPACE(*s))
s++;
@@ -450,13 +453,16 @@ proc_options(argc, argv)
break;
case 'F':
- rb_fs = rb_str_new2(s+1);
+ if (*++s) {
+ rb_fs = rb_str_new2(s);
+ }
break;
case 'K':
- s++;
- rb_set_kcode(s);
- s++;
+ if (*++s) {
+ rb_set_kcode(s);
+ s++;
+ }
goto reswitch;
case 'T':
@@ -634,7 +640,6 @@ proc_options(argc, argv)
}
process_sflag();
- sflag = 0;
xflag = 0;
}