diff options
author | Per Bothner <per@bothner.com> | 2002-03-03 00:35:11 -0800 |
---|---|---|
committer | Per Bothner <bothner@gcc.gnu.org> | 2002-03-03 00:35:11 -0800 |
commit | 2a85660dc27b7059ea083a775a99a0c206abeee4 (patch) | |
tree | 2d5ffb4752a4b455256e860f15ecb662d91ac6e9 /gcc/java/jcf-path.c | |
parent | c26a6db811ab9dd1dd94c1b410cb93871d6d1a47 (diff) | |
download | gcc-2a85660dc27b7059ea083a775a99a0c206abeee4.zip gcc-2a85660dc27b7059ea083a775a99a0c206abeee4.tar.gz gcc-2a85660dc27b7059ea083a775a99a0c206abeee4.tar.bz2 |
Make --CLASSPATH by a synonym for --classpath and -classpath.
Implement --bootclasspath.
From-SVN: r50247
Diffstat (limited to 'gcc/java/jcf-path.c')
-rw-r--r-- | gcc/java/jcf-path.c | 66 |
1 files changed, 28 insertions, 38 deletions
diff --git a/gcc/java/jcf-path.c b/gcc/java/jcf-path.c index efdd843..0976705 100644 --- a/gcc/java/jcf-path.c +++ b/gcc/java/jcf-path.c @@ -1,6 +1,6 @@ /* Handle CLASSPATH, -classpath, and path searching. - Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -72,7 +72,8 @@ static void add_path PARAMS ((struct entry **, const char *, int)); built-in system directory (only libgcj.jar) CLASSPATH environment variable -classpath option overrides $CLASSPATH - -CLASSPATH option overrides $CLASSPATH, -classpath, and built-in + -CLASSPATH option is a synonym for -classpath (for compatibility) + -bootclasspath overrides built-in -I prepends path to list We implement this by keeping several path lists, and then simply @@ -85,10 +86,7 @@ static struct entry *include_dirs; static struct entry *classpath_env; /* This holds the -classpath command-line option. */ -static struct entry *classpath_u; - -/* This holds the -CLASSPATH command-line option. */ -static struct entry *classpath_l; +static struct entry *classpath_user; /* This holds the default directories. Some of these will have the "system" flag set. */ @@ -222,6 +220,8 @@ add_path (entp, cp, is_system) } } +static int init_done = 0; + /* Initialize the path module. */ void jcf_path_init () @@ -231,7 +231,9 @@ jcf_path_init () struct stat stat_b; int found = 0, len; - add_entry (&sys_dirs, ".", 0); + if (init_done) + return; + init_done = 1; sep[0] = DIR_SEPARATOR; sep[1] = '\0'; @@ -284,27 +286,25 @@ jcf_path_init () add_path (&classpath_env, cp, 0); } -/* Call this when -CLASSPATH is seen on the command line. - This is the override-all switch, even the built in classes - are overridden. +/* Call this when -classpath is seen on the command line. + This overrides only the $CLASSPATH environment variable. */ void -jcf_path_CLASSPATH_arg (path) +jcf_path_classpath_arg (path) const char *path; { - free_entry (&classpath_l); - add_path (&classpath_l, path, 0); + free_entry (&classpath_user); + add_path (&classpath_user, path, 0); } -/* Call this when -classpath is seen on the command line. - This overrides only the $CLASSPATH environment variable. +/* Call this when -bootclasspath is seen on the command line. */ void -jcf_path_classpath_arg (path) +jcf_path_bootclasspath_arg (path) const char *path; { - free_entry (&classpath_u); - add_path (&classpath_u, path, 0); + free_entry (&sys_dirs); + add_path (&sys_dirs, path, 1); } /* Call this when -I is seen on the command line. */ @@ -322,42 +322,32 @@ void jcf_path_seal (print) int print; { - int do_system = 1; struct entry *secondary; sealed = include_dirs; include_dirs = NULL; - if (classpath_l) + if (classpath_user) { - secondary = classpath_l; - classpath_l = NULL; - do_system = 0; - } - else if (classpath_u) - { - secondary = classpath_u; - classpath_u = NULL; + secondary = classpath_user; + classpath_user = NULL; } else { + if (! classpath_env) + add_entry (&classpath_env, ".", 0); + secondary = classpath_env; classpath_env = NULL; } - free_entry (&classpath_l); - free_entry (&classpath_u); + + free_entry (&classpath_user); free_entry (&classpath_env); append_entry (&sealed, secondary); - - if (do_system) - { - append_entry (&sealed, sys_dirs); - sys_dirs = NULL; - } - else - free_entry (&sys_dirs); + append_entry (&sealed, sys_dirs); + sys_dirs = NULL; if (print) { |