You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by ap...@apache.org on 2007/04/25 12:33:53 UTC

svn commit: r532301 - /harmony/enhanced/classlib/trunk/modules/luni/src/main/native/launcher/shared/main.c

Author: apetrenko
Date: Wed Apr 25 03:33:51 2007
New Revision: 532301

URL: http://svn.apache.org/viewvc?view=rev&rev=532301
Log:
Patch for HARMONY-3615 "[classlib][launcher] should print help message when run without class specified"

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/main/native/launcher/shared/main.c

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/launcher/shared/main.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/launcher/shared/main.c?view=diff&rev=532301&r1=532300&r2=532301
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/launcher/shared/main.c (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/launcher/shared/main.c Wed Apr 25 03:33:51 2007
@@ -103,6 +103,16 @@
 #define	DIR_SEPERATOR_STRING "/"
 #endif
 
+void
+printUsageMessage(HyPortLibrary * portLibrary)
+{
+  PORT_ACCESS_FROM_PORT (portLibrary);
+  hyfile_printf (PORTLIB, HYPORT_TTY_OUT, "Harmony Java launcher\n");
+  hyfile_printf (PORTLIB, HYPORT_TTY_OUT, HY_COPYRIGHT_STRING "\n");
+  hyfile_printf (PORTLIB, HYPORT_TTY_OUT,
+                  "java [-vm:vmdll -vmdir:dir -D... [-X...]] [args]\n");
+}
+
 /**
  * The actual main function wrapped in the standard GP-handler.
  * 
@@ -196,10 +206,7 @@
      *  they thought they were running Java...
 	 */
 	if (argc <= 1) {
-      hyfile_printf (PORTLIB, HYPORT_TTY_OUT, "Harmony Java launcher\n");
-      hyfile_printf (PORTLIB, HYPORT_TTY_OUT, HY_COPYRIGHT_STRING "\n");
-      hyfile_printf (PORTLIB, HYPORT_TTY_OUT,
-                     "java [-vm:vmdll -vmdir:dir -D... [-X...]] [args]\n");
+      printUsageMessage(PORTLIB);
       goto bail;
     }
 
@@ -266,6 +273,11 @@
 	/* Now ensure tools JAR is on classpath */
 	augmentToolsArgs(args->portLibrary, &argc, &argv);
 	classArg = arrangeToolsArgs(args->portLibrary, &argc, &argv, mainClass);
+  }
+
+  if (mainClass == NULL && !isStandaloneJar) {
+    printUsageMessage(PORTLIB);
+    goto bail;
   }
 
   /* Useful when debugging */