[dvblast-devel] [PATCH 19/20] dvblastctl: Print frontend type using macro.

Georgi Chorbadzhiyski gf at unixsol.org
Mon Sep 5 09:52:54 CEST 2011


Use PRINT_TYPE macro in preparation for XML output support
for fe_status command.
---
 dvblastctl.c |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/dvblastctl.c b/dvblastctl.c
index 0f91687..960a600 100644
--- a/dvblastctl.c
+++ b/dvblastctl.c
@@ -485,14 +485,19 @@ int main( int i_argc, char **ppsz_argv )
             exit(255);
         }
 
+#define PRINT_TYPE( x ) \
+    do { \
+        printf("type: %s\n", STRINGIFY(x) ); \
+    } while(0)
         switch ( p_ret->info.type )
         {
-        case FE_QPSK: printf("type: QPSK\n"); break;
-        case FE_QAM: printf("type: QAM\n"); break;
-        case FE_OFDM: printf("type: OFDM\n"); break;
-        case FE_ATSC: printf("type: ATSC\n"); break;
-        default: printf("type: UNKNOWN\n"); break;
+        case FE_QPSK: PRINT_TYPE(QPSK); break;
+        case FE_QAM : PRINT_TYPE(QAM); break;
+        case FE_OFDM: PRINT_TYPE(OFDM); break;
+        case FE_ATSC: PRINT_TYPE(ATSC); break;
+        default     : PRINT_TYPE(UNKNOWN); break;
         }
+#undef PRINT_TYPE
 
 #define PRINT_INFO( x )                                                 \
         printf( STRINGIFY(x) ": %u\n", p_ret->info.x );
-- 
1.7.5.1



More information about the dvblast-devel mailing list