diff options
| author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2026-03-26 12:53:53 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-26 12:53:53 +0100 |
| commit | 13e14a6bfd9f29cbfeab0c5161d2a994f97532e7 (patch) | |
| tree | 3aa7186fe092e42783dc7e981dc39a74ea61c466 /gl/m4/getdelim.m4 | |
| parent | 9d8503f90ef25b2cecd324dc118e441f40233ea8 (diff) | |
| download | monitoring-plugins-13e14a6bfd9f29cbfeab0c5161d2a994f97532e7.tar.gz | |
* Sync with the 202601-stable Gnulib code (4a3650d887)
* Ignore more deps stuff in gnulib
* Remove autogenerated gnulib files
* Ignore more gnulib generated headers
Diffstat (limited to 'gl/m4/getdelim.m4')
| -rw-r--r-- | gl/m4/getdelim.m4 | 51 |
1 files changed, 29 insertions, 22 deletions
diff --git a/gl/m4/getdelim.m4 b/gl/m4/getdelim.m4 index 63d88306..8b6eff47 100644 --- a/gl/m4/getdelim.m4 +++ b/gl/m4/getdelim.m4 | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | # getdelim.m4 | 1 | # getdelim.m4 |
| 2 | # serial 19 | 2 | # serial 21 |
| 3 | 3 | ||
| 4 | dnl Copyright (C) 2005-2007, 2009-2025 Free Software Foundation, Inc. | 4 | dnl Copyright (C) 2005-2007, 2009-2026 Free Software Foundation, Inc. |
| 5 | dnl | 5 | dnl |
| 6 | dnl This file is free software; the Free Software Foundation | 6 | dnl This file is free software; the Free Software Foundation |
| 7 | dnl gives unlimited permission to copy and/or distribute it, | 7 | dnl gives unlimited permission to copy and/or distribute it, |
| @@ -37,6 +37,7 @@ AC_DEFUN([gl_FUNC_GETDELIM], | |||
| 37 | gl_cv_func_working_getdelim=no ;; | 37 | gl_cv_func_working_getdelim=no ;; |
| 38 | *) | 38 | *) |
| 39 | echo fooNbarN | tr -d '\012' | tr N '\012' > conftest.data | 39 | echo fooNbarN | tr -d '\012' | tr N '\012' > conftest.data |
| 40 | touch conftest.empty | ||
| 40 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ | 41 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
| 41 | # include <stdio.h> | 42 | # include <stdio.h> |
| 42 | # include <stdlib.h> | 43 | # include <stdlib.h> |
| @@ -44,6 +45,7 @@ AC_DEFUN([gl_FUNC_GETDELIM], | |||
| 44 | int main () | 45 | int main () |
| 45 | { | 46 | { |
| 46 | FILE *in = fopen ("./conftest.data", "r"); | 47 | FILE *in = fopen ("./conftest.data", "r"); |
| 48 | int result = 0; | ||
| 47 | if (!in) | 49 | if (!in) |
| 48 | return 1; | 50 | return 1; |
| 49 | { | 51 | { |
| @@ -53,7 +55,7 @@ AC_DEFUN([gl_FUNC_GETDELIM], | |||
| 53 | size_t siz = 0; | 55 | size_t siz = 0; |
| 54 | int len = getdelim (&line, &siz, '\n', in); | 56 | int len = getdelim (&line, &siz, '\n', in); |
| 55 | if (!(len == 4 && line && strcmp (line, "foo\n") == 0)) | 57 | if (!(len == 4 && line && strcmp (line, "foo\n") == 0)) |
| 56 | { free (line); fclose (in); return 2; } | 58 | result |= 2; |
| 57 | free (line); | 59 | free (line); |
| 58 | } | 60 | } |
| 59 | { | 61 | { |
| @@ -62,35 +64,40 @@ AC_DEFUN([gl_FUNC_GETDELIM], | |||
| 62 | char *line = NULL; | 64 | char *line = NULL; |
| 63 | size_t siz = (size_t)(~0) / 4; | 65 | size_t siz = (size_t)(~0) / 4; |
| 64 | if (getdelim (&line, &siz, '\n', in) == -1) | 66 | if (getdelim (&line, &siz, '\n', in) == -1) |
| 65 | { fclose (in); return 3; } | 67 | result |= 4; |
| 66 | free (line); | 68 | free (line); |
| 67 | } | 69 | } |
| 68 | fclose (in); | 70 | fclose (in); |
| 69 | return 0; | 71 | { |
| 72 | /* Test that reading EOF as the first character sets the first byte | ||
| 73 | in the buffer to NUL. This fails on glibc 2.42 and earlier. */ | ||
| 74 | in = fopen ("./conftest.empty", "r"); | ||
| 75 | if (!in) | ||
| 76 | return 1; | ||
| 77 | char *line = malloc (1); | ||
| 78 | line[0] = 'A'; | ||
| 79 | size_t siz = 1; | ||
| 80 | if (getdelim (&line, &siz, '\n', in) != -1 || line[0] != '\0') | ||
| 81 | result |= 8; | ||
| 82 | free (line); | ||
| 83 | } | ||
| 84 | fclose (in); | ||
| 85 | return result; | ||
| 70 | } | 86 | } |
| 71 | ]])], | 87 | ]])], |
| 72 | [gl_cv_func_working_getdelim=yes], | 88 | [gl_cv_func_working_getdelim=yes], |
| 73 | [gl_cv_func_working_getdelim=no], | 89 | [gl_cv_func_working_getdelim=no], |
| 74 | [dnl We're cross compiling. | 90 | [case "$host_os" in |
| 75 | dnl Guess it works on glibc2 systems and musl systems. | 91 | # Guess yes on musl. |
| 76 | AC_EGREP_CPP([Lucky GNU user], | 92 | *-musl* | midipix*) gl_cv_func_working_getdelim="guessing yes" ;; |
| 77 | [ | 93 | # Guess no on glibc. |
| 78 | #include <features.h> | 94 | *-gnu* | gnu*) gl_cv_func_working_getdelim="guessing no" ;; |
| 79 | #ifdef __GNU_LIBRARY__ | 95 | *) gl_cv_func_working_getdelim="$gl_cross_guess_normal" ;; |
| 80 | #if (__GLIBC__ >= 2) && !defined __UCLIBC__ | 96 | esac |
| 81 | Lucky GNU user | ||
| 82 | #endif | ||
| 83 | #endif | ||
| 84 | ], | ||
| 85 | [gl_cv_func_working_getdelim="guessing yes"], | ||
| 86 | [case "$host_os" in | ||
| 87 | *-musl* | midipix*) gl_cv_func_working_getdelim="guessing yes" ;; | ||
| 88 | *) gl_cv_func_working_getdelim="$gl_cross_guess_normal" ;; | ||
| 89 | esac | ||
| 90 | ]) | ||
| 91 | ]) | 97 | ]) |
| 92 | ;; | 98 | ;; |
| 93 | esac | 99 | esac |
| 100 | rm -f conftest.data conftest.empty | ||
| 94 | ]) | 101 | ]) |
| 95 | case "$gl_cv_func_working_getdelim" in | 102 | case "$gl_cv_func_working_getdelim" in |
| 96 | *yes) ;; | 103 | *yes) ;; |
