gij.cc (main): Formatting fixes.

* 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.

From-SVN: r30020
This commit is contained in:
Tom Tromey 1999-10-15 16:53:41 +00:00 committed by Tom Tromey
parent 7cf4196339
commit 76ed0c0a4b
4 changed files with 39 additions and 6 deletions

View File

@ -1,5 +1,13 @@
1999-10-15 Tom Tromey <tromey@cygnus.com> 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. * include/java-props.h: Added copyright.
1999-10-13 Anthony Green <green@cygnus.com> 1999-10-13 Anthony Green <green@cygnus.com>

View File

@ -15,13 +15,20 @@ details. */
#include <java/lang/System.h> #include <java/lang/System.h>
#include <java/util/Properties.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) if (argc < 2)
{ {
printf ("usage: %s <class name> args\n", argv[0]); printf ("usage: %s CLASS [ARGS]...\n", argv[0]);
exit (1); exit (1);
} }
_Jv_RunMain (argv[1], argc-1, argv+1); _Jv_RunMain (argv[1], argc - 1, argv + 1);
} }

View File

@ -19,5 +19,11 @@ typedef struct
size_t value_length; size_t value_length;
} property_pair; } 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 #endif

View File

@ -53,7 +53,6 @@ details. */
#define SystemClass _CL_Q34java4lang6System #define SystemClass _CL_Q34java4lang6System
extern java::lang::Class SystemClass; extern java::lang::Class SystemClass;
extern property_pair *_Jv_Environment_Properties;
#if defined (ECOS) #if defined (ECOS)
@ -336,8 +335,8 @@ java::lang::System::init_properties (void)
while (buf_r != NULL) while (buf_r != NULL)
{ {
int r = getpwuid_adaptor int r = getpwuid_adaptor (getpwuid_r, user_id, &pwd_r,
(getpwuid_r, user_id, &pwd_r, buf_r, len_r, &pwd_entry); buf_r, len_r, &pwd_entry);
if (r == 0) if (r == 0)
break; break;
else if (r != ERANGE) else if (r != ERANGE)
@ -379,6 +378,19 @@ java::lang::System::init_properties (void)
free (buffer); free (buffer);
#endif #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. // Set the system properties from the user's environment.
if (_Jv_Environment_Properties) if (_Jv_Environment_Properties)
{ {