Index: /trunk/ntripserver/NtripLinuxServer.c
===================================================================
--- /trunk/ntripserver/NtripLinuxServer.c	(revision 21)
+++ /trunk/ntripserver/NtripLinuxServer.c	(revision 22)
@@ -41,5 +41,5 @@
  */
 
-/* $Id: NtripLinuxServer.c,v 1.9 2005/04/19 11:28:17 stoecker Exp $
+/* $Id: NtripLinuxServer.c,v 1.10 2005/04/27 08:32:43 stoecker Exp $
  * Changes - Version 0.7
  * Sep 22 2003  Steffen Tschirpke <St.Tschirpke@actina.de>
@@ -96,13 +96,13 @@
 #define NTRIP_PORT      80
 
-int ttybaud             = 19200;
-char *ttyport           = "/dev/gps";
-char *filepath          = "/dev/stdin";
-enum MODE mode          = INFILE;
+static int ttybaud             = 19200;
+static const char *ttyport     = "/dev/gps";
+static const char *filepath    = "/dev/stdin";
+static enum MODE mode          = INFILE;
 
 /* Forward references */
-int openserial(u_char * tty, int blocksz, int ttybaud);
-void send_receive_loop(int socket, int fd);
-void usage(int);
+static int openserial(const char * tty, int blocksz, int baud);
+static void send_receive_loop(int sock, int fd);
+static void usage(int);
 
 /*
@@ -126,5 +126,4 @@
 int main(int argc, char **argv)
 {
-  u_char *ttyin = ttyport;
   int c, gpsfd = -1;
   int size = 2048;              /* for setting send buffer size */
@@ -132,7 +131,7 @@
   unsigned int out_port = 0;
   unsigned int in_port = 0;
-  char *mountpoint = NULL;
-  char *password = "";
-  char *initfile = NULL;
+  const char *mountpoint = NULL;
+  const char *password = "";
+  const char *initfile = NULL;
   int sock_id;
   char szSendBuffer[BUFSZ];
@@ -152,5 +151,5 @@
   {
     memset((char *) &out_addr, 0x00, sizeof(out_addr));
-    memcpy(&out_addr.sin_addr, outhost->h_addr, outhost->h_length);
+    memcpy(&out_addr.sin_addr, outhost->h_addr, (size_t)outhost->h_length);
   }
 
@@ -176,6 +175,6 @@
       }
       break;
-    case 'i':                  /* gps serial ttyin */
-      ttyin = optarg;
+    case 'i':                  /* gps serial ttyport */
+      ttyport = optarg;
       break;
     case 'b':                  /* serial ttyin speed */
@@ -195,5 +194,5 @@
       }
       memset((char *) &out_addr, 0x00, sizeof(out_addr));
-      memcpy(&out_addr.sin_addr, outhost->h_addr, outhost->h_length);
+      memcpy(&out_addr.sin_addr, outhost->h_addr, (size_t)outhost->h_length);
       break;
     case 'p':                  /* http server port */
@@ -226,5 +225,5 @@
       }
       memset((char *) &in_addr, 0x00, sizeof(in_addr));
-      memcpy(&in_addr.sin_addr, inhost->h_addr, inhost->h_length);
+      memcpy(&in_addr.sin_addr, inhost->h_addr, (size_t)inhost->h_length);
       break;
     case 'P':                  /* port */
@@ -297,10 +296,10 @@
   case SERIAL:                 /* open serial port */
     {
-      gpsfd = openserial(ttyin, 1, ttybaud);
+      gpsfd = openserial(ttyport, 1, ttybaud);
       if(gpsfd < 0)
       {
         exit(1);
       }
-      printf("serial input: device = %s, speed = %d\n", ttyin, ttybaud);
+      printf("serial input: device = %s, speed = %d\n", ttyport, ttybaud);
     }
     break;
