summaryrefslogtreecommitdiff
path: root/ruby.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-02-05 10:27:34 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-02-05 10:27:34 +0000
commit9b64dfe3b8f0343ebf97ae80d3a4ec3f4bd115b3 (patch)
tree7acd7b77321fdbc63149b47fde3bace6f7733614 /ruby.c
parent06d4e3b42d836b762c29cdc9dc7181caf14dcdec (diff)
990205
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_3@391 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ruby.c')
-rw-r--r--ruby.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/ruby.c b/ruby.c
index 47772c3581..9f60cff0f6 100644
--- a/ruby.c
+++ b/ruby.c
@@ -279,6 +279,10 @@ proc_options(argcp, argvp)
case 'e':
forbid_setid("-e");
+ if (!argv[1]) {
+ fprintf(stderr, "%s: no code specified for -e\n", origargv[0]);
+ exit(2);
+ }
if (!e_fp) {
e_tmpname = ruby_mktemp();
if (!e_tmpname) rb_fatal("Can't mktemp");
@@ -288,11 +292,9 @@ proc_options(argcp, argvp)
}
if (script == 0) script = e_tmpname;
}
- if (argv[1]) {
- fputs(argv[1], e_fp);
- argc--, argv++;
- }
+ fputs(argv[1], e_fp);
putc('\n', e_fp);
+ argc--, argv++;
break;
case 'r':
@@ -404,8 +406,8 @@ proc_options(argcp, argvp)
exit(0);
}
else {
- printf("%s: invalid option --%s (-h will show valid options)\n",
- origargv[0], s);
+ fprintf(stderr, "%s: invalid option --%s (-h will show valid options)\n",
+ origargv[0], s);
exit(2);
}
break;
@@ -416,8 +418,8 @@ proc_options(argcp, argvp)
break;
default:
- printf("%s: invalid option -%c (-h will show valid options)\n",
- origargv[0], *s);
+ fprintf(stderr, "%s: invalid option -%c (-h will show valid options)\n",
+ origargv[0], *s);
exit(2);
case 0: