summaryrefslogtreecommitdiff
path: root/ruby.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-01-15 05:58:02 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-01-15 05:58:02 +0000
commit378f74227ea752dbfcf58a4a45782979589c9a13 (patch)
tree55ba06a156fddf8d07ddec7a4c7cb0fee60dbd1f /ruby.c
parente1e5eda547ef256076d0c6276af4284cfd8081fd (diff)
* ruby.c (proc_options): ignore trailing CRs at the end of short
options as well as long options. fixed: [ruby-core:04232] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7775 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ruby.c')
-rw-r--r--ruby.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/ruby.c b/ruby.c
index 8f39204e1f..773ef7b814 100644
--- a/ruby.c
+++ b/ruby.c
@@ -683,9 +683,20 @@ proc_options(argc, argv)
}
break;
+ case '\r':
+ if (!s[1]) break;
+
default:
- fprintf(stderr, "%s: invalid option -%c (-h will show valid options)\n",
- origargv[0], *s);
+ {
+ const char *format;
+ if (ISPRINT(*s)) {
+ format = "%s: invalid option -%c (-h will show valid options)\n";
+ }
+ else {
+ format = "%s: invalid option -\\%03o (-h will show valid options)\n";
+ }
+ fprintf(stderr, format, origargv[0], (int)(unsigned char)*s);
+ }
exit(2);
case 0: