diff options
author | Jari Aalto <jari.aalto@cante.net> | 1996-08-26 18:22:31 +0000 |
---|---|---|
committer | Jari Aalto <jari.aalto@cante.net> | 2009-09-12 16:46:49 +0000 |
commit | 726f63884db0132f01745f1fb4465e6621088ccf (patch) | |
tree | 6c2f7765a890a97e0e513cb539df43283a8f7c4d /portbash/strings.sh | |
download | android_external_bash-726f63884db0132f01745f1fb4465e6621088ccf.tar.gz android_external_bash-726f63884db0132f01745f1fb4465e6621088ccf.tar.bz2 android_external_bash-726f63884db0132f01745f1fb4465e6621088ccf.zip |
Imported from ../bash-1.14.7.tar.gz.
Diffstat (limited to 'portbash/strings.sh')
-rw-r--r-- | portbash/strings.sh | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/portbash/strings.sh b/portbash/strings.sh new file mode 100644 index 0000000..99a686a --- /dev/null +++ b/portbash/strings.sh @@ -0,0 +1,87 @@ +#! /bin/sh +CC=cc +export CC + +if [ -f /usr/include/string.h ]; then + STRINGH='<string.h>' +elif [ -f /usr/include/strings.h ]; then + STRINGH='<strings.h>' +else + exit 1 +fi + +cat > x.c << EOF +#include $STRINGH + +#ifndef strchr +extern char *strchr(); +#endif + +char *x = "12345"; + +main() +{ + char *s; + + s = strchr(x, '2'); + if (s) + exit(0); + exit(1); +} +EOF + +if ${CC} x.c >/dev/null 2>&1 +then + if ./a.out + then + echo '#define HAVE_STRCHR' + fi +fi + +rm -f x.c x.o a.out + +cat > x.c << EOF +extern char *strerror(); + +main() +{ + char *s; + + s = strerror(2); + if (s) + exit(0); + exit(1); +} +EOF + +if ${CC} x.c >/dev/null 2>&1 +then + if ./a.out + then + echo '#define HAVE_STRERROR' + fi +fi + +rm -f x.c x.o a.out + + +cat > x.c << EOF + +main() +{ + if (strcasecmp("abc", "AbC") == 0) + exit(0); + exit(1); +} +EOF + +if ${CC} x.c >/dev/null 2>&1 +then + if ./a.out + then + echo '#define HAVE_STRCASECMP' + fi +fi + +rm -f x.c x.o a.out +exit 0 |