@@ -336,5 +335,5 @@
           while((i = fread(buffer, 1, sizeof(buffer), fh)) > 0)
           {
-            if((send(gpsfd, buffer, i, 0)) != i)
+            if((send(gpsfd, buffer, (size_t)i, 0)) != i)
             {
               perror("ERROR: sending init file");
@@ -397,5 +396,5 @@
     strcat(szSendBuffer, "\0");
     nBufferBytes = strlen(szSendBuffer);
-    if((send(sock_id, szSendBuffer, nBufferBytes, 0)) != nBufferBytes)
+    if((send(sock_id, szSendBuffer, (size_t)nBufferBytes, 0)) != nBufferBytes)
     {
       fprintf(stderr, "ERROR: could not send to caster\n");
@@ -426,5 +425,5 @@
 }
 
-void send_receive_loop(int socket, int fd)
+static void send_receive_loop(int sock, int fd)
 {
   char buffer[BUFSZ] = { 0 };
@@ -450,10 +449,11 @@
     }
     /* send data */
-    if((i = send(socket, buffer, nBufferBytes, MSG_DONTWAIT)) != nBufferBytes)
+    if((i = send(sock, buffer, (size_t)nBufferBytes, MSG_DONTWAIT))
+    != nBufferBytes)
     {
       if(i < 0 && errno != EAGAIN)
       {
         perror("WARNING: could not send data - retry connection");
-        close(socket);
+        close(sock);
         sleep(5);
         return;
@@ -461,5 +461,5 @@
       else if(i)
       {
-        memmove(buffer, buffer+i, nBufferBytes-i);
+        memmove(buffer, buffer+i, (size_t)(nBufferBytes-i));
         nBufferBytes -= i;
       }
@@ -482,5 +482,5 @@
  *               unsigned char   name of the appropriate serial port.
  *     blocksz : integer       : Block size for port I/O
- *     ttybaud : integer       : Baud rate for port I/O
+ *     baud :    integer       : Baud rate for port I/O
  *
  * Return Value:
@@ -492,5 +492,5 @@
  */
 
-int openserial(u_char * tty, int blocksz, int ttybaud)
+static int openserial(const char * tty, int blocksz, int baud)
 {
   int fd;
@@ -525,55 +525,55 @@
    */
 
-  switch (ttybaud)
+  switch (baud)
   {
   case 300:
-    ttybaud = B300;
+    baud = B300;
     break;
   case 1200:
-    ttybaud = B1200;
+    baud = B1200;
     break;
   case 2400:
-    ttybaud = B2400;
+    baud = B2400;
     break;
   case 4800:
-    ttybaud = B4800;
+    baud = B4800;
     break;
   case 9600:
-    ttybaud = B9600;
+    baud = B9600;
     break;
   case 19200:
-    ttybaud = B19200;
+    baud = B19200;
     break;
   case 38400:
-    ttybaud = B38400;
+    baud = B38400;
     break;
 #ifdef B57600
   case 57600:
-    ttybaud = B57600;
+    baud = B57600;
     break;
 #endif
 #ifdef B115200
   case 115200:
-    ttybaud = B115200;
+    baud = B115200;
     break;
 #endif
 #ifdef B230400
   case 230400:
-    ttybaud = B230400;
+    baud = B230400;
     break;
 #endif
   default:
     fprintf(stderr, "WARNING: Baud settings not useful, using 19200\n");
-    ttybaud = B19200;
+    baud = B19200;
     break;
   }
 #endif
 
-  if(cfsetispeed(&termios, ttybaud) != 0)
+  if(cfsetispeed(&termios, baud) != 0)
   {
     perror("ERROR: setting serial speed with cfsetispeed");
     return (-1);
   }
-  if(cfsetospeed(&termios, ttybaud) != 0)
+  if(cfsetospeed(&termios, baud) != 0)
   {
     perror("ERROR: setting serial speed with cfsetospeed");
@@ -607,5 +607,5 @@
  */
 
-void usage(int rc)
+static void usage(int rc)
 {
   fprintf(stderr, "Usage: %s [OPTIONS]\n", VERSION);
