summaryrefslogtreecommitdiff
path: root/ruby.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-01-05 04:41:21 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-01-05 04:41:21 +0000
commitde7161526014b781468cea5d84411e23be945f79 (patch)
treece7e90b3c16ce6246be9850c9b1ea1328992c0e7 /ruby.c
parenta1d1b1516750c1047ceb7010f8f5ca34b358c7e3 (diff)
20000105
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@598 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ruby.c')
-rw-r--r--ruby.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/ruby.c b/ruby.c
index 50e425b562..4f87d74818 100644
--- a/ruby.c
+++ b/ruby.c
@@ -6,7 +6,7 @@
$Date$
created at: Tue Aug 10 12:47:31 JST 1993
- Copyright (C) 1993-1999 Yukihiro Matsumoto
+ Copyright (C) 1993-2000 Yukihiro Matsumoto
************************************************/
@@ -79,6 +79,7 @@ usage(name)
"-0[octal] specify record separator (\\0, if no argument)",
"-a autosplit mode with -n or -p (splits $_ into $F)",
"-c check syntax only",
+"-Cdirectory cd to directory, before executing your script",
"-d set debugging flags (set $DEBUG to true)",
"-e 'command' one line of script. Several -e's allowed. Omit [programfile]",
"-Fpattern split() pattern for autosplit (-a)",
@@ -95,7 +96,6 @@ usage(name)
"-v enables verbose mode",
"-w turn warnings on for compilation of your script",
"-x[directory] strip off text before #!ruby line and perhaps cd to directory",
-"-Xdirectory cd to directory, before executing your script",
"--copyright print the copyright",
"--version print the version",
"\n",
@@ -441,13 +441,17 @@ proc_options(argc, argv)
}
break;
+ case 'C':
case 'X':
s++;
if (!*s) {
s = argv[1];
argc--,argv++;
}
- if (*s && chdir(s) < 0) {
+ if (!s || !*s) {
+ rb_fatal("Can't chdir");
+ }
+ if (chdir(s) < 0) {
rb_fatal("Can't chdir to %s", s);
}
break;