Imported from ../bash-4.0-rc1.tar.gz.
[platform/upstream/bash.git] / lib / sh / snprintf.c
index 246a01a..c406d4a 100644 (file)
@@ -1,3 +1,5 @@
+/* snprintf - formatted output to strings, with bounds checking and allocation */
+
 /*
  build a test version with
    gcc -g -DDRIVER -I../.. -I../../include -o test-snprintf snprintf.c fmtu*long.o
@@ -7,21 +9,22 @@
    Unix snprintf implementation.
    derived from inetutils/libinetutils/snprintf.c Version 1.1
 
-   Copyright (C) 2001 Free Software Foundation, Inc.
+   Copyright (C) 2001,2006 Free Software Foundation, Inc.
+
+   This file is part of GNU Bash, the Bourne Again SHell.
 
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   Bash 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 3 of the License, or
    (at your option) any later version.
-   
-   This program is distributed in the hope that it will be useful,
+
+   Bash 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 License for more details.
-   
-   You should have received a copy of the GNU General License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with Bash.  If not, see <http://www.gnu.org/licenses/>.
    
    Revision History:
 
 #  include <config.h>
 #endif
 
+#if defined(DEBUG)
+#  undef HAVE_SNPRINTF
+#  undef HAVE_ASPRINTF
+#endif
+
 #if defined(DRIVER) && !defined(HAVE_CONFIG_H)
 #define HAVE_LONG_LONG
 #define HAVE_LONG_DOUBLE
@@ -401,7 +409,7 @@ static void xfree __P((void *));
              } \
        } while (0)
 
-#if defined (HAVE_LOCALE_H)
+#if defined (HAVE_LOCALE_H) && defined (HAVE_LOCALECONV)
 #  define GETLOCALEDATA(d, t, g) \
       do \
        { \