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

  Server: cvs.openpkg.org                  Name:   Michael Schloh
  Root:   /e/openpkg/cvs                   Email:  [EMAIL PROTECTED]
  Module: openpkg-src                      Date:   29-Nov-2004 18:30:00
  Branch: HEAD                             Handle: 2004112917295900

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

  Log:
    quickly repair unportable setenv(3) implemenation by supplying our
    own, as copied from mapson and honeyd packages

  Summary:
    Revision    Changes     Path
    1.6         +9  -1      openpkg-src/inetutils/inetutils.spec
    1.1         +62 -0      openpkg-src/inetutils/setenv.c
    1.1         +29 -0      openpkg-src/inetutils/setenv.h
    1.1         +65 -0      openpkg-src/inetutils/unsetenv.c
    1.1         +29 -0      openpkg-src/inetutils/unsetenv.h
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: openpkg-src/inetutils/inetutils.spec
  ============================================================================
  $ cvs diff -u -r1.5 -r1.6 inetutils.spec
  --- openpkg-src/inetutils/inetutils.spec      7 Feb 2004 17:55:39 -0000       
1.5
  +++ openpkg-src/inetutils/inetutils.spec      29 Nov 2004 17:29:59 -0000      
1.6
  @@ -34,7 +34,7 @@
   Group:        Network
   License:      GPL
   Version:      1.4.2
  -Release:      20040207
  +Release:      20041129
   
   #   package options
   %option       with_fsl     yes
  @@ -42,6 +42,10 @@
   
   #   list of sources
   Source0:      ftp://ftp.gnu.org/gnu/inetutils/inetutils-%{version}.tar.gz
  +Source1:      setenv.h
  +Source2:      setenv.c
  +Source3:      unsetenv.h
  +Source4:      unsetenv.c
   Patch0:       inetutils.patch
   
   #   build information
  @@ -73,6 +77,10 @@
   %prep
       %setup -q
       %patch -p0
  +    cp -f %{SOURCE setenv.c} libinetutils/
  +    cp -f %{SOURCE setenv.h} libinetutils/
  +    cp -f %{SOURCE unsetenv.c} libinetutils/
  +    cp -f %{SOURCE unsetenv.h} libinetutils/
   
   %build
       CC="%{l_cc}" \
  @@ .
  patch -p0 <<'@@ .'
  Index: openpkg-src/inetutils/setenv.c
  ============================================================================
  $ cvs diff -u -r0 -r1.1 setenv.c
  --- /dev/null 2004-11-29 18:29:59 +0100
  +++ setenv.c  2004-11-29 18:29:59 +0100
  @@ -0,0 +1,62 @@
  +/*
  +** 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.
  +**
  +*/
  +
  +#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/inetutils/setenv.h
  ============================================================================
  $ cvs diff -u -r0 -r1.1 setenv.h
  --- /dev/null 2004-11-29 18:29:59 +0100
  +++ setenv.h  2004-11-29 18:29:59 +0100
  @@ -0,0 +1,29 @@
  +/*
  +** 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);
  +#endif /* not LOC_SETENV_H */
  @@ .
  patch -p0 <<'@@ .'
  Index: openpkg-src/inetutils/unsetenv.c
  ============================================================================
  $ cvs diff -u -r0 -r1.1 unsetenv.c
  --- /dev/null 2004-11-29 18:29:59 +0100
  +++ unsetenv.c        2004-11-29 18:30:00 +0100
  @@ -0,0 +1,65 @@
  +/*
  +** 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.
  +**
  +*/
  +
  +#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/inetutils/unsetenv.h
  ============================================================================
  $ cvs diff -u -r0 -r1.1 unsetenv.h
  --- /dev/null 2004-11-29 18:29:59 +0100
  +++ unsetenv.h        2004-11-29 18:30:00 +0100
  @@ -0,0 +1,29 @@
  +/*
  +** 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 *);
  +#endif /* not LOC_UNSETENV_H */
  @@ .
______________________________________________________________________
The OpenPKG Project                                    www.openpkg.org
CVS Repository Commit List                     [EMAIL PROTECTED]

Reply via email to