2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 * Copyright (C) 2006 - INRIA
5 * This file must be used under the terms of the CeCILL.
6 * This source file is licensed as described in the file COPYING, which
7 * you should have received as part of this distribution. The terms
8 * are also available at
9 * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
14 #include <Windows.h> /* GetEnvironmentVariable */
16 #include <stdlib.h> /* getenv */
18 #include <string.h> /* strlen */
20 #include "localization.h"
22 /*--------------------------------------------------------------------------*/
23 void C2F(getenvc)(int *ierr,char *var,char *buf,int *buflen,int *iflag)
26 if (GetEnvironmentVariable(var,buf,(DWORD)*buflen) == 0)
28 if ( *iflag == 1 ) sciprint(_("Undefined environment variable %s.\n"),var);
33 *buflen = (int)strlen(buf);
38 if ( (local=getenv(var)) == 0)
40 if ( *iflag == 1 ) sciprint(_("Undefined environment variable %s.\n"),var);
45 strncpy(buf,local,*buflen);
46 *buflen = strlen(buf);
51 /*--------------------------------------------------------------------------*/