Bug#357126: dvb-utils: Make [stc]zap flush stdout after writing status line

Sebastian Schmidt yath at yath.de
Wed Mar 15 20:07:15 UTC 2006


Package: dvb-utils
Version: 1.1.0-9
Severity: wishlist
Tags: upstream patch

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Moin,

attached is a patch that makes [stc]zap fflush(stdout) after writing the
status line (status 1f | signal foo | snr bar ...). Else passing the
output to a script that parses this data isn't possible without opening
a pty or so. (you can verify this with "czap foo | cat" which first
prints out something after BUFIZ bytes).

The patch also fixes a very minor bug in tzap and szap, where the \n of
the status line got printed after the 1s sleep and not before.

Regards,
  Sebastian

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFEGHPzvBVic1oTsEgRAksjAJ9XwHb1A6qzrJHMCSVVUfK2q92gxwCeNy/F
pBmI7KJBQrP1hzDAZWnGMFU=
=YvTe
-----END PGP SIGNATURE-----
-------------- next part --------------
diff -ur linuxtv-dvb-apps-1.1.0/util/szap/czap.c linuxtv-dvb-apps-1.1.0.new/util/szap/czap.c
--- linuxtv-dvb-apps-1.1.0/util/szap/czap.c	2004-04-22 13:09:11.000000000 +0200
+++ linuxtv-dvb-apps-1.1.0.new/util/szap/czap.c	2006-03-15 19:39:47.880163500 +0100
@@ -243,9 +243,10 @@
 		if (status & FE_HAS_LOCK)
 			printf("FE_HAS_LOCK");
 
-		usleep(1000000);
+        printf("\n");
+        fflush(stdout);
 
-		printf("\n");
+		usleep(1000000);
 	} while (1);
 
 	return 0;
diff -ur linuxtv-dvb-apps-1.1.0/util/szap/femon.c linuxtv-dvb-apps-1.1.0.new/util/szap/femon.c
--- linuxtv-dvb-apps-1.1.0/util/szap/femon.c	2004-04-22 13:09:12.000000000 +0200
+++ linuxtv-dvb-apps-1.1.0.new/util/szap/femon.c	2006-03-15 19:42:59.948167000 +0100
@@ -81,6 +81,7 @@
 	 printf("FE_HAS_LOCK");
 
       printf("\n");
+      fflush(stdout);
       usleep(1000000);
    } while (1);
 
diff -ur linuxtv-dvb-apps-1.1.0/util/szap/szap.c linuxtv-dvb-apps-1.1.0.new/util/szap/szap.c
--- linuxtv-dvb-apps-1.1.0/util/szap/szap.c	2004-04-22 13:09:12.000000000 +0200
+++ linuxtv-dvb-apps-1.1.0.new/util/szap/szap.c	2006-03-15 19:43:20.789469500 +0100
@@ -216,6 +216,7 @@
       if (status & FE_HAS_LOCK)
 	 printf("FE_HAS_LOCK");
       printf("\n");
+      fflush(stdout);
 
       if (exit_after_tuning && ((status & FE_HAS_LOCK) || (++timeout >= 10)))
          break;
diff -ur linuxtv-dvb-apps-1.1.0/util/szap/tzap.c linuxtv-dvb-apps-1.1.0.new/util/szap/tzap.c
--- linuxtv-dvb-apps-1.1.0/util/szap/tzap.c	2004-04-22 13:09:12.000000000 +0200
+++ linuxtv-dvb-apps-1.1.0.new/util/szap/tzap.c	2006-03-15 19:43:53.123490250 +0100
@@ -362,9 +362,10 @@
 		if (status & FE_HAS_LOCK)
 			printf("FE_HAS_LOCK");
 
-		usleep(1000000);
+        printf("\n");
+        fflush(stdout);
 
-		printf("\n");
+		usleep(1000000);
 	} while (1);
 
 	return 0;


More information about the pkg-vdr-dvb-devel mailing list