unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Kevin Ryde <user42@zip.com.au>
Cc: guile-devel@gnu.org
Subject: Re: native Win32 guile 1.7.0
Date: Thu, 12 Jun 2003 09:54:05 +1000	[thread overview]
Message-ID: <87k7bsmaqq.fsf@zip.com.au> (raw)
In-Reply-To: <Pine.LNX.4.44.0305301113300.607-100000@bono.reversers.net> (stefan@lkcc.org's message of "Fri, 30 May 2003 11:27:37 +0200 (CEST)")

stefan <stefan@lkcc.org> 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


  parent reply	other threads:[~2003-06-11 23:54 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-29 14:31 native Win32 guile 1.7.0 stefan
2003-05-29 23:13 ` Kevin Ryde
2003-05-29 23:23   ` Kevin Ryde
2003-05-30  3:23   ` stefan
2003-05-30 23:58     ` Kevin Ryde
2003-06-11 23:42       ` Kevin Ryde
2003-05-30  9:27   ` stefan
2003-05-31  0:20     ` Kevin Ryde
2003-06-08 22:03     ` Kevin Ryde
2003-06-11 23:15       ` Kevin Ryde
2003-06-12  5:01       ` stefan
2003-06-15  0:15         ` putenv tests (was: native Win32 guile 1.7.0) Kevin Ryde
2003-06-11 23:54     ` Kevin Ryde [this message]
2003-06-14  5:36       ` native Win32 guile 1.7.0 stefan
2003-06-14 12:24         ` Marius Vollmer
2003-06-14 13:46           ` stefan
2003-06-14 16:18             ` Marius Vollmer
2003-06-16 17:25               ` stefan
2003-06-18 23:42                 ` Marius Vollmer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k7bsmaqq.fsf@zip.com.au \
    --to=user42@zip.com.au \
    --cc=guile-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).