?RCS: $Id$ ?RCS: ?RCS: Copyright (c) 2000 Jarkko Hietaniemi ?RCS: ?RCS: You may distribute under the terms of either the GNU General Public ?RCS: License or the Artistic License, as specified in the README file. ?RCS: ?MAKE:d_strtouq: Inlibc cat Compile run ?MAKE: -pick add $@ %< ?S:d_strtouq: ?S: This variable conditionally defines the HAS_STRTOUQ symbol, which ?S: indicates to the C program that the strtouq() routine is available. ?S:. ?C:HAS_STRTOUQ: ?C: This symbol, if defined, indicates that the strtouq routine is ?C: available to convert strings to unsigned long longs (quads). ?C:. ?H:#$d_strtouq HAS_STRTOUQ /**/ ?H:. ?F:!try : see if strtouq exists set strtouq d_strtouq eval $inlibc case "$d_strtouq" in "$define") $cat <try.c <<'EOCP' #include #include extern unsigned long long int strtouq(char *s, char **, int); static int bad = 0; void check(char *s, unsigned long long eull, int een) { unsigned long long gull; errno = 0; gull = strtouq(s, 0, 10); if (!((gull == eull) && (errno == een))) bad++; } int main() { check(" 1", 1LL, 0); check(" 0", 0LL, 0); check("18446744073709551615", 18446744073709551615ULL, 0); check("18446744073709551616", 18446744073709551615ULL, ERANGE); #if 0 /* strtouq() for /^-/ strings is undefined. */ check("-1", 18446744073709551615ULL, 0); check("-18446744073709551614", 2LL, 0); check("-18446744073709551615", 1LL, 0); check("-18446744073709551616", 18446744073709551615ULL, ERANGE); check("-18446744073709551617", 18446744073709551615ULL, ERANGE); #endif if (!bad) printf("ok\n"); return 0; } EOCP set try if eval $compile; then case "`$run ./try`" in ok) echo "Your strtouq() seems to be working okay." ;; *) cat <&4 Your strtouq() doesn't seem to be working okay. EOM d_strtouq="$undef" ;; esac else echo "(I can't seem to compile the test program--assuming it doesn't)" d_strtouq="$undef" fi ;; esac