/* confdefs.h */ #define PACKAGE_NAME "GNU inetutils" #define PACKAGE_TARNAME "inetutils" #define PACKAGE_VERSION "2.2" #define PACKAGE_STRING "GNU inetutils 2.2" #define PACKAGE_BUGREPORT "bug-inetutils@gnu.org" #define PACKAGE_URL "http://www.gnu.org/software/inetutils/" #define PACKAGE "inetutils" #define VERSION "2.2" #define STDC_HEADERS 1 #define HAVE_SYS_TYPES_H 1 #define HAVE_SYS_STAT_H 1 #define HAVE_STDLIB_H 1 #define HAVE_STRING_H 1 #define HAVE_MEMORY_H 1 #define HAVE_STRINGS_H 1 #define HAVE_INTTYPES_H 1 #define HAVE_STDINT_H 1 #define HAVE_UNISTD_H 1 #define HAVE_WCHAR_H 1 #define HAVE_FEATURES_H 1 #define HAVE_ARPA_INET_H 1 #define HAVE_SYS_SOCKET_H 1 #define HAVE_UNISTD_H 1 #define HAVE_SYS_PARAM_H 1 #define HAVE_DIRENT_H 1 #define HAVE_FNMATCH_H 1 #define HAVE_PTY_H 1 #define HAVE_TERMIOS_H 1 #define HAVE_SYS_STAT_H 1 #define HAVE_SYS_VFS_H 1 #define HAVE_NETDB_H 1 #define HAVE_NETINET_IN_H 1 #define HAVE_GETOPT_H 1 #define HAVE_SYS_CDEFS_H 1 #define HAVE_STDIO_EXT_H 1 #define HAVE_GRP_H 1 #define HAVE_GLOB_H 1 #define HAVE_THREADS_H 1 #define HAVE_LIMITS_H 1 #define HAVE_INTTYPES_H 1 #define HAVE_SYS_TYPES_H 1 #define HAVE_STDINT_H 1 #define HAVE_LANGINFO_H 1 #define HAVE_SYS_MMAN_H 1 #define HAVE_POLL_H 1 #define HAVE_SYS_IOCTL_H 1 #define HAVE_UTMP_H 1 #define HAVE_UTMPX_H 1 #define HAVE_MALLOC_H 1 #define HAVE_SYS_SELECT_H 1 #define HAVE_SYS_TIME_H 1 #define HAVE_STRINGS_H 1 #define HAVE_SYS_RANDOM_H 1 #define HAVE_SYS_UIO_H 1 #define HAVE_SYSEXITS_H 1 #define HAVE_WCTYPE_H 1 #define HAVE_STDLIB_H 1 #define _ALL_SOURCE 1 #define _DARWIN_C_SOURCE 1 #define _GNU_SOURCE 1 #define _HPUX_ALT_XOPEN_SOCKET_API 1 #define _NETBSD_SOURCE 1 #define _OPENBSD_SOURCE 1 #define _POSIX_PTHREAD_SEMANTICS 1 #define __STDC_WANT_IEC_60559_ATTRIBS_EXT__ 1 #define __STDC_WANT_IEC_60559_BFP_EXT__ 1 #define __STDC_WANT_IEC_60559_DFP_EXT__ 1 #define __STDC_WANT_IEC_60559_FUNCS_EXT__ 1 #define __STDC_WANT_IEC_60559_TYPES_EXT__ 1 #define __STDC_WANT_LIB_EXT2__ 1 #define __STDC_WANT_MATH_SPEC_FUNCS__ 1 #define _TANDEM_SOURCE 1 #define __EXTENSIONS__ 1 #define HAVE_FSEEKO 1 #define HAVE_ALLOCA_H 1 #define HAVE_ALLOCA 1 #define restrict __restrict__ #define HAVE_DECL_CLEARERR_UNLOCKED 1 #define HAVE_DECL_FEOF_UNLOCKED 1 #define HAVE_DECL_FERROR_UNLOCKED 1 #define HAVE_DECL_FFLUSH_UNLOCKED 1 #define HAVE_DECL_FGETS_UNLOCKED 1 #define HAVE_DECL_FPUTC_UNLOCKED 1 #define HAVE_DECL_FPUTS_UNLOCKED 1 #define HAVE_DECL_FREAD_UNLOCKED 1 #define HAVE_DECL_FWRITE_UNLOCKED 1 #define HAVE_DECL_GETC_UNLOCKED 1 #define HAVE_DECL_GETCHAR_UNLOCKED 1 #define HAVE_DECL_PUTC_UNLOCKED 1 #define HAVE_DECL_PUTCHAR_UNLOCKED 1 #define HAVE_FLOCKFILE 1 #define HAVE_FUNLOCKFILE 1 #define HAVE_BTOWC 1 #define HAVE_FCHDIR 1 #define HAVE_EXPLICIT_BZERO 1 #define HAVE_FCNTL 1 #define HAVE_SYMLINK 1 #define HAVE_FDOPENDIR 1 #define HAVE_MEMPCPY 1 #define HAVE_FNMATCH 1 #define HAVE_MBSRTOWCS 1 #define HAVE_FSTATAT 1 #define HAVE_OPENAT 1 #define HAVE_FSTATFS 1 #define HAVE_GETDELIM 1 #define HAVE_GETDTABLESIZE 1 #define HAVE_GETLOGIN_R 1 #define HAVE_GETPASS 1 #define HAVE___FSETLOCKING 1 #define HAVE_GETRANDOM 1 #define HAVE_GETUSERSHELL 1 #define HAVE_GLOB 1 #define HAVE_GLOB_PATTERN_P 1 #define HAVE_GETPWNAM_R 1 #define HAVE_ISBLANK 1 #define HAVE_LSTAT 1 #define HAVE_MBSINIT 1 #define HAVE_MBRTOWC 1 #define HAVE_MPROTECT 1 #define HAVE_GETGROUPLIST 1 #define HAVE_MKSTEMP 1 #define HAVE_NL_LANGINFO 1 #define HAVE_PIPE 1 #define HAVE_POSIX_OPENPT 1 #define HAVE_UTMPNAME 1 #define HAVE_UTMPXNAME 1 #define HAVE_ISWCTYPE 1 #define HAVE_SETENV 1 #define HAVE_SLEEP 1 #define HAVE_SNPRINTF 1 #define HAVE_STRNDUP 1 #define HAVE_WCRTOMB 1 #define HAVE_ISWCNTRL 1 #define HAVE_WMEMPCPY 1 #define HAVE_DECL_STRERROR_R 1 #define HAVE_STRERROR_R 1 #define STRERROR_R_CHAR_P 1 #define HAVE_LANGINFO_CODESET 1 #define HAVE_MALLOC_POSIX 1 #define HAVE_ENVIRON_DECL 1 #define HAVE_DECL_FCHDIR 1 #define HAVE_WORKING_O_NOATIME 1 #define HAVE_WORKING_O_NOFOLLOW 1 #define PROMOTED_MODE_T mode_t #define HAVE_DECL_STRMODE 0 #define HAVE_MBSTATE_T 1 #define _USE_STD_STAT 1 #define HAVE_DECL_FSEEKO 1 #define LSTAT_FOLLOWS_SLASHED_SYMLINK 1 #define HAVE_DECL_FTELLO 1 #define HAVE_SHUTDOWN 1 #define HAVE_STRUCT_SOCKADDR_STORAGE 1 #define HAVE_SA_FAMILY_T 1 #define HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY 1 #define HAVE_GETHOSTBYNAME 1 #define HAVE_GETSERVBYNAME 1 #define HAVE_DECL_INET_NTOP 1 #define HAVE_IPV4 1 #define HAVE_IPV6 1 #define HAVE_DECL_GETCWD 1 #define HAVE_DECL_GETDELIM 1 #define HAVE_DECL_GETDTABLESIZE 1 #define GETGROUPS_T gid_t #define HAVE_DECL_GETLINE 1 #define HAVE_DECL_GETLOGIN_R 1 #define HAVE_DECL_GETLOGIN 1 #define HAVE_GETOPT_H 1 #define HAVE_GETOPT_LONG_ONLY 1 #define HAVE_DECL_FLOCKFILE 1 #define HAVE_DECL_FUNLOCKFILE 1 #define HAVE_PTHREAD_API 1 #define SETLOCALE_NULL_ALL_MTSAFE 1 #define SETLOCALE_NULL_ONE_MTSAFE 1 #define HAVE_WINT_T 1 #define HAVE_LONG_LONG_INT 1 #define HAVE_UNSIGNED_LONG_LONG_INT 1 #define HAVE_WCHAR_T 1 #define HAVE_WEAK_SYMBOLS 1 #define USE_POSIX_THREADS 1 #define USE_POSIX_THREADS_FROM_LIBC 1 #define MALLOC_0_IS_NONNULL 1 #define HAVE_MAP_ANONYMOUS 1 #define HAVE_DECL_MEMRCHR 1 #define HAVE_MINMAX_IN_SYS_PARAM_H 1 #define HAVE_DECL_ALARM 1 #define HAVE_DECL_SETENV 1 #define HAVE_SEARCH_H 1 #define HAVE_TSEARCH 1 #define HAVE_SIGSET_T 1 #define HAVE_DECL_SNPRINTF 1 #define HAVE__BOOL 1 #define HAVE_DECL_FCLOSEALL 1 #define __USE_MINGW_ANSI_STDIO 1 #define HAVE_DECL_ECVT 1 #define HAVE_DECL_FCVT 1 #define HAVE_DECL_GCVT 1 #define HAVE_DECL_STRDUP 1 #define HAVE_DECL_STRNDUP 1 #define HAVE_DECL_STRNLEN 1 #define HAVE_DECL_EXECVPE 1 #define HAVE_INTTYPES_H_WITH_UINTMAX 1 #define HAVE_STDINT_H_WITH_UINTMAX 1 #define HAVE_INTMAX_T 1 #define DBL_EXPBIT0_WORD 1 #define DBL_EXPBIT0_BIT 20 #define HAVE_SNPRINTF 1 #define HAVE_STRNLEN 1 #define HAVE_WCSLEN 1 #define HAVE_WCSNLEN 1 #define HAVE_MBRTOWC 1 #define HAVE_WCRTOMB 1 #define HAVE_DECL__SNPRINTF 0 #define HAVE_SNPRINTF_RETVAL_C99 1 #define HAVE_SNPRINTF_TRUNCATION_C99 1 #define HAVE_DECL_VSNPRINTF 1 #define HAVE_DECL_WCSDUP 1 #define HAVE_TOWLOWER 1 #define HAVE_ALLOCA 1 #define HAVE_DECL_PROGRAM_INVOCATION_NAME 1 #define HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME 1 #define HAVE_PROGRAM_INVOCATION_NAME 1 #define HAVE_PROGRAM_INVOCATION_SHORT_NAME 1 #define GNULIB_TEST_BTOWC 1 #define HAVE___BUILTIN_EXPECT 1 #define GNULIB_TEST_CALLOC_POSIX 1 #define GNULIB_TEST_CHDIR 1 #define HAVE_CLOCK_GETTIME 1 #define HAVE_CLOCK_SETTIME 1 #define GNULIB_TEST_CLOEXEC 1 #define GNULIB_TEST_CLOSE 1 #define HAVE_CLOSEDIR 1 #define GNULIB_TEST_CLOSEDIR 1 #define D_INO_IN_DIRENT 1 #define HAVE_STRUCT_DIRENT_D_TYPE 1 #define HAVE_DIRFD 1 #define HAVE_DECL_DIRFD 1 #define GNULIB_TEST_DIRFD 1 #define GNULIB_TEST_DUP 1 #define GNULIB_TEST_DUP2 1 #define GNULIB_TEST_ENVIRON 1 #define GNULIB_TEST_EXPLICIT_BZERO 1 #define GNULIB_TEST_FCHDIR 1 #define GNULIB_TEST_FCNTL 1 #define GNULIB_FCNTL_SAFER 1 #define GNULIB_FD_SAFER_FLAG 1 #define HAVE_DECL_FDOPENDIR 1 #define GNULIB_TEST_FDOPENDIR 1 #define GNULIB_FDOPENDIR 1 #define FLEXIBLE_ARRAY_MEMBER /**/ #define GNULIB_TEST_FNMATCH 1 #define GNULIB_TEST_FOPEN 1 #define GNULIB_FOPEN_GNU 1 #define GNULIB_FOPEN_SAFER 1 #define HAVE_DECL_FORKPTY 1 #define HAVE_FORKPTY 1 #define GNULIB_TEST_FORKPTY 1 #define HAVE_FREE_POSIX 1 #define GNULIB_TEST_FREE_POSIX 1 #define GNULIB_TEST_FSEEK 1 #define GNULIB_TEST_FSEEKO 1 #define GNULIB_TEST_FSTAT 1 #define GNULIB_TEST_FSTATAT 1 #define GNULIB_TEST_FTELL 1 #define GNULIB_TEST_FTELLO 1 #define HAVE_STRUCT_STATFS_F_TYPE 1 #define HAVE___FSWORD_T 1 #define fts_open rpl_fts_open #define fts_close rpl_fts_close #define fts_read rpl_fts_read #define fts_set rpl_fts_set #define fts_children rpl_fts_children #define fts_cross_check rpl_fts_cross_check #define HAVE_GETADDRINFO 1 #define HAVE_DECL_GAI_STRERROR 1 #define HAVE_DECL_GAI_STRERRORA 0 #define HAVE_DECL_GETADDRINFO 1 #define HAVE_DECL_FREEADDRINFO 1 #define HAVE_DECL_GETNAMEINFO 1 #define HAVE_STRUCT_ADDRINFO 1 #define GNULIB_TEST_GETADDRINFO 1 #define HAVE_GETPAGESIZE 1 #define HAVE_MINIMALLY_WORKING_GETCWD 1 #define GNULIB_GETCWD 1 #define GNULIB_TEST_GETCWD 1 #define GNULIB_TEST_GETCWD 1 #define GNULIB_TEST_GETDELIM 1 #define HAVE_GETDOMAINNAME 1 #define HAVE_DECL_GETDOMAINNAME 1 #define GNULIB_TEST_GETDOMAINNAME 1 #define GNULIB_TEST_GETDTABLESIZE 1 #define HAVE_GETGROUPS 1 #define GNULIB_TEST_GETGROUPS 1 #define HAVE_GETHOSTNAME 1 #define GNULIB_TEST_GETHOSTNAME 1 #define GNULIB_TEST_GETLINE 1 #define GNULIB_TEST_GETLOGIN_R 1 #define __GETOPT_PREFIX rpl_ #define GNULIB_TEST_GETOPT_POSIX 1 #define GNULIB_TEST_GETPASS 1 #define GNULIB_TEST_GETPEERNAME 1 #define HAVE_DECL_PROGRAM_INVOCATION_NAME 1 #define HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME 1 #define HAVE_DECL___ARGV 0 #define GNULIB_TEST_GETRANDOM 1 #define HAVE_DECL_GETUSERSHELL 1 #define GNULIB_TEST_GETUSERSHELL 1 #define GNULIB_TEST_GLOB 1 #define HAVE_GETHOSTBYNAME 1 #define HAVE_DECL_INET_NTOP 1 #define HAVE_IOCTL 1 #define GNULIB_TEST_IOCTL 1 #define GNULIB_ISBLANK 1 #define HAVE___INLINE 1 #define GNULIB_TEST_LOCALECONV 1 #define HAVE_PTHREAD_RWLOCK 1 #define HAVE_PTHREAD_MUTEX_RECURSIVE 1 #define GNULIB_LOCK 1 #define HAVE_LOGIN_TTY 1 #define GNULIB_TEST_LOGIN_TTY 1 #define GNULIB_TEST_LSEEK 1 #define GNULIB_TEST_LSTAT 1 #define GNULIB_TEST_MALLOC_POSIX 1 #define MBRTOWC_IN_C_LOCALE_MAYBE_EILSEQ 1 #define GNULIB_TEST_MBRTOWC 1 #define GNULIB_TEST_MBSINIT 1 #define GNULIB_TEST_MBSRTOWCS 1 #define HAVE_MBTOWC 1 #define GNULIB_TEST_MBTOWC 1 #define GNULIB_TEST_MEMCHR 1 #define HAVE_MEMPCPY 1 #define GNULIB_TEST_MEMPCPY 1 #define HAVE_MEMRCHR 1 #define GNULIB_TEST_MEMRCHR 1 #define GNULIB_TEST_MKDIR 1 #define GNULIB_TEST_MKSTEMP 1 #define GNULIB_MSVC_NOTHROW 1 #define FUNC_NL_LANGINFO_YESEXPR_WORKS 1 #define NL_LANGINFO_MTSAFE 1 #define GNULIB_TEST_NL_LANGINFO 1 #define GNULIB_TEST_OPEN 1 #define GNULIB_OPENAT 1 #define GNULIB_TEST_OPENAT 1 #define GNULIB_OPENAT_SAFER 1 #define HAVE_OPENDIR 1 #define GNULIB_TEST_OPENDIR 1 #define HAVE_DECL_OPENPTY 1 #define HAVE_OPENPTY 1 #define GNULIB_TEST_OPENPTY 1 #define GNULIB_TEST_PIPE 1 #define HAVE_POLL 1 #define GNULIB_TEST_POLL 1 #define GNULIB_TEST_POSIX_OPENPT 1 #define HAVE_DECL_PROGRAM_INVOCATION_NAME 1 #define HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME 1 #define HAVE_RAWMEMCHR 1 #define GNULIB_TEST_RAWMEMCHR 1 #define HAVE_READDIR 1 #define GNULIB_TEST_READDIR 1 #define HAVE_READLINE 1 #define HAVE_READLINE_READLINE_H 1 #define HAVE_READLINE_HISTORY_H 1 #define HAVE_DECL_GETUTENT 1 #define HAVE_STRUCT_UTMPX_UT_USER 1 #define HAVE_STRUCT_UTMP_UT_USER 1 #define HAVE_STRUCT_UTMPX_UT_NAME 1 #define HAVE_STRUCT_UTMP_UT_NAME 1 #define HAVE_STRUCT_UTMPX_UT_TYPE 1 #define HAVE_STRUCT_UTMP_UT_TYPE 1 #define HAVE_STRUCT_UTMPX_UT_PID 1 #define HAVE_STRUCT_UTMP_UT_PID 1 #define HAVE_STRUCT_UTMPX_UT_ID 1 #define HAVE_STRUCT_UTMP_UT_ID 1 #define HAVE_STRUCT_UTMPX_UT_EXIT 1 #define HAVE_STRUCT_UTMP_UT_EXIT 1 #define HAVE_STRUCT_UTMPX_UT_EXIT_E_EXIT 1 #define HAVE_STRUCT_UTMP_UT_EXIT_E_EXIT 1 #define HAVE_STRUCT_UTMPX_UT_EXIT_E_TERMINATION 1 #define HAVE_STRUCT_UTMP_UT_EXIT_E_TERMINATION 1 #define GNULIB_TEST_REALLOC_POSIX 1 #define HAVE_REALLOCARRAY 1 #define GNULIB_REALLOCARRAY 1 #define GNULIB_TEST_REALLOCARRAY 1 /* end confdefs.h. */ #include #include #include #include #if defined M_CHECK_ACTION || HAVE_DECL_ALARM # include # include #endif #if HAVE_MALLOC_H # include #endif #ifdef M_CHECK_ACTION /* Exit with distinguishable exit code. */ static void sigabrt_no_core (int sig) { raise (SIGTERM); } #endif int main () { int result = 0; static struct re_pattern_buffer regex; unsigned char folded_chars[UCHAR_MAX + 1]; int i; const char *s; struct re_registers regs; /* Some builds of glibc go into an infinite loop on this test. Use alarm to force death, and mallopt to avoid malloc recursion in diagnosing the corrupted heap. */ #if HAVE_DECL_ALARM signal (SIGALRM, SIG_DFL); alarm (2); #endif #ifdef M_CHECK_ACTION signal (SIGABRT, sigabrt_no_core); mallopt (M_CHECK_ACTION, 2); #endif if (setlocale (LC_ALL, "en_US.UTF-8")) { { /* https://sourceware.org/ml/libc-hacker/2006-09/msg00008.html This test needs valgrind to catch the bug on Debian GNU/Linux 3.1 x86, but it might catch the bug better on other platforms and it shouldn't hurt to try the test here. */ static char const pat[] = "insert into"; static char const data[] = "\xFF\0\x12\xA2\xAA\xC4\xB1,K\x12\xC4\xB1*\xACK"; re_set_syntax (RE_SYNTAX_GREP | RE_HAT_LISTS_NOT_NEWLINE | RE_ICASE); memset (®ex, 0, sizeof regex); s = re_compile_pattern (pat, sizeof pat - 1, ®ex); if (s) result |= 1; else { if (re_search (®ex, data, sizeof data - 1, 0, sizeof data - 1, ®s) != -1) result |= 1; regfree (®ex); } } { /* This test is from glibc bug 15078. The test case is from Andreas Schwab in . */ static char const pat[] = "[^x]x"; static char const data[] = /* */ "\xe1\x80\x80" "\xe1\x80\xbb" "\xe1\x80\xbd" "\xe1\x80\x94" "\xe1\x80\xba" "\xe1\x80\xaf" "\xe1\x80\x95" "\xe1\x80\xba" "x"; re_set_syntax (0); memset (®ex, 0, sizeof regex); s = re_compile_pattern (pat, sizeof pat - 1, ®ex); if (s) result |= 1; else { i = re_search (®ex, data, sizeof data - 1, 0, sizeof data - 1, 0); if (i != 0 && i != 21) result |= 1; regfree (®ex); } } if (! setlocale (LC_ALL, "C")) return 1; } /* This test is from glibc bug 3957, reported by Andrew Mackey. */ re_set_syntax (RE_SYNTAX_EGREP | RE_HAT_LISTS_NOT_NEWLINE); memset (®ex, 0, sizeof regex); s = re_compile_pattern ("a[^x]b", 6, ®ex); if (s) result |= 2; else { /* This should fail, but succeeds for glibc-2.5. */ if (re_search (®ex, "a\nb", 3, 0, 3, ®s) != -1) result |= 2; regfree (®ex); } /* This regular expression is from Spencer ere test number 75 in grep-2.3. */ re_set_syntax (RE_SYNTAX_POSIX_EGREP); memset (®ex, 0, sizeof regex); for (i = 0; i <= UCHAR_MAX; i++) folded_chars[i] = i; regex.translate = folded_chars; s = re_compile_pattern ("a[[:]:]]b\n", 11, ®ex); /* This should fail with _Invalid character class name_ error. */ if (!s) { result |= 4; regfree (®ex); } /* Ensure that [b-a] is diagnosed as invalid, when using RE_NO_EMPTY_RANGES. */ re_set_syntax (RE_SYNTAX_POSIX_EGREP | RE_NO_EMPTY_RANGES); memset (®ex, 0, sizeof regex); s = re_compile_pattern ("a[b-a]", 6, ®ex); if (s == 0) { result |= 8; regfree (®ex); } /* This should succeed, but does not for glibc-2.1.3. */ memset (®ex, 0, sizeof regex); s = re_compile_pattern ("{1", 2, ®ex); if (s) result |= 8; else regfree (®ex); /* The following example is derived from a problem report against gawk from Jorge Stolfi . */ memset (®ex, 0, sizeof regex); s = re_compile_pattern ("[an\371]*n", 7, ®ex); if (s) result |= 8; else { /* This should match, but does not for glibc-2.2.1. */ if (re_match (®ex, "an", 2, 0, ®s) != 2) result |= 8; else { free (regs.start); free (regs.end); } regfree (®ex); } memset (®ex, 0, sizeof regex); s = re_compile_pattern ("x", 1, ®ex); if (s) result |= 8; else { /* glibc-2.2.93 does not work with a negative RANGE argument. */ if (re_search (®ex, "wxy", 3, 2, -2, ®s) != 1) result |= 8; else { free (regs.start); free (regs.end); } regfree (®ex); } /* The version of regex.c in older versions of gnulib ignored RE_ICASE. Detect that problem too. */ re_set_syntax (RE_SYNTAX_EMACS | RE_ICASE); memset (®ex, 0, sizeof regex); s = re_compile_pattern ("x", 1, ®ex); if (s) result |= 16; else { if (re_search (®ex, "WXY", 3, 0, 3, ®s) < 0) result |= 16; else { free (regs.start); free (regs.end); } regfree (®ex); } /* Catch a bug reported by Vin Shelton in https://lists.gnu.org/r/bug-coreutils/2007-06/msg00089.html */ re_set_syntax (RE_SYNTAX_POSIX_BASIC & ~RE_CONTEXT_INVALID_DUP & ~RE_NO_EMPTY_RANGES); memset (®ex, 0, sizeof regex); s = re_compile_pattern ("[[:alnum:]_-]\\+$", 16, ®ex); if (s) result |= 32; else regfree (®ex); /* REG_STARTEND was added to glibc on 2004-01-15. Reject older versions. */ if (! REG_STARTEND) result |= 64; /* Matching with the compiled form of this regexp would provoke an assertion failure prior to glibc-2.28: regexec.c:1375: pop_fail_stack: Assertion 'num >= 0' failed With glibc-2.28, compilation fails and reports the invalid back reference. */ re_set_syntax (RE_SYNTAX_POSIX_EGREP); memset (®ex, 0, sizeof regex); s = re_compile_pattern ("0|()0|\\1|0", 10, ®ex); if (!s) { memset (®s, 0, sizeof regs); i = re_search (®ex, "x", 1, 0, 1, ®s); if (i != -1) result |= 64; if (0 <= i) { free (regs.start); free (regs.end); } regfree (®ex); } else { if (strcmp (s, "Invalid back reference")) result |= 64; } /* glibc bug 11053. */ re_set_syntax (RE_SYNTAX_POSIX_BASIC); memset (®ex, 0, sizeof regex); static char const pat_sub2[] = "\\(a*\\)*a*\\1"; s = re_compile_pattern (pat_sub2, sizeof pat_sub2 - 1, ®ex); if (s) result |= 64; else { memset (®s, 0, sizeof regs); static char const data[] = "a"; int datalen = sizeof data - 1; i = re_search (®ex, data, datalen, 0, datalen, ®s); if (i != 0) result |= 64; else if (regs.num_regs < 2) result |= 64; else if (! (regs.start[0] == 0 && regs.end[0] == 1)) result |= 64; else if (! (regs.start[1] == 0 && regs.end[1] == 0)) result |= 64; regfree (®ex); free (regs.start); free (regs.end); } #if 0 /* It would be nice to reject hosts whose regoff_t values are too narrow (including glibc on hosts with 64-bit ptrdiff_t and 32-bit int), but we should wait until glibc implements this feature. Otherwise, support for equivalence classes and multibyte collation symbols would always be broken except when compiling --without-included-regex. */ if (sizeof (regoff_t) < sizeof (ptrdiff_t) || sizeof (regoff_t) < sizeof (ssize_t)) result |= 64; #endif return result; ; return 0; }