This is the mail archive of the
java-patches@sources.redhat.com
mailing list for the Java project.
patch to add -classpath option to gij
- To: java-patches at sourceware dot cygnus dot com
- Subject: patch to add -classpath option to gij
- From: Oskar Liljeblad <osk at hem dot passagen dot se>
- Date: Mon, 24 Jul 2000 15:00:08 +0200
Here's a patch that add the -classpath option to gij. It was
originally written by me but Jeff Sturm refurbished it a
bit (and added support for -classpath=FOO as well -classpath FOO).
2000-07-24 Oskar Liljeblad <osk@hem.passagen.se>
* gij.cc: Implemented parsing of -classpath option.
Oskar Liljeblad (osk@hem.passagen.se)
Index: gij.cc
===================================================================
RCS file: /cvs/java/libgcj/libjava/gij.cc,v
retrieving revision 1.9
diff -u -p -r1.9 gij.cc
--- gij.cc 2000/05/31 22:49:18 1.9
+++ gij.cc 2000/07/23 14:02:16
@@ -27,6 +27,7 @@ help ()
printf ("Usage: gij [OPTION] ... CLASS [ARGS] ...\n\n");
printf ("Interpret Java bytecodes\n\n");
printf (" -DVAR=VAL define property VAR with value VAL\n");
+ printf (" --classpath=PATH set path to find .class files\n");
printf (" --help print this help, then exit\n");
printf (" --ms=NUMBER set initial heap size\n");
printf (" --mx=NUMBER set maximum heap size\n");
@@ -51,6 +52,7 @@ main (int argc, const char **argv)
/* We rearrange ARGV so that all the -D options appear near the
beginning. */
int last_D_option = 0;
+ const char *classpath = NULL;
int i;
for (i = 1; i < argc; ++i)
@@ -106,6 +108,14 @@ main (int argc, const char **argv)
goto no_arg;
_Jv_SetMaximumHeapSize (argv[++i]);
}
+ else if (! strncmp (arg, "-classpath=", 11))
+ classpath = arg + 11;
+ else if (! strcmp (arg, "-classpath"))
+ {
+ if (i >= argc - 1)
+ goto no_arg;
+ classpath = argv[++i];
+ }
else
{
fprintf (stderr, "gij: unrecognized option -- `%s'\n", argv[i]);
@@ -116,6 +126,15 @@ main (int argc, const char **argv)
argv[last_D_option] = NULL;
_Jv_Compiler_Properties = argv;
+
+ if (classpath)
+ {
+ char *cp_env;
+ cp_env = (char *) _Jv_Malloc(strlen (classpath) + 10 + 1);
+ strcpy (cp_env, "CLASSPATH=");
+ strcat (cp_env, argv[i]);
+ putenv (cp_env);
+ }
if (argc - i < 1)
{