Skip to content

Commit 4207e80

Browse files
committed
Adds exit code defs and minor fixes from PR feedback
1 parent 88aa5a9 commit 4207e80

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

exitCodes.h

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#ifndef EXITCODES_H
2+
#define EXITCODES_H
3+
4+
// Exit codes for SIPNET; most of the current uses of exit(1) should
5+
// get better codes, which will appear here
6+
typedef enum {
7+
EXIT_SUCCESS = 0,
8+
EXIT_FAILURE = 1,
9+
EXIT_UNKNOWN_EVENT = 2
10+
} ExitCode;
11+
12+
#endif

sipnet.c

+4-3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "outputItems.h"
2121
#include "modelStructures.h"
2222
#include "events.h"
23+
#include "exitCodes.h"
2324

2425
// begin definitions for choosing different model structures
2526
// (1 -> true, 0 -> false)
@@ -2280,8 +2281,8 @@ void updateTrackers(double oldSoilWater) {
22802281
// let's leave it here for now. Maybe someday we will factor that out.
22812282
//
22822283
// Process events for current location/year/day
2283-
void processEvents() {
22842284
#if EVENT_HANDLER
2285+
void processEvents() {
22852286
// If locEvent starts off NULL, this function will just fall through, as it should.
22862287
const int year = climate->year;
22872288
const int day = climate->day;
@@ -2318,13 +2319,13 @@ void processEvents() {
23182319
break;
23192320
default:
23202321
printf("Unknown event type (%d) in processEvents()\n", locEvent->type);
2321-
exit(1);
2322+
exit(EXIT_UNKNOWN_EVENT);
23222323
}
23232324

23242325
locEvent = locEvent->nextEvent;
23252326
}
2326-
#endif
23272327
}
2328+
#endif
23282329

23292330

23302331
// !!! main runner function !!!

0 commit comments

Comments
 (0)