Handle missing antenna pattern file

This commit is contained in:
Gareth Evans
2017-02-22 18:55:47 +00:00
parent 1a4f4bd226
commit 0b495ad094
3 changed files with 272 additions and 271 deletions

View File

@@ -659,7 +659,7 @@ char LoadSDF(char *name)
return return_value;
}
void LoadPAT(char *filename)
int LoadPAT(char *filename)
{
/* This function reads and processes antenna pattern (.az
and .el) files that correspond in name to previously
@@ -696,9 +696,9 @@ void LoadPAT(char *filename)
/* Load .az antenna pattern file */
fd = fopen(azfile, "r");
if( (fd = fopen(azfile, "r")) == NULL )
return errno;
if (fd != NULL) {
/* Clear azimuth pattern array */
for (x = 0; x <= 360; x++) {
@@ -824,13 +824,12 @@ void LoadPAT(char *filename)
azimuth_pattern[360] = azimuth_pattern[0];
got_azimuth_pattern = 255;
}
/* Read and process .el file */
fd = fopen(elfile, "r");
if( (fd = fopen(elfile, "r")) == NULL )
return errno;
if (fd != NULL) {
for (x = 0; x <= 10000; x++) {
el_pattern[x] = 0.0;
read_count[x] = 0;
@@ -993,7 +992,6 @@ void LoadPAT(char *filename)
}
got_elevation_pattern = 255;
}
for (x = 0; x <= 360; x++) {
for (y = 0; y <= 1000; y++) {

View File

@@ -5,7 +5,7 @@
int LoadSDF_SDF(char *name, int winfiles);
char LoadSDF(char *name, int winfiles);
void LoadPAT(char *filename);
int LoadPAT(char *filename);
void LoadSignalColors(struct site xmtr);
void LoadLossColors(struct site xmtr);
void LoadDBMColors(struct site xmtr);

View File

@@ -1218,7 +1218,10 @@ int main(int argc, char *argv[])
strncpy(mapfile, argv[z], 253);
strncpy(tx_site[0].name, "Tx", 2);
strncpy(tx_site[0].filename, argv[z], 253);
LoadPAT(argv[z]);
if( (result = LoadPAT(argv[z])) != 0 ){
fprintf(stderr,"Error reading antenna pattern file\n");
exit(result);
}
} else if (z <= y && argv[z][0] && argv[z][0] == '-' && argv[z][1] == '\0' ) {
/* Handle writing image data to stdout */
to_stdout = true;