OpenPKG CVS Repository
  http://cvs.openpkg.org/
  ____________________________________________________________________________

  Server: cvs.openpkg.org                  Name:   Ralf S. Engelschall
  Root:   /v/openpkg/cvs                   Email:  [EMAIL PROTECTED]
  Module: openpkg-src                      Date:   06-Oct-2006 08:24:18
  Branch: HEAD                             Handle: 2006100607241800

  Modified files:
    openpkg-src/mapson      mapson.spec setenv.c setenv.h unsetenv.c
                            unsetenv.h

  Log:
    fix setenv function by using a copy of a newer version

  Summary:
    Revision    Changes     Path
    1.34        +3  -5      openpkg-src/mapson/mapson.spec
    1.2         +10 -46     openpkg-src/mapson/setenv.c
    1.2         +0  -25     openpkg-src/mapson/setenv.h
    1.2         +4  -37     openpkg-src/mapson/unsetenv.c
    1.2         +0  -25     openpkg-src/mapson/unsetenv.h
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: openpkg-src/mapson/mapson.spec
  ============================================================================
  $ cvs diff -u -r1.33 -r1.34 mapson.spec
  --- openpkg-src/mapson/mapson.spec    24 May 2006 18:52:20 -0000      1.33
  +++ openpkg-src/mapson/mapson.spec    6 Oct 2006 06:24:18 -0000       1.34
  @@ -33,7 +33,7 @@
   Group:        Mail
   License:      GPL
   Version:      3.0
  -Release:      20060524
  +Release:      20061006
   
   #   list of sources
   Source0:      
http://switch.dl.sourceforge.net/sourceforge/mapson/mapson-%{version}.tar.gz
  @@ -68,10 +68,8 @@
       %patch -p0
       touch aclocal.m4
       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/
  +    cp %{SOURCE setenv.c} %{SOURCE setenv.h} libsetenv/
  +    cp %{SOURCE unsetenv.c} %{SOURCE unsetenv.h} libunsetenv/
   
   %build
       CC="%{l_cc}" \
  @@ .
  patch -p0 <<'@@ .'
  Index: openpkg-src/mapson/setenv.c
  ============================================================================
  $ cvs diff -u -r1.1 -r1.2 setenv.c
  --- openpkg-src/mapson/setenv.c       30 Jun 2004 15:14:35 -0000      1.1
  +++ openpkg-src/mapson/setenv.c       6 Oct 2006 06:24:18 -0000       1.2
  @@ -1,62 +1,26 @@
  -/*
  -** setenv.c: ISO C implementation
  -** Copyright (c) 2003 Michael Schloh von Bennewitz <[EMAIL PROTECTED]>
  -** 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 HAVE_SETENV
   #ifdef HAVE_CONFIG_H
  -#include <sys/types.h>
   #include "config.h"
   #endif
  +#include <sys/types.h>
  +#include <stdlib.h>
  +#include <string.h>
   
  -#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) */
  +    char *szPair = NULL;
   
  -    /* 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 */
  +    szPair = malloc(strlen(kszName) + 1 + strlen(kszValue) + 1);
  +    if (szPair == NULL)
  +        return -1;
       strcpy(szPair, kszName);
       strcat(szPair, "=");
       strcat(szPair, kszValue);
  -    putenv(szPair);     /* Handoff */
  -
  -    return 0;           /* Success */
  +    putenv(szPair);
  +    return 0;
   }
   #endif /* !HAVE_SETENV */
   
  @@ .
  patch -p0 <<'@@ .'
  Index: openpkg-src/mapson/setenv.h
  ============================================================================
  $ cvs diff -u -r1.1 -r1.2 setenv.h
  --- openpkg-src/mapson/setenv.h       30 Jun 2004 15:14:35 -0000      1.1
  +++ openpkg-src/mapson/setenv.h       6 Oct 2006 06:24:18 -0000       1.2
  @@ -1,28 +1,3 @@
  -/*
  -** setenv.h: ISO C interface
  -** Copyright (c) 2003 Michael Schloh von Bennewitz <[EMAIL PROTECTED]>
  -** 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);
  @@ .
  patch -p0 <<'@@ .'
  Index: openpkg-src/mapson/unsetenv.c
  ============================================================================
  $ cvs diff -u -r1.1 -r1.2 unsetenv.c
  --- openpkg-src/mapson/unsetenv.c     30 Jun 2004 15:14:35 -0000      1.1
  +++ openpkg-src/mapson/unsetenv.c     6 Oct 2006 06:24:18 -0000       1.2
  @@ -1,43 +1,14 @@
  -/*
  -** unsetenv.c: ISO C implementation
  -** Copyright (c) 2003 Michael Schloh von Bennewitz <[EMAIL PROTECTED]>
  -** 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 HAVE_UNSETENV
   #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) */
  -
  +#include <sys/types.h>
  +#include <stdlib.h>
  +#include <string.h>
   
   extern char **environ;
   
  -/*
  -** Implements unsetenv(3) C library function for platforms not including it
  -*/
   void unsetenv(const char *kszName)
   {
       int nLen;
  @@ -46,16 +17,12 @@
   
       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++;
  @@ .
  patch -p0 <<'@@ .'
  Index: openpkg-src/mapson/unsetenv.h
  ============================================================================
  $ cvs diff -u -r1.1 -r1.2 unsetenv.h
  --- openpkg-src/mapson/unsetenv.h     30 Jun 2004 15:14:35 -0000      1.1
  +++ openpkg-src/mapson/unsetenv.h     6 Oct 2006 06:24:18 -0000       1.2
  @@ -1,28 +1,3 @@
  -/*
  -** unsetenv.h: ISO C interface
  -** Copyright (c) 2003 Michael Schloh von Bennewitz <[EMAIL PROTECTED]>
  -** 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 *);
  @@ .
______________________________________________________________________
The OpenPKG Project                                    www.openpkg.org
CVS Repository Commit List                     [email protected]

Reply via email to