]> jspc29.x-matter.uni-frankfurt.de Git - trbnettools.git/commitdiff
added new option: -e
authorhadaq <hadaq>
Sun, 8 Jan 2012 19:54:25 +0000 (19:54 +0000)
committerhadaq <hadaq>
Sun, 8 Jan 2012 19:54:25 +0000 (19:54 +0000)
libtrbnet/trbcmd.c

index 257403044f088462e0d3ac29d5d7315fc728dc91..75af570fc98ef470bbfd41e6a0f23a331eef7ae9 100644 (file)
@@ -25,7 +25,7 @@
 
 static int hexMode = HEXMODE;
 
-static const char trbcmd_version[] = "$Revision: 2.73 $";
+static const char trbcmd_version[] = "$Revision: 2.74 $";
 
 #define BACKLOG 10
 static uint16_t tcp_port = 55555;
@@ -108,6 +108,7 @@ void usage(const char *progName)
   fprintf(stdout,
           "  -H    hex-mode: all arguments will be interpreted "
           "as hexadecimal-numbers\n");
+  fprintf(stdout, "  -e    put a EOF marker \"<EOF>\" at end of output\n");
   fprintf(stdout, "  -V    version number\n");
   fprintf(stdout, "\nCommands:\n");
   fprintf(stdout, "   r <trbaddress> <register>                        -> "
@@ -191,15 +192,16 @@ int start(int argc, char **argv)
   int loop = 1;
   int sleepTime = 0;
   int loopCtr = 0;
+  int eof_marker = 0;
   uint16_t trgCtr = 0;          /* counter for the %ctr option */
   int opt;
   int i;
 
 #ifdef PEXOR
-  const char optString[] = "+hf:n:d:s:HMVD";
+  const char optString[] = "+hf:n:d:s:HMVeD";
   pexor_dma = 1;
 #else
-  const char optString[] = "+hf:n:d:s:HMV";
+  const char optString[] = "+hf:n:d:s:HMVe";
 #endif
 
   trb_debug = 0;
@@ -231,6 +233,9 @@ int start(int argc, char **argv)
     case 'H':
       hexMode = 1;
       break;
+    case 'e':
+      eof_marker = 1;
+      break;
     case 'V':
       printf("%s %s, using libtrbnet %s\n",
              basename(argv[0]), trbcmd_version, trbnet_version);
@@ -1263,8 +1268,11 @@ int start(int argc, char **argv)
         logError(ERROR, "Invalid command, try -h option\n");
         return -1;
       }
+      if (eof_marker == 1) {
+        fprintf(stdout, "<EOF>\n");
+      }
     }  /* End script-file-loop */
-
+    
     trgCtr++;
   
     if (sleepTime > 0) {