aboutsummaryrefslogtreecommitdiff
path: root/portable/snprintf.c
diff options
context:
space:
mode:
authorRuss Allbery <eagle@eyrie.org>2014-07-16 13:43:17 -0700
committerRuss Allbery <eagle@eyrie.org>2014-07-16 13:43:17 -0700
commit6409733ee3b7b1910dc1c166a392cc628834146c (patch)
treee9460f8f2ca0f3676afeed2a9dcf549acfc39b53 /portable/snprintf.c
parent334ed844cbb5c8f7ea82a94c701a3016dd6950b9 (diff)
parentf8963ceb19cd2b503b981f43a3f8c0f45649989f (diff)
Imported Upstream version 1.1
Diffstat (limited to 'portable/snprintf.c')
-rw-r--r--portable/snprintf.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/portable/snprintf.c b/portable/snprintf.c
index 91c8491..c35ad80 100644
--- a/portable/snprintf.c
+++ b/portable/snprintf.c
@@ -2,8 +2,9 @@
* Replacement for a missing snprintf or vsnprintf.
*
* The following implementation of snprintf was taken mostly verbatim from
- * <http://www.fiction.net/~blong/programs/>; it is the version of snprintf
- * used in Mutt.
+ * <http://www.fiction.net/blong/programs/>; it is the version of snprintf
+ * used in Mutt. A possibly newer version is used in wget, found at
+ * <https://github.com/wertarbyte/wget/blob/master/src/snprintf.c>.
*
* Please do not reformat or otherwise change this file more than necessary so
* that later merges with the original source are easy. Bug fixes and
@@ -73,7 +74,7 @@
* fixed handling of %.0f
* added test for HAVE_LONG_DOUBLE
*
- * Russ Allbery <rra@stanford.edu> 2000-08-26
+ * Russ Allbery <eagle@eyrie.org> 2000-08-26
* fixed return value to comply with C99
* fixed handling of snprintf(NULL, ...)
*
@@ -432,7 +433,7 @@ static int dopr (char *buffer, size_t maxlen, const char *format, va_list args)
break;
case 'w':
/* not supported yet, treat as next char */
- ch = *format++;
+ format++;
break;
default:
/* Unknown, skip */
@@ -695,7 +696,7 @@ static int fmtfp (char *buffer, size_t *currlen, size_t maxlen,
/* For each leading 0 in fractional part, print one more
fractional digit. */
LDOUBLE temp;
- if (ufvalue != 0)
+ if (ufvalue > 0)
for (temp = ufvalue; temp < 0.1; temp *= 10)
++max;
}