diff options
author | Colin Watson <cjwatson@debian.org> | 2013-09-14 15:08:28 +0100 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2013-09-14 15:08:28 +0100 |
commit | c41345ad7ee5a22689e2c009595e85fa27b4b39a (patch) | |
tree | 55ee4e68932acc86eeec1594063783252680e640 /openbsd-compat/bsd-snprintf.c | |
parent | 4425e64da7dee0b3e81f1ae301f56fa3a83fe221 (diff) | |
parent | 79524838f0d5eb1cdf9fc268ec4c0bce46ccb67f (diff) |
Import 6.3p1 tarball
Diffstat (limited to 'openbsd-compat/bsd-snprintf.c')
-rw-r--r-- | openbsd-compat/bsd-snprintf.c | 46 |
1 files changed, 2 insertions, 44 deletions
diff --git a/openbsd-compat/bsd-snprintf.c b/openbsd-compat/bsd-snprintf.c index 975991e7f..41d2be238 100644 --- a/openbsd-compat/bsd-snprintf.c +++ b/openbsd-compat/bsd-snprintf.c | |||
@@ -160,8 +160,6 @@ | |||
160 | #define DP_C_LONG 2 | 160 | #define DP_C_LONG 2 |
161 | #define DP_C_LDOUBLE 3 | 161 | #define DP_C_LDOUBLE 3 |
162 | #define DP_C_LLONG 4 | 162 | #define DP_C_LLONG 4 |
163 | #define DP_C_SIZE 5 | ||
164 | #define DP_C_INTMAX 6 | ||
165 | 163 | ||
166 | #define char_to_int(p) ((p)- '0') | 164 | #define char_to_int(p) ((p)- '0') |
167 | #ifndef MAX | 165 | #ifndef MAX |
@@ -184,7 +182,7 @@ static int dopr(char *buffer, size_t maxlen, const char *format, | |||
184 | static int fmtstr(char *buffer, size_t *currlen, size_t maxlen, | 182 | static int fmtstr(char *buffer, size_t *currlen, size_t maxlen, |
185 | char *value, int flags, int min, int max); | 183 | char *value, int flags, int min, int max); |
186 | static int fmtint(char *buffer, size_t *currlen, size_t maxlen, | 184 | static int fmtint(char *buffer, size_t *currlen, size_t maxlen, |
187 | intmax_t value, int base, int min, int max, int flags); | 185 | LLONG value, int base, int min, int max, int flags); |
188 | static int fmtfp(char *buffer, size_t *currlen, size_t maxlen, | 186 | static int fmtfp(char *buffer, size_t *currlen, size_t maxlen, |
189 | LDOUBLE fvalue, int min, int max, int flags); | 187 | LDOUBLE fvalue, int min, int max, int flags); |
190 | 188 | ||
@@ -192,7 +190,7 @@ static int | |||
192 | dopr(char *buffer, size_t maxlen, const char *format, va_list args_in) | 190 | dopr(char *buffer, size_t maxlen, const char *format, va_list args_in) |
193 | { | 191 | { |
194 | char ch; | 192 | char ch; |
195 | intmax_t value; | 193 | LLONG value; |
196 | LDOUBLE fvalue; | 194 | LDOUBLE fvalue; |
197 | char *strvalue; | 195 | char *strvalue; |
198 | int min; | 196 | int min; |
@@ -289,10 +287,6 @@ dopr(char *buffer, size_t maxlen, const char *format, va_list args_in) | |||
289 | cflags = DP_C_SHORT; | 287 | cflags = DP_C_SHORT; |
290 | ch = *format++; | 288 | ch = *format++; |
291 | break; | 289 | break; |
292 | case 'j': | ||
293 | cflags = DP_C_INTMAX; | ||
294 | ch = *format++; | ||
295 | break; | ||
296 | case 'l': | 290 | case 'l': |
297 | cflags = DP_C_LONG; | 291 | cflags = DP_C_LONG; |
298 | ch = *format++; | 292 | ch = *format++; |
@@ -305,10 +299,6 @@ dopr(char *buffer, size_t maxlen, const char *format, va_list args_in) | |||
305 | cflags = DP_C_LDOUBLE; | 299 | cflags = DP_C_LDOUBLE; |
306 | ch = *format++; | 300 | ch = *format++; |
307 | break; | 301 | break; |
308 | case 'z': | ||
309 | cflags = DP_C_SIZE; | ||
310 | ch = *format++; | ||
311 | break; | ||
312 | default: | 302 | default: |
313 | break; | 303 | break; |
314 | } | 304 | } |
@@ -324,10 +314,6 @@ dopr(char *buffer, size_t maxlen, const char *format, va_list args_in) | |||
324 | value = va_arg (args, long int); | 314 | value = va_arg (args, long int); |
325 | else if (cflags == DP_C_LLONG) | 315 | else if (cflags == DP_C_LLONG) |
326 | value = va_arg (args, LLONG); | 316 | value = va_arg (args, LLONG); |
327 | else if (cflags == DP_C_SIZE) | ||
328 | value = va_arg (args, ssize_t); | ||
329 | else if (cflags == DP_C_INTMAX) | ||
330 | value = va_arg (args, intmax_t); | ||
331 | else | 317 | else |
332 | value = va_arg (args, int); | 318 | value = va_arg (args, int); |
333 | if (fmtint(buffer, &currlen, maxlen, | 319 | if (fmtint(buffer, &currlen, maxlen, |
@@ -342,12 +328,6 @@ dopr(char *buffer, size_t maxlen, const char *format, va_list args_in) | |||
342 | value = (long)va_arg (args, unsigned long int); | 328 | value = (long)va_arg (args, unsigned long int); |
343 | else if (cflags == DP_C_LLONG) | 329 | else if (cflags == DP_C_LLONG) |
344 | value = (long)va_arg (args, unsigned LLONG); | 330 | value = (long)va_arg (args, unsigned LLONG); |
345 | else if (cflags == DP_C_SIZE) | ||
346 | value = va_arg (args, size_t); | ||
347 | #ifdef notyet | ||
348 | else if (cflags == DP_C_INTMAX) | ||
349 | value = va_arg (args, uintmax_t); | ||
350 | #endif | ||
351 | else | 331 | else |
352 | value = (long)va_arg (args, unsigned int); | 332 | value = (long)va_arg (args, unsigned int); |
353 | if (fmtint(buffer, &currlen, maxlen, value, | 333 | if (fmtint(buffer, &currlen, maxlen, value, |
@@ -362,12 +342,6 @@ dopr(char *buffer, size_t maxlen, const char *format, va_list args_in) | |||
362 | value = (long)va_arg (args, unsigned long int); | 342 | value = (long)va_arg (args, unsigned long int); |
363 | else if (cflags == DP_C_LLONG) | 343 | else if (cflags == DP_C_LLONG) |
364 | value = (LLONG)va_arg (args, unsigned LLONG); | 344 | value = (LLONG)va_arg (args, unsigned LLONG); |
365 | else if (cflags == DP_C_SIZE) | ||
366 | value = va_arg (args, size_t); | ||
367 | #ifdef notyet | ||
368 | else if (cflags == DP_C_INTMAX) | ||
369 | value = va_arg (args, uintmax_t); | ||
370 | #endif | ||
371 | else | 345 | else |
372 | value = (long)va_arg (args, unsigned int); | 346 | value = (long)va_arg (args, unsigned int); |
373 | if (fmtint(buffer, &currlen, maxlen, value, | 347 | if (fmtint(buffer, &currlen, maxlen, value, |
@@ -384,12 +358,6 @@ dopr(char *buffer, size_t maxlen, const char *format, va_list args_in) | |||
384 | value = (long)va_arg (args, unsigned long int); | 358 | value = (long)va_arg (args, unsigned long int); |
385 | else if (cflags == DP_C_LLONG) | 359 | else if (cflags == DP_C_LLONG) |
386 | value = (LLONG)va_arg (args, unsigned LLONG); | 360 | value = (LLONG)va_arg (args, unsigned LLONG); |
387 | else if (cflags == DP_C_SIZE) | ||
388 | value = va_arg (args, size_t); | ||
389 | #ifdef notyet | ||
390 | else if (cflags == DP_C_INTMAX) | ||
391 | value = va_arg (args, uintmax_t); | ||
392 | #endif | ||
393 | else | 361 | else |
394 | value = (long)va_arg (args, unsigned int); | 362 | value = (long)va_arg (args, unsigned int); |
395 | if (fmtint(buffer, &currlen, maxlen, value, | 363 | if (fmtint(buffer, &currlen, maxlen, value, |
@@ -448,7 +416,6 @@ dopr(char *buffer, size_t maxlen, const char *format, va_list args_in) | |||
448 | (long) strvalue, 16, min, max, flags) == -1) | 416 | (long) strvalue, 16, min, max, flags) == -1) |
449 | return -1; | 417 | return -1; |
450 | break; | 418 | break; |
451 | #if we_dont_want_this_in_openssh | ||
452 | case 'n': | 419 | case 'n': |
453 | if (cflags == DP_C_SHORT) { | 420 | if (cflags == DP_C_SHORT) { |
454 | short int *num; | 421 | short int *num; |
@@ -462,21 +429,12 @@ dopr(char *buffer, size_t maxlen, const char *format, va_list args_in) | |||
462 | LLONG *num; | 429 | LLONG *num; |
463 | num = va_arg (args, LLONG *); | 430 | num = va_arg (args, LLONG *); |
464 | *num = (LLONG)currlen; | 431 | *num = (LLONG)currlen; |
465 | } else if (cflags == DP_C_SIZE) { | ||
466 | ssize_t *num; | ||
467 | num = va_arg (args, ssize_t *); | ||
468 | *num = (ssize_t)currlen; | ||
469 | } else if (cflags == DP_C_INTMAX) { | ||
470 | intmax_t *num; | ||
471 | num = va_arg (args, intmax_t *); | ||
472 | *num = (intmax_t)currlen; | ||
473 | } else { | 432 | } else { |
474 | int *num; | 433 | int *num; |
475 | num = va_arg (args, int *); | 434 | num = va_arg (args, int *); |
476 | *num = currlen; | 435 | *num = currlen; |
477 | } | 436 | } |
478 | break; | 437 | break; |
479 | #endif | ||
480 | case '%': | 438 | case '%': |
481 | DOPR_OUTCH(buffer, currlen, maxlen, ch); | 439 | DOPR_OUTCH(buffer, currlen, maxlen, ch); |
482 | break; | 440 | break; |