Skip to content

Commit a74137c

Browse files
Merge pull request #863 from ourairquality/rtkrcv-stat-config
rtkrcv: use the config stat file settings
2 parents 132454b + c73db40 commit a74137c

2 files changed

Lines changed: 25 additions & 19 deletions

File tree

app/consapp/rtkrcv/rtkrcv.c

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
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
};
145145
static 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)
18521852
int 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);

app/consapp/str2str/str2str.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
#define PRGNAME "str2str" /* program name */
3939
#define MAXSTR 5 /* max number of streams */
4040
#define TRACEFILE "str2str_%Y%m%d%h%M.trace" /* Debug trace file */
41-
#define LOGFILE "str2str_%Y%m%d%h%M.log" /* Deamon log file */
41+
#define LOGFILE "str2str_%Y%m%d%h%M.log" /* Daemon log file */
4242

4343
/* global variables ----------------------------------------------------------*/
4444
static strsvr_t strsvr; /* stream server */
@@ -116,7 +116,7 @@ static const char *help[]={
116116
" -b str_no relay back messages from output str to input str [no]",
117117
" -t level trace level [0]",
118118
" -fl file log file [str2str.trace]",
119-
" --deamon detach from the console",
119+
" --daemon detach from the console",
120120
" --version print version",
121121
" -h print help",
122122
"",
@@ -246,7 +246,7 @@ static void readcmd(const char *file, char *cmd, size_t size, int type)
246246
fclose(fp);
247247
}
248248

249-
static void deamonise(void)
249+
static void daemonise(void)
250250
{
251251
#ifndef WIN32
252252
/* In case we were not started in the background, fork and let the parent
@@ -295,7 +295,7 @@ int main(int argc, char **argv)
295295
int i,j,n=0,dispint=5000,trlevel=0,opts[]={10000,10000,2000,32768,10,0,30,0};
296296
int types[MAXSTR]={STR_FILE,STR_FILE},stat[MAXSTR]={0},log_stat[MAXSTR]={0};
297297
int byte[MAXSTR]={0},bps[MAXSTR]={0},fmts[MAXSTR]={0},sta=0;
298-
int deamon=0;
298+
int daemon=0;
299299
const char *msg = "1004,1019"; // Current messages.
300300
const char *msgs[MAXSTR]; // Messages per output stream.
301301
const char *log = ""; // Log for the next input or output stream.
@@ -364,7 +364,8 @@ int main(int argc, char **argv)
364364
else if (!strcmp(argv[i],"-b" )&&i+1<argc) opts[7]=atoi(argv[++i]);
365365
else if (!strcmp(argv[i],"-fl" )&&i+1<argc) logfile=argv[++i];
366366
else if (!strcmp(argv[i],"-t" )&&i+1<argc) trlevel=atoi(argv[++i]);
367-
else if (!strcmp(argv[i], "--deamon")) deamon=1;
367+
else if (!strcmp(argv[i], "--daemon")) daemon=1;
368+
else if (!strcmp(argv[i], "--deamon")) daemon=1;
368369
else if (!strcmp(argv[i], "--version")) {
369370
fprintf(stderr, "str2str RTKLIB %s %s\n", VER_RTKLIB, PATCH_LEVEL);
370371
exit(0);
@@ -406,7 +407,7 @@ int main(int argc, char **argv)
406407
matcpy(conv[i]->out.sta.pos,stapos,3,1);
407408
matcpy(conv[i]->out.sta.del,stadel,3,1);
408409
}
409-
if (deamon) deamonise();
410+
if (daemon) daemonise();
410411
signal(SIGTERM,sigfunc);
411412
signal(SIGINT ,sigfunc);
412413
signal(SIGHUP ,SIG_IGN);

0 commit comments

Comments
 (0)