From: Trastabuga
Subject: How to export a new environment variable from CMUCL?
Date: 
Message-ID: <1173925069.891548.70840@o5g2000hsb.googlegroups.com>
I tried (setf (cdr (assoc :GDFONTPATH ext:*environment-list*)) "/usr/
share/fonts/truetype/msttcorefonts") and though it adds a new variable
to ext:*environment-list* it doesn't seem to have any effect on the
system. I am doing it correctly or I need do some unix system calls?

Andrew

From: John Thingstad
Subject: Re: How to export a new environment variable from CMUCL?
Date: 
Message-ID: <op.to7l76w1pqzri1@pandora.upc.no>
On Thu, 15 Mar 2007 03:17:49 +0100, Trastabuga <·········@gmail.com> wrote:

> I tried (setf (cdr (assoc :GDFONTPATH ext:*environment-list*)) "/usr/
> share/fonts/truetype/msttcorefonts") and though it adds a new variable
> to ext:*environment-list* it doesn't seem to have any effect on the
> system. I am doing it correctly or I need do some unix system calls?
>
> Andrew
>

naw, You need to set the environment for the OS.
Merly setting it in the list won't do.

To set it externally you must use the OS command setenv.
For example you could download and load CFFI and write

(foreign-funcall "setenv" var :string val :string)

Well that is the portable way anyhow.

-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
From: Luís Oliveira
Subject: Re: How to export a new environment variable from CMUCL?
Date: 
Message-ID: <m1odmvoynx.fsf@deadspam.com>
"John Thingstad" <··············@chello.no> writes:
> To set it externally you must use the OS command setenv.
> For example you could download and load CFFI and write
>
> (foreign-funcall "setenv" var :string val :string)

;; int setenv(const char *name, const char *value, int rewrite);

I think that should be:

  (foreign-funcall "setenv" :string "FOO" :string "bar" :boolean t :int)

-- 
Luís Oliveira
http://student.dei.uc.pt/~lmoliv/
From: John Thingstad
Subject: Re: How to export a new environment variable from CMUCL?
Date: 
Message-ID: <op.to7ywjy6pqzri1@pandora.upc.no>
On Thu, 15 Mar 2007 05:20:55 +0100, Madhu <·······@meer.net> wrote:

>
> In order to mutate the system, like John Thingstad suggested, With
> CMUCL you should be able to do
>
> (alien:def-alien-routine ("getenv" unix-getenv) c-call:c-string
>   (name c-call:c-string))
> (alien:def-alien-routine ("setenv" unix-setenv) c-call:int
>   (name c-call:c-string)
>   (value c-call:c-string)
>   (overwrite c-call:int))
> (alien:def-alien-routine ("unsetenv" unix-unsetenv) c-call:void
>   (name c-call:c-string))
>
> #||
> (unix-getenv "HOME")
> (unix-setenv "HOME" "/tmp/" 1) ;See man setenv(3)
> (unix-unsetenv "HOME")
> ||#
> --
> Madhu
>

For the record setenv and getenv work under Windows as well (and Mac).

-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/