summaryrefslogtreecommitdiff
path: root/ruby.c
diff options
context:
space:
mode:
Diffstat (limited to 'ruby.c')
-rw-r--r--ruby.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/ruby.c b/ruby.c
index 9f60cff0f6..4f2ed550e1 100644
--- a/ruby.c
+++ b/ruby.c
@@ -279,7 +279,11 @@ proc_options(argcp, argvp)
case 'e':
forbid_setid("-e");
- if (!argv[1]) {
+ if (!*++s) {
+ s = argv[1];
+ argc--,argv++;
+ }
+ if (!s) {
fprintf(stderr, "%s: no code specified for -e\n", origargv[0]);
exit(2);
}
@@ -292,9 +296,8 @@ proc_options(argcp, argvp)
}
if (script == 0) script = e_tmpname;
}
- fputs(argv[1], e_fp);
+ fputs(s, e_fp);
putc('\n', e_fp);
- argc--, argv++;
break;
case 'r':