Index: trunk/ntripserver/NtripLinuxServer.c
===================================================================
--- trunk/ntripserver/NtripLinuxServer.c	(revision 18)
+++ trunk/ntripserver/NtripLinuxServer.c	(revision 21)
@@ -41,5 +41,5 @@
  */
 
-/* $Id: NtripLinuxServer.c,v 1.8 2005/03/21 13:02:47 stoecker Exp $
+/* $Id: NtripLinuxServer.c,v 1.9 2005/04/19 11:28:17 stoecker Exp $
  * Changes - Version 0.7
  * Sep 22 2003  Steffen Tschirpke <St.Tschirpke@actina.de>
@@ -134,4 +134,5 @@
   char *mountpoint = NULL;
   char *password = "";
+  char *initfile = NULL;
   int sock_id;
   char szSendBuffer[BUFSZ];
@@ -160,10 +161,13 @@
     exit(1);
   }
-  while((c = getopt(argc, argv, "M:i:h:b:p:s:a:m:c:H:P:")) != EOF)
+  while((c = getopt(argc, argv, "M:i:h:b:p:s:a:m:c:H:P:f:")) != EOF)
   {
     switch (c)
     {
     case 'M':
-      mode = atoi(optarg);
+      if(!strcmp(optarg, "serial")) mode = 1;
+      else if(!strcmp(optarg, "tcpsocket")) mode = 2;
+      else if(!strcmp(optarg, "file")) mode = 3;
+      else mode = atoi(optarg);
       if((mode == 0) || (mode > 3))
       {
@@ -205,6 +209,9 @@
       mountpoint = optarg;
       break;
-    case 'f':                  /* datastream from file */
+    case 's':                  /* datastream from file */
       filepath = optarg;
+      break;
+    case 'f':
+      initfile = optarg;
       break;
     case 'c':                  /* password */
@@ -309,6 +316,7 @@
       }
 
-      printf("socket input: host = %s, port = %d\n",
-        inet_ntoa(in_addr.sin_addr), in_port);
+      printf("socket input: host = %s, port = %d%s%s\n",
+        inet_ntoa(in_addr.sin_addr), in_port, initfile ? ", initfile = " : "",
+        initfile ? initfile : "");
 
       if(connect(gpsfd, (struct sockaddr *) &in_addr, sizeof(in_addr)) < 0)
@@ -317,4 +325,33 @@
           inet_ntoa(in_addr.sin_addr), in_port);
         exit(1);
+      }
+      if(initfile)
+      {
+        char buffer[1024];
+        FILE *fh;
+        int i;
+
+        if((fh = fopen(initfile, "r")))
+        {
+          while((i = fread(buffer, 1, sizeof(buffer), fh)) > 0)
+          {
+            if((send(gpsfd, buffer, i, 0)) != i)
+            {
+              perror("ERROR: sending init file");
+              exit(1);
+            }
+          }
+          if(i < 0)
+          {
+            perror("ERROR: reading init file");
+            exit(1);
+          }
+          fclose(fh);
+        }
+        else
+        {
+          fprintf(stderr, "ERROR: can't read init file %s\n", initfile);
+          exit(1);
+        }
       }
     }
@@ -594,4 +631,5 @@
   fprintf(stderr, "    -P receiver port (default: 1025)\n");
   fprintf(stderr, "    -H hostname of TCP server (default: 127.0.0.1)\n");
+  fprintf(stderr, "    -f initfile send to server\n");
   fprintf(stderr, "    \n");
   exit(rc);
