From: Ruud de Rooij Date: Sun, 4 Jun 2000 20:24:39 +0000 (+0000) Subject: * Added autoconf test for Miquel van Smoorenburg's liblockfile X-Git-Tag: kim-before-sasl~5 X-Git-Url: http://git.marmaro.de/?p=mmh;a=commitdiff_plain;h=3a162432aa58eff6e48f99afaf746408905b008c * Added autoconf test for Miquel van Smoorenburg's liblockfile library, as found on Debian systems. * Added liblockfile support to sbr/lock_file.c. --- diff --git a/ChangeLog b/ChangeLog index 80dc52d..d13b3b2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Sun Jun 4 21:35:40 CEST 2000 Ruud de Rooij + + * Added autoconf test for Miquel van Smoorenburg's liblockfile + library, as found on Debian systems. + + * Added liblockfile support to sbr/lock_file.c. + Wed May 31 7:19:30 2000 Shantonu Sen * Fixed up dtimep.lex a bit. Added back memory options for AIX to diff --git a/config.h.in b/config.h.in index 2690592..4f3b78d 100644 --- a/config.h.in +++ b/config.h.in @@ -453,6 +453,9 @@ /* Define if you have the header file. */ #undef HAVE_UNISTD_H +/* Define if you have the lockfile library (-llockfile). */ +#undef HAVE_LIBLOCKFILE + /* Define if you have the m library (-lm). */ #undef HAVE_LIBM diff --git a/configure b/configure index eeb5adc..3f98efd 100755 --- a/configure +++ b/configure @@ -1082,7 +1082,7 @@ else 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; @@ -1263,7 +1263,7 @@ if test -n "$RANLIB"; then 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 @@ -3458,14 +3458,93 @@ fi 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 +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 <&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 <&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 <&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 @@ -3506,7 +3585,7 @@ if eval "test \"`echo '$ac_cv_func_'dbm_open`\" = yes"; then 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 @@ -3514,7 +3593,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lndbm $LIBS" cat > conftest.$ac_ext <&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 @@ -3551,7 +3630,7 @@ EOF 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 @@ -3559,7 +3638,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldbm $LIBS" cat > conftest.$ac_ext <&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 @@ -3606,17 +3685,17 @@ for ac_hdr in db1/ndbm.h 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 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* @@ -3649,12 +3728,12 @@ if test x"$with_hesiod" != x -a x"$with_hesiod" != x"no"; then 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 <&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 @@ -3695,7 +3774,7 @@ if eval "test \"`echo '$ac_cv_func_'res_send`\" = yes"; then 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 @@ -3703,7 +3782,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lresolv $LIBS" cat > conftest.$ac_ext <&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 @@ -3744,7 +3823,7 @@ fi 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 @@ -3752,7 +3831,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lhesiod $HESIOD_LIBS $LIBS" cat > conftest.$ac_ext <&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 @@ -3797,7 +3876,7 @@ if test x"$with_krb4" != x -a x"$with_krb4" != x"no"; then 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 @@ -3805,7 +3884,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lkrb4 $KRB4_LIBS -ldes425 -lkrb5 -lcrypto -lcom_err $LIBS" cat > conftest.$ac_ext <&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 @@ -3835,7 +3914,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then 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 @@ -3843,7 +3922,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lkrb $KRB4_LIBS -ldes $LIBS" cat > conftest.$ac_ext <&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 @@ -3884,12 +3963,12 @@ nmh_save_LIBS="$LIBS" 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 < #if HAVE_TERMIOS_H @@ -3902,7 +3981,7 @@ int main() { 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 @@ -3918,19 +3997,19 @@ echo "$ac_t""$nmh_cv_decl_ospeed_include_defines" 1>&6 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 <&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 @@ -3965,12 +4044,12 @@ fi 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 < #include @@ -3987,7 +4066,7 @@ int main() { 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 @@ -4006,12 +4085,12 @@ EOF 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 < #if STDC_HEADERS @@ -4039,12 +4118,12 @@ EOF 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 < #if STDC_HEADERS @@ -4072,12 +4151,12 @@ EOF 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 @@ -4106,12 +4185,12 @@ 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 < #if STDC_HEADERS @@ -4139,12 +4218,12 @@ EOF 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 < #if STDC_HEADERS @@ -4173,12 +4252,12 @@ fi 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 < #include @@ -4186,7 +4265,7 @@ int main() { 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 @@ -4207,12 +4286,12 @@ EOF 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 < #include @@ -4220,7 +4299,7 @@ int main() { 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 @@ -4242,12 +4321,12 @@ fi 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 < @@ -4263,7 +4342,7 @@ int main() { 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 @@ -4284,7 +4363,7 @@ EOF 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 @@ -4322,7 +4401,7 @@ fi 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 diff --git a/configure.in b/configure.in index 490fa0e..7f4bd12 100644 --- a/configure.in +++ b/configure.in @@ -470,6 +470,8 @@ for lib in $termcap_curses_order; do done AC_SUBST(TERMLIB)dnl +dnl Check for liblockfile (as found on Debian systems) +AC_CHECK_HEADER(lockfile.h, AC_CHECK_LIB(lockfile, maillock) ) dnl -------------- dnl CHECK FOR NDBM diff --git a/sbr/dtimep.c b/sbr/dtimep.c index 2ddeae6..fa64ccb 100644 --- a/sbr/dtimep.c +++ b/sbr/dtimep.c @@ -1095,7 +1095,7 @@ YY_MALLOC_DECL YY_DECL { register yy_state_type yy_current_state; - register char *yy_cp = NULL, *yy_bp = NULL; + register char *yy_cp, *yy_bp; register int yy_act; #line 197 "dtimep.lex" diff --git a/sbr/lock_file.c b/sbr/lock_file.c index a99c681..ec88737 100644 --- a/sbr/lock_file.c +++ b/sbr/lock_file.c @@ -5,6 +5,14 @@ * $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 Sun, 28 Mar 1999 15:34:03 +0200 + */ + #include #include @@ -40,6 +48,10 @@ #include +#if defined(HAVE_LIBLOCKFILE) +#include +#endif + extern int errno; #ifdef LOCKDIR @@ -56,7 +68,9 @@ char *lockdir = LOCKDIR; /* struct for getting name of lock file to create */ struct lockinfo { char curlock[BUFSIZ]; +#if !defined(HAVE_LIBLOCKFILE) char tmplock[BUFSIZ]; +#endif }; /* @@ -65,11 +79,13 @@ struct lockinfo { */ #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 { @@ -156,9 +172,13 @@ lkclose (int fd, char *file) #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)); } @@ -231,9 +251,13 @@ lkfclose (FILE *fp, char *file) #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)); } @@ -336,6 +360,7 @@ lkopen_dot (char *file, int access, mode_t mode) */ lockname (file, &lkinfo, 1); +#if !defined(HAVE_LIBLOCKFILE) for (i = 0;;) { /* attempt to create lock file */ if (lockit (&lkinfo) == 0) { @@ -363,8 +388,19 @@ lkopen_dot (char *file, int access, mode_t mode) } } } +#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. @@ -404,6 +440,7 @@ lockit (struct lockinfo *li) return (fd == -1 ? -1 : 0); } +#endif /* HAVE_LIBLOCKFILE */ /* * Get name of lock file, and temporary lock file @@ -453,6 +490,7 @@ lockname (char *file, struct lockinfo *li, int isnewlock) 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() @@ -476,6 +514,7 @@ lockname (char *file, struct lockinfo *li, int isnewlock) unlink (li->tmplock); /* remove any stray */ } +#endif } @@ -565,8 +604,12 @@ alrmser (int sig) /* 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 */ diff --git a/stamp-h.in b/stamp-h.in index 9d2c7d5..82f8952 100644 --- a/stamp-h.in +++ b/stamp-h.in @@ -1 +1 @@ -Wed May 31 01:52:24 MEST 2000 +Sun Jun 4 21:45:41 CEST 2000