int main() {
/* Ultrix mips cc rejects this. */
-typedef int charset[2]; const charset x;
+typedef int charset[2]; const charset x = {0,0};
/* SunOS 4.1.1 cc rejects this. */
char const *const *ccp;
char **p;
else
echo "$ac_t""no" 1>&6
fi
- for ac_prog in gawk mawk nawk awk
+ for ac_prog in mawk gawk nawk awk
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
done
+ac_safe=`echo "lockfile.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for lockfile.h""... $ac_c" 1>&6
+echo "configure:3464: checking for lockfile.h" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3469 "configure"
+#include "confdefs.h"
+#include <lockfile.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:3474: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ echo $ac_n "checking for maillock in -llockfile""... $ac_c" 1>&6
+echo "configure:3491: checking for maillock in -llockfile" >&5
+ac_lib_var=`echo lockfile'_'maillock | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-llockfile $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 3499 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char maillock();
+
+int main() {
+maillock()
+; return 0; }
+EOF
+if { (eval echo configure:3510: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_lib=HAVE_LIB`echo lockfile | sed -e 's/^a-zA-Z0-9_/_/g' \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+ LIBS="-llockfile $LIBS"
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
echo $ac_n "checking for dbm_open""... $ac_c" 1>&6
-echo "configure:3464: checking for dbm_open" >&5
+echo "configure:3543: checking for dbm_open" >&5
if eval "test \"`echo '$''{'ac_cv_func_dbm_open'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3469 "configure"
+#line 3548 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char dbm_open(); below. */
; return 0; }
EOF
-if { (eval echo configure:3492: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3571: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_dbm_open=yes"
else
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for dbm_open in -lndbm""... $ac_c" 1>&6
-echo "configure:3510: checking for dbm_open in -lndbm" >&5
+echo "configure:3589: checking for dbm_open in -lndbm" >&5
ac_lib_var=`echo ndbm'_'dbm_open | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lndbm $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 3518 "configure"
+#line 3597 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
dbm_open()
; return 0; }
EOF
-if { (eval echo configure:3529: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3608: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for dbm_open in -ldbm""... $ac_c" 1>&6
-echo "configure:3555: checking for dbm_open in -ldbm" >&5
+echo "configure:3634: checking for dbm_open in -ldbm" >&5
ac_lib_var=`echo dbm'_'dbm_open | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-ldbm $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 3563 "configure"
+#line 3642 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
dbm_open()
; return 0; }
EOF
-if { (eval echo configure:3574: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3653: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3610: checking for $ac_hdr" >&5
+echo "configure:3689: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3615 "configure"
+#line 3694 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3620: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3699: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
HESIOD_LIBS="-L$with_hesiod/lib"
fi
echo $ac_n "checking for res_send""... $ac_c" 1>&6
-echo "configure:3653: checking for res_send" >&5
+echo "configure:3732: checking for res_send" >&5
if eval "test \"`echo '$''{'ac_cv_func_res_send'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3658 "configure"
+#line 3737 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char res_send(); below. */
; return 0; }
EOF
-if { (eval echo configure:3681: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3760: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_res_send=yes"
else
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for res_send in -lresolv""... $ac_c" 1>&6
-echo "configure:3699: checking for res_send in -lresolv" >&5
+echo "configure:3778: checking for res_send in -lresolv" >&5
ac_lib_var=`echo resolv'_'res_send | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lresolv $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 3707 "configure"
+#line 3786 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
res_send()
; return 0; }
EOF
-if { (eval echo configure:3718: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3797: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
fi
echo $ac_n "checking for hes_resolve in -lhesiod""... $ac_c" 1>&6
-echo "configure:3748: checking for hes_resolve in -lhesiod" >&5
+echo "configure:3827: checking for hes_resolve in -lhesiod" >&5
ac_lib_var=`echo hesiod'_'hes_resolve | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lhesiod $HESIOD_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 3756 "configure"
+#line 3835 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
hes_resolve()
; return 0; }
EOF
-if { (eval echo configure:3767: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3846: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
KRB4_INCLUDES="-I/usr/include/kerberosIV"
fi
echo $ac_n "checking for krb_rd_req in -lkrb4""... $ac_c" 1>&6
-echo "configure:3801: checking for krb_rd_req in -lkrb4" >&5
+echo "configure:3880: checking for krb_rd_req in -lkrb4" >&5
ac_lib_var=`echo krb4'_'krb_rd_req | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lkrb4 $KRB4_LIBS -ldes425 -lkrb5 -lcrypto -lcom_err $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 3809 "configure"
+#line 3888 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
krb_rd_req()
; return 0; }
EOF
-if { (eval echo configure:3820: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3899: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for krb_rd_req in -lkrb""... $ac_c" 1>&6
-echo "configure:3839: checking for krb_rd_req in -lkrb" >&5
+echo "configure:3918: checking for krb_rd_req in -lkrb" >&5
ac_lib_var=`echo krb'_'krb_rd_req | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lkrb $KRB4_LIBS -ldes $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 3847 "configure"
+#line 3926 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
krb_rd_req()
; return 0; }
EOF
-if { (eval echo configure:3858: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3937: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
LIBS="$TERMLIB $LIBS"
echo $ac_n "checking if an include file defines ospeed""... $ac_c" 1>&6
-echo "configure:3888: checking if an include file defines ospeed" >&5
+echo "configure:3967: checking if an include file defines ospeed" >&5
if eval "test \"`echo '$''{'nmh_cv_decl_ospeed_include_defines'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3893 "configure"
+#line 3972 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if HAVE_TERMIOS_H
ospeed = 0;
; return 0; }
EOF
-if { (eval echo configure:3906: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3985: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
nmh_cv_decl_ospeed_include_defines=yes
else
if test $nmh_cv_decl_ospeed_include_defines = no; then
echo $ac_n "checking if you must define ospeed""... $ac_c" 1>&6
-echo "configure:3922: checking if you must define ospeed" >&5
+echo "configure:4001: checking if you must define ospeed" >&5
if eval "test \"`echo '$''{'nmh_cv_decl_ospeed_must_define'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3927 "configure"
+#line 4006 "configure"
#include "confdefs.h"
int main() {
extern short ospeed; ospeed = 0;
; return 0; }
EOF
-if { (eval echo configure:3934: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4013: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
nmh_cv_decl_ospeed_must_define=yes
else
LIBS="$nmh_save_LIBS"
echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
-echo "configure:3969: checking return type of signal handlers" >&5
+echo "configure:4048: checking return type of signal handlers" >&5
if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3974 "configure"
+#line 4053 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <signal.h>
int i;
; return 0; }
EOF
-if { (eval echo configure:3991: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4070: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_type_signal=void
else
echo $ac_n "checking for pid_t""... $ac_c" 1>&6
-echo "configure:4010: checking for pid_t" >&5
+echo "configure:4089: checking for pid_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4015 "configure"
+#line 4094 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
fi
echo $ac_n "checking for off_t""... $ac_c" 1>&6
-echo "configure:4043: checking for off_t" >&5
+echo "configure:4122: checking for off_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4048 "configure"
+#line 4127 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
fi
echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6
-echo "configure:4076: checking for uid_t in sys/types.h" >&5
+echo "configure:4155: checking for uid_t in sys/types.h" >&5
if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4081 "configure"
+#line 4160 "configure"
#include "confdefs.h"
#include <sys/types.h>
EOF
fi
echo $ac_n "checking for mode_t""... $ac_c" 1>&6
-echo "configure:4110: checking for mode_t" >&5
+echo "configure:4189: checking for mode_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_mode_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4115 "configure"
+#line 4194 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
fi
echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:4143: checking for size_t" >&5
+echo "configure:4222: checking for size_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4148 "configure"
+#line 4227 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
echo $ac_n "checking for sigset_t""... $ac_c" 1>&6
-echo "configure:4177: checking for sigset_t" >&5
+echo "configure:4256: checking for sigset_t" >&5
if eval "test \"`echo '$''{'nmh_cv_type_sigset_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4182 "configure"
+#line 4261 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <signal.h>
sigset_t tempsigset;
; return 0; }
EOF
-if { (eval echo configure:4190: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4269: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
nmh_cv_type_sigset_t=yes
else
fi
echo $ac_n "checking for st_blksize in struct stat""... $ac_c" 1>&6
-echo "configure:4211: checking for st_blksize in struct stat" >&5
+echo "configure:4290: checking for st_blksize in struct stat" >&5
if eval "test \"`echo '$''{'ac_cv_struct_st_blksize'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4216 "configure"
+#line 4295 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/stat.h>
struct stat s; s.st_blksize;
; return 0; }
EOF
-if { (eval echo configure:4224: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4303: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_struct_st_blksize=yes
else
echo $ac_n "checking for tm_gmtoff in struct tm""... $ac_c" 1>&6
-echo "configure:4246: checking for tm_gmtoff in struct tm" >&5
+echo "configure:4325: checking for tm_gmtoff in struct tm" >&5
if eval "test \"`echo '$''{'nmh_cv_struct_tm_gmtoff'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4251 "configure"
+#line 4330 "configure"
#include "confdefs.h"
#ifdef TIME_WITH_SYS_TIME
# include <sys/time.h>
struct tm temptm; temptm.tm_gmtoff = 0;
; return 0; }
EOF
-if { (eval echo configure:4267: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4346: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
nmh_cv_struct_tm_gmtoff=yes
else
fi
echo $ac_n "checking what style of signals to use""... $ac_c" 1>&6
-echo "configure:4288: checking what style of signals to use" >&5
+echo "configure:4367: checking what style of signals to use" >&5
if test $ac_cv_func_sigaction = yes -a $ac_cv_func_sigprocmask = yes; then
signals_style=POSIX_SIGNALS
cat >> confdefs.h <<\EOF
echo "$ac_t""$signals_style" 1>&6
echo $ac_n "checking where signal.h is located""... $ac_c" 1>&6
-echo "configure:4326: checking where signal.h is located" >&5
+echo "configure:4405: checking where signal.h is located" >&5
if eval "test \"`echo '$''{'nmh_cv_path_signal_h'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
* $Id$
*/
+/* Modified by Ruud de Rooij to support Miquel van Smoorenburg's liblockfile
+ *
+ * Since liblockfile locking shares most of its code with dot locking, it
+ * is enabled by defining both DOT_LOCKING and HAVE_LIBLOCKFILE.
+ *
+ * Ruud de Rooij <ruud@debian.org> Sun, 28 Mar 1999 15:34:03 +0200
+ */
+
#include <h/mh.h>
#include <h/signals.h>
#include <signal.h>
+#if defined(HAVE_LIBLOCKFILE)
+#include <lockfile.h>
+#endif
+
extern int errno;
#ifdef LOCKDIR
/* struct for getting name of lock file to create */
struct lockinfo {
char curlock[BUFSIZ];
+#if !defined(HAVE_LIBLOCKFILE)
char tmplock[BUFSIZ];
+#endif
};
/*
*/
#define NSECS 20
+#if !defined(HAVE_LIBLOCKFILE)
/*
* How old does a lock file need to be
* before we remove it.
*/
#define RSECS 180
+#endif /* HAVE_LIBLOCKFILE */
/* struct for recording and updating locks */
struct lock {
#ifdef DOT_LOCKING
lockname (file, &lkinfo, 0); /* get name of lock file */
+#if !defined(HAVE_LIBLOCKFILE)
unlink (lkinfo.curlock); /* remove lock file */
+#else
+ lockfile_remove(lkinfo.curlock);
+#endif /* HAVE_LIBLOCKFILE */
timerOFF (fd); /* turn off lock timer */
-#endif
+#endif /* DOT_LOCKING */
return (close (fd));
}
#ifdef DOT_LOCKING
lockname (file, &lkinfo, 0); /* get name of lock file */
+#if !defined(HAVE_LIBLOCKFILE)
unlink (lkinfo.curlock); /* remove lock file */
+#else
+ lockfile_remove(lkinfo.curlock);
+#endif /* HAVE_LIBLOCKFILE */
timerOFF (fileno(fp)); /* turn off lock timer */
-#endif
+#endif /* DOT_LOCKING */
return (fclose (fp));
}
*/
lockname (file, &lkinfo, 1);
+#if !defined(HAVE_LIBLOCKFILE)
for (i = 0;;) {
/* attempt to create lock file */
if (lockit (&lkinfo) == 0) {
}
}
}
+#else
+ if (lockfile_create(lkinfo.curlock, 5, 0) == L_SUCCESS) {
+ timerON(lkinfo.curlock, fd);
+ return fd;
+ }
+ else {
+ close(fd);
+ return -1;
+ }
+#endif /* HAVE_LIBLOCKFILE */
}
+#if !defined(HAVE_LIBLOCKFILE)
/*
* Routine that actually tries to create
* the lock file.
return (fd == -1 ? -1 : 0);
}
+#endif /* HAVE_LIBLOCKFILE */
/*
* Get name of lock file, and temporary lock file
snprintf (bp, sizeof(li->curlock) - bplen, "%s.lock", cp);
+#if !defined(HAVE_LIBLOCKFILE)
/*
* If this is for a new lock, create a name for
* the temporary lock file for lockit()
unlink (li->tmplock); /* remove any stray */
}
+#endif
}
/* update the ctime of all the lock files */
for (lp = l_top; lp; lp = lp->l_next) {
lockfile = lp->l_lock;
+#if !defined(HAVE_LIBLOCKFILE)
if (*lockfile && (j = creat (lockfile, 0600)) != -1)
close (j);
+#else
+ lockfile_touch(lockfile);
+#endif
}
/* restart the alarm */