diff options
author | Lorenz <12514511+RincewindsHat@users.noreply.github.com> | 2023-03-27 10:34:19 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-27 10:34:19 (GMT) |
commit | bbc97d57f7f9e0a49fea78c02861c444fe95d46a (patch) | |
tree | c8956bbbe9b73e37d261735699a82cccaacea0db /gl/printf-parse.c | |
parent | 917dba07fded8ef04967183a4c0443b5cce2db82 (diff) | |
parent | 482aa6c7fe86d7a899e4888d14149f1ccd5401fd (diff) | |
download | monitoring-plugins-bbc97d5.tar.gz |
Merge branch 'master' into dev/check_ssh-patches
Diffstat (limited to 'gl/printf-parse.c')
-rw-r--r-- | gl/printf-parse.c | 55 |
1 files changed, 20 insertions, 35 deletions
diff --git a/gl/printf-parse.c b/gl/printf-parse.c index 23cacc1..3040749 100644 --- a/gl/printf-parse.c +++ b/gl/printf-parse.c | |||
@@ -1,18 +1,18 @@ | |||
1 | /* Formatted output to strings. | 1 | /* Formatted output to strings. |
2 | Copyright (C) 1999-2000, 2002-2003, 2006-2013 Free Software Foundation, Inc. | 2 | Copyright (C) 1999-2000, 2002-2003, 2006-2023 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This program is free software; you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU General Public License as published by | 5 | it under the terms of the GNU Lesser General Public License as |
6 | the Free Software Foundation; either version 3, or (at your option) | 6 | published by the Free Software Foundation; either version 2.1 of the |
7 | any later version. | 7 | License, or (at your option) any later version. |
8 | 8 | ||
9 | This program is distributed in the hope that it will be useful, | 9 | This file is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | GNU General Public License for more details. | 12 | GNU Lesser General Public License for more details. |
13 | 13 | ||
14 | You should have received a copy of the GNU General Public License along | 14 | You should have received a copy of the GNU Lesser General Public License |
15 | with this program; if not, see <http://www.gnu.org/licenses/>. */ | 15 | along with this program. If not, see <https://www.gnu.org/licenses/>. */ |
16 | 16 | ||
17 | /* This file can be parametrized with the following macros: | 17 | /* This file can be parametrized with the following macros: |
18 | CHAR_T The element type of the format string. | 18 | CHAR_T The element type of the format string. |
@@ -48,16 +48,7 @@ | |||
48 | #include <stddef.h> | 48 | #include <stddef.h> |
49 | 49 | ||
50 | /* Get intmax_t. */ | 50 | /* Get intmax_t. */ |
51 | #if defined IN_LIBINTL || defined IN_LIBASPRINTF | 51 | #include <stdint.h> |
52 | # if HAVE_STDINT_H_WITH_UINTMAX | ||
53 | # include <stdint.h> | ||
54 | # endif | ||
55 | # if HAVE_INTTYPES_H_WITH_UINTMAX | ||
56 | # include <inttypes.h> | ||
57 | # endif | ||
58 | #else | ||
59 | # include <stdint.h> | ||
60 | #endif | ||
61 | 52 | ||
62 | /* malloc(), realloc(), free(). */ | 53 | /* malloc(), realloc(), free(). */ |
63 | #include <stdlib.h> | 54 | #include <stdlib.h> |
@@ -419,7 +410,7 @@ PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a) | |||
419 | cp++; | 410 | cp++; |
420 | } | 411 | } |
421 | #endif | 412 | #endif |
422 | #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ | 413 | #if defined _WIN32 && ! defined __CYGWIN__ |
423 | /* On native Windows, PRIdMAX is defined as "I64d". | 414 | /* On native Windows, PRIdMAX is defined as "I64d". |
424 | We cannot change it to "lld" because PRIdMAX must also | 415 | We cannot change it to "lld" because PRIdMAX must also |
425 | be understood by the system's printf routines. */ | 416 | be understood by the system's printf routines. */ |
@@ -447,14 +438,12 @@ PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a) | |||
447 | switch (c) | 438 | switch (c) |
448 | { | 439 | { |
449 | case 'd': case 'i': | 440 | case 'd': case 'i': |
450 | #if HAVE_LONG_LONG_INT | 441 | /* If 'long long' is larger than 'long': */ |
451 | /* If 'long long' exists and is larger than 'long': */ | ||
452 | if (flags >= 16 || (flags & 4)) | 442 | if (flags >= 16 || (flags & 4)) |
453 | type = TYPE_LONGLONGINT; | 443 | type = TYPE_LONGLONGINT; |
454 | else | 444 | else |
455 | #endif | 445 | /* If 'long long' is the same as 'long', we parse "lld" into |
456 | /* If 'long long' exists and is the same as 'long', we parse | 446 | TYPE_LONGINT. */ |
457 | "lld" into TYPE_LONGINT. */ | ||
458 | if (flags >= 8) | 447 | if (flags >= 8) |
459 | type = TYPE_LONGINT; | 448 | type = TYPE_LONGINT; |
460 | else if (flags & 2) | 449 | else if (flags & 2) |
@@ -465,14 +454,12 @@ PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a) | |||
465 | type = TYPE_INT; | 454 | type = TYPE_INT; |
466 | break; | 455 | break; |
467 | case 'o': case 'u': case 'x': case 'X': | 456 | case 'o': case 'u': case 'x': case 'X': |
468 | #if HAVE_LONG_LONG_INT | 457 | /* If 'unsigned long long' is larger than 'unsigned long': */ |
469 | /* If 'long long' exists and is larger than 'long': */ | ||
470 | if (flags >= 16 || (flags & 4)) | 458 | if (flags >= 16 || (flags & 4)) |
471 | type = TYPE_ULONGLONGINT; | 459 | type = TYPE_ULONGLONGINT; |
472 | else | 460 | else |
473 | #endif | 461 | /* If 'unsigned long long' is the same as 'unsigned long', we |
474 | /* If 'unsigned long long' exists and is the same as | 462 | parse "llu" into TYPE_ULONGINT. */ |
475 | 'unsigned long', we parse "llu" into TYPE_ULONGINT. */ | ||
476 | if (flags >= 8) | 463 | if (flags >= 8) |
477 | type = TYPE_ULONGINT; | 464 | type = TYPE_ULONGINT; |
478 | else if (flags & 2) | 465 | else if (flags & 2) |
@@ -525,14 +512,12 @@ PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a) | |||
525 | type = TYPE_POINTER; | 512 | type = TYPE_POINTER; |
526 | break; | 513 | break; |
527 | case 'n': | 514 | case 'n': |
528 | #if HAVE_LONG_LONG_INT | 515 | /* If 'long long' is larger than 'long': */ |
529 | /* If 'long long' exists and is larger than 'long': */ | ||
530 | if (flags >= 16 || (flags & 4)) | 516 | if (flags >= 16 || (flags & 4)) |
531 | type = TYPE_COUNT_LONGLONGINT_POINTER; | 517 | type = TYPE_COUNT_LONGLONGINT_POINTER; |
532 | else | 518 | else |
533 | #endif | 519 | /* If 'long long' is the same as 'long', we parse "lln" into |
534 | /* If 'long long' exists and is the same as 'long', we parse | 520 | TYPE_COUNT_LONGINT_POINTER. */ |
535 | "lln" into TYPE_COUNT_LONGINT_POINTER. */ | ||
536 | if (flags >= 8) | 521 | if (flags >= 8) |
537 | type = TYPE_COUNT_LONGINT_POINTER; | 522 | type = TYPE_COUNT_LONGINT_POINTER; |
538 | else if (flags & 2) | 523 | else if (flags & 2) |