RE:no putenv(char*): a limitation of CIN

From: Masaharu Goto (MXJ02154@nifty.ne.jp)
Date: Fri Dec 11 1998 - 12:33:24 MET


Pasha,

The reason is clear. getenv is in ANSI C/C++ standard, and putenv is not.
For portability reason, I avoided including non-ANSI C/C++ library by
default. 

You can do it in an optional library. There are templates of system calls and
OS API libraries under lib directory of cint source code distribution.

   lib/posix      produces  include/posix.dll     included by include/unistd.h
   lib/win32api   produces  include/win32api.dll  included by include/windows.
h
   lib/socket     produces  include/socket.dll    included by include/socket.h

Subset of POSIX system calls are supported by the lib/posix library which
will be embedded into unistd.h header.  Unfortunately, putenv is not included
yet.  (It's windows counterpart SetEnvironmentVariable() is) You can easily
do so by adding setenv prototype to lib/posix/posix.h and run setup script. 

By the way, 
 I think it is a good idea to include posix.dll, win32api.dll and socket.dll
into the ROOT binary distribution. What do you think Fons?

Thank you
Masaharu Goto

---------------------------------------------------------------
Dear ROOT developers,
        I've been trying to change my environment string from interactive CINT
prompt and have found that for some reason I can't do this. While `getenv'
function does what it supposed to, its counterpart - `putenv' doesn't seem
to be recognized by CINT (normally both are defined in <stdlib.h>):


CINT/ROOT C/C++ Interpreter version 5.13.78, Oct 22 1998
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.
root [0] getenv("ROOTSYS")     
(char* 0x7fff0659)"/cdf/upgrade/root/v2_00_13/GCC_2_8"
root [1] putenv("qq=eee")
Error: No symbol putenv("qq=eee") in current scope  FILE:/var/tmp/baaa002vc
LINE:1
*** Interpreter error recovered ***


I'm wondering why isn't it possible to call `putenv' ? - thanks a lot, pasha

P.S.  the symptoms are the same on SGI/IRIX/EGCS and Linux/KCC



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:40 MET