[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnetC/libc/stdlib getenv.c, NONE, 1.1 getenv-
From: |
Richard Baumann <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnetC/libc/stdlib getenv.c, NONE, 1.1 getenv-glue.cs, NONE, 1.1 Makefile.am, 1.1, 1.2 |
Date: |
Wed, 27 Aug 2003 05:20:58 -0400 |
Update of /cvsroot/dotgnu-pnet/pnetC/libc/stdlib
In directory subversions:/tmp/cvs-serv468/libc/stdlib
Modified Files:
Makefile.am
Added Files:
getenv.c getenv-glue.cs
Log Message:
Apply patch #1840, "getenv() implementation", from Mario D. Santana.
--- NEW FILE ---
/*
* getenv.c - Get a value from the environment
*
* This file is part of the Portable.NET C library.
* Copyright (C) 2002 Southern Storm Software, Pty Ltd.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdlib.h>
char *__syscall_getenv(const char *name);
/* TODO: make returned pointers valid after subsequent calls to getenv */
char *__global_envval = NULL;
char *
getenv (const char *name)
{
if (__global_envval) free (__global_envval);
__global_envval = __syscall_getenv (name);
return __global_envval;
}
--- NEW FILE ---
/*
* getenv-glue.cs - Implementation of getenv() in C# for pnetC
*
* This file is part of the Portable.NET C library.
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
using System;
using System.Runtime.InteropServices;
__module
{
// Get the value of the environment variable with the given name
public static IntPtr __syscall_getenv(IntPtr name)
{
String vname, rv;
vname = Marshal.PtrToStringAnsi(name);
rv = Environment.GetEnvironmentVariable(vname);
if (rv == null) return IntPtr.Zero;
return Marshal.StringToHGlobalAnsi(rv);
}
} // __module
Index: Makefile.am
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetC/libc/stdlib/Makefile.am,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** Makefile.am 28 Jun 2003 09:53:38 -0000 1.1
--- Makefile.am 27 Aug 2003 09:20:54 -0000 1.2
***************
*** 3,9 ****
--- 3,13 ----
noinst_LIBRARIES = libCStdlib.a
+ SUFFIXES = .cs
+
libCStdlib_a_SOURCES = \
abort.c \
_exit.c \
+ getenv-glue.cs \
+ getenv.c \
exit.c
***************
*** 11,12 ****
--- 15,20 ----
-I$(top_srcdir)/libc \
-imacros $(top_srcdir)/include/libc-symbols.h
+
+
+ .cs.o:
+ $(COMPILE) -x cs -o $@ -c $<
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnetC/libc/stdlib getenv.c, NONE, 1.1 getenv-glue.cs, NONE, 1.1 Makefile.am, 1.1, 1.2,
Richard Baumann <address@hidden> <=