From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Kevin Ryde Newsgroups: gmane.lisp.guile.devel Subject: Re: native Win32 guile 1.7.0 Date: Thu, 12 Jun 2003 09:54:05 +1000 Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Message-ID: <87k7bsmaqq.fsf@zip.com.au> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1055375609 4800 80.91.224.249 (11 Jun 2003 23:53:29 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 11 Jun 2003 23:53:29 +0000 (UTC) Cc: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Thu Jun 12 01:53:27 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19QFPD-0001FH-00 for ; Thu, 12 Jun 2003 01:53:27 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.20) id 19QFQi-0007pb-KB for guile-devel@m.gmane.org; Wed, 11 Jun 2003 19:55:00 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.20) id 19QFQK-0007WL-RZ for guile-devel@gnu.org; Wed, 11 Jun 2003 19:54:36 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.20) id 19QFQB-0007B9-Lj for guile-devel@gnu.org; Wed, 11 Jun 2003 19:54:28 -0400 Original-Received: from snoopy.pacific.net.au ([61.8.0.36]) by monty-python.gnu.org with esmtp (Exim 4.20) id 19QFQA-00074Z-0y for guile-devel@gnu.org; Wed, 11 Jun 2003 19:54:26 -0400 Original-Received: from sunny.pacific.net.au (sunny.pacific.net.au [203.2.228.40]) h5BNsMYd021963; Thu, 12 Jun 2003 09:54:24 +1000 Original-Received: from wisma.pacific.net.au (wisma.pacific.net.au [210.23.129.72]) by sunny.pacific.net.au with ESMTP id h5BNsMQg025312; Thu, 12 Jun 2003 09:54:22 +1000 (EST) Original-Received: from localhost (ppp124.dyn228.pacific.net.au [203.143.228.124]) by wisma.pacific.net.au (8.12.9/8.12.9) with ESMTP id h5BNsAYZ011409; Thu, 12 Jun 2003 09:54:21 +1000 (EST) Original-Received: from gg by localhost with local (Exim 3.35 #1 (Debian)) id 19QFPr-00043r-00; Thu, 12 Jun 2003 09:54:07 +1000 Original-To: stefan Mail-Copies-To: never In-Reply-To: (stefan@lkcc.org's message of "Fri, 30 May 2003 11:27:37 +0200 (CEST)") User-Agent: Gnus/5.090019 (Oort Gnus v0.19) Emacs/21.2 (gnu/linux) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Developers list for Guile, the GNU extensibility library List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.lisp.guile.devel:2523 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:2523 stefan writes: > > I just added a check for unsetenv() in the configure script and used it in > posix.c appropiately for mingw32 hosts. Which means that a > putenv("name="); would remove the environment variable 'name'. I guess this means it's not possible to use putenv("name=") to set name to an empty string. I'm pretty sure it's valid to do so on other systems. On wine, which might not be the same as a real mingw, setting "name= " and then changing that space to a \0 does the trick. Bit nasty to go changing putenvs strings like that, but unless there's a setenv or some function hiding then there might be no choice. Eg, (untested), /* If str is "FOO=", ie. attempting to set an empty string, then we need to see if it's been successful. On MINGW, "FOO=" means remove FOO from the environment. As a workaround, we set "FOO= ", ie. a space, and then modify the string returned by getenv. It's not enough just to modify the string we set, because MINGW putenv copies it. */ if (ptr[SCM_STRING_LENGTH(str)-1] == '=') { SCM name = scm_substring (str, SCM_MAKINUM (0), SCM_MAKINUM (SCM_STRING_LENGTH (str) - 1)); if (getenv (SCM_STRING_CHARS (name)) == NULL) { char *alt = scm_malloc (SCM_STRING_LENGTH (str) + 2); memcpy (alt, SCM_STRING_CHARS (str), SCM_STRING_LENGTH(str)); alt[SCM_STRING_LENGTH(str)] = ' '; alt[SCM_STRING_LENGTH(str)+1] = '\0'; rv = putenv (alt); if (rv < 0) SCM_SYSERROR; free (ptr); /* don't need the old string we gave to putenv */ alt = getenv (SCM_STRING_CHARS (name)); alt[SCM_STRING_LENGTH(str)] = '\0'; } } _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://mail.gnu.org/mailman/listinfo/guile-devel