From abf6a75b428517d9caaf9155212b0b10e0379a99 Mon Sep 17 00:00:00 2001 From: DJ Delorie Date: Tue, 24 May 2005 21:01:33 +0000 Subject: merge from gcc --- libiberty/getopt.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'libiberty/getopt.c') diff --git a/libiberty/getopt.c b/libiberty/getopt.c index d09ce5a..0b5c2e8 100644 --- a/libiberty/getopt.c +++ b/libiberty/getopt.c @@ -212,8 +212,16 @@ static char *posixly_correct; /* Avoid depending on library functions or files whose names are inconsistent. */ -#ifndef getenv -extern char *getenv (); +#if HAVE_STDLIB_H && HAVE_DECL_GETENV +# include +#elif !defined(getenv) +# ifdef __cplusplus +extern "C" { +# endif /* __cplusplus */ +extern char *getenv (const char *); +# ifdef __cplusplus +} +# endif /* __cplusplus */ #endif static char * @@ -325,7 +333,7 @@ exchange (char **argv) { /* We must extend the array. The user plays games with us and presents new arguments. */ - char *new_str = malloc (top + 1); + char *new_str = (char *) malloc (top + 1); if (new_str == NULL) nonoption_flags_len = nonoption_flags_max_len = 0; else -- cgit v1.1