1 ?RCS: $Id: d_access.U,v 3.0 1993/08/18 12:05:42 ram Exp $
3 ?RCS: Copyright (c) 1991-1993, Raphael Manfredi
5 ?RCS: You may redistribute only under the terms of the Artistic Licence,
6 ?RCS: as specified in the README file that comes with the distribution.
7 ?RCS: You may reuse parts of this distribution only within the terms of
8 ?RCS: that same Artistic Licence; a copy of which may be found at the root
9 ?RCS: of the source tree for dist 3.0.
11 ?RCS: $Log: d_access.U,v $
12 ?RCS: Revision 3.0 1993/08/18 12:05:42 ram
13 ?RCS: Baseline for dist 3.0 netwide release.
15 ?MAKE:d_access: test +cc cat +cppflags h_fcntl h_sysfile rm Inlibc Findhdr
16 ?MAKE: -pick add $@ %<
18 ?S: This variable conditionally defines HAS_ACCESS if the access() system
19 ?S: call is available to check for access permissions using real IDs.
22 ?C: This manifest constant lets the C program know that the access()
23 ?C: system call is available to check for accessibility using real UID/GID.
24 ?C: (always present on UNIX.)
26 ?H:#$d_access HAS_ACCESS /**/
28 ?W:%<:R_OK W_OK X_OK F_OK
30 ?LINT:change h_fcntl h_sysfile
31 : access call always available on UNIX
35 : locate the flags for 'access()'
39 $cat >access.c <<'EOCP'
40 #include <sys/types.h>
54 : check sys/file.h first, no particular reason here
55 if $test `./findhdr sys/file.h` && \
56 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
58 echo "<sys/file.h> defines the *_OK access constants." >&4
59 elif $test `./findhdr fcntl.h` && \
60 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
62 echo "<fcntl.h> defines the *_OK access constants." >&4
64 elif $test `./findhdr unistd.h` && \
65 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
66 echo "<unistd.h> defines the *_OK access constants." >&4
69 echo "I can't find the four *_OK access constants--I'll use mine." >&4