Google Groups unterstützt keine neuen Usenet-Beiträge oder ‑Abos mehr. Bisherige Inhalte sind weiterhin sichtbar.

setenv and unsetenv under SV4

7 Aufrufe
Direkt zur ersten ungelesenen Nachricht

Richard Morriss

ungelesen,
30.07.1997, 03:00:0030.07.97
an

Under FreeBSD there are calls available setenv and unsetenv to set/unset
environment variables from your code. Is there anything equivelent under
SV4 type unix's, in my case Solaris 2.5 ??

TIA
--
Richard Morriss
ric...@police.tas.gov.au
Information Technology Branch
Tasmania Police Department

Dan Abarbanel

ungelesen,
31.07.1997, 03:00:0031.07.97
an

Richard Morriss wrote:
>
> Under FreeBSD there are calls available setenv and unsetenv to set/unset
> environment variables from your code. Is there anything equivelent under
> SV4 type unix's, in my case Solaris 2.5 ??
>
> TIA

man putenv(3C).

Dan

--
======================================================================
Dan Abarbanel | "Warning: Dates in the calendar are
Madge Networks ESD, Israel | closer than they appear!"
Tel: +972 3 6457662 |
Fax: +972 3 6487146 |
e-mail: daba...@madge.com | Disclaimer: You call this an OPINION?

Alton B. Coalter

ungelesen,
31.07.1997, 03:00:0031.07.97
an

Richard Morriss wrote:
>
> Under FreeBSD there are calls available setenv and unsetenv to set/unset
> environment variables from your code. Is there anything equivelent under
> SV4 type unix's, in my case Solaris 2.5 ??

setenv and unsetenv are csh commands. Do a ps to see what shell you
are in, then try 'man ksh' or 'man sh' for your correct syntax.

-/Renegade

Andrew Gierth

ungelesen,
31.07.1997, 03:00:0031.07.97
an

>>>>> "Alton" == Alton B Coalter <rene...@internetMCI.com> writes:

Alton> setenv and unsetenv are csh commands.

setenv() and unsetenv() are library functions in BSDish flavours.

int setenv(const char *name, const char *value, int overwrite);
void unsetenv(const char *name)

Not portable to SysVish flavours of course (see putenv()).

--
Andrew.

comp.unix.programmer FAQ: see <URL: http://www.erlenstar.demon.co.uk/unix/>
or <URL: http://www.whitefang.com/unix/>

Guy Harris

ungelesen,
01.08.1997, 03:00:0001.08.97
an

Richard Morriss wrote:
>Under FreeBSD there are calls available setenv and unsetenv to set/unset
>environment variables from your code. Is there anything equivelent under
>SV4 type unix's, in my case Solaris 2.5 ??

Alton B. Coalter <rene...@internetMCI.com> wrote:
>setenv and unsetenv are csh commands.

Yeah, but they're also functions in 4.4-Lite's C library (and in the C
library of 4.4-Lite's derivatives, such as FreeBSD); as the original
poster said "from your code", he was probably thinking of the functions,
not the commands.

(Besides, SVR4 *has* a C shell, so it's unlikely that he's running into
a problem of not having them in Solaris 2.5....)

"putenv()" provides similar functionality to "setenv()", at least in the
case where the third argument to "setenv()" is non-zero. There's no
equivalent of "unsetenv()" I know of - but, as most UNIXes tend to
implement the environment in the same fashion, and as 4.4-Lite and
FreeBSD are available in source form, the original poster might consider
just trying to port the FreeBSD "lib/libc/stdlib/setenv.c" and
"lib/libc/stdlib/getenv.c" to Solaris 2.5 (bearing in mind that the
FreeBSD versions might not be MT-safe, if his program is multi-threaded).
--
Reply, or follow up, but don't do both, please.

postmaster@localhost
postmaster@[127.0.0.1]

0 neue Nachrichten