Check `ST_DATADIR` before usage.
Otherwise the String "(null)" may be added to path specifications when `ST_DATADIR` is not defined.pull/16/head
parent
211cbaddd4
commit
66a85e8c0a
6
rffit.c
6
rffit.c
|
@ -81,6 +81,8 @@ struct site get_site(int site_id)
|
|||
char *env,filename[LIM];
|
||||
|
||||
env=getenv("ST_DATADIR");
|
||||
if(env==NULL||strlen(env)==0)
|
||||
env=".";
|
||||
sprintf(filename,"%s/data/sites.txt",env);
|
||||
|
||||
file=fopen(filename,"r");
|
||||
|
@ -319,6 +321,8 @@ int main(int argc,char *argv[])
|
|||
}
|
||||
|
||||
env=getenv("ST_DATADIR");
|
||||
if(env==NULL||strlen(env)==0)
|
||||
env=".";
|
||||
// Decode options
|
||||
while ((arg=getopt(argc,argv,"d:c:i:hs:gm:"))!=-1) {
|
||||
switch(arg) {
|
||||
|
@ -709,6 +713,8 @@ int main(int argc,char *argv[])
|
|||
// Flux limit
|
||||
if (c=='l') {
|
||||
env=getenv("ST_DATADIR");
|
||||
if(env==NULL||strlen(env)==0)
|
||||
env=".";
|
||||
sprintf(freqlist,"%s/data/frequencies.txt",env);
|
||||
fp=fopen(freqlist,"a");
|
||||
fprintf(fp,"%05d %lf\n",orb.satno,d.ffit/1000.0);
|
||||
|
|
10
rftrace.c
10
rftrace.c
|
@ -124,6 +124,8 @@ struct site get_site(int site_id)
|
|||
char *env,filename[LIM];
|
||||
|
||||
env=getenv("ST_DATADIR");
|
||||
if(env==NULL||strlen(env)==0)
|
||||
env=".";
|
||||
sprintf(filename,"%s/data/sites.txt",env);
|
||||
|
||||
file=fopen(filename,"r");
|
||||
|
@ -181,6 +183,8 @@ void identify_trace_graves(char *tlefile,struct trace t,int satno)
|
|||
char *env,freqlist[LIM];
|
||||
|
||||
env=getenv("ST_DATADIR");
|
||||
if(env==NULL||strlen(env)==0)
|
||||
env=".";
|
||||
sprintf(freqlist,"%s/data/frequencies.txt",env);
|
||||
|
||||
// Reloop stderr
|
||||
|
@ -331,6 +335,8 @@ void identify_trace(char *tlefile,struct trace t,int satno)
|
|||
char tbuf[30];
|
||||
|
||||
env=getenv("ST_DATADIR");
|
||||
if(env==NULL||strlen(env)==0)
|
||||
env=".";
|
||||
sprintf(freqlist,"%s/data/frequencies.txt",env);
|
||||
|
||||
// Reloop stderr
|
||||
|
@ -448,6 +454,8 @@ int is_classified(int satno)
|
|||
|
||||
// Get classfd.tle path
|
||||
env=getenv("ST_TLEDIR");
|
||||
if(env==NULL||strlen(env)==0)
|
||||
env=".";
|
||||
sprintf(tlefile,"%s/classfd.tle",env);
|
||||
|
||||
// Does it exist
|
||||
|
@ -488,6 +496,8 @@ struct trace *compute_trace(char *tlefile,double *mjd,int n,int site_id,float fr
|
|||
double ra,de,azi,alt;
|
||||
|
||||
env=getenv("ST_DATADIR");
|
||||
if(env==NULL||strlen(env)==0)
|
||||
env=".";
|
||||
sprintf(freqlist,"%s/data/frequencies.txt",env);
|
||||
|
||||
// Frequency limits
|
||||
|
|
Loading…
Reference in New Issue