diff src/recpt1ctl.c @ 164:7d8a5bb874ad

EXPERIMENTAL: Change phisical channel by mq_recv(). KNOWN ISSUE: Cannnot split BS-TBS(BS1_1). enable compile recpt1ctl. SID can specified by recpt1ctl.
author Naoya OYAMA <naoya.oyama@gmail.com>
date Mon, 01 Oct 2012 21:52:05 +0900
parents 9c7bc6c0327e
children 061ef2cd98f0
line wrap: on
line diff
--- a/src/recpt1ctl.c	Mon Sep 24 20:49:17 2012 +0900
+++ b/src/recpt1ctl.c	Mon Oct 01 21:52:05 2012 +0900
@@ -9,13 +9,7 @@
 #include <getopt.h>
 
 #include "version.h"
-
-#define MSGSZ     255
-
-typedef struct msgbuf {
-    long    mtype;
-    char    mtext[MSGSZ];
-} message_buf;
+#include "pt1_common.h"
 
 void
 show_usage(char *cmd)
@@ -130,9 +124,11 @@
     int msqid;
     int msgflg = IPC_CREAT | 0666;
     key_t key = 0;
-    int channel=0, recsec = 0, extsec=0;
-    message_buf sbuf;
+    int recsec = 0, extsec=0;
+    char *channel = NULL;
+    pt1_message_buf sbuf;
     size_t buf_length;
+    char *sid_list = NULL;
 
     int result;
     int option_index;
@@ -144,10 +140,12 @@
         { "help",      0, NULL, 'h'},
         { "version",   0, NULL, 'v'},
         { "list",      0, NULL, 'l'},
+        { "sid",       1, NULL, 'i'},
+        { "SID",       1, NULL, 'i'},
         {0, 0, NULL, 0} /* terminate */
     };
 
-    while((result = getopt_long(argc, argv, "p:c:e:t:hvl",
+    while((result = getopt_long(argc, argv, "p:c:e:t:hvli",
                                 long_options, &option_index)) != -1) {
         switch(result) {
         case 'h':
@@ -175,8 +173,8 @@
             fprintf(stderr, "Pid = %d\n", key);
             break;
         case 'c':
-            channel = atoi(optarg);
-            fprintf(stderr, "Channel = %d\n", channel);
+            channel = optarg;
+            fprintf(stderr, "Channel = %s\n", channel);
             break;
         case 'e':
             parse_time(optarg, &extsec);
@@ -186,6 +184,9 @@
             parse_time(optarg, &recsec);
             fprintf(stderr, "Total recording time = %d sec\n", recsec);
             break;
+        case 'i':
+            sid_list = optarg;
+            break;
         }
     }
 
@@ -201,7 +202,7 @@
     }
 
     sbuf.mtype = 1;
-    sprintf(sbuf.mtext, "ch=%d t=%d e=%d", channel, recsec, extsec);
+    sprintf(sbuf.mtext, "ch=%s t=%d e=%d i=%s", channel, recsec, extsec, sid_list);
 
     buf_length = strlen(sbuf.mtext) + 1 ;