X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fsnprintf.c;h=c52a152bf500bf06e9de6231e81a5c0d777de145;hb=7ef6c64e210ac0979d7e8ac69bc5b5208c2405ab;hp=dbae815a5507eae43f88ced743cb4fc2a44cabc8;hpb=3f868c07b0cc903d1ace5d81cabe123d0607435e;p=gnulib.git diff --git a/lib/snprintf.c b/lib/snprintf.c index dbae815a5..c52a152bf 100644 --- a/lib/snprintf.c +++ b/lib/snprintf.c @@ -1,5 +1,5 @@ /* Formatted output to strings. - Copyright (C) 2004, 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2004, 2006-2014 Free Software Foundation, Inc. Written by Simon Josefsson and Paul Eggert. This program is free software; you can redistribute it and/or modify @@ -13,8 +13,7 @@ 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + with this program; if not, see . */ #include @@ -29,16 +28,11 @@ #include "vasnprintf.h" -/* Some systems, like OSF/1 4.0 and Woe32, don't have EOVERFLOW. */ -#ifndef EOVERFLOW -# define EOVERFLOW E2BIG -#endif - /* Print formatted output to string STR. Similar to sprintf, but additional length SIZE limit how much is written into STR. Returns string length of formatted string (which may be larger than SIZE). STR may be NULL, in which case nothing will be written. On error, - return a negative value. */ + return a negative value. */ int snprintf (char *str, size_t size, const char *format, ...) { @@ -58,11 +52,11 @@ snprintf (char *str, size_t size, const char *format, ...) if (output != str) { if (size) - { - size_t pruned_len = (len < size ? len : size - 1); - memcpy (str, output, pruned_len); - str[pruned_len] = '\0'; - } + { + size_t pruned_len = (len < size ? len : size - 1); + memcpy (str, output, pruned_len); + str[pruned_len] = '\0'; + } free (output); }