Update of /cvsroot/winbash/winbash/portbash
In directory usw-pr-cvs1:/tmp/cvs-serv381/portbash
Modified Files:
README libc.sh mkdesc.sh pgrp.c signals.sh stdio.sh strings.sh
syscalls.sh
Log Message:
Fixed more cr/lf problems.
Index: README
===================================================================
RCS file: /cvsroot/winbash/winbash/portbash/README,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- README 9 Mar 2002 03:39:13 -0000 1.1.1.1
+++ README 9 Mar 2002 04:43:16 -0000 1.2
@@ -1 +1 @@
-run sh mkdesc.sh for a first cut at a machines.h entry
+run sh mkdesc.sh for a first cut at a machines.h entry
Index: libc.sh
===================================================================
RCS file: /cvsroot/winbash/winbash/portbash/libc.sh,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- libc.sh 9 Mar 2002 03:39:13 -0000 1.1.1.1
+++ libc.sh 9 Mar 2002 04:43:16 -0000 1.2
@@ -1,172 +1,172 @@
-#! /bin/sh
-
-CC=cc
-export CC
-
-cat > x.c <<EOF
-extern char *alloca();
-
-main()
-{
- char *s;
- s = alloca(20);
-}
-EOF
-
-if ${CC} x.c > /dev/null 2>&1; then
- :
-else
- echo '#undef HAVE_ALLOCA'
-fi
-rm -f x.c x.o a.out
-
-cat > x.c << EOF
-#include <sys/types.h>
-#include <sys/param.h>
-extern char *getwd();
-main()
-{
- getwd();
-}
-EOF
-
-if ${CC} x.c > /dev/null 2>&1; then
- echo '#define HAVE_GETWD'
-else
- echo '#undef HAVE_GETWD'
- rm -f x.c x.o a.out
-
- cat > x.c << EOF
-extern char *getcwd();
-
-main()
-{
- getcwd();
-}
-EOF
-
- if ${CC} x.c >/dev/null 2>&1; then
- echo '#define HAVE_GETCWD'
- fi
-fi
-rm -f a.out x.c x.o
-
-cat > x.c << EOF
-/*
- * exit 0 if we have bcopy in libc and it works as in BSD
- */
-
-extern int bcopy();
-
-char x[] = "12345";
-char y[] = "67890";
-
-main()
-{
- bcopy(x, y, 5);
- exit(strcmp(x, y));
-}
-EOF
-
-if ${CC} x.c > /dev/null 2>&1 && ./a.out ; then
- BC='-DHAVE_BCOPY'
-fi
-
-rm -f x.c x.o a.out
-
-cat > x.c << EOF
-/*
- * If this compiles, the system has uid_t and gid_t
- */
-
-#include <sys/types.h>
-
-uid_t u;
-gid_t g;
-
-main()
-{
- exit(0);
-}
-EOF
-
-if ${CC} x.c > /dev/null 2>&1; then
- UIDT='-DHAVE_UID_T'
-fi
-
-rm -f x.c x.o a.out
-
-cat > x.c <<EOF
-#include <signal.h>
-
-extern char *sys_siglist[];
-
-main()
-{
- char *x;
-
- x = sys_siglist[3];
- write(2, x, strlen(x));
- exit(0);
-}
-EOF
-
-if ${CC} ./x.c >/dev/null 2>&1; then
- echo '#define HAVE_SYS_SIGLIST'
-else
-
- cat > x.c <<EOF
-#include <signal.h>
-
-extern char *_sys_siglist[];
-
-main()
-{
- exit(0);
-}
-EOF
-
- if ${CC} ./x.c >/dev/null 2>&1; then
- echo '#define HAVE_SYS_SIGLIST'
- SL='-Dsys_siglist=_sys_siglist'
- fi
-fi
-
-PG=
-if ${CC} pgrp.c >/dev/null 2>&1; then
- PG=`./a.out`
-fi
-
-if [ -f /unix ] && [ -f /usr/ccs/lib/libc.so ]; then
- R4="-DUSGr4"
-fi
-
-touch not_a_directory
-if [ -f /usr/include/dirent.h ]; then
- d='<dirent.h>'
-else
- d='<sys/dir.h>'
-fi
-
-cat > x.c << EOF
-/*
- * exit 0 if opendir does not check whether its argument is a directory
- */
-
-#include $d
-DIR *dir;
-
-main()
-{
- dir = opendir("not_a_directory");
- exit (dir == 0);
-}
-EOF
-
-if ${CC} x.c > /dev/null 2>&1 && ./a.out ; then
- OD='-DOPENDIR_NOT_ROBUST'
-fi
-
-rm -f x.c x.o a.out pgrp.o not_a_directory
-echo "#define SYSDEP_CFLAGS $BC $UIDT $SL $PG $R4 $OD"
-exit 0
+#! /bin/sh
+
+CC=cc
+export CC
+
+cat > x.c <<EOF
+extern char *alloca();
+
+main()
+{
+ char *s;
+ s = alloca(20);
+}
+EOF
+
+if ${CC} x.c > /dev/null 2>&1; then
+ :
+else
+ echo '#undef HAVE_ALLOCA'
+fi
+rm -f x.c x.o a.out
+
+cat > x.c << EOF
+#include <sys/types.h>
+#include <sys/param.h>
+extern char *getwd();
+main()
+{
+ getwd();
+}
+EOF
+
+if ${CC} x.c > /dev/null 2>&1; then
+ echo '#define HAVE_GETWD'
+else
+ echo '#undef HAVE_GETWD'
+ rm -f x.c x.o a.out
+
+ cat > x.c << EOF
+extern char *getcwd();
+
+main()
+{
+ getcwd();
+}
+EOF
+
+ if ${CC} x.c >/dev/null 2>&1; then
+ echo '#define HAVE_GETCWD'
+ fi
+fi
+rm -f a.out x.c x.o
+
+cat > x.c << EOF
+/*
+ * exit 0 if we have bcopy in libc and it works as in BSD
+ */
+
+extern int bcopy();
+
+char x[] = "12345";
+char y[] = "67890";
+
+main()
+{
+ bcopy(x, y, 5);
+ exit(strcmp(x, y));
+}
+EOF
+
+if ${CC} x.c > /dev/null 2>&1 && ./a.out ; then
+ BC='-DHAVE_BCOPY'
+fi
+
+rm -f x.c x.o a.out
+
+cat > x.c << EOF
+/*
+ * If this compiles, the system has uid_t and gid_t
+ */
+
+#include <sys/types.h>
+
+uid_t u;
+gid_t g;
+
+main()
+{
+ exit(0);
+}
+EOF
+
+if ${CC} x.c > /dev/null 2>&1; then
+ UIDT='-DHAVE_UID_T'
+fi
+
+rm -f x.c x.o a.out
+
+cat > x.c <<EOF
+#include <signal.h>
+
+extern char *sys_siglist[];
+
+main()
+{
+ char *x;
+
+ x = sys_siglist[3];
+ write(2, x, strlen(x));
+ exit(0);
+}
+EOF
+
+if ${CC} ./x.c >/dev/null 2>&1; then
+ echo '#define HAVE_SYS_SIGLIST'
+else
+
+ cat > x.c <<EOF
+#include <signal.h>
+
+extern char *_sys_siglist[];
+
+main()
+{
+ exit(0);
+}
+EOF
+
+ if ${CC} ./x.c >/dev/null 2>&1; then
+ echo '#define HAVE_SYS_SIGLIST'
+ SL='-Dsys_siglist=_sys_siglist'
+ fi
+fi
+
+PG=
+if ${CC} pgrp.c >/dev/null 2>&1; then
+ PG=`./a.out`
+fi
+
+if [ -f /unix ] && [ -f /usr/ccs/lib/libc.so ]; then
+ R4="-DUSGr4"
+fi
+
+touch not_a_directory
+if [ -f /usr/include/dirent.h ]; then
+ d='<dirent.h>'
+else
+ d='<sys/dir.h>'
+fi
+
+cat > x.c << EOF
+/*
+ * exit 0 if opendir does not check whether its argument is a directory
+ */
+
+#include $d
+DIR *dir;
+
+main()
+{
+ dir = opendir("not_a_directory");
+ exit (dir == 0);
+}
+EOF
+
+if ${CC} x.c > /dev/null 2>&1 && ./a.out ; then
+ OD='-DOPENDIR_NOT_ROBUST'
+fi
+
+rm -f x.c x.o a.out pgrp.o not_a_directory
+echo "#define SYSDEP_CFLAGS $BC $UIDT $SL $PG $R4 $OD"
+exit 0
Index: mkdesc.sh
===================================================================
RCS file: /cvsroot/winbash/winbash/portbash/mkdesc.sh,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- mkdesc.sh 9 Mar 2002 03:39:13 -0000 1.1.1.1
+++ mkdesc.sh 9 Mar 2002 04:43:16 -0000 1.2
@@ -1,11 +1,11 @@
-#! /bin/sh
-
-if [ -f /unix ]; then
- echo '#define M_OS "USG"'
-fi
-
-sh signals.sh
-sh stdio.sh
-sh strings.sh
-sh syscalls.sh
-sh libc.sh
+#! /bin/sh
+
+if [ -f /unix ]; then
+ echo '#define M_OS "USG"'
+fi
+
+sh signals.sh
+sh stdio.sh
+sh strings.sh
+sh syscalls.sh
+sh libc.sh
Index: pgrp.c
===================================================================
RCS file: /cvsroot/winbash/winbash/portbash/pgrp.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- pgrp.c 9 Mar 2002 03:39:13 -0000 1.1.1.1
+++ pgrp.c 9 Mar 2002 04:43:16 -0000 1.2
@@ -1,48 +1,48 @@
-/*
- * If this system has a BSD-style getpgrp() call which takes a pid
- * as an argument, output a -DBSD_GETPGRP.
- */
-#include <stdio.h>
-#include <sys/types.h>
-
-int pid;
-int pg1, pg2, pg3, pg4;
-int ng, np, s, child;
-
-main()
-{
- pid = getpid();
- pg1 = getpgrp(0);
- pg2 = getpgrp();
- pg3 = getpgrp(pid);
- pg4 = getpgrp(1);
-
- /*
- * If all of these values are the same, it's pretty sure that
- * we're on a system that ignores getpgrp's first argument.
- */
- if (pg2 == pg4 && pg1 == pg3 && pg2 == pg3)
- exit(0);
-
- child = fork();
- if (child < 0)
- exit(1);
- else if (child == 0) {
- np = getpid();
- /*
- * If this is Sys V, this will not work; pgrp will be
- * set to np because setpgrp just changes a pgrp to be
- * the same as the pid.
- */
- setpgrp(np, pg1);
- ng = getpgrp(0); /* Same result for Sys V and BSD */
- if (ng == pg1) {
- printf("-DBSD_GETPGRP\n");
- exit(0);
- } else
- exit(1);
- } else {
- wait(&s);
- exit(s>>8);
- }
-}
+/*
+ * If this system has a BSD-style getpgrp() call which takes a pid
+ * as an argument, output a -DBSD_GETPGRP.
+ */
+#include <stdio.h>
+#include <sys/types.h>
+
+int pid;
+int pg1, pg2, pg3, pg4;
+int ng, np, s, child;
+
+main()
+{
+ pid = getpid();
+ pg1 = getpgrp(0);
+ pg2 = getpgrp();
+ pg3 = getpgrp(pid);
+ pg4 = getpgrp(1);
+
+ /*
+ * If all of these values are the same, it's pretty sure that
+ * we're on a system that ignores getpgrp's first argument.
+ */
+ if (pg2 == pg4 && pg1 == pg3 && pg2 == pg3)
+ exit(0);
+
+ child = fork();
+ if (child < 0)
+ exit(1);
+ else if (child == 0) {
+ np = getpid();
+ /*
+ * If this is Sys V, this will not work; pgrp will be
+ * set to np because setpgrp just changes a pgrp to be
+ * the same as the pid.
+ */
+ setpgrp(np, pg1);
+ ng = getpgrp(0); /* Same result for Sys V and BSD */
+ if (ng == pg1) {
+ printf("-DBSD_GETPGRP\n");
+ exit(0);
+ } else
+ exit(1);
+ } else {
+ wait(&s);
+ exit(s>>8);
+ }
+}
Index: signals.sh
===================================================================
RCS file: /cvsroot/winbash/winbash/portbash/signals.sh,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- signals.sh 9 Mar 2002 03:39:13 -0000 1.1.1.1
+++ signals.sh 9 Mar 2002 04:43:16 -0000 1.2
@@ -1,64 +1,64 @@
-#! /bin/sh
-#
-CC=cc
-export CC
-
-cat > x.c <<EOF
-#include <signal.h>
-
-main()
-{
-}
-EOF
-
-${CC} -E x.c > x.i || { rm -f x.c x.i ; exit 1; }
-
-if egrep 'void.*signal' x.i >/dev/null 2>&1
-then
- echo '#define VOID_SIGHANDLER'
-fi
-rm -f x.c x.i
-
-cat > x.c << EOF
-#include <signal.h>
-sigset_t set, oset;
-main()
-{
- sigemptyset(&set);
- sigemptyset(&oset);
- sigaddset(&set, 2);
- sigprocmask(SIG_BLOCK, &set, &oset);
-}
-EOF
-if ${CC} x.c >/dev/null 2>&1; then
- echo '#define HAVE_POSIX_SIGNALS'
-else
- cat > x.c << EOF
-#include <signal.h>
-main()
-{
- long omask = sigblock(sigmask(2));
- sigsetmask(omask);
-}
-EOF
- if ${CC} x.c >/dev/null 2>&1; then
- echo '#define HAVE_BSD_SIGNALS'
- else
- cat > x.c << EOF
-#include <signal.h>
-main()
-{
- int n;
- n = sighold(2);
- sigrelse(2);
-}
-EOF
- if ${CC} x.c >/dev/null 2>&1; then
- echo '#define HAVE_USG_SIGHOLD'
- fi
- fi
-fi
-
-rm -f x.c x.o a.out
-
-exit 0
+#! /bin/sh
+#
+CC=cc
+export CC
+
+cat > x.c <<EOF
+#include <signal.h>
+
+main()
+{
+}
+EOF
+
+${CC} -E x.c > x.i || { rm -f x.c x.i ; exit 1; }
+
+if egrep 'void.*signal' x.i >/dev/null 2>&1
+then
+ echo '#define VOID_SIGHANDLER'
+fi
+rm -f x.c x.i
+
+cat > x.c << EOF
+#include <signal.h>
+sigset_t set, oset;
+main()
+{
+ sigemptyset(&set);
+ sigemptyset(&oset);
+ sigaddset(&set, 2);
+ sigprocmask(SIG_BLOCK, &set, &oset);
+}
+EOF
+if ${CC} x.c >/dev/null 2>&1; then
+ echo '#define HAVE_POSIX_SIGNALS'
+else
+ cat > x.c << EOF
+#include <signal.h>
+main()
+{
+ long omask = sigblock(sigmask(2));
+ sigsetmask(omask);
+}
+EOF
+ if ${CC} x.c >/dev/null 2>&1; then
+ echo '#define HAVE_BSD_SIGNALS'
+ else
+ cat > x.c << EOF
+#include <signal.h>
+main()
+{
+ int n;
+ n = sighold(2);
+ sigrelse(2);
+}
+EOF
+ if ${CC} x.c >/dev/null 2>&1; then
+ echo '#define HAVE_USG_SIGHOLD'
+ fi
+ fi
+fi
+
+rm -f x.c x.o a.out
+
+exit 0
Index: stdio.sh
===================================================================
RCS file: /cvsroot/winbash/winbash/portbash/stdio.sh,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- stdio.sh 9 Mar 2002 03:39:13 -0000 1.1.1.1
+++ stdio.sh 9 Mar 2002 04:43:16 -0000 1.2
@@ -1,87 +1,87 @@
-#! /bin/sh
-#
-# test certain aspects of stdio
-CC=cc
-export CC
-
-cat > x.c << EOF
-#include <stdio.h>
-#include <varargs.h>
-
-xp(va_alist)
-va_dcl
-{
- va_list args;
- va_start (args);
- vfprintf(stdout, "abcde", args);
-}
-
-main()
-{
- xp();
- exit(0);
-}
-EOF
-
-if ${CC} x.c >/dev/null 2>&1
-then
- echo '#define HAVE_VFPRINTF'
- rm -f x.c x.o a.out
-else
-
- cat > x.c << EOF
-#include <stdio.h>
-
-main()
-{
- _doprnt();
-}
-EOF
-
- if ${CC} x.c >/dev/null 2>&1
- then
- echo '#define USE_VFPRINTF_EMULATION'
- rm -f x.c x.o a.out
- fi
-fi
-
-cat > x.c << EOF
-#include <stdio.h>
-main()
-{
- setlinebuf(stdout);
-}
-EOF
-
-if ${CC} x.c > /dev/null 2>&1
-then
- rm -f x.c x.o a.out
- echo '#define HAVE_SETLINEBUF'
-else
- # check for setvbuf
- # If this compiles, the system has setvbuf. If this segfaults while
- # running, non-reversed systems get a seg violation
-
- cat > x.c << EOF
-#include <stdio.h>
-
-main()
-{
- setvbuf(stdout, _IOLBF, (char *)0, BUFSIZ); /* reversed */
- exit(0); /* non-reversed systems segv */
-}
-EOF
-
- if ${CC} x.c >/dev/null 2>&1 ; then
- echo '#define HAVE_SETVBUF'
- if a.out; then
- :
- else
- rm -f core
- echo '#define REVERSED_SETVBUF_ARGS'
- fi
- fi
-fi
-
-rm -f x.c x.o a.out
-exit 0
+#! /bin/sh
+#
+# test certain aspects of stdio
+CC=cc
+export CC
+
+cat > x.c << EOF
+#include <stdio.h>
+#include <varargs.h>
+
+xp(va_alist)
+va_dcl
+{
+ va_list args;
+ va_start (args);
+ vfprintf(stdout, "abcde", args);
+}
+
+main()
+{
+ xp();
+ exit(0);
+}
+EOF
+
+if ${CC} x.c >/dev/null 2>&1
+then
+ echo '#define HAVE_VFPRINTF'
+ rm -f x.c x.o a.out
+else
+
+ cat > x.c << EOF
+#include <stdio.h>
+
+main()
+{
+ _doprnt();
+}
+EOF
+
+ if ${CC} x.c >/dev/null 2>&1
+ then
+ echo '#define USE_VFPRINTF_EMULATION'
+ rm -f x.c x.o a.out
+ fi
+fi
+
+cat > x.c << EOF
+#include <stdio.h>
+main()
+{
+ setlinebuf(stdout);
+}
+EOF
+
+if ${CC} x.c > /dev/null 2>&1
+then
+ rm -f x.c x.o a.out
+ echo '#define HAVE_SETLINEBUF'
+else
+ # check for setvbuf
+ # If this compiles, the system has setvbuf. If this segfaults while
+ # running, non-reversed systems get a seg violation
+
+ cat > x.c << EOF
+#include <stdio.h>
+
+main()
+{
+ setvbuf(stdout, _IOLBF, (char *)0, BUFSIZ); /* reversed */
+ exit(0); /* non-reversed systems segv */
+}
+EOF
+
+ if ${CC} x.c >/dev/null 2>&1 ; then
+ echo '#define HAVE_SETVBUF'
+ if a.out; then
+ :
+ else
+ rm -f core
+ echo '#define REVERSED_SETVBUF_ARGS'
+ fi
+ fi
+fi
+
+rm -f x.c x.o a.out
+exit 0
Index: strings.sh
===================================================================
RCS file: /cvsroot/winbash/winbash/portbash/strings.sh,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- strings.sh 9 Mar 2002 03:39:13 -0000 1.1.1.1
+++ strings.sh 9 Mar 2002 04:43:16 -0000 1.2
@@ -1,87 +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
+#! /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
Index: syscalls.sh
===================================================================
RCS file: /cvsroot/winbash/winbash/portbash/syscalls.sh,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- syscalls.sh 9 Mar 2002 03:39:13 -0000 1.1.1.1
+++ syscalls.sh 9 Mar 2002 04:43:16 -0000 1.2
@@ -1,80 +1,80 @@
-#! /bin/sh
-CC=cc
-export CC
-
-cat > x.c << EOF
-/*
- * exit 0 if we have the getgroups system or library call.
- */
-
-main()
-{
- int g[100], ng;
-
- ng = getgroups(100, g);
- if (ng)
- exit(0);
- exit(1);
-}
-EOF
-if ${CC} x.c > /dev/null 2>&1 && ./a.out ; then
- echo '#define HAVE_GETGROUPS'
-fi
-rm -f x.c x.o a.out
-
-cat > x.c << EOF
-extern int dup2();
-main()
-{
- exit(dup2(1, 2) == -1);
-}
-EOF
-
-if ${CC} x.c > /dev/null 2>&1 && ./a.out ; then
- echo '#define HAVE_DUP2'
-fi
-rm -f a.out x.c x.o
-
-cat > x.c << EOF
-extern int getpageesize();
-main()
-{
- int n = getpagesize();
-}
-EOF
-
-if ${CC} x.c > /dev/null 2>&1
-then
- echo '#define HAVE_GETPAGESIZE'
-fi
-rm -f a.out x.c x.o
-
-cat > x.c << EOF
-extern int getdtablesize();
-main()
-{
- int n = getdtablesize();
-}
-EOF
-
-if ${CC} x.c > /dev/null 2>&1
-then
- echo '#define HAVE_GETDTABLESIZE'
-fi
-rm -f a.out x.c x.o
-
-cat > x.c << EOF
-extern int setdtablesize();
-main()
-{
- int n = setdtablesize(128);
-}
-EOF
-
-if ${CC} x.c > /dev/null 2>&1
-then
- echo '#define HAVE_SETDTABLESIZE'
-fi
-rm -f a.out x.c x.o
-
-exit 0
+#! /bin/sh
+CC=cc
+export CC
+
+cat > x.c << EOF
+/*
+ * exit 0 if we have the getgroups system or library call.
+ */
+
+main()
+{
+ int g[100], ng;
+
+ ng = getgroups(100, g);
+ if (ng)
+ exit(0);
+ exit(1);
+}
+EOF
+if ${CC} x.c > /dev/null 2>&1 && ./a.out ; then
+ echo '#define HAVE_GETGROUPS'
+fi
+rm -f x.c x.o a.out
+
+cat > x.c << EOF
+extern int dup2();
+main()
+{
+ exit(dup2(1, 2) == -1);
+}
+EOF
+
+if ${CC} x.c > /dev/null 2>&1 && ./a.out ; then
+ echo '#define HAVE_DUP2'
+fi
+rm -f a.out x.c x.o
+
+cat > x.c << EOF
+extern int getpageesize();
+main()
+{
+ int n = getpagesize();
+}
+EOF
+
+if ${CC} x.c > /dev/null 2>&1
+then
+ echo '#define HAVE_GETPAGESIZE'
+fi
+rm -f a.out x.c x.o
+
+cat > x.c << EOF
+extern int getdtablesize();
+main()
+{
+ int n = getdtablesize();
+}
+EOF
+
+if ${CC} x.c > /dev/null 2>&1
+then
+ echo '#define HAVE_GETDTABLESIZE'
+fi
+rm -f a.out x.c x.o
+
+cat > x.c << EOF
+extern int setdtablesize();
+main()
+{
+ int n = setdtablesize(128);
+}
+EOF
+
+if ${CC} x.c > /dev/null 2>&1
+then
+ echo '#define HAVE_SETDTABLESIZE'
+fi
+rm -f a.out x.c x.o
+
+exit 0
|