From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: stefan Newsgroups: gmane.lisp.guile.devel Subject: Re: native Win32 guile 1.7.0 Date: Sat, 14 Jun 2003 07:36:24 +0200 (CEST) Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Message-ID: References: <87k7bsmaqq.fsf@zip.com.au> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Trace: main.gmane.org 1055569200 11223 80.91.224.249 (14 Jun 2003 05:40:00 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sat, 14 Jun 2003 05:40:00 +0000 (UTC) Cc: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sat Jun 14 07:39:57 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 19R3lc-0002uJ-00 for ; Sat, 14 Jun 2003 07:39:56 +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 19R3np-0003vV-Lx for guile-devel@m.gmane.org; Sat, 14 Jun 2003 01:42:13 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.20) id 19R3nd-0003vE-I4 for guile-devel@gnu.org; Sat, 14 Jun 2003 01:42:01 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.20) id 19R3nc-0003v3-Ah for guile-devel@gnu.org; Sat, 14 Jun 2003 01:42:00 -0400 Original-Received: from obh.snafu.de ([213.73.92.34]) by monty-python.gnu.org with esmtp (Exim 4.20) id 19R3nb-0003tH-TA for guile-devel@gnu.org; Sat, 14 Jun 2003 01:42:00 -0400 Original-Received: from p-165-001.zrz.tu-berlin.de ([130.149.165.1] helo=bono) by obh.snafu.de with asmtp (TLSv1:DES-CBC3-SHA:168) (Exim 3.36 #1) id 19R3nZ-000Iol-00; Sat, 14 Jun 2003 07:41:58 +0200 Original-Received: from localhost ([127.0.0.1] ident=ela) by bono with esmtp (Exim 3.36 #1) id 19R3iC-0000ao-00; Sat, 14 Jun 2003 07:36:25 +0200 X-X-Sender: stefan@bono.reversers.net Original-To: Kevin Ryde In-Reply-To: <87k7bsmaqq.fsf@zip.com.au> 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:2537 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:2537 On Thu, 12 Jun 2003, Kevin Ryde wrote: > > 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'; > } > } I tested this piece of code on my Win95 box and modified it a bit to get it really working. Then I applied the code CVS. The (putenv) primitive now behaves equally on GNU/Linux and Win32. Cheers, stefan@lkcc.org _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://mail.gnu.org/mailman/listinfo/guile-devel