Index: ftp/ftp_var.h --- ftp/ftp_var.h.orig 2000-07-08 03:00:53.000000000 +0200 +++ ftp/ftp_var.h 2006-10-06 08:11:07.845316590 +0200 @@ -36,6 +36,24 @@ #include #include +/* + * Format of command table. + */ +struct cmd { + char *c_name; /* name of command */ + char *c_help; /* help string */ + char c_bell; /* give bell when command completes */ + char c_conn; /* must be connected to use command */ + char c_proxy; /* proxy server may execute */ + void (*c_handler) __P((int, char **)); /* function to call */ +}; + +struct macel { + char mac_name[9]; /* macro name */ + char *mac_start; /* start of macro in macbuf */ + char *mac_end; /* end of macro in macbuf */ +}; + #include "extern.h" #ifndef FTP_EXTERN @@ -108,23 +126,6 @@ FTP_EXTERN int options; /* used during socket creation */ -/* - * Format of command table. - */ -struct cmd { - char *c_name; /* name of command */ - char *c_help; /* help string */ - char c_bell; /* give bell when command completes */ - char c_conn; /* must be connected to use command */ - char c_proxy; /* proxy server may execute */ - void (*c_handler) __P((int, char **)); /* function to call */ -}; - -struct macel { - char mac_name[9]; /* macro name */ - char *mac_start; /* start of macro in macbuf */ - char *mac_end; /* end of macro in macbuf */ -}; FTP_EXTERN int macnum; /* number of defined macros */ FTP_EXTERN struct macel macros[16]; Index: libinetutils/revoke.c --- libinetutils/revoke.c.orig 2002-06-26 05:15:06.000000000 +0200 +++ libinetutils/revoke.c 2006-10-06 08:11:07.855316674 +0200 @@ -10,6 +10,14 @@ extern int errno; #endif +#ifdef __linux__ +#include +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0) +#define NO_REVOKE 1 +#endif +#endif + +#ifndef NO_REVOKE int revoke (char *path) { @@ -21,3 +29,4 @@ #endif return -1; } +#endif Index: libinetutils/setenv.c --- libinetutils/setenv.c.orig 2002-12-11 13:40:24.000000000 +0100 +++ libinetutils/setenv.c 2006-10-06 08:12:44.556778332 +0200 @@ -1,129 +1,49 @@ -/* Copyright (C) 1992, 1995, 2000 Free Software Foundation, Inc. - -NOTE: The canonical source of this file is maintained with the GNU C Library. -Bugs can be reported to bug-glibc@prep.ai.mit.edu. - -This program is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) any -later version. - -This program 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 General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, -USA. */ #ifdef HAVE_CONFIG_H -# include -#endif - -#include - -#if _LIBC || HAVE_STDLIB_H -# include -#endif -#if _LIBC || HAVE_STRING_H -# include -#endif -#if _LIBC || HAVE_UNISTD_H -# include -#endif - -#ifndef HAVE_GNU_LD -# define __environ environ +#include "config.h" #endif +#include +#include +#include -int -setenv (name, value, replace) - const char *name; - const char *value; - int replace; +#ifndef HAVE_SETENV +int setenv(const char *kszName, const char *kszValue, int nOverwrite) { - register char **ep; - register size_t size; - const size_t namelen = strlen (name); - const size_t vallen = strlen (value) + 1; - - size = 0; - for (ep = __environ; *ep != NULL; ++ep) - if (!strncmp (*ep, name, namelen) && (*ep)[namelen] == '=') - break; - else - ++size; - - if (*ep == NULL) - { - static char **last_environ; - char **new_environ; - if (__environ == last_environ) - /* We allocated this space; we can extend it. */ - new_environ = (char **) realloc (last_environ, - (size + 2) * sizeof (char *)); - else - new_environ = (char **) malloc ((size + 2) * sizeof (char *)); - - if (new_environ == NULL) - return -1; - - new_environ[size] = malloc (namelen + 1 + vallen); - if (new_environ[size] == NULL) - { - free ((char *) new_environ); - errno = ENOMEM; - return -1; - } - - if (__environ != last_environ) - memcpy ((char *) new_environ, (char *) __environ, - size * sizeof (char *)); - - memcpy (new_environ[size], name, namelen); - new_environ[size][namelen] = '='; - memcpy (&new_environ[size][namelen + 1], value, vallen); - - new_environ[size + 1] = NULL; - - last_environ = __environ = new_environ; - } - else if (replace) - { - size_t len = strlen (*ep); - if (len + 1 < namelen + 1 + vallen) - { - /* The existing string is too short; malloc a new one. */ - char *new = malloc (namelen + 1 + vallen); - if (new == NULL) - return -1; - *ep = new; - } - memcpy (*ep, name, namelen); - (*ep)[namelen] = '='; - memcpy (&(*ep)[namelen + 1], value, vallen); - } + char *szPair = NULL; - return 0; + if (nOverwrite == 0 && getenv(kszName) != 0) + return 0; + szPair = malloc(strlen(kszName) + 1 + strlen(kszValue) + 1); + if (szPair == NULL) + return -1; + strcpy(szPair, kszName); + strcat(szPair, "="); + strcat(szPair, kszValue); + putenv(szPair); + return 0; } +#endif /* !HAVE_SETENV */ -void -unsetenv (name) - const char *name; +#ifndef HAVE_UNSETENV +extern char **environ; +void unsetenv(const char *kszName) { - const size_t len = strlen (name); - char **ep; - - for (ep = __environ; *ep; ++ep) - if (!strncmp (*ep, name, len) && (*ep)[len] == '=') - { - /* Found it. Remove this pointer by moving later ones back. */ - char **dp = ep; - do - dp[0] = dp[1]; - while (*dp++); - /* Continue the loop in case NAME appears again. */ - } + 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 */ + Index: libinetutils/ttymsg.c --- libinetutils/ttymsg.c.orig 2001-11-01 16:52:19.000000000 +0100 +++ libinetutils/ttymsg.c 2006-10-06 08:11:07.855316674 +0200 @@ -132,7 +132,7 @@ } if (wret) { - (char *)iov->iov_base += wret; + iov->iov_base += wret; iov->iov_len -= wret; } continue; Index: libinetutils/xalloc.h --- libinetutils/xalloc.h.orig 2002-12-11 13:51:10.000000000 +0100 +++ libinetutils/xalloc.h 2006-10-06 08:11:07.855316674 +0200 @@ -39,7 +39,9 @@ /* Exit value when the requested amount of memory is not available. It is initialized to EXIT_FAILURE, but the caller may set it to some other value. */ +#ifdef __GLIBC__ extern int xalloc_exit_failure; +#endif /* If this pointer is non-zero, run the specified function upon each allocation failure. It is initialized to zero. */ Index: libinetutils/xmalloc.c --- libinetutils/xmalloc.c.orig 2002-12-11 13:42:01.000000000 +0100 +++ libinetutils/xmalloc.c 2006-10-06 08:11:07.855316674 +0200 @@ -23,6 +23,7 @@ #if STDC_HEADERS # include +# include #else void *calloc (); void *malloc (); @@ -34,7 +35,9 @@ #define _(msgid) gettext (msgid) #define N_(msgid) msgid +#ifdef __GLIBC__ #include "error.h" +#endif #include "xalloc.h" #ifndef EXIT_FAILURE @@ -53,7 +56,9 @@ /* Exit value when the requested amount of memory is not available. The caller may set it to some other value. */ +#ifdef __GLIBC__ int xalloc_exit_failure = EXIT_FAILURE; +#endif /* If non NULL, call this function when memory is exhausted. */ void (*xalloc_fail_func) PARAMS ((void)) = 0; @@ -67,7 +72,11 @@ { if (xalloc_fail_func) (*xalloc_fail_func) (); +#ifdef __GLIBC__ error (xalloc_exit_failure, 0, "%s", _(xalloc_msg_memory_exhausted)); +#else + fprintf(stderr, "%s", _(xalloc_msg_memory_exhausted)); +#endif /* The `noreturn' cannot be given to error, since it may return if its first argument is 0. To help compilers understand the xalloc_die does terminate, call exit. */ Index: talk/io.c --- talk/io.c.orig 2001-06-02 17:27:15.000000000 +0200 +++ talk/io.c 2006-10-06 08:11:07.855316674 +0200 @@ -129,7 +129,9 @@ } extern int errno; +#if !defined(__FreeBSD__) extern int sys_nerr; +#endif /* * p_error prints the system error message on the standard location