[前][次][番号順一覧][スレッド一覧]

ruby-changes:4099

From: ko1@a...
Date: Sun, 24 Feb 2008 05:25:59 +0900 (JST)
Subject: [ruby-changes:4099] nobu - Ruby:r15589 (trunk): * ruby.c (proc_options): check if argument for -E exists.

nobu	2008-02-24 05:25:29 +0900 (Sun, 24 Feb 2008)

  New Revision: 15589

  Modified files:
    trunk/ChangeLog
    trunk/ruby.c

  Log:
    * ruby.c (proc_options): check if argument for -E exists.


  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ruby.c?r1=15589&r2=15588&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=15589&r2=15588&diff_format=u

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 15588)
+++ ChangeLog	(revision 15589)
@@ -1,3 +1,7 @@
+Sun Feb 24 05:25:26 2008  Nobuyoshi Nakada  <nobu@r...>
+
+	* ruby.c (proc_options): check if argument for -E exists.
+
 Sun Feb 24 05:09:43 2008  Nobuyoshi Nakada  <nobu@r...>
 
 	* misc/ruby-style.el (ruby-style-label-indent): fix for labels inside
Index: ruby.c
===================================================================
--- ruby.c	(revision 15588)
+++ ruby.c	(revision 15589)
@@ -539,7 +539,7 @@
 static int
 proc_options(int argc, char **argv, struct cmdline_options *opt)
 {
-    int argc0 = argc;
+    int n, argc0 = argc;
     const char *s;
 
     if (argc == 0)
@@ -707,10 +707,7 @@
 	    break;
 
 	  case 'E':
-	    if (!*++s) {
-		s = argv[1];
-		argc--, argv++;
-	    }
+	    if (!*++s) goto next_encoding;
 	    goto encoding;
 
 	  case 'K':
@@ -797,18 +794,17 @@
             }
             else if (strcmp("disable-gems", s) == 0)
 		opt->disable_gems = 1;
-	    else if (strcmp("encoding", s) == 0) {
-		if (!--argc || !(s = *++argv)) {
-		  noencoding:
-		    rb_raise(rb_eRuntimeError, "missing argument for --encoding");
+	    else if (strncmp("encoding", s, n = 8) == 0 && (!s[n] || s[n] == '=')) {
+		s += n;
+		if (!*s++) {
+		  next_encoding:
+		    if (!--argc || !(s = *++argv)) {
+			rb_raise(rb_eRuntimeError, "missing argument for --encoding");
+		    }
 		}
 	      encoding:
 		opt->ext.enc.name = rb_str_new2(s);
 	    }
-	    else if (strncmp("encoding=", s, 9) == 0) {
-		if (!*(s += 9)) goto noencoding;
-		goto encoding;
-	    }
 	    else if (strcmp("version", s) == 0)
 		opt->version = 1;
 	    else if (strcmp("verbose", s) == 0) {

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]