[Libguestfs] [PATCH] daemon/Win32: Replace setenv with Win32 equivalent.

Jim Meyering jim at meyering.net
Wed Nov 25 17:51:55 UTC 2009


Richard W.M. Jones wrote:
> Subject: [PATCH 4/7] daemon/Win32: Replace setenv with Win32 equivalent.
...
> +#ifdef HAVE_WINDOWS_H
> +#include <windows.h>
> +#endif
> +
>  #include <stdio.h>
>  #include <stdlib.h>
>  #include <string.h>
> @@ -167,6 +171,9 @@ main (int argc, char *argv[])
>      perror ("sigaction SIGPIPE"); /* but try to continue anyway ... */
>  #endif
>
> +#ifdef WIN32
> +#define setenv(n,v,f) _putenv(n "=" v)
> +#endif
>    /* Set up a basic environment.  After we are called by /init the
>     * environment is essentially empty.
>     * https://bugzilla.redhat.com/show_bug.cgi?id=502074#c5

ACK,
It's slightly more readable with nesting-reflecting indentation:

#ifdef HAVE_WINDOWS_H
# include <windows.h>
#endif

...

#ifdef WIN32
# define setenv(n,v,f) _putenv(n "=" v)
#endif




More information about the Libguestfs mailing list