forked from ExternalVendorCode/Signal-Server
Correctly detect missing clutter file
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
#include <errno.h>
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "main.hh"
|
#include "main.hh"
|
||||||
|
|
||||||
@@ -22,9 +23,8 @@ int loadClutter(char *filename, double radius, struct site tx)
|
|||||||
char * pch;
|
char * pch;
|
||||||
FILE *fd;
|
FILE *fd;
|
||||||
|
|
||||||
fd = fopen(filename, "rb");
|
if( (fd = fopen(filename, "rb")) == NULL)
|
||||||
|
return errno;
|
||||||
if (fd != NULL) {
|
|
||||||
|
|
||||||
if (fgets(line, 19, fd) != NULL) {
|
if (fgets(line, 19, fd) != NULL) {
|
||||||
pch = strtok (line," ");
|
pch = strtok (line," ");
|
||||||
@@ -120,7 +120,7 @@ int loadClutter(char *filename, double radius, struct site tx)
|
|||||||
fprintf(stderr, "Clutter error @ x %d y %d\n", x, y);
|
fprintf(stderr, "Clutter error @ x %d y %d\n", x, y);
|
||||||
}//if
|
}//if
|
||||||
}//for
|
}//for
|
||||||
}
|
|
||||||
fclose(fd);
|
fclose(fd);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
7
main.cc
7
main.cc
@@ -1042,7 +1042,7 @@ int main(int argc, char *argv[])
|
|||||||
int x, y, z = 0, min_lat, min_lon, max_lat, max_lon,
|
int x, y, z = 0, min_lat, min_lon, max_lat, max_lon,
|
||||||
rxlat, rxlon, txlat, txlon, west_min, west_max,
|
rxlat, rxlon, txlat, txlon, west_min, west_max,
|
||||||
nortRxHin, nortRxHax, propmodel, knifeedge = 0, ppa =
|
nortRxHin, nortRxHax, propmodel, knifeedge = 0, ppa =
|
||||||
0, normalise = 0, haf = 0, pmenv = 1, lidar=0, cropped;
|
0, normalise = 0, haf = 0, pmenv = 1, lidar=0, cropped, result;
|
||||||
|
|
||||||
bool use_threads = true;
|
bool use_threads = true;
|
||||||
|
|
||||||
@@ -1797,7 +1797,10 @@ int main(int argc, char *argv[])
|
|||||||
Clutter tiles cover 16 x 12 degs but we only need a fraction of that area.
|
Clutter tiles cover 16 x 12 degs but we only need a fraction of that area.
|
||||||
Limit by max_range / miles per degree (at equator)
|
Limit by max_range / miles per degree (at equator)
|
||||||
*/
|
*/
|
||||||
loadClutter(clutter_file,max_range/45,tx_site[0]);
|
if( (result = loadClutter(clutter_file,max_range/45,tx_site[0])) != 0 ){
|
||||||
|
fprintf(stderr, "Error, invalid or clutter file not found\n");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ppa == 0) {
|
if (ppa == 0) {
|
||||||
|
Reference in New Issue
Block a user