one global way to set environment variables - xdm patch
this is a patch for xdm (and kdm) to read /etc/environment.
bad features :
- hardcoded filename "/etc/environment"
(sorry, i tried to change that, but i don't understand the
xdmcp protocoll and failed ...)
- no dupe checking for variables (xdm sets some variables himself,
so PATH or such things could be set twice).
but i think there should realy be one global way to set environment
variables for login, xdm, telnet and ssh sessions.
currently there is none as x11 doesn't import /etc/environment.
sourceing the file does not help, as the variables should be exported.
(e.g. PATH or LANG must be set for applications called by the
windowmanager and in xterms).
This way kdm will read /etc/environment (like ssh and login do), and set
the environment accourding. sorry, i couldn't get the filename
a) PATH is set in the xdm-config file
b) PS1 will not reach an xterm. i don't know why.
--- verify.c Thu Nov 20 14:08:18 1997
+++ verify.c.new Mon Feb 2 21:28:16 1998
@@ -88,6 +88,8 @@
extern char **defaultEnv (), **setEnv ();
+ FILE * fd;
+ char buffer;
env = defaultEnv ();
env = setEnv (env, "DISPLAY", d->name);
@@ -103,6 +105,24 @@
if ( (str = getenv(*envvar)))
env = setEnv (env, *envvar, str);
+ if (fd = fopen("/etc/environment","r"))
+ while (fgets(buffer,sizeof(buffer),fd)==buffer)
+ char *cp;
+ cp = strchr(buffer, '\n');
+ if (!cp) break;
+ *cp = '\0';
+ cp = strchr(buffer,'=');
+ if (cp)
+ env = setEnv(env, buffer, ++cp);
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
Trouble? e-mail to email@example.com .