?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_strtoull: Inlibc d_longlong Compile cat
+?MAKE:d_strtoull: Inlibc d_longlong Compile cat run
?MAKE: -pick add $@ %<
?S:d_strtoull:
?S: This variable conditionally defines the HAS_STRTOULL symbol, which
?H:#$d_strtoull HAS_STRTOULL /**/
?H:.
?F:!try
-?LINT:set d_strtoull
: see if strtoull exists
set strtoull d_strtoull
eval $inlibc
#define strtoull __strtoull
#endif
#include <stdio.h>
-extern unsigned long long int strtoull(char *s, char **, int);
+extern unsigned long long int strtoull(char *s, char **, int);
static int bad = 0;
int check(char *s, long long eull, int een) {
long long gull;
bad++;
}
int main() {
- check(" 1", 1LL, 0);
- check(" 0", 0LL, 0);
- check("18446744073709551615", 18446744073709551615ULL, 0);
- check("18446744073709551616", 18446744073709551615ULL, ERANGE);
+ check(" 1", 1LL, 0);
+ check(" 0", 0LL, 0);
+ check("18446744073709551615", 18446744073709551615ULL, 0);
+ check("18446744073709551616", 18446744073709551615ULL, ERANGE);
+#if 0 /* strtoull() 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");
}
EOCP
set try
if eval $compile; then
- case "`./try`" in
+ case "`$run ./try`" in
ok) echo "Your strtoull() seems to be working okay." ;;
*) cat <<EOM >&4
Your strtoull() doesn't seem to be working okay.
d_strtoull="$undef"
;;
esac
+ else
+ echo "(I can't seem to compile the test program--assuming it doesn't)"
+ d_strtoull="$undef"
fi
;;
esac