]> rtime.felk.cvut.cz Git - sojka/can-utils.git/blobdiff - canplayer.c
Update includes to Linux 3.6 with CAN FD support.
[sojka/can-utils.git] / canplayer.c
index efce089fb9421c321bb6ba30d4c3c3bd42a6e85d..b0b63334e711ceebd56dd9b1fddf535d226fb637 100644 (file)
@@ -41,7 +41,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
  * DAMAGE.
  *
- * Send feedback to <socketcan-users@lists.berlios.de>
+ * Send feedback to <linux-can@vger.kernel.org>
  *
  */
 
@@ -53,6 +53,7 @@
 #include <unistd.h>
 
 #include <net/if.h>
+#include <sys/socket.h>
 #include <sys/ioctl.h>
 #include <sys/time.h>
 #include <linux/can.h>
@@ -310,11 +311,12 @@ int main(int argc, char **argv)
                loops = 1;
        }
 
-       if (verbose > 1) /* use -v -v to see this */
+       if (verbose > 1) /* use -v -v to see this */
                if (infinite_loops)
                        printf("infinite_loops\n");
                else
                        printf("%d loops\n", loops);
+       }
 
        sleep_ts.tv_sec  =  gap / 1000;
        sleep_ts.tv_nsec = (gap % 1000) * 1000000;
@@ -423,11 +425,12 @@ int main(int argc, char **argv)
                                        txidx = get_txidx(device);
                                }
 
-                               if (txidx == STDOUTIDX) /* hook to print logfile lines on stdout */
+                               if (txidx == STDOUTIDX) /* hook to print logfile lines on stdout */
 
                                        printf("%s", buf); /* print the line AS-IS without extra \n */
+                                       fflush(stdout);
 
-                               else if (txidx > 0) { /* only send to valid CAN devices */
+                               else if (txidx > 0) { /* only send to valid CAN devices */
 
                                        if (parse_canframe(ascframe, &frame)) {
                                                fprintf(stderr, "wrong CAN frame format: '%s'!", ascframe);