Tested:
#include <stdlib.h>
#include <stdio.h>
int
main (int argc, const char *argv[])
{
char *s;
putenv ("NAME=1");
#ifdef NO_EQUAL
s = "NAME";
#else
s = "NAME=";
#endif
putenv (s);
if (getenv ("NAME"))
printf ("NAME=%s\n", getenv ("NAME"));
else
puts ("no environment variable: NAME");
return 0;
}With -DNO_EQUAL option to compile, it doesn't unsetenv.
putenv("NAME") is nonstandard extension (available in GNU implementation).
We use this nonstandard extension in common/sysutil.c:gnupg_unsetenv for Windows (!HAVE_UNSETENV).