From 5cbe3de330c73d872a58699bf49ae42125c67b11 Mon Sep 17 00:00:00 2001 From: reinelt <> Date: Fri, 27 Apr 2001 05:04:57 +0000 Subject: [lcd4linux @ 2001-04-27 05:04:57 by reinelt] replaced OPEN_MAX with sysconf() replaced mktemp() with mkstemp() unlock serial port if open() fails --- BeckmannEgle.c | 11 ++- Crystalfontz.c | 11 ++- MatrixOrbital.c | 11 ++- PalmPilot.c | 11 ++- SIN.c | 11 ++- configure | 207 +++++++++++++++++++++++++++----------------------------- lcd4linux.c | 18 +++-- lock.c | 20 ++++-- 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; diff --git a/SIN.c b/SIN.c index 85ba29a..51861a7 100644 --- a/SIN.c +++ b/SIN.c @@ -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; diff --git a/configure b/configure index 769afc7..499aad8 100755 --- a/configure +++ b/configure @@ -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 <&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 <&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 <&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 <&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 <&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 <&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 <&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 <&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 < #include @@ -2302,7 +2298,7 @@ else #include 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 @@ -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 @@ -2358,7 +2354,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #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 < #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 <&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 <&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 < #include @@ -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 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 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 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 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 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 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 <&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 <&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 < #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 < #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 < #include @@ -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 < #include @@ -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 @@ -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 < Autoconf TIOCGETP @@ -3111,7 +3107,7 @@ rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then cat > conftest.$ac_ext < 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 <&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 < #include @@ -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 <&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 #include #include -#include #include #include @@ -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; i2; 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)); diff --git a/lock.c b/lock.c index 2e02f35..c39f4ca 100644 --- a/lock.c +++ b/lock.c @@ -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) { diff --git a/pixmap.c b/pixmap.c index dca7f52..e7c13f3 100644 --- a/pixmap.c +++ b/pixmap.c @@ -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 -- cgit v1.2.3