diff --git a/README.md b/README.md index d4a0425..e6f464d 100644 --- a/README.md +++ b/README.md @@ -16,10 +16,11 @@ Install Configure --------- * You will need to set the following environment variables in your login file to run **strf**. - * `ST_DATADIR` path to **strf** directory (e.g. `$HOME/software/strf`) + * `ST_DATADIR` path to **strf** directory (e.g. `$HOME/software/strf`, default: './') * `ST_TLEDIR` path to TLE directory (e.g. `$HOME/tle`) * `ST_COSPAR` COSPAR site number (add to site location to `$ST_DATADIR/data/sites.txt`) * `ST_LOGIN` space-track.org login info (of the form `ST_LOGIN="identity=username&password=password"`) + * `ST_SITES_TXT` path to sites.txt (optional, default: `$ST_DATADIR/data/sites.txt`) * Run `tleupdate` to download latest TLEs. * You should install NTP support on the system and configure time/date to automatically synchronize to time servers. diff --git a/rfsites.c b/rfsites.c index 58b60b0..b00bd27 100644 --- a/rfsites.c +++ b/rfsites.c @@ -16,12 +16,19 @@ site_t get_site(int site_id) { float alt; char abbrev[3],observer[64]; site_t s; - char *env,filename[LIM]; + char *env_datadir,*env_sites_txt,filename[LIM]; - env=getenv("ST_DATADIR"); - if(env==NULL||strlen(env)==0) - env="."; - sprintf(filename,"%s/data/sites.txt",env); + env_datadir = getenv("ST_DATADIR"); + if (env_datadir == NULL || strlen(env_datadir) == 0) { + env_datadir = "."; + } + + env_sites_txt = getenv("ST_SITES_TXT"); + if (env_sites_txt == NULL || strlen(env_sites_txt) == 0) { + sprintf(filename, "%s/data/sites.txt", env_datadir); + } else { + sprintf(filename, "%s", env_datadir); + } file=fopen(filename,"r"); if (file==NULL) {