aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libjava/ChangeLog8
-rw-r--r--libjava/gij.cc13
-rw-r--r--libjava/include/java-props.h6
-rw-r--r--libjava/java/lang/natSystem.cc18
4 files changed, 39 insertions, 6 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index ae6a17d..4f37d8a 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,5 +1,13 @@
1999-10-15 Tom Tromey <tromey@cygnus.com>
+ * gij.cc (main): Formatting fixes.
+ (_Jv_Compiler_Properties): Define.
+ * java/lang/natSystem.cc (_Jv_Environment_Properties): Don't
+ declare.
+ (init_properties): Set properites from _Jv_Compiler_Properties.
+ * include/java-props.h (_Jv_Compiler_Properties,
+ _Jv_Environment_Properties): Declare.
+
* include/java-props.h: Added copyright.
1999-10-13 Anthony Green <green@cygnus.com>
diff --git a/libjava/gij.cc b/libjava/gij.cc
index ffe1515..b851b77 100644
--- a/libjava/gij.cc
+++ b/libjava/gij.cc
@@ -15,13 +15,20 @@ details. */
#include <java/lang/System.h>
#include <java/util/Properties.h>
-int main (int argc, const char **argv)
+// This is used to initialize the compiled-in system properties.
+const char *_Jv_Compiler_Properties[] =
+{
+ NULL
+};
+
+int
+main (int argc, const char **argv)
{
if (argc < 2)
{
- printf ("usage: %s <class name> args\n", argv[0]);
+ printf ("usage: %s CLASS [ARGS]...\n", argv[0]);
exit (1);
}
- _Jv_RunMain (argv[1], argc-1, argv+1);
+ _Jv_RunMain (argv[1], argc - 1, argv + 1);
}
diff --git a/libjava/include/java-props.h b/libjava/include/java-props.h
index 53ecb09..65130da 100644
--- a/libjava/include/java-props.h
+++ b/libjava/include/java-props.h
@@ -19,5 +19,11 @@ typedef struct
size_t value_length;
} property_pair;
+// The compiler generates this declaration.
+extern char *_Jv_Compiler_Properties[];
+
+// Properties taken from the user's environment.
+extern property_pair *_Jv_Environment_Properties;
+
#endif
diff --git a/libjava/java/lang/natSystem.cc b/libjava/java/lang/natSystem.cc
index f146f3e..268c1cc 100644
--- a/libjava/java/lang/natSystem.cc
+++ b/libjava/java/lang/natSystem.cc
@@ -53,7 +53,6 @@ details. */
#define SystemClass _CL_Q34java4lang6System
extern java::lang::Class SystemClass;
-extern property_pair *_Jv_Environment_Properties;
#if defined (ECOS)
@@ -336,8 +335,8 @@ java::lang::System::init_properties (void)
while (buf_r != NULL)
{
- int r = getpwuid_adaptor
- (getpwuid_r, user_id, &pwd_r, buf_r, len_r, &pwd_entry);
+ int r = getpwuid_adaptor (getpwuid_r, user_id, &pwd_r,
+ buf_r, len_r, &pwd_entry);
if (r == 0)
break;
else if (r != ERANGE)
@@ -379,6 +378,19 @@ java::lang::System::init_properties (void)
free (buffer);
#endif
+ // Set some properties according to whatever was compiled in with
+ // `-D'.
+ for (int i = 0; _Jv_Compiler_Properties[i]; ++i)
+ {
+ const char *s, *p;
+ // Find the `='.
+ for (s = p = _Jv_Compiler_Properties[i]; *s && *s != '='; ++s)
+ ;
+ jstring name = JvNewStringLatin1 (p, s - p);
+ jstring val = JvNewStringLatin1 (*s == '=' ? s + 1 : s);
+ properties->put (name, val);
+ }
+
// Set the system properties from the user's environment.
if (_Jv_Environment_Properties)
{