Changeset 21 in ntrip for trunk/ntripserver
- Timestamp:
- Apr 27, 2005, 10:32:43 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/ntripserver/NtripLinuxServer.c ¶
r18 r21 41 41 */ 42 42 43 /* $Id: NtripLinuxServer.c,v 1. 82005/03/21 13:02:47 stoecker Exp $43 /* $Id: NtripLinuxServer.c,v 1.9 2005/04/19 11:28:17 stoecker Exp $ 44 44 * Changes - Version 0.7 45 45 * Sep 22 2003 Steffen Tschirpke <St.Tschirpke@actina.de> … … 134 134 char *mountpoint = NULL; 135 135 char *password = ""; 136 char *initfile = NULL; 136 137 int sock_id; 137 138 char szSendBuffer[BUFSZ]; … … 160 161 exit(1); 161 162 } 162 while((c = getopt(argc, argv, "M:i:h:b:p:s:a:m:c:H:P:")) != EOF) 163 while((c = getopt(argc, argv, "M:i:h:b:p:s:a:m:c:H:P:f:")) != EOF) 163 164 { 164 165 switch (c) 165 166 { 166 167 case 'M': 167 mode = atoi(optarg); 168 if(!strcmp(optarg, "serial")) mode = 1; 169 else if(!strcmp(optarg, "tcpsocket")) mode = 2; 170 else if(!strcmp(optarg, "file")) mode = 3; 171 else mode = atoi(optarg); 168 172 if((mode == 0) || (mode > 3)) 169 173 { … … 205 209 mountpoint = optarg; 206 210 break; 207 case ' f': /* datastream from file */211 case 's': /* datastream from file */ 208 212 filepath = optarg; 213 break; 214 case 'f': 215 initfile = optarg; 209 216 break; 210 217 case 'c': /* password */ … … 309 316 } 310 317 311 printf("socket input: host = %s, port = %d\n", 312 inet_ntoa(in_addr.sin_addr), in_port); 318 printf("socket input: host = %s, port = %d%s%s\n", 319 inet_ntoa(in_addr.sin_addr), in_port, initfile ? ", initfile = " : "", 320 initfile ? initfile : ""); 313 321 314 322 if(connect(gpsfd, (struct sockaddr *) &in_addr, sizeof(in_addr)) < 0) … … 317 325 inet_ntoa(in_addr.sin_addr), in_port); 318 326 exit(1); 327 } 328 if(initfile) 329 { 330 char buffer[1024]; 331 FILE *fh; 332 int i; 333 334 if((fh = fopen(initfile, "r"))) 335 { 336 while((i = fread(buffer, 1, sizeof(buffer), fh)) > 0) 337 { 338 if((send(gpsfd, buffer, i, 0)) != i) 339 { 340 perror("ERROR: sending init file"); 341 exit(1); 342 } 343 } 344 if(i < 0) 345 { 346 perror("ERROR: reading init file"); 347 exit(1); 348 } 349 fclose(fh); 350 } 351 else 352 { 353 fprintf(stderr, "ERROR: can't read init file %s\n", initfile); 354 exit(1); 355 } 319 356 } 320 357 } … … 594 631 fprintf(stderr, " -P receiver port (default: 1025)\n"); 595 632 fprintf(stderr, " -H hostname of TCP server (default: 127.0.0.1)\n"); 633 fprintf(stderr, " -f initfile send to server\n"); 596 634 fprintf(stderr, " \n"); 597 635 exit(rc);
Note:
See TracChangeset
for help on using the changeset viewer.