]> the.earth.li Git - sersniff.git/blobdiff - sersniff.c
Use cfsetspeed to set port speed rather than c_cflags.
[sersniff.git] / sersniff.c
index f12faf44de92841c28e7e339912713f4be6b7eb0..45572dc15f91b61c70a490e2aa87aa95fdd8a0c4 100644 (file)
@@ -59,8 +59,9 @@ int openport(const char *device, speed_t baud, int setup)
 
        if (setup) {
                bzero(&serparams, sizeof(serparams));
-       
-               serparams.c_cflag=baud | CLOCAL | CS8 | CREAD;
+
+               cfsetspeed(&serparams, baud);
+               serparams.c_cflag |= CLOCAL | CS8 | CREAD;
 
                if (tcflush(filedes, TCIFLUSH)) {
                        fprintf(stderr,"%s: ",device);
@@ -128,7 +129,6 @@ void outputchar(unsigned char c, int port, int alpha,
 void mainloop(int port1, int port2, int silent, int alpha, long usec_threshold, char *name1, char *name2, char *format)
 {
        unsigned char c1, c2;
-       int last;
        int rc;
        fd_set rfds;
        fd_set efds;
@@ -142,7 +142,6 @@ void mainloop(int port1, int port2, int silent, int alpha, long usec_threshold,
        /* need the largest fd for the select call */
        biggestfd=port1 > port2 ? port1 : port2;
        biggestfd++;
-       last=0;
 
        while (!quit) {
                /* reset the select set */