fix iprofd to work with (hopefully) 2.2.19 and 2.4.1

This commit is contained in:
kai 2001-01-06 18:25:05 +00:00
parent 800ca3cc5a
commit b8dcdae47d
3 changed files with 89 additions and 212 deletions

187
iprofd/configure vendored
View File

@ -12,8 +12,6 @@ ac_help=
ac_default_prefix=/usr/local
# Any additions from configure.in:
ac_default_prefix=/usr
ac_help="$ac_help
--with-kernel=DIR Set kernel source directory [/usr/src/linux]"
ac_help="$ac_help
--with-sbin=DIR Set dir where binary is istalled. [/sbin]"
ac_help="$ac_help
@ -567,7 +565,7 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
echo "configure:571: checking for a BSD compatible install" >&5
echo "configure:569: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -622,7 +620,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:626: checking for $ac_word" >&5
echo "configure:624: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -652,7 +650,7 @@ if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:656: checking for $ac_word" >&5
echo "configure:654: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -703,7 +701,7 @@ fi
# Extract the first word of "cl", so it can be a program name with args.
set dummy cl; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:707: checking for $ac_word" >&5
echo "configure:705: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -735,7 +733,7 @@ fi
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
echo "configure:739: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
echo "configure:737: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@ -746,12 +744,12 @@ cross_compiling=$ac_cv_prog_cc_cross
cat > conftest.$ac_ext << EOF
#line 750 "configure"
#line 748 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
if { (eval echo configure:755: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:753: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
ac_cv_prog_cc_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
@ -777,12 +775,12 @@ if test $ac_cv_prog_cc_works = no; then
{ echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
echo "configure:781: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "configure:779: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
cross_compiling=$ac_cv_prog_cc_cross
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
echo "configure:786: checking whether we are using GNU C" >&5
echo "configure:784: checking whether we are using GNU C" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -791,7 +789,7 @@ else
yes;
#endif
EOF
if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:795: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:793: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
@ -810,7 +808,7 @@ ac_test_CFLAGS="${CFLAGS+set}"
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
echo "configure:814: checking whether ${CC-cc} accepts -g" >&5
echo "configure:812: checking whether ${CC-cc} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -844,7 +842,7 @@ fi
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
echo "configure:848: checking how to run the C preprocessor" >&5
echo "configure:846: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
@ -859,13 +857,13 @@ else
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
#line 863 "configure"
#line 861 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:869: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:867: \"$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
:
@ -876,13 +874,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
#line 880 "configure"
#line 878 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:886: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:884: \"$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
:
@ -893,13 +891,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -nologo -E"
cat > conftest.$ac_ext <<EOF
#line 897 "configure"
#line 895 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:903: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:901: \"$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
:
@ -924,12 +922,12 @@ fi
echo "$ac_t""$CPP" 1>&6
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
echo "configure:928: checking for ANSI C header files" >&5
echo "configure:926: 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 933 "configure"
#line 931 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
@ -937,7 +935,7 @@ else
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:941: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:939: \"$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*
@ -954,7 +952,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 958 "configure"
#line 956 "configure"
#include "confdefs.h"
#include <string.h>
EOF
@ -972,7 +970,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 976 "configure"
#line 974 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
@ -993,7 +991,7 @@ if test "$cross_compiling" = yes; then
:
else
cat > conftest.$ac_ext <<EOF
#line 997 "configure"
#line 995 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@ -1004,7 +1002,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
exit (0); }
EOF
if { (eval echo configure:1008: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
if { (eval echo configure:1006: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
:
else
@ -1031,17 +1029,17 @@ for ac_hdr in sys/ioctl.h unistd.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:1035: checking for $ac_hdr" >&5
echo "configure:1033: 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 1040 "configure"
#line 1038 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1045: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1043: \"$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*
@ -1069,135 +1067,14 @@ done
OLD_CPPFLAGS="$CPPFLAGS"
lxdir="no"
eval tst_kerneldir=$CONFIG_KERNELDIR
# Check whether --with-kernel or --without-kernel was given.
if test "${with_kernel+set}" = set; then
withval="$with_kernel"
DOTEST="y"; tst_kerneldir="${withval}"
fi
if test "$DOTEST" = "y" || test "$CONFIG_KERNELDIR" != "" ; then
echo $ac_n "checking for linux kernel source in ${tst_kerneldir}""... $ac_c" 1>&6
echo "configure:1086: checking for linux kernel source in ${tst_kerneldir}" >&5
CPPFLAGS="-nostdinc -I${tst_kerneldir}/include -I${tst_kerneldir}/drivers/isdn"
cat > conftest.$ac_ext <<EOF
#line 1089 "configure"
#include "confdefs.h"
#include <isdn_common.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1094: \"$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*
lxdir=${tst_kerneldir}
else
echo "$ac_err" >&5
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
echo "$ac_t"""no"" 1>&6
fi
rm -f conftest*
fi
if test "$lxdir" = "no" ; then
echo $ac_n "checking for linux kernel source in /usr/src/linux""... $ac_c" 1>&6
echo "configure:1110: checking for linux kernel source in /usr/src/linux" >&5
CPPFLAGS="-nostdinc -I/usr/src/linux/include -I/usr/src/linux/drivers/isdn"
cat > conftest.$ac_ext <<EOF
#line 1113 "configure"
#include "confdefs.h"
#include <isdn_common.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1118: \"$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*
lxdir=/usr/src/linux
else
echo "$ac_err" >&5
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
fi
rm -f conftest*
fi
if test "$lxdir" = "no" ; then
echo "$ac_t"""$lxdir"" 1>&6
echo $ac_n "checking for linux kernel source in /usr/local/src/linux""... $ac_c" 1>&6
echo "configure:1133: checking for linux kernel source in /usr/local/src/linux" >&5
CPPFLAGS="-nostdinc -I/usr/local/src/linux/include -I/usr/local/src/linux/drivers/isdn"
cat > conftest.$ac_ext <<EOF
#line 1136 "configure"
#include "confdefs.h"
#include <isdn_common.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1141: \"$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*
lxdir=/usr/local/src/linux
else
echo "$ac_err" >&5
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
fi
rm -f conftest*
fi
if test "$lxdir" != "no" ; then
echo "$ac_t"""yes"" 1>&6
else
lxdir=""
{ echo "configure: error: "Kernel source not found. You MUST specify a correct path to the linux source in the configuration."" 1>&2; exit 1; }
fi
CONFIG_KERNELDIR="$lxdir"
CPPFLAGS="$OLD_CPPFLAGS"
cat >> confdefs.h <<EOF
#define CONFIG_KERNELDIR "$lxdir"
EOF
ac_safe=`echo "$CONFIG_KERNELDIR/include/linux/isdn.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $CONFIG_KERNELDIR/include/linux/isdn.h""... $ac_c" 1>&6
echo "configure:1170: checking for $CONFIG_KERNELDIR/include/linux/isdn.h" >&5
if eval "test \"`echo '$''{'ac_cv_file_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
{ echo "configure: error: Cannot check for file existence when cross compiling" 1>&2; exit 1; }
else
if test -r $CONFIG_KERNELDIR/include/linux/isdn.h; then
eval "ac_cv_file_$ac_safe=yes"
else
eval "ac_cv_file_$ac_safe=no"
fi
fi
fi
if eval "test \"`echo '$ac_cv_file_'$ac_safe`\" = yes"; then
echo "$ac_t""yes" 1>&6
:
else
echo "$ac_t""no" 1>&6
{ echo "configure: error: "$CONFIG_KERNELDIR/include/linux/isdn.h missing. Kernel installed?"" 1>&2; exit 1; }
fi
echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
echo "configure:1196: checking return type of signal handlers" >&5
echo "configure:1073: 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 1201 "configure"
#line 1078 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <signal.h>
@ -1214,7 +1091,7 @@ int main() {
int i;
; return 0; }
EOF
if { (eval echo configure:1218: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:1095: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_type_signal=void
else
@ -1411,12 +1288,12 @@ s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
s%@INSTALL_DATA@%$INSTALL_DATA%g
s%@CC@%$CC%g
s%@CPP@%$CPP%g
s%@CONFIG_KERNELDIR@%$CONFIG_KERNELDIR%g
s%@INSTALL@%$INSTALL%g
s%@MANDATE@%$MANDATE%g
s%@I4LVERSION@%$I4LVERSION%g
s%@CONFIG_SBINDIR@%$CONFIG_SBINDIR%g
s%@CONFIG_MANDIR@%$CONFIG_MANDIR%g
s%@CONFIG_KERNELDIR@%$CONFIG_KERNELDIR%g
CEOF
EOF

View File

@ -19,10 +19,10 @@ AC_HEADER_STDC
AC_CHECK_HEADERS(sys/ioctl.h unistd.h)
dnl Find current kernel source
AC_FIND_KERNEL
AC_CHECK_FILE($CONFIG_KERNELDIR/include/linux/isdn.h,,
AC_MSG_ERROR("$CONFIG_KERNELDIR/include/linux/isdn.h missing. Kernel installed?")
)
dnl AC_FIND_KERNEL
dnl AC_CHECK_FILE($CONFIG_KERNELDIR/include/linux/isdn.h,,
dnl AC_MSG_ERROR("$CONFIG_KERNELDIR/include/linux/isdn.h missing. Kernel installed?")
dnl)
dnl Checks for typedefs, structures, and compiler characteristics.

View File

@ -1,4 +1,4 @@
/* $Id: iprofd.c,v 1.8 2000/03/03 12:45:53 calle Exp $
/* $Id: iprofd.c,v 1.9 2001/01/06 18:25:05 kai Exp $
* Daemon for saving ttyIx-profiles to a file.
*
@ -21,33 +21,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log: iprofd.c,v $
* Revision 1.8 2000/03/03 12:45:53 calle
* Make compile with newer versions of kernel drivers.
*
* Revision 1.7 1999/09/06 08:03:25 fritz
* Changed my mail-address.
*
* Revision 1.6 1998/07/22 19:07:13 keil
* Make it compiling with older I4L versions
*
* Revision 1.5 1998/06/26 15:20:13 fritz
* Added capability to save listener string.
*
* Revision 1.4 1998/04/28 08:34:23 paul
* Fixed compiler warnings from egcs.
*
* Revision 1.3 1998/04/24 09:19:23 paul
* Ignore empty file when starting up instead of generating error message
* about wrong signature, there is _no_ signature! iprofd writes new data
* anyway in that case.
*
* Revision 1.2 1997/02/21 13:18:27 fritz
* Reformatted, changed some error-messages.
*
* Revision 1.1 1997/02/17 00:09:12 fritz
* New CVS tree
*
*/
#define SIGNATURE "iprofd%02x"
@ -60,29 +33,46 @@
#include <unistd.h>
#include <sys/ioctl.h>
#include <signal.h>
#include <linux/isdn.h>
#include <string.h>
//#include <linux/isdn.h>
typedef unsigned char uchar;
int isdnctrl_fd;
char *modemsettings;
#ifndef ISDN_LMSNLEN
#define ISDN_LMSNLEN 0
#endif
#define IIOCSIGPRF _IO('I',14)
#define IIOCGETPRF _IO('I',15)
#define IIOCSETPRF _IO('I',16)
#define IIOCGETDVR _IO('I',22)
#ifndef ISDN_MODEM_NUMREG
#define ISDN_MODEM_NUMREG ISDN_MODEM_ANZREG
#endif
#define ISDN_MAX_CHANNELS 64
#define BUFSZ ((ISDN_MODEM_NUMREG+ISDN_MSNLEN+ISDN_LMSNLEN)*ISDN_MAX_CHANNELS)
#define ISDN_LMSNLEN_4 0
#define ISDN_LMSNLEN_5 255
#define ISDN_LMSNLEN_6 255
#define ISDN_MSNLEN_4 20
#define ISDN_MSNLEN_5 20
#define ISDN_MSNLEN_6 32
#define ISDN_MODEM_NUMREG_4 23
#define ISDN_MODEM_NUMREG_5 24
#define ISDN_MODEM_NUMREG_6 24
#define BUFSZ_4 ((ISDN_MODEM_NUMREG_4+ISDN_MSNLEN_4+ISDN_LMSNLEN_4)*ISDN_MAX_CHANNELS)
#define BUFSZ_5 ((ISDN_MODEM_NUMREG_5+ISDN_MSNLEN_5+ISDN_LMSNLEN_5)*ISDN_MAX_CHANNELS)
#define BUFSZ_6 ((ISDN_MODEM_NUMREG_6+ISDN_MSNLEN_6+ISDN_LMSNLEN_6)*ISDN_MAX_CHANNELS)
int bufsz;
int tty_dv;
void
dumpModem(int dummy)
{
int fd;
int len;
char buffer[BUFSZ];
char buffer[bufsz];
char signature[SIGLEN];
if ((len = ioctl(isdnctrl_fd, IIOCGETPRF, &buffer)) < 0) {
@ -94,7 +84,7 @@ dumpModem(int dummy)
perror(modemsettings);
exit(-1);
}
sprintf(signature, SIGNATURE, TTY_DV);
sprintf(signature, SIGNATURE, tty_dv);
write(fd, signature, sizeof(signature));
write(fd, buffer, len);
close(fd);
@ -106,10 +96,10 @@ readModem(void)
{
int len;
int fd;
char buffer[BUFSZ];
char buffer[bufsz];
char signature[SIGLEN];
sprintf(signature, SIGNATURE, TTY_DV);
sprintf(signature, SIGNATURE, tty_dv);
fd = open(modemsettings, O_RDONLY);
if (fd < 0)
return;
@ -118,18 +108,18 @@ readModem(void)
perror(modemsettings);
exit(-1);
}
if (len == 0) { /* empty file, ignore it */
close(fd);
return;
}
if (len == 0) { /* empty file, ignore it */
close(fd);
return;
}
if (strcmp(buffer, signature)) {
fprintf(stderr, "Version of iprofd (%d) does NOT match\n", TTY_DV);
fprintf(stderr, "Currently running kernel does NOT match\n");
fprintf(stderr, "signature of saved data!\n");
fprintf(stderr, "Profiles NOT restored, use AT&W0 to update data.\n");
close(fd);
return;
}
len = read(fd, buffer, BUFSZ);
len = read(fd, buffer, bufsz);
if (len < 0) {
perror(modemsettings);
exit(-1);
@ -170,15 +160,25 @@ main(int argc, char **argv)
exit(-1);
}
close(isdnctrl_fd);
data_version &= 0xff;
if (data_version != TTY_DV) {
fprintf(stderr, "Version of kernel modem-profile (%d) does NOT match\n",
data_version);
fprintf(stderr, "version of iprofd (%d)!\n", TTY_DV);
fprintf(stderr, "Make sure, you are using the correct version.\n");
fprintf(stderr, "(Try recompiling iprofd).\n");
tty_dv = data_version & 0xff;
switch (tty_dv) {
case 4:
bufsz = BUFSZ_4;
break;
case 5:
bufsz = BUFSZ_5;
break;
case 6:
bufsz = BUFSZ_6;
break;
default:
fprintf(stderr, "Version of kernel modem-profile (%d) is NOT handled\n",
tty_dv);
fprintf(stderr, "by this version of iprofd!\n");
fprintf(stderr, "(Try to get the latest version).\n");
exit(-1);
}
isdnctrl_fd = open("/dev/isdnctrl", O_RDONLY);
if (isdnctrl_fd < 0) {
perror("/dev/isdninfo");