From 12618ed4e1ccf62075420a84ff59dae02ccc039a Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 15 Jan 2005 05:58:02 +0000 Subject: * 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: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@7775 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ruby.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'ruby.c') diff --git a/ruby.c b/ruby.c index f41196093..10a1813d0 100644 --- a/ruby.c +++ b/ruby.c @@ -678,9 +678,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: -- cgit