mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ruby.c (proc_options): check if argument for -E exists.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15589 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
f11ac55489
commit
b3b3ff29b5
2 changed files with 13 additions and 13 deletions
|
@ -1,3 +1,7 @@
|
|||
Sun Feb 24 05:25:26 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* ruby.c (proc_options): check if argument for -E exists.
|
||||
|
||||
Sun Feb 24 05:09:43 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* misc/ruby-style.el (ruby-style-label-indent): fix for labels inside
|
||||
|
|
22
ruby.c
22
ruby.c
|
@ -539,7 +539,7 @@ moreswitches(const char *s, struct cmdline_options *opt)
|
|||
static int
|
||||
proc_options(int argc, char **argv, struct cmdline_options *opt)
|
||||
{
|
||||
int argc0 = argc;
|
||||
int n, argc0 = argc;
|
||||
const char *s;
|
||||
|
||||
if (argc == 0)
|
||||
|
@ -707,10 +707,7 @@ proc_options(int argc, char **argv, struct cmdline_options *opt)
|
|||
break;
|
||||
|
||||
case 'E':
|
||||
if (!*++s) {
|
||||
s = argv[1];
|
||||
argc--, argv++;
|
||||
}
|
||||
if (!*++s) goto next_encoding;
|
||||
goto encoding;
|
||||
|
||||
case 'K':
|
||||
|
@ -797,18 +794,17 @@ proc_options(int argc, char **argv, struct cmdline_options *opt)
|
|||
}
|
||||
else if (strcmp("disable-gems", s) == 0)
|
||||
opt->disable_gems = 1;
|
||||
else if (strcmp("encoding", s) == 0) {
|
||||
if (!--argc || !(s = *++argv)) {
|
||||
noencoding:
|
||||
rb_raise(rb_eRuntimeError, "missing argument for --encoding");
|
||||
else if (strncmp("encoding", s, n = 8) == 0 && (!s[n] || s[n] == '=')) {
|
||||
s += n;
|
||||
if (!*s++) {
|
||||
next_encoding:
|
||||
if (!--argc || !(s = *++argv)) {
|
||||
rb_raise(rb_eRuntimeError, "missing argument for --encoding");
|
||||
}
|
||||
}
|
||||
encoding:
|
||||
opt->ext.enc.name = rb_str_new2(s);
|
||||
}
|
||||
else if (strncmp("encoding=", s, 9) == 0) {
|
||||
if (!*(s += 9)) goto noencoding;
|
||||
goto encoding;
|
||||
}
|
||||
else if (strcmp("version", s) == 0)
|
||||
opt->version = 1;
|
||||
else if (strcmp("verbose", s) == 0) {
|
||||
|
|
Loading…
Reference in a new issue