diff options
author | reinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f> | 2001-04-27 05:04:57 +0000 |
---|---|---|
committer | reinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f> | 2001-04-27 05:04:57 +0000 |
commit | 850d421bcdf6f502f9e8e0b8be3ba4c75f31a82c (patch) | |
tree | 28dd45bfdc2b53e3d1be653408d485419a49a410 | |
parent | 7bd45509770b7daf6c7e083b9e584dccf0aacb7f (diff) | |
download | lcd4linux-850d421bcdf6f502f9e8e0b8be3ba4c75f31a82c.tar.gz |
[lcd4linux @ 2001-04-27 05:04:57 by reinelt]
replaced OPEN_MAX with sysconf()
replaced mktemp() with mkstemp()
unlock serial port if open() fails
git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@132 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
-rw-r--r-- | BeckmannEgle.c | 11 | ||||
-rw-r--r-- | Crystalfontz.c | 11 | ||||
-rw-r--r-- | MatrixOrbital.c | 11 | ||||
-rw-r--r-- | PalmPilot.c | 11 | ||||
-rw-r--r-- | SIN.c | 11 | ||||
-rwxr-xr-x | configure | 207 | ||||
-rw-r--r-- | lcd4linux.c | 18 | ||||
-rw-r--r-- | lock.c | 20 | ||||
-rw-r--r-- | pixmap.c | 10 |
9 files changed, 185 insertions, 125 deletions
diff --git a/BeckmannEgle.c b/BeckmannEgle.c index bc6055e..51bf98e 100644 --- a/BeckmannEgle.c +++ b/BeckmannEgle.c @@ -1,4 +1,4 @@ -/* $Id: BeckmannEgle.c,v 1.5 2001/02/13 09:00:13 reinelt Exp $ +/* $Id: BeckmannEgle.c,v 1.6 2001/04/27 05:04:57 reinelt Exp $ * * driver for Beckmann+Egle mini terminals * @@ -20,6 +20,12 @@ * * * $Log: BeckmannEgle.c,v $ + * Revision 1.6 2001/04/27 05:04:57 reinelt + * + * replaced OPEN_MAX with sysconf() + * replaced mktemp() with mkstemp() + * unlock serial port if open() fails + * * Revision 1.5 2001/02/13 09:00:13 reinelt * * prepared framework for GPO's (general purpose outputs) @@ -137,10 +143,12 @@ static int BE_open (void) fd = open(Port, O_RDWR | O_NOCTTY | O_NDELAY); if (fd==-1) { error ("BeckmannEgle: open(%s) failed: %s", Port, strerror(errno)); + unlock_port(Port); return -1; } if (tcgetattr(fd, &portset)==-1) { error ("BeckmannEgle: tcgetattr(%s) failed: %s", Port, strerror(errno)); + unlock_port(Port); return -1; } cfmakeraw(&portset); // 8N1 @@ -148,6 +156,7 @@ static int BE_open (void) cfsetospeed(&portset, B9600); // 9600 baud if (tcsetattr(fd, TCSANOW, &portset)==-1) { error ("BeckmannEgle: tcsetattr(%s) failed: %s", Port, strerror(errno)); + unlock_port(Port); return -1; } return fd; diff --git a/Crystalfontz.c b/Crystalfontz.c index c88f55d..599ff0a 100644 --- a/Crystalfontz.c +++ b/Crystalfontz.c @@ -1,4 +1,4 @@ -/* $Id: Crystalfontz.c,v 1.6 2001/02/13 09:00:13 reinelt Exp $ +/* $Id: Crystalfontz.c,v 1.7 2001/04/27 05:04:57 reinelt Exp $ * * driver for display modules from Crystalfontz * @@ -19,6 +19,12 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Log: Crystalfontz.c,v $ + * Revision 1.7 2001/04/27 05:04:57 reinelt + * + * replaced OPEN_MAX with sysconf() + * replaced mktemp() with mkstemp() + * unlock serial port if open() fails + * * Revision 1.6 2001/02/13 09:00:13 reinelt * * prepared framework for GPO's (general purpose outputs) @@ -93,16 +99,19 @@ struct termios portset; fd=open(Port,O_RDWR|O_NOCTTY|O_NDELAY); if (fd==-1) { error ("Crystalfontz: open(%s) failed: %s", Port, strerror(errno)); + unlock_port(Port); return -1; } if (tcgetattr(fd,&portset)==-1) { error ("Crystalfontz: tcgetattr(%s) failed: %s", Port, strerror(errno)); + unlock_port(Port); return -1; } cfmakeraw(&portset); cfsetospeed(&portset,Speed); if (tcsetattr(fd, TCSANOW, &portset)==-1) { error ("Crystalfontz: tcsetattr(%s) failed: %s", Port, strerror(errno)); + unlock_port(Port); return -1; } return fd; diff --git a/MatrixOrbital.c b/MatrixOrbital.c index b2ae3e7..6c35632 100644 --- a/MatrixOrbital.c +++ b/MatrixOrbital.c @@ -1,4 +1,4 @@ -/* $Id: MatrixOrbital.c,v 1.21 2001/02/14 07:40:16 reinelt Exp $ +/* $Id: MatrixOrbital.c,v 1.22 2001/04/27 05:04:57 reinelt Exp $ * * driver for Matrix Orbital serial display modules * @@ -20,6 +20,12 @@ * * * $Log: MatrixOrbital.c,v $ + * Revision 1.22 2001/04/27 05:04:57 reinelt + * + * replaced OPEN_MAX with sysconf() + * replaced mktemp() with mkstemp() + * unlock serial port if open() fails + * * Revision 1.21 2001/02/14 07:40:16 reinelt * * first (incomplete) GPO implementation @@ -184,16 +190,19 @@ static int MO_open (void) fd = open(Port, O_RDWR | O_NOCTTY | O_NDELAY); if (fd==-1) { error ("MatrixOrbital: open(%s) failed: %s", Port, strerror(errno)); + unlock_port(Port); return -1; } if (tcgetattr(fd, &portset)==-1) { error ("MatrixOrbital: tcgetattr(%s) failed: %s", Port, strerror(errno)); + unlock_port(Port); return -1; } cfmakeraw(&portset); cfsetospeed(&portset, Speed); if (tcsetattr(fd, TCSANOW, &portset)==-1) { error ("MatrixOrbital: tcsetattr(%s) failed: %s", Port, strerror(errno)); + unlock_port(Port); return -1; } return fd; diff --git a/PalmPilot.c b/PalmPilot.c index 139d99c..66eeb0c 100644 --- a/PalmPilot.c +++ b/PalmPilot.c @@ -1,4 +1,4 @@ -/* $Id: PalmPilot.c,v 1.5 2001/03/16 16:40:17 ltoetsch Exp $ +/* $Id: PalmPilot.c,v 1.6 2001/04/27 05:04:57 reinelt Exp $ * * driver for 3Com Palm Pilot * @@ -20,6 +20,12 @@ * * * $Log: PalmPilot.c,v $ + * Revision 1.6 2001/04/27 05:04:57 reinelt + * + * replaced OPEN_MAX with sysconf() + * replaced mktemp() with mkstemp() + * unlock serial port if open() fails + * * Revision 1.5 2001/03/16 16:40:17 ltoetsch * implemented time bar * @@ -98,16 +104,19 @@ static int Palm_open (void) fd = open(Port, O_RDWR | O_NOCTTY | O_NDELAY); if (fd==-1) { error ("PalmPilot: open(%s) failed: %s", Port, strerror(errno)); + unlock_port(Port); return -1; } if (tcgetattr(fd, &portset)==-1) { error ("PalmPilot: tcgetattr(%s) failed: %s", Port, strerror(errno)); + unlock_port(Port); return -1; } cfmakeraw(&portset); cfsetospeed(&portset, Speed); if (tcsetattr(fd, TCSANOW, &portset)==-1) { error ("PalmPilot: tcsetattr(%s) failed: %s", Port, strerror(errno)); + unlock_port(Port); return -1; } return fd; @@ -1,4 +1,4 @@ -/* $Id: SIN.c,v 1.6 2001/02/13 09:00:13 reinelt Exp $ +/* $Id: SIN.c,v 1.7 2001/04/27 05:04:57 reinelt Exp $ * * driver for SIN router displays * @@ -20,6 +20,12 @@ * * * $Log: SIN.c,v $ + * Revision 1.7 2001/04/27 05:04:57 reinelt + * + * replaced OPEN_MAX with sysconf() + * replaced mktemp() with mkstemp() + * unlock serial port if open() fails + * * Revision 1.6 2001/02/13 09:00:13 reinelt * * prepared framework for GPO's (general purpose outputs) @@ -96,16 +102,19 @@ static int SIN_open (void) fd = open(Port, O_RDWR | O_NOCTTY | O_NDELAY); if (fd==-1) { error ("SIN: open(%s) failed: %s", Port, strerror(errno)); + unlock_port(Port); return -1; } if (tcgetattr(fd, &portset)==-1) { error ("SIN: tcgetattr(%s) failed: %s", Port, strerror(errno)); + unlock_port(Port); return -1; } cfmakeraw(&portset); cfsetospeed(&portset, B9600); if (tcsetattr(fd, TCSANOW, &portset)==-1) { error ("SIN: tcsetattr(%s) failed: %s", Port, strerror(errno)); + unlock_port(Port); return -1; } return fd; @@ -1,7 +1,7 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.14 +# Generated automatically using autoconf version 2.13 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. # # This configure script is free software; the Free Software Foundation @@ -344,7 +344,7 @@ EOF verbose=yes ;; -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.14" + echo "configure generated by autoconf version 2.13" exit 0 ;; -with-* | --with-*) @@ -1680,7 +1680,6 @@ else /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char gethostbyname(); -char (*f)(); int main() { @@ -1690,12 +1689,12 @@ int main() { #if defined (__stub_gethostbyname) || defined (__stub___gethostbyname) choke me #else -f = gethostbyname; +gethostbyname(); #endif ; return 0; } EOF -if { (eval echo configure:1699: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1698: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_gethostbyname=yes" else @@ -1716,7 +1715,7 @@ fi if test $ac_cv_func_gethostbyname = no; then echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 -echo "configure:1720: checking for gethostbyname in -lnsl" >&5 +echo "configure:1719: checking for gethostbyname in -lnsl" >&5 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1724,7 +1723,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <<EOF -#line 1728 "configure" +#line 1727 "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 @@ -1735,7 +1734,7 @@ int main() { gethostbyname() ; return 0; } EOF -if { (eval echo configure:1739: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1738: \"$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 @@ -1765,12 +1764,12 @@ fi # -lsocket must be given before -lnsl if both are needed. # We assume that if connect needs -lnsl, so does gethostbyname. echo $ac_n "checking for connect""... $ac_c" 1>&6 -echo "configure:1769: checking for connect" >&5 +echo "configure:1768: checking for connect" >&5 if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1774 "configure" +#line 1773 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char connect(); below. */ @@ -1779,7 +1778,6 @@ else /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char connect(); -char (*f)(); int main() { @@ -1789,12 +1787,12 @@ int main() { #if defined (__stub_connect) || defined (__stub___connect) choke me #else -f = connect; +connect(); #endif ; return 0; } EOF -if { (eval echo configure:1798: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1796: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_connect=yes" else @@ -1815,7 +1813,7 @@ fi if test $ac_cv_func_connect = no; then echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6 -echo "configure:1819: checking for connect in -lsocket" >&5 +echo "configure:1817: checking for connect in -lsocket" >&5 ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1823,7 +1821,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsocket $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <<EOF -#line 1827 "configure" +#line 1825 "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 @@ -1834,7 +1832,7 @@ int main() { connect() ; return 0; } EOF -if { (eval echo configure:1838: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1836: \"$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 @@ -1858,12 +1856,12 @@ fi # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX. echo $ac_n "checking for remove""... $ac_c" 1>&6 -echo "configure:1862: checking for remove" >&5 +echo "configure:1860: checking for remove" >&5 if eval "test \"`echo '$''{'ac_cv_func_remove'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1867 "configure" +#line 1865 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char remove(); below. */ @@ -1872,7 +1870,6 @@ else /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char remove(); -char (*f)(); int main() { @@ -1882,12 +1879,12 @@ int main() { #if defined (__stub_remove) || defined (__stub___remove) choke me #else -f = remove; +remove(); #endif ; return 0; } EOF -if { (eval echo configure:1891: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1888: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_remove=yes" else @@ -1908,7 +1905,7 @@ fi if test $ac_cv_func_remove = no; then echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6 -echo "configure:1912: checking for remove in -lposix" >&5 +echo "configure:1909: checking for remove in -lposix" >&5 ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1916,7 +1913,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lposix $LIBS" cat > conftest.$ac_ext <<EOF -#line 1920 "configure" +#line 1917 "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 @@ -1927,7 +1924,7 @@ int main() { remove() ; return 0; } EOF -if { (eval echo configure:1931: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1928: \"$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 @@ -1951,12 +1948,12 @@ fi # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. echo $ac_n "checking for shmat""... $ac_c" 1>&6 -echo "configure:1955: checking for shmat" >&5 +echo "configure:1952: checking for shmat" >&5 if eval "test \"`echo '$''{'ac_cv_func_shmat'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1960 "configure" +#line 1957 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char shmat(); below. */ @@ -1965,7 +1962,6 @@ else /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char shmat(); -char (*f)(); int main() { @@ -1975,12 +1971,12 @@ int main() { #if defined (__stub_shmat) || defined (__stub___shmat) choke me #else -f = shmat; +shmat(); #endif ; return 0; } EOF -if { (eval echo configure:1984: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1980: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_shmat=yes" else @@ -2001,7 +1997,7 @@ fi if test $ac_cv_func_shmat = no; then echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6 -echo "configure:2005: checking for shmat in -lipc" >&5 +echo "configure:2001: checking for shmat in -lipc" >&5 ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2009,7 +2005,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lipc $LIBS" cat > conftest.$ac_ext <<EOF -#line 2013 "configure" +#line 2009 "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 @@ -2020,7 +2016,7 @@ int main() { shmat() ; return 0; } EOF -if { (eval echo configure:2024: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2020: \"$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 @@ -2053,7 +2049,7 @@ fi # libraries we check for below, so use a different variable. # --interran@uluru.Stanford.EDU, kb@cs.umb.edu. echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6 -echo "configure:2057: checking for IceConnectionNumber in -lICE" >&5 +echo "configure:2053: checking for IceConnectionNumber in -lICE" >&5 ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2061,7 +2057,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lICE $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <<EOF -#line 2065 "configure" +#line 2061 "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 @@ -2072,7 +2068,7 @@ int main() { IceConnectionNumber() ; return 0; } EOF -if { (eval echo configure:2076: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2072: \"$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 @@ -2098,7 +2094,7 @@ fi echo $ac_n "checking which drivers to compile""... $ac_c" 1>&6 -echo "configure:2102: checking which drivers to compile" >&5 +echo "configure:2098: checking which drivers to compile" >&5 # Check whether --with-drivers or --without-drivers was given. if test "${with_drivers+set}" = set; then withval="$with_drivers" @@ -2289,12 +2285,12 @@ fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:2293: checking for ANSI C header files" >&5 +echo "configure:2289: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2298 "configure" +#line 2294 "configure" #include "confdefs.h" #include <stdlib.h> #include <stdarg.h> @@ -2302,7 +2298,7 @@ else #include <float.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2306: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2302: \"$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* @@ -2319,7 +2315,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 2323 "configure" +#line 2319 "configure" #include "confdefs.h" #include <string.h> EOF @@ -2337,7 +2333,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 2341 "configure" +#line 2337 "configure" #include "confdefs.h" #include <stdlib.h> EOF @@ -2358,7 +2354,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext <<EOF -#line 2362 "configure" +#line 2358 "configure" #include "confdefs.h" #include <ctype.h> #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -2369,7 +2365,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:2373: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2369: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -2397,12 +2393,12 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 -echo "configure:2401: checking for $ac_hdr that defines DIR" >&5 +echo "configure:2397: checking for $ac_hdr that defines DIR" >&5 if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2406 "configure" +#line 2402 "configure" #include "confdefs.h" #include <sys/types.h> #include <$ac_hdr> @@ -2410,7 +2406,7 @@ int main() { DIR *dirp = 0; ; return 0; } EOF -if { (eval echo configure:2414: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2410: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval "ac_cv_header_dirent_$ac_safe=yes" else @@ -2435,7 +2431,7 @@ done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 -echo "configure:2439: checking for opendir in -ldir" >&5 +echo "configure:2435: checking for opendir in -ldir" >&5 ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2443,7 +2439,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldir $LIBS" cat > conftest.$ac_ext <<EOF -#line 2447 "configure" +#line 2443 "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 @@ -2454,7 +2450,7 @@ int main() { opendir() ; return 0; } EOF -if { (eval echo configure:2458: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2454: \"$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 @@ -2476,7 +2472,7 @@ fi else echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 -echo "configure:2480: checking for opendir in -lx" >&5 +echo "configure:2476: checking for opendir in -lx" >&5 ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2484,7 +2480,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lx $LIBS" cat > conftest.$ac_ext <<EOF -#line 2488 "configure" +#line 2484 "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 @@ -2495,7 +2491,7 @@ int main() { opendir() ; return 0; } EOF -if { (eval echo configure:2499: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2495: \"$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 @@ -2518,12 +2514,12 @@ fi fi echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6 -echo "configure:2522: checking for sys/wait.h that is POSIX.1 compatible" >&5 +echo "configure:2518: checking for sys/wait.h that is POSIX.1 compatible" >&5 if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2527 "configure" +#line 2523 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/wait.h> @@ -2539,7 +2535,7 @@ wait (&s); s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } EOF -if { (eval echo configure:2543: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2539: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_sys_wait_h=yes else @@ -2563,17 +2559,17 @@ for ac_hdr in fcntl.h limits.h strings.h sys/ioctl.h sys/time.h syslog.h unistd. do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2567: checking for $ac_hdr" >&5 +echo "configure:2563: 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 2572 "configure" +#line 2568 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2577: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2573: \"$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* @@ -2603,17 +2599,17 @@ for ac_hdr in sys/io.h asm/io.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2607: checking for $ac_hdr" >&5 +echo "configure:2603: 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 2612 "configure" +#line 2608 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2617: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2613: \"$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* @@ -2643,17 +2639,17 @@ for ac_hdr in linux/parport.h linux/ppdev.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2647: checking for $ac_hdr" >&5 +echo "configure:2643: 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 2652 "configure" +#line 2648 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2657: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2653: \"$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* @@ -2683,17 +2679,17 @@ for ac_hdr in gd/gd.h gd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2687: checking for $ac_hdr" >&5 +echo "configure:2683: 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 2692 "configure" +#line 2688 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2697: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2693: \"$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* @@ -2723,17 +2719,17 @@ for ac_hdr in net/if_ppp.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2727: checking for $ac_hdr" >&5 +echo "configure:2723: 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 2732 "configure" +#line 2728 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2737: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2733: \"$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* @@ -2763,17 +2759,17 @@ for ac_hdr in asm/msr.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2767: checking for $ac_hdr" >&5 +echo "configure:2763: 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 2772 "configure" +#line 2768 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2777: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2773: \"$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* @@ -2801,12 +2797,12 @@ done echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:2805: checking for working const" >&5 +echo "configure:2801: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2810 "configure" +#line 2806 "configure" #include "confdefs.h" int main() { @@ -2855,7 +2851,7 @@ ccp = (char const *const *) p; ; return 0; } EOF -if { (eval echo configure:2859: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2855: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -2876,21 +2872,21 @@ EOF fi echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:2880: checking for inline" >&5 +echo "configure:2876: checking for inline" >&5 if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat > conftest.$ac_ext <<EOF -#line 2887 "configure" +#line 2883 "configure" #include "confdefs.h" int main() { } $ac_kw foo() { ; return 0; } EOF -if { (eval echo configure:2894: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2890: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_inline=$ac_kw; break else @@ -2916,12 +2912,12 @@ EOF esac echo $ac_n "checking for pid_t""... $ac_c" 1>&6 -echo "configure:2920: checking for pid_t" >&5 +echo "configure:2916: 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 2925 "configure" +#line 2921 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -2949,12 +2945,12 @@ EOF fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:2953: checking for size_t" >&5 +echo "configure:2949: 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 2958 "configure" +#line 2954 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -2982,12 +2978,12 @@ EOF fi echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:2986: checking whether time.h and sys/time.h may both be included" >&5 +echo "configure:2982: checking whether time.h and sys/time.h may both be included" >&5 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2991 "configure" +#line 2987 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/time.h> @@ -2996,7 +2992,7 @@ int main() { struct tm *tp; ; return 0; } EOF -if { (eval echo configure:3000: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2996: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else @@ -3017,12 +3013,12 @@ EOF fi echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6 -echo "configure:3021: checking whether struct tm is in sys/time.h or time.h" >&5 +echo "configure:3017: checking whether struct tm is in sys/time.h or time.h" >&5 if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3026 "configure" +#line 3022 "configure" #include "confdefs.h" #include <sys/types.h> #include <time.h> @@ -3030,7 +3026,7 @@ int main() { struct tm *tp; tp->tm_sec; ; return 0; } EOF -if { (eval echo configure:3034: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3030: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_tm=time.h else @@ -3051,12 +3047,12 @@ EOF fi echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6 -echo "configure:3055: checking for uid_t in sys/types.h" >&5 +echo "configure:3051: 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 3060 "configure" +#line 3056 "configure" #include "confdefs.h" #include <sys/types.h> EOF @@ -3087,13 +3083,13 @@ fi if test $ac_cv_prog_gcc = yes; then echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6 -echo "configure:3091: checking whether ${CC-cc} needs -traditional" >&5 +echo "configure:3087: checking whether ${CC-cc} needs -traditional" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_pattern="Autoconf.*'x'" cat > conftest.$ac_ext <<EOF -#line 3097 "configure" +#line 3093 "configure" #include "confdefs.h" #include <sgtty.h> Autoconf TIOCGETP @@ -3111,7 +3107,7 @@ rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then cat > conftest.$ac_ext <<EOF -#line 3115 "configure" +#line 3111 "configure" #include "confdefs.h" #include <termio.h> Autoconf TCGETA @@ -3133,7 +3129,7 @@ echo "$ac_t""$ac_cv_prog_gcc_traditional" 1>&6 fi echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6 -echo "configure:3137: checking for 8-bit clean memcmp" >&5 +echo "configure:3133: checking for 8-bit clean memcmp" >&5 if eval "test \"`echo '$''{'ac_cv_func_memcmp_clean'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3141,7 +3137,7 @@ else ac_cv_func_memcmp_clean=no else cat > conftest.$ac_ext <<EOF -#line 3145 "configure" +#line 3141 "configure" #include "confdefs.h" main() @@ -3151,7 +3147,7 @@ main() } EOF -if { (eval echo configure:3155: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3151: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_memcmp_clean=yes else @@ -3169,12 +3165,12 @@ echo "$ac_t""$ac_cv_func_memcmp_clean" 1>&6 test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.${ac_objext}" echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:3173: checking return type of signal handlers" >&5 +echo "configure:3169: 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 3178 "configure" +#line 3174 "configure" #include "confdefs.h" #include <sys/types.h> #include <signal.h> @@ -3191,7 +3187,7 @@ int main() { int i; ; return 0; } EOF -if { (eval echo configure:3195: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3191: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -3212,12 +3208,12 @@ EOF for ac_func in gettimeofday putenv select socket strdup strerror strstr strtol uname do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3216: checking for $ac_func" >&5 +echo "configure:3212: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3221 "configure" +#line 3217 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3226,7 +3222,6 @@ else /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func(); -char (*f)(); int main() { @@ -3236,12 +3231,12 @@ int main() { #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -f = $ac_func; +$ac_func(); #endif ; return 0; } EOF -if { (eval echo configure:3245: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3240: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3356,7 +3351,7 @@ do echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.14" + echo "$CONFIG_STATUS generated by autoconf version 2.13" exit 0 ;; -help | --help | --hel | --he | --h) echo "\$ac_cs_usage"; exit 0 ;; diff --git a/lcd4linux.c b/lcd4linux.c index 7e991f4..e763a5d 100644 --- a/lcd4linux.c +++ b/lcd4linux.c @@ -1,4 +1,4 @@ -/* $Id: lcd4linux.c,v 1.32 2001/03/13 07:41:22 reinelt Exp $ +/* $Id: lcd4linux.c,v 1.33 2001/04/27 05:04:57 reinelt Exp $ * * LCD4Linux * @@ -20,6 +20,12 @@ * * * $Log: lcd4linux.c,v $ + * Revision 1.33 2001/04/27 05:04:57 reinelt + * + * replaced OPEN_MAX with sysconf() + * replaced mktemp() with mkstemp() + * unlock serial port if open() fails + * * Revision 1.32 2001/03/13 07:41:22 reinelt * * added NEWS file @@ -181,7 +187,6 @@ #include <string.h> #include <unistd.h> #include <fcntl.h> -#include <limits.h> #include <errno.h> #include <signal.h> @@ -431,12 +436,13 @@ int main (int argc, char *argv[]) lcd_quit(); if (got_signal==SIGHUP) { - int i, j; + long fd; debug ("restarting..."); // close all files on exec - for (i=3; i<OPEN_MAX; i++) { - if ((j=fcntl(i,F_GETFD,0))!=-1) - fcntl(i,F_SETFD,j|FD_CLOEXEC); + for (fd=sysconf(_SC_OPEN_MAX); fd>2; fd--) { + int flag; + if ((flag=fcntl(fd,F_GETFD,0))!=-1) + fcntl(fd,F_SETFD,flag|FD_CLOEXEC); } execv (my_argv[0], my_argv); error ("execv() failed: %s", strerror(errno)); @@ -1,4 +1,4 @@ -/* $Id: lock.c,v 1.2 2000/08/10 09:44:09 reinelt Exp $ +/* $Id: lock.c,v 1.3 2001/04/27 05:04:57 reinelt Exp $ * * UUCP style locking * @@ -20,6 +20,12 @@ * * * $Log: lock.c,v $ + * Revision 1.3 2001/04/27 05:04:57 reinelt + * + * replaced OPEN_MAX with sysconf() + * replaced mktemp() with mkstemp() + * unlock serial port if open() fails + * * Revision 1.2 2000/08/10 09:44:09 reinelt * * new debugging scheme: error(), info(), debug() @@ -76,13 +82,15 @@ pid_t lock_port (char *port) snprintf(lockfile, sizeof(lockfile), LOCK, p); snprintf(tempfile, sizeof(tempfile), LOCK, "TMP.XXXXXX"); - if (mktemp(tempfile)==NULL) { - error ("mktemp(%s) failed.", tempfile); + if ((fd=mkstemp(tempfile))==-1) { + error ("mkstemp(%s) failed: %s", tempfile, strerror(errno)); return -1; } - if ((fd=creat(tempfile, 0664))==-1) { - error ("creat(%s) failed: %s", tempfile, strerror(errno)); + if (fchmod(fd,S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH)==-1) { + error ("fchmod(%s) failed: %s", tempfile, strerror(errno)); + close(fd); + unlink(tempfile); return -1; } @@ -95,7 +103,7 @@ pid_t lock_port (char *port) } close (fd); - + while (link(tempfile, lockfile)==-1) { if (errno!=EEXIST) { @@ -1,4 +1,4 @@ -/* $Id: pixmap.c,v 1.7 2001/03/17 11:44:10 ltoetsch Exp $ +/* $Id: pixmap.c,v 1.8 2001/04/27 05:04:57 reinelt Exp $ * * generic pixmap driver * @@ -20,8 +20,14 @@ * * * $Log: pixmap.c,v $ + * Revision 1.8 2001/04/27 05:04:57 reinelt + * + * replaced OPEN_MAX with sysconf() + * replaced mktemp() with mkstemp() + * unlock serial port if open() fails + * * Revision 1.7 2001/03/17 11:44:10 ltoetsch - * allow more then 1 BAR_T + * allow more than 1 BAR_T * * Revision 1.6 2001/03/16 16:40:17 ltoetsch * implemented time bar |