Move error messages to stderr

This commit is contained in:
Gareth Evans
2017-02-01 15:00:37 +00:00
parent e4ca9f3099
commit 29df12461b
5 changed files with 8 additions and 8 deletions

View File

@@ -28,8 +28,8 @@ modes 1 = URBAN, 2 = SUBURBAN, 3 = OPEN
http://morse.colorado.edu/~tlen5510/text/classwebch3.html http://morse.colorado.edu/~tlen5510/text/classwebch3.html
*/ */
if (f < 150 || f > 2000) { if (f < 150 || f > 2000) {
printf fprintf
("Error: COST231 Hata model frequency range 150-2000MHz\n"); (stderr,"Error: COST231 Hata model frequency range 150-2000MHz\n");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }

View File

@@ -11,7 +11,7 @@ double ECC33pathLoss(float f, float TxH, float RxH, float d, int mode)
} }
if (f < 700 || f > 3500) { if (f < 700 || f > 3500) {
printf("Error: ECC33 model frequency range 700-3500MHz\n"); fprintf(stderr,"Error: ECC33 model frequency range 700-3500MHz\n");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
// MHz to GHz // MHz to GHz

View File

@@ -12,8 +12,8 @@ double EricssonpathLoss(float f, float TxH, float RxH, float d, int mode)
double a0 = 36.2, a1 = 30.2, a2 = -12, a3 = 0.1; double a0 = 36.2, a1 = 30.2, a2 = -12, a3 = 0.1;
if (f < 150 || f > 3500) { if (f < 150 || f > 3500) {
printf fprintf
("Error: Ericsson9999 model frequency range 150-3500MHz\n"); (stderr,"Error: Ericsson9999 model frequency range 150-3500MHz\n");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }

View File

@@ -150,7 +150,7 @@ namespace {
int rc = pthread_create(&threads[thread_count], NULL, rangePropagation, arg); int rc = pthread_create(&threads[thread_count], NULL, rangePropagation, arg);
if (rc) if (rc)
printf("ERROR; return code from pthread_create() is %d\n", rc); fprintf(stderr,"ERROR; return code from pthread_create() is %d\n", rc);
else else
++thread_count; ++thread_count;
} }
@@ -161,7 +161,7 @@ namespace {
for(unsigned int i=0; i<thread_count; i++) { for(unsigned int i=0; i<thread_count; i++) {
int rc = pthread_join(threads[i], &status); int rc = pthread_join(threads[i], &status);
if (rc) if (rc)
printf("ERROR; return code from pthread_join() is %d\n", rc); fprintf(stderr,"ERROR; return code from pthread_join() is %d\n", rc);
} }
thread_count = 0; thread_count = 0;
} }

View File

@@ -16,7 +16,7 @@ double SUIpathLoss(float f, float TxH, float RxH, float d, int mode)
*/ */
d = d * 1000; // km to m d = d * 1000; // km to m
if (f < 1900 || f > 11000) { if (f < 1900 || f > 11000) {
printf("Error: SUI model frequency range 1.9-11GHz\n"); fprintf(stderr,"Error: SUI model frequency range 1.9-11GHz\n");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
// Terrain mode A is default // Terrain mode A is default