6464#define NAVIFILE "rtkrcv.nav" /* navigation save file */
6565#define STATFILE "rtkrcv_%Y%m%d%h%M.stat" /* solution status file */
6666#define TRACEFILE "rtkrcv_%Y%m%d%h%M.trace" /* debug trace file */
67- #define LOGFILE "rtkrcv_%Y%m%d%h%M.log" /* Deamon log file */
67+ #define LOGFILE "rtkrcv_%Y%m%d%h%M.log" /* Daemon log file */
6868#define INTKEEPALIVE 1000 /* keep alive interval (ms) */
6969
7070#define ESC_CLEAR "\033[H\033[2J" /* ansi/vt100 escape: erase screen */
@@ -139,7 +139,7 @@ static const char *usage[]={
139139 " -r level output solution status file (0:off,1:states,2:residuals)" ,
140140 " -t level debug trace level (0:off,1-5:on)" ,
141141 " -sta sta station name for receiver dcb" ,
142- " --deamon detach from the console" ,
142+ " --daemon detach from the console" ,
143143 " --version print the version and exit"
144144};
145145static const char * helptxt []= {
@@ -1693,7 +1693,7 @@ static void accept_sock(int ssock, con_t **con)
16931693 inet_ntoa (addr .sin_addr ));
16941694}
16951695
1696- static void deamonise (void )
1696+ static void daemonise (void )
16971697{
16981698#ifndef WIN32
16991699 /* In case we were not started in the background, fork and let the parent
@@ -1741,7 +1741,7 @@ static void deamonise(void)
17411741* set, load or save command on the console. To shutdown the program, use
17421742* shutdown command on the console or send USR2 signal to the process.
17431743*
1744- * The --deamon option implies no console. When used with -s or -nc the RTK
1744+ * The --daemon option implies no console. When used with -s or -nc the RTK
17451745* server is started on program startup. A telnet console can be used with
17461746* this option to start and control the RTK server.
17471747*
@@ -1756,7 +1756,7 @@ static void deamonise(void)
17561756* -r level output solution status file (0:off,1:states,2:residuals)
17571757* -t level debug trace level (0:off,1-5:on)
17581758* -sta sta station name for receiver dcb
1759- * --deamon detach from the console
1759+ * --daemon detach from the console
17601760* --version prints the version and exits
17611761*
17621762* command
@@ -1852,9 +1852,9 @@ static void deamonise(void)
18521852int main (int argc , char * * argv )
18531853{
18541854 con_t * con [MAXCON ]= {0 };
1855- int i ,port = 0 ,outstat = 0 ,trace = 0 ,sock = 0 ;
1855+ int i ,port = 0 ,outstat = 0 ,outstatp = 0 , trace = 0 ,sock = 0 ;
18561856 char * dev = "" ,file [MAXSTR ]= "" ;
1857- int deamon = 0 ;
1857+ int daemon = 0 ;
18581858
18591859 for (i = 1 ;i < argc ;i ++ ) {
18601860 if (!strcmp (argv [i ],"-s" )) start |=1 ; /* console */
@@ -1864,17 +1864,21 @@ int main(int argc, char **argv)
18641864 else if (!strcmp (argv [i ],"-d" )&& i + 1 < argc ) dev = argv [++ i ];
18651865 else if (!strcmp (argv [i ],"-o" )&& i + 1 < argc ) strcpy (file ,argv [++ i ]);
18661866 else if (!strcmp (argv [i ],"-w" )&& i + 1 < argc ) strcpy (passwd ,argv [++ i ]);
1867- else if (!strcmp (argv [i ],"-r" )&& i + 1 < argc ) outstat = atoi (argv [++ i ]);
1867+ else if (!strcmp (argv [i ],"-r" )&& i + 1 < argc ) {
1868+ outstat = atoi (argv [++ i ]);
1869+ outstatp = 1 ;
1870+ }
18681871 else if (!strcmp (argv [i ],"-t" )&& i + 1 < argc ) trace = atoi (argv [++ i ]);
18691872 else if (!strcmp (argv [i ],"-sta" )&& i + 1 < argc ) strcpy (sta_name ,argv [++ i ]);
1870- else if (!strcmp (argv [i ], "--deamon" )) deamon = 1 ;
1873+ else if (!strcmp (argv [i ], "--daemon" )) daemon = 1 ;
1874+ else if (!strcmp (argv [i ], "--deamon" )) daemon = 1 ;
18711875 else if (!strcmp (argv [i ], "--version" )) {
18721876 fprintf (stderr , "rtkrcv RTKLIB %s %s\n" , VER_RTKLIB , PATCH_LEVEL );
18731877 exit (0 );
18741878 }
18751879 else printusage ();
18761880 }
1877- if (deamon ) deamonise ();
1881+ if (daemon ) daemonise ();
18781882 if (trace > 0 ) {
18791883 traceopen (TRACEFILE );
18801884 tracelevel (trace );
@@ -1898,8 +1902,9 @@ int main(int argc, char **argv)
18981902 if (!readnav (NAVIFILE ,& svr .nav )) {
18991903 fprintf (stderr ,"no navigation data: %s\n" ,NAVIFILE );
19001904 }
1901- if (outstat > 0 ) {
1902- rtkopenstat (STATFILE ,outstat );
1905+ if (!outstatp ) outstat = solopt -> sstat ;
1906+ if (outstat > 0 ) {
1907+ rtkopenstat (filopt .solstat [0 ] != '\0' ? filopt .solstat : STATFILE , outstat );
19031908 }
19041909 /* open monitor port */
19051910 if (moniport > 0 && !openmoni (moniport )) {
@@ -1917,7 +1922,7 @@ int main(int argc, char **argv)
19171922 }
19181923 if (start & 2 ) { /* Start without console */
19191924 startsvr (NULL );
1920- } else if (!deamon ) {
1925+ } else if (!daemon ) {
19211926 /* open device for local console */
19221927 if (!(con [0 ]= con_open (0 ,dev ))) {
19231928 fprintf (stderr ,"console open error dev=%s\n" ,dev );
0 commit comments