ratpoison-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RP] Solaris


From: Gergely Nagy
Subject: Re: [RP] Solaris
Date: Fri Jan 4 09:27:02 2002
User-agent: Wanderlust/2.9.2 (Unchained Melody) Emacs/21.1 Mule/5.0 (SAKAKI)

> Solaris 2.7: putenv/getenv works. But I could not find clearenv :-(

I poked around the manual pages, and I *think* that putenv("FOO=");
might do as a replacement for unsetenv("FOO"); I'll come up with a
patch for ratpoison in the very near future, which will implement
(un)setenv on systems where only putenv is avaialable.

Actually, something along these lines should do the trick (using
HAVE_foo and autoconf test would be better though):

#ifndef setenv
/* FIXME: overwrite has no effect in this implementation! */
int setenv(const char *name, const char *value, int overwrite)
{
        char *tmp;
        int i;

        tmp = (char *)malloc (strlen(name) + strlen(value) + 2);
        strcpy(tmp, name);
        strcat(tmp, "=");
        strcat(tmp, value);

        i = putenv(tmp);

        free(tmp);

        return i;
}
#endif
#ifndef unsetenv
void unsetenv (const char *name)
{
        char *tmp;
        int i;

        tmp = (char *)malloc (strlen(name) + 2);
        strcpy (tmp, name);
        strcat (tmp, "=");

        putenv(tmp);

        free(tmp);
}
#endif

Attachment: pgp35kB_ND1yp.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]