[kaffe] CVS kaffe (dalibor): Fixed gjdoc -help option

Kaffe CVS cvs-commits at kaffe.org
Sun Apr 18 08:40:03 PDT 2004


PatchSet 4660 
Date: 2004/04/18 15:18:44
Author: dalibor
Branch: HEAD
Tag: (none) 
Log:
 Fixed gjdoc -help option

2004-04-18  Nektarios Papadopoulos <npapadop at inaccessnetworks.com>

        * tools/gjdoc/javalib/gnu/classpath/tools/gjdoc/Main.java:
        Fixed -help option.

Members: 
	ChangeLog:1.2236->1.2237 
	tools/gjdoc/javalib/gnu/classpath/tools/gjdoc/Main.java:1.1->1.2 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.2236 kaffe/ChangeLog:1.2237
--- kaffe/ChangeLog:1.2236	Sun Apr 18 14:19:02 2004
+++ kaffe/ChangeLog	Sun Apr 18 15:18:44 2004
@@ -1,3 +1,8 @@
+2004-04-18  Nektarios Papadopoulos <npapadop at inaccessnetworks.com>
+
+	* tools/gjdoc/javalib/gnu/classpath/tools/gjdoc/Main.java:
+	Fixed -help option.
+
 2004-04-18  Dalibor Topic <robilad at kaffe.org>
 
 	* config/m68k/openbsd2/jit.h:
Index: kaffe/tools/gjdoc/javalib/gnu/classpath/tools/gjdoc/Main.java
diff -u kaffe/tools/gjdoc/javalib/gnu/classpath/tools/gjdoc/Main.java:1.1 kaffe/tools/gjdoc/javalib/gnu/classpath/tools/gjdoc/Main.java:1.2
--- kaffe/tools/gjdoc/javalib/gnu/classpath/tools/gjdoc/Main.java:1.1	Wed Apr 14 19:41:12 2004
+++ kaffe/tools/gjdoc/javalib/gnu/classpath/tools/gjdoc/Main.java	Sun Apr 18 15:18:47 2004
@@ -537,6 +537,9 @@
       List customOptions=new LinkedList();
 
 
+      rootDoc = new RootDocImpl();
+      reporter = rootDoc.getReporter();
+
       //--- Iterate over all options given on the command line
 
       for (Iterator it = arguments.iterator(); it.hasNext(); ) {
@@ -556,29 +559,33 @@
 	 }
 
 	 //--- Otherwise the option is recognized as a standard option.
-	 //         If the option requires more arguments than given on the
-	 //         command line, issue a fatal error
-
-	 else if (!it.hasNext()) {
-	    reporter.printFatal("Missing value for option "+arg+".");
-	 }
-
-	 //--- The option is recognized as standard option, and all
-	 //         required arguments are supplied. Create a new String
+	 //         if all required arguments are supplied. Create a new String
 	 //         array for the option and its arguments, and store it
 	 //         in the options array.
 
-	 //         FIXME: this does not deal well with omitted arguments
-	 //         like such '-sourcepath -private': this would lead
-	 //         to '-private' being silently accepted as an argument
-	 //         to '-sourcepath'.
-
 	 else {
 	    String[] option=new String[optlen];
 	    option[0] = arg;
-	    for (int j=1; j<optlen; ++j)
-	       option[j] = (String)it.next();
-	    options.add(option);
+	    boolean optargs_ok = true;
+	    for (int j=1; j<optlen && optargs_ok; ++j) {
+	 	if (it.hasNext()) {
+	 		option[j] = (String)it.next();
+			if (option[j].startsWith("-")) {
+				optargs_ok = false;
+			}
+		}
+		else {
+			optargs_ok = false;
+		}
+	    }
+	    if (optargs_ok)
+	    	options.add(option);
+	    else {
+	 	//         If the option requires more arguments than given on the
+	 	//         command line, issue a fatal error
+
+	    	reporter.printFatal("Missing value for option "+arg+".");
+	    }
 	 }
       }
 
@@ -587,9 +594,6 @@
       String[][] optionArr=(String[][])options.toArray(new String[options.size()][0]);
 
       //--- Validate all options and issue warnings/errors
-
-      rootDoc = new RootDocImpl();
-      reporter = rootDoc.getReporter();
       
       if (validOptions(optionArr, rootDoc)) {
 




More information about the kaffe mailing list