Termios made compatible with Digital UNIX 4.0, cfset[io]speed() missing.
[mdsms.git] / mdsms.c
diff --git a/mdsms.c b/mdsms.c
index 48eb8f5..7f5a0e1 100644 (file)
--- a/mdsms.c
+++ b/mdsms.c
@@ -5,6 +5,9 @@ static char rcsid[] ATTR_UNUSED = "$Id$";
 
 /*
  * $Log$
 
 /*
  * $Log$
+ * Revision 1.4  1999/07/14 01:01:11  short
+ * Termios made compatible with Digital UNIX 4.0, cfset[io]speed() missing.
+ *
  * Revision 1.3  1999/06/03 11:46:41  short
  * Logging (--log) implemented.
  *
  * Revision 1.3  1999/06/03 11:46:41  short
  * Logging (--log) implemented.
  *
@@ -84,7 +87,7 @@ static size_t bodylen;
 static char *devicename; /* path stripped */
 static char lockreal[512],locked;
 
 static char *devicename; /* path stripped */
 static char lockreal[512],locked;
 
-static struct termios restios;
+static struct termios restios,tios;
 static char restios_yes;
 static FILE *logf;
 
 static char restios_yes;
 static FILE *logf;
 
@@ -787,7 +790,6 @@ char *s,*finame;
 FILE *fin;
 int i;
 unsigned fatal=0;
 FILE *fin;
 int i;
 unsigned fatal=0;
-struct termios tios;
 
        if ((s=strrchr((pname=*argv),'/'))) pname=s+1;
        atexit(cleanup);
 
        if ((s=strrchr((pname=*argv),'/'))) pname=s+1;
        atexit(cleanup);
@@ -902,10 +904,13 @@ time_t start,end;
        memset(tios.c_cc,_POSIX_VDISABLE,sizeof(tios.c_cc));
        tios.c_cc[VTIME]=0;
        tios.c_cc[VMIN ]=1;
        memset(tios.c_cc,_POSIX_VDISABLE,sizeof(tios.c_cc));
        tios.c_cc[VTIME]=0;
        tios.c_cc[VMIN ]=1;
+           cfsetispeed(&tios,B19200);
+       if (cfsetospeed(&tios,B19200)|cfsetispeed(&tios,B19200))
+               error("Error setting termios baudrate on device: %m");
        if (tcflush(devfd,TCIOFLUSH))
                error("Error flushing termios (TCIOFLUSH) on device: %m");
        if (tcsetattr(devfd,TCSANOW,&tios))
        if (tcflush(devfd,TCIOFLUSH))
                error("Error flushing termios (TCIOFLUSH) on device: %m");
        if (tcsetattr(devfd,TCSANOW,&tios))
-               error("!Unable to set initial termios device settings");
+               error("!Unable to set initial termios device settings: %m");
 
        signal(SIGALRM,(RETSIGTYPE (*)(int))sigalarm);
        do {
 
        signal(SIGALRM,(RETSIGTYPE (*)(int))sigalarm);
        do {