[prev in list] [next in list] [prev in thread] [next in thread]
List: openpkg-cvs
Subject: [CVS] OpenPKG: openpkg-src/mapson/ mapson.patch mapson.spec setenv.c s...
From: "Michael Schloh" <ms () openpkg ! org>
Date: 2004-06-30 15:14:36
Message-ID: 20040630151436.BED5C2FF258 () mail ! openpkg ! org
[Download RAW message or body]
OpenPKG CVS Repository
http://cvs.openpkg.org/
____________________________________________________________________________
Server: cvs.openpkg.org Name: Michael Schloh
Root: /e/openpkg/cvs Email: ms@openpkg.org
Module: openpkg-src Date: 30-Jun-2004 17:14:36
Branch: HEAD Handle: -NONE-
Added files:
openpkg-src/mapson setenv.c setenv.h unsetenv.c unsetenv.h
Modified files:
openpkg-src/mapson mapson.patch mapson.spec
Log:
package local versions of setenv(3) and unsetenv(3) source code for
use by mapson buildconf on platforms not supplying the functions
themselves
Summary:
Revision Changes Path
1.5 +309 -0 openpkg-src/mapson/mapson.patch
1.28 +10 -1 openpkg-src/mapson/mapson.spec
1.1 +62 -0 openpkg-src/mapson/setenv.c
1.1 +29 -0 openpkg-src/mapson/setenv.h
1.1 +65 -0 openpkg-src/mapson/unsetenv.c
1.1 +29 -0 openpkg-src/mapson/unsetenv.h
____________________________________________________________________________
patch -p0 <<'@@ .'
Index: openpkg-src/mapson/mapson.patch
============================================================================
$ cvs diff -u -r1.4 -r1.5 mapson.patch
--- openpkg-src/mapson/mapson.patch 5 Apr 2004 11:11:17 -0000 1.4
+++ openpkg-src/mapson/mapson.patch 30 Jun 2004 15:14:35 -0000 1.5
@@ -1,3 +1,4 @@
+Index: libhashcash/hashcash.h
--- libhashcash/hashcash.h.orig 2004-04-05 12:52:56.000000000 +0200
+++ libhashcash/hashcash.h 2004-04-05 12:53:18.000000000 +0200
@@ -130,7 +130,7 @@
@@ -9,3 +10,311 @@
int required_bits );
/* return how many tries per second the machine can do */
+Index: configure.ac
+--- configure.ac.orig 2004-06-21 23:16:35.000000000 +0200
++++ configure.ac 2004-06-30 16:18:22.983805330 +0200
+@@ -33,6 +33,24 @@
+ AC_LIBOBJ(libgetopt/getopt1)
+ fi
+
++dnl If the system is missing setenv(3), then use
++dnl the version included in this distribution instead.
++dnl
++AC_CHECK_FUNC(setenv, have_setenv=yes, have_setenv=no)
++if test "x$have_setenv" != "xyes" -o "x$have_setenv" != "xyes"; then
++ CPPFLAGS="$CPPFLAGS -Ilibsetenv"
++ AC_LIBOBJ(libsetenv/setenv)
++fi
++
++dnl If the system is missing unsetenv(3), then use
++dnl the version included in this distribution instead.
++dnl
++AC_CHECK_FUNC(unsetenv, have_unsetenv=yes, have_unsetenv=no)
++if test "x$have_unsetenv" != "xyes" -o "x$have_unsetenv" != "xyes"; then
++ CPPFLAGS="$CPPFLAGS -Ilibunsetenv"
++ AC_LIBOBJ(libunsetenv/unsetenv)
++fi
++
+ dnl Perform some incredibly experimental magic to guess installation
+ dnl paths in an unexpectedly clever way. Henceforth evaluate the paths
+ dnl right away so that we can guarantee _absolute_ paths for our
+Index: configure
+--- configure.orig 2004-06-30 16:26:59.696796000 +0200
++++ configure 2004-06-30 16:27:15.198222529 +0200
+@@ -3537,6 +3537,222 @@
+
+ fi
+
++echo "$as_me:$LINENO: checking for setenv" >&5
++echo $ECHO_N "checking for setenv... $ECHO_C" >&6
++if test "${ac_cv_func_setenv+set}" = set; then
++ echo $ECHO_N "(cached) $ECHO_C" >&6
++else
++ cat >conftest.$ac_ext <<_ACEOF
++/* confdefs.h. */
++_ACEOF
++cat confdefs.h >>conftest.$ac_ext
++cat >>conftest.$ac_ext <<_ACEOF
++/* end confdefs.h. */
++/* Define setenv to an innocuous variant, in case <limits.h> declares setenv.
++ For example, HP-UX 11i <limits.h> declares gettimeofday. */
++#define setenv innocuous_setenv
++
++/* System header to define __stub macros and hopefully few prototypes,
++ which can conflict with char setenv (); below.
++ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
++ <limits.h> exists even on freestanding compilers. */
++
++#ifdef __STDC__
++# include <limits.h>
++#else
++# include <assert.h>
++#endif
++
++#undef setenv
++
++/* Override any gcc2 internal prototype to avoid an error. */
++#ifdef __cplusplus
++extern "C"
++{
++#endif
++/* We use char because int might match the return type of a gcc2
++ builtin and then its argument prototype would still apply. */
++char setenv ();
++/* The GNU C library defines this for functions which it implements
++ to always fail with ENOSYS. Some functions are actually named
++ something starting with __ and the normal name is an alias. */
++#if defined (__stub_setenv) || defined (__stub___setenv)
++choke me
++#else
++char (*f) () = setenv;
++#endif
++#ifdef __cplusplus
++}
++#endif
++
++int
++main ()
++{
++return f != setenv;
++ ;
++ return 0;
++}
++_ACEOF
++rm -f conftest.$ac_objext conftest$ac_exeext
++if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
++ (eval $ac_link) 2>conftest.er1
++ ac_status=$?
++ grep -v '^ *+' conftest.er1 >conftest.err
++ rm -f conftest.er1
++ cat conftest.err >&5
++ echo "$as_me:$LINENO: \$? = $ac_status" >&5
++ (exit $ac_status); } &&
++ { ac_try='test -z "$ac_cxx_werror_flag"
++ || test ! -s conftest.err'
++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
++ (eval $ac_try) 2>&5
++ ac_status=$?
++ echo "$as_me:$LINENO: \$? = $ac_status" >&5
++ (exit $ac_status); }; } &&
++ { ac_try='test -s conftest$ac_exeext'
++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
++ (eval $ac_try) 2>&5
++ ac_status=$?
++ echo "$as_me:$LINENO: \$? = $ac_status" >&5
++ (exit $ac_status); }; }; then
++ ac_cv_func_setenv=yes
++else
++ echo "$as_me: failed program was:" >&5
++sed 's/^/| /' conftest.$ac_ext >&5
++
++ac_cv_func_setenv=no
++fi
++rm -f conftest.err conftest.$ac_objext \
++ conftest$ac_exeext conftest.$ac_ext
++fi
++echo "$as_me:$LINENO: result: $ac_cv_func_setenv" >&5
++echo "${ECHO_T}$ac_cv_func_setenv" >&6
++if test $ac_cv_func_setenv = yes; then
++ have_setenv=yes
++else
++ have_setenv=no
++fi
++
++if test "x$have_setenv" != "xyes" -o "x$have_setenv" != "xyes"; then
++ CPPFLAGS="$CPPFLAGS -Ilibsetenv"
++ case $LIBOBJS in
++ "libsetenv/setenv.$ac_objext" | \
++ *" libsetenv/setenv.$ac_objext" | \
++ "libsetenv/setenv.$ac_objext "* | \
++ *" libsetenv/setenv.$ac_objext "* ) ;;
++ *) LIBOBJS="$LIBOBJS libsetenv/setenv.$ac_objext" ;;
++esac
++
++fi
++
++echo "$as_me:$LINENO: checking for unsetenv" >&5
++echo $ECHO_N "checking for unsetenv... $ECHO_C" >&6
++if test "${ac_cv_func_unsetenv+set}" = set; then
++ echo $ECHO_N "(cached) $ECHO_C" >&6
++else
++ cat >conftest.$ac_ext <<_ACEOF
++/* confdefs.h. */
++_ACEOF
++cat confdefs.h >>conftest.$ac_ext
++cat >>conftest.$ac_ext <<_ACEOF
++/* end confdefs.h. */
++/* Define unsetenv to an innocuous variant, in case <limits.h> declares unsetenv.
++ For example, HP-UX 11i <limits.h> declares gettimeofday. */
++#define unsetenv innocuous_unsetenv
++
++/* System header to define __stub macros and hopefully few prototypes,
++ which can conflict with char unsetenv (); below.
++ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
++ <limits.h> exists even on freestanding compilers. */
++
++#ifdef __STDC__
++# include <limits.h>
++#else
++# include <assert.h>
++#endif
++
++#undef unsetenv
++
++/* Override any gcc2 internal prototype to avoid an error. */
++#ifdef __cplusplus
++extern "C"
++{
++#endif
++/* We use char because int might match the return type of a gcc2
++ builtin and then its argument prototype would still apply. */
++char unsetenv ();
++/* The GNU C library defines this for functions which it implements
++ to always fail with ENOSYS. Some functions are actually named
++ something starting with __ and the normal name is an alias. */
++#if defined (__stub_unsetenv) || defined (__stub___unsetenv)
++choke me
++#else
++char (*f) () = unsetenv;
++#endif
++#ifdef __cplusplus
++}
++#endif
++
++int
++main ()
++{
++return f != unsetenv;
++ ;
++ return 0;
++}
++_ACEOF
++rm -f conftest.$ac_objext conftest$ac_exeext
++if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
++ (eval $ac_link) 2>conftest.er1
++ ac_status=$?
++ grep -v '^ *+' conftest.er1 >conftest.err
++ rm -f conftest.er1
++ cat conftest.err >&5
++ echo "$as_me:$LINENO: \$? = $ac_status" >&5
++ (exit $ac_status); } &&
++ { ac_try='test -z "$ac_cxx_werror_flag"
++ || test ! -s conftest.err'
++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
++ (eval $ac_try) 2>&5
++ ac_status=$?
++ echo "$as_me:$LINENO: \$? = $ac_status" >&5
++ (exit $ac_status); }; } &&
++ { ac_try='test -s conftest$ac_exeext'
++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
++ (eval $ac_try) 2>&5
++ ac_status=$?
++ echo "$as_me:$LINENO: \$? = $ac_status" >&5
++ (exit $ac_status); }; }; then
++ ac_cv_func_unsetenv=yes
++else
++ echo "$as_me: failed program was:" >&5
++sed 's/^/| /' conftest.$ac_ext >&5
++
++ac_cv_func_unsetenv=no
++fi
++rm -f conftest.err conftest.$ac_objext \
++ conftest$ac_exeext conftest.$ac_ext
++fi
++echo "$as_me:$LINENO: result: $ac_cv_func_unsetenv" >&5
++echo "${ECHO_T}$ac_cv_func_unsetenv" >&6
++if test $ac_cv_func_unsetenv = yes; then
++ have_unsetenv=yes
++else
++ have_unsetenv=no
++fi
++
++if test "x$have_unsetenv" != "xyes" -o "x$have_unsetenv" != "xyes"; then
++ CPPFLAGS="$CPPFLAGS -Ilibunsetenv"
++ case $LIBOBJS in
++ "libunsetenv/unsetenv.$ac_objext" | \
++ *" libunsetenv/unsetenv.$ac_objext" | \
++ "libunsetenv/unsetenv.$ac_objext "* | \
++ *" libunsetenv/unsetenv.$ac_objext "* ) ;;
++ *) LIBOBJS="$LIBOBJS libunsetenv/unsetenv.$ac_objext" ;;
++esac
++
++fi
++
+ if test "$prefix" = "NONE"; then
+ prefix=/usr/local
+ if test "$exec_prefix" = "NONE"; then
+Index: Makefile.in
+--- Makefile.in.orig 2004-06-21 23:18:16.000000000 +0200
++++ Makefile.in 2004-06-30 16:55:48.072234546 +0200
+@@ -48,7 +48,7 @@
+ $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/configure COPYING ChangeLog INSTALL TODO compile \
+ depcomp install-sh libgetopt/getopt.c libgetopt/getopt1.c \
+- missing
++ libsetenv/setenv.c libunsetenv/unsetenv.c missing
+ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+ am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+@@ -79,6 +79,8 @@
+ am__depfiles_maybe = depfiles
+ @AMDEP_TRUE@DEP_FILES = $(DEPDIR)/libgetopt/getopt.Po \
+ @AMDEP_TRUE@ $(DEPDIR)/libgetopt/getopt1.Po \
++@AMDEP_TRUE@ $(DEPDIR)/libsetenv/setenv.Po \
++@AMDEP_TRUE@ $(DEPDIR)/libunsetenv/unsetenv.Po \
+ @AMDEP_TRUE@ ./$(DEPDIR)/mapson-accept-confirmation.Po \
+ @AMDEP_TRUE@ ./$(DEPDIR)/mapson-address-db.Po \
+ @AMDEP_TRUE@ ./$(DEPDIR)/mapson-config.Po \
+@@ -324,6 +326,8 @@
+
+ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/libgetopt/getopt.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/libgetopt/getopt1.Po@am__quote@
++@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/libsetenv/setenv.Po@am__quote@
++@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/libunsetenv/unsetenv.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mapson-accept-confirmation.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mapson-address-db.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mapson-config.Po@am__quote@
+@@ -1039,7 +1043,10 @@
+
+ distclean: distclean-recursive
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+- -rm -rf $(DEPDIR)/libgetopt ./$(DEPDIR)
++ -rm -rf $(DEPDIR)/libgetopt
++ -rm -rf $(DEPDIR)/libsetenv
++ -rm -rf $(DEPDIR)/libunsetenv
++ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+ distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+@@ -1067,7 +1074,10 @@
+ maintainer-clean: maintainer-clean-recursive
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -rf $(top_srcdir)/autom4te.cache
+- -rm -rf $(DEPDIR)/libgetopt ./$(DEPDIR)
++ -rm -rf $(DEPDIR)/libgetopt
++ -rm -rf $(DEPDIR)/libsetenv
++ -rm -rf $(DEPDIR)/libunsetenv
++ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+ maintainer-clean-am: distclean-am maintainer-clean-generic
+
@@ .
patch -p0 <<'@@ .'
Index: openpkg-src/mapson/mapson.spec
============================================================================
$ cvs diff -u -r1.27 -r1.28 mapson.spec
--- openpkg-src/mapson/mapson.spec 22 Jun 2004 09:21:45 -0000 1.27
+++ openpkg-src/mapson/mapson.spec 30 Jun 2004 15:14:35 -0000 1.28
@@ -34,10 +34,14 @@
Group: Mail
License: GPL
Version: 3.0
-Release: 20040622
+Release: 20040630
# list of sources
Source0: http://osdn.dl.sourceforge.net/sourceforge/mapson/mapson-%{version}.tar.gz
+Source1: setenv.h
+Source2: setenv.c
+Source3: unsetenv.h
+Source4: unsetenv.c
Patch0: mapson.patch
# build information
@@ -63,6 +67,11 @@
%prep
%setup -q
%patch -p0
+ mkdir libsetenv libunsetenv
+ cp -f %{SOURCE setenv.c} libsetenv/
+ cp -f %{SOURCE setenv.h} libsetenv/
+ cp -f %{SOURCE unsetenv.c} libunsetenv/
+ cp -f %{SOURCE unsetenv.h} libunsetenv/
%build
CC="%{l_cc}" \
@@ .
patch -p0 <<'@@ .'
Index: openpkg-src/mapson/setenv.c
============================================================================
$ cvs diff -u -r0 -r1.1 setenv.c
--- /dev/null 2004-06-30 17:14:35.000000000 +0200
+++ setenv.c 2004-06-30 17:14:36.000000000 +0200
@@ -0,0 +1,62 @@
+/*
+** setenv.c: ISO C implementation
+** Copyright (c) 2003 Michael Schloh von Bennewitz <michael@schloh.com>
+** Copyright (c) 2003 Cable & Wireless <http://www.cw.com/de/>
+**
+** Permission to use, copy, modify, and distribute this software for
+** any purpose with or without fee is hereby granted, provided that
+** the above copyright notice and this permission notice appear in all
+** copies.
+**
+** THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+** WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+** MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+** IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
+** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+** USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+** SUCH DAMAGE.
+**
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <sys/types.h>
+#include "config.h"
+#endif
+
+#ifndef HAVE_SETENV
+#include <stdlib.h> /* For putenv(3) and malloc(3) */
+#include <string.h> /* For strcpy(3) and strcat(3) */
+
+
+/*
+** Implements setenv(3) C library function for platforms not including it
+*/
+int setenv(const char *kszName, const char *kszValue, int nOverwrite)
+{
+ char *szPair = NULL; /* String we will pass to putenv(3) */
+
+ /* Short circuite if overwrite is not enabled on an existing variable */
+ if (nOverwrite == 0 && getenv(kszName) != 0)
+ return 0;
+
+ /* Allocate space for name, value, equals, and string terminator */
+ szPair = malloc(strlen(kszName) + strlen(kszValue) + strlen("=") + 1);
+
+ if (szPair == NULL) /* Memory error */
+ return 1; /* Unsuccessful */
+
+ /* Copy the incoming variables */
+ strcpy(szPair, kszName);
+ strcat(szPair, "=");
+ strcat(szPair, kszValue);
+ putenv(szPair); /* Handoff */
+
+ return 0; /* Success */
+}
+#endif /* !HAVE_SETENV */
+
@@ .
patch -p0 <<'@@ .'
Index: openpkg-src/mapson/setenv.h
============================================================================
$ cvs diff -u -r0 -r1.1 setenv.h
--- /dev/null 2004-06-30 17:14:35.000000000 +0200
+++ setenv.h 2004-06-30 17:14:36.000000000 +0200
@@ -0,0 +1,29 @@
+/*
+** setenv.h: ISO C interface
+** Copyright (c) 2003 Michael Schloh von Bennewitz <michael@schloh.com>
+** Copyright (c) 2003 Cable & Wireless <http://www.cw.com/de/>
+**
+** Permission to use, copy, modify, and distribute this software for
+** any purpose with or without fee is hereby granted, provided that
+** the above copyright notice and this permission notice appear in all
+** copies.
+**
+** THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+** WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+** MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+** IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
+** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+** USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+** SUCH DAMAGE.
+**
+*/
+
+#ifndef LOC_SETENV_H
+# define LOC_SETENV_H
+int setenv(const char *, const char *, int);
+#endif /* not LOC_SETENV_H */
@@ .
patch -p0 <<'@@ .'
Index: openpkg-src/mapson/unsetenv.c
============================================================================
$ cvs diff -u -r0 -r1.1 unsetenv.c
--- /dev/null 2004-06-30 17:14:35.000000000 +0200
+++ unsetenv.c 2004-06-30 17:14:36.000000000 +0200
@@ -0,0 +1,65 @@
+/*
+** unsetenv.c: ISO C implementation
+** Copyright (c) 2003 Michael Schloh von Bennewitz <michael@schloh.com>
+** Copyright (c) 2003 Cable & Wireless <http://www.cw.com/de/>
+**
+** Permission to use, copy, modify, and distribute this software for
+** any purpose with or without fee is hereby granted, provided that
+** the above copyright notice and this permission notice appear in all
+** copies.
+**
+** THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+** WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+** MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+** IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
+** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+** USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+** SUCH DAMAGE.
+**
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <sys/types.h>
+#include "config.h"
+#endif
+
+#ifndef HAVE_UNSETENV
+#include <stdlib.h> /* For putenv(3) and malloc(3) */
+#include <string.h> /* For strcpy(3) and strcat(3) */
+
+
+extern char **environ;
+
+/*
+** Implements unsetenv(3) C library function for platforms not including it
+*/
+void unsetenv(const char *kszName)
+{
+ int nLen;
+ const char *kszTail;
+ char **ppEnv;
+
+ if (kszName == 0 || environ == 0)
+ return;
+
+ for (kszTail = kszName; *kszTail && *kszTail != '='; kszTail++)
+ /* noop */;
+
+ nLen = kszTail - kszName;
+
+ for (ppEnv = environ; *ppEnv != 0; ppEnv++)
+ if (strncmp(*ppEnv, kszName, nLen) == 0 && (*ppEnv)[nLen] == '=')
+ break;
+
+ while (*ppEnv != 0) {
+ *ppEnv = *(ppEnv + 1);
+ ppEnv++;
+ }
+}
+#endif /* !HAVE_UNSETENV */
+
@@ .
patch -p0 <<'@@ .'
Index: openpkg-src/mapson/unsetenv.h
============================================================================
$ cvs diff -u -r0 -r1.1 unsetenv.h
--- /dev/null 2004-06-30 17:14:35.000000000 +0200
+++ unsetenv.h 2004-06-30 17:14:36.000000000 +0200
@@ -0,0 +1,29 @@
+/*
+** unsetenv.h: ISO C interface
+** Copyright (c) 2003 Michael Schloh von Bennewitz <michael@schloh.com>
+** Copyright (c) 2003 Cable & Wireless <http://www.cw.com/de/>
+**
+** Permission to use, copy, modify, and distribute this software for
+** any purpose with or without fee is hereby granted, provided that
+** the above copyright notice and this permission notice appear in all
+** copies.
+**
+** THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+** WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+** MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+** IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
+** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+** USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+** SUCH DAMAGE.
+**
+*/
+
+#ifndef LOC_UNSETENV_H
+# define LOC_UNSETENV_H
+void unsetenv(const char *);
+#endif /* not LOC_UNSETENV_H */
@@ .
______________________________________________________________________
The OpenPKG Project www.openpkg.org
CVS Repository Commit List openpkg-cvs@openpkg.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic