X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;f=libjava%2Fgij.cc;h=64457857a1321e52b65546a0ee884ac7834a71d9;hb=0d6299d3db27837d4344fdfc748541b831fba760;hp=54674a9d2c806453500c8baab411332a9f208ba3;hpb=57b0b1025d6ee33cfb8c6a7d18153e12f35063b5;p=pf3gnuchains%2Fgcc-fork.git diff --git a/libjava/gij.cc b/libjava/gij.cc index 54674a9d2c8..64457857a13 100644 --- a/libjava/gij.cc +++ b/libjava/gij.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 1999, 2000 Free Software Foundation +/* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation This file is part of libgcj. @@ -24,25 +24,32 @@ details. */ static void help () { - printf ("Usage: gij [OPTION] ... CLASS [ARGS] ...\n\n"); - printf ("Interpret Java bytecodes\n\n"); + printf ("Usage: gij [OPTION] ... CLASS [ARGS] ...\n"); + printf (" to interpret Java bytecodes, or\n"); + printf (" gij -jar [OPTION] ... JARFILE [ARGS] ...\n"); + printf (" to execute a jar file\n\n"); + printf (" --cp LIST set class path\n"); + printf (" --classpath LIST set class path\n"); printf (" -DVAR=VAL define property VAR with value VAL\n"); - printf (" --help print this help, then exit\n"); + printf (" -?, --help print this help, then exit\n"); + printf (" -X print help on supported -X options, then exit\n"); printf (" --ms=NUMBER set initial heap size\n"); printf (" --mx=NUMBER set maximum heap size\n"); + printf (" --verbose[:class] print information about class loading\n"); + printf (" --showversion print version number, then keep going\n"); printf (" --version print version number, then exit\n"); - printf ("\nSee http://sources.redhat.com/java/ for information on reporting bugs\n"); + printf ("\nOptions can be specified with `-' or `--'.\n"); + printf ("\nSee http://gcc.gnu.org/java/ for information on reporting bugs\n"); exit (0); } static void version () { - printf ("gij (GNU libgcj) version %s\n\n", VERSION); - printf ("Copyright (C) 1999, 2000 Free Software Foundation.\n"); + printf ("gij (GNU libgcj) version %s\n\n", __VERSION__); + printf ("Copyright (C) 2002 Free Software Foundation, Inc.\n"); printf ("This is free software; see the source for copying conditions. There is NO\n"); printf ("warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"); - exit (0); } int @@ -51,6 +58,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; + bool jar_mode = false; int i; for (i = 1; i < argc; ++i) @@ -73,14 +81,25 @@ main (int argc, const char **argv) continue; } + if (! strcmp (arg, "-jar")) + { + jar_mode = true; + continue; + } + /* Allow both single or double hyphen for all remaining options. */ if (arg[1] == '-') ++arg; - if (! strcmp (arg, "-help")) + if (! strcmp (arg, "-help") || ! strcmp (arg, "-?")) help (); else if (! strcmp (arg, "-version")) + { + version (); + exit (0); + } + else if (! strcmp (arg, "-showversion")) version (); /* FIXME: use getopt and avoid the ugliness here. We at least need to handle the argument in a better way. */ @@ -106,6 +125,26 @@ main (int argc, const char **argv) goto no_arg; _Jv_SetMaximumHeapSize (argv[++i]); } + else if (! strcmp (arg, "-cp") || ! strcmp (arg, "-classpath")) + { + if (i >= argc - 1) + goto no_arg; + // We set _Jv_Jar_Class_Path. If the user specified `-jar' + // then the jar code will override this. This is the + // correct behavior. + _Jv_Jar_Class_Path = argv[++i]; + } + else if (! strcmp (arg, "-verbose") || ! strcmp (arg, "-verbose:class")) + gcj::verbose_class_flag = true; + else if (arg[1] == 'X') + { + if (arg[2] == '\0') + { + printf ("gij: currently no -X options are recognized\n"); + exit (0); + } + /* Ignore other -X options. */ + } else { fprintf (stderr, "gij: unrecognized option -- `%s'\n", argv[i]); @@ -120,9 +159,12 @@ main (int argc, const char **argv) if (argc - i < 1) { fprintf (stderr, "Usage: gij [OPTION] ... CLASS [ARGS] ...\n"); + fprintf (stderr, " to invoke CLASS.main, or\n"); + fprintf (stderr, " gij -jar [OPTION] ... JARFILE [ARGS] ...\n"); + fprintf (stderr, " to execute a jar file\n"); fprintf (stderr, "Try `gij --help' for more information.\n"); exit (1); } - _Jv_RunMain (argv[i], argc - i, argv + i); + _Jv_RunMain (NULL, argv[i], argc - i, argv + i, jar_mode); }