Browse Source

adding simple version option for `diu_minder`

abram 5 years ago
parent
commit
d80b7a36a7
1 changed files with 12 additions and 2 deletions
  1. 12 2
      busunit/DIUv2/diu_main.c

+ 12 - 2
busunit/DIUv2/diu_main.c

@@ -54,6 +54,8 @@
 
 #define _SLEN LINE_BUFFER_SIZE
 
+#define DIU_MINDER_VERSION "2.1.10"
+
 static const char *s_http_port = "60535";
 static struct mg_serve_http_opts s_http_server_opts;
 
@@ -1402,15 +1404,23 @@ int main(int argc, char **argv) {
 
   time_t last_stale_gps_check = 0;
 
+  struct mg_connection *nc;
+
   long long int _usec_now, _usec_prv, _usec_del;
+
+  if ( (argc>1) && (
+        (strncmp(argv[1], "-h", 3)==0) ||
+        (strncmp(argv[1], "-v", 3)==0) ) ) { 
+    printf("diu_minder version: %s\n", DIU_MINDER_VERSION);
+    exit(0);
+  }
+
   _usec_now = get_usec_time();
   _usec_prv = _usec_now;
   _usec_del = 60000000;
 
   // setup mongoose web server
   //
-  struct mg_connection *nc;
-
   mg_mgr_init(&g_mgr, NULL);
   nc = mg_bind(&g_mgr, s_http_port, ev_handler);
   if (!nc) {