Update version info for release v4.6.1 (#2122)
[WRF.git] / external / io_grib1 / MEL_grib1 / upd_child_errmsg.c
blobd0a795e5675d6b19964d11065e66accced9d2418
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
4 #include "dprints.h" /* for dprints */
5 #include "gribfuncs.h" /* prototypes */
7 /*
8 *********************************************************************
9 * A. FUNCTION: upd_child_errmsg
10 * Tacks the given function name in front of the error message array
11 * to show which level of the Nested Function calls the error
12 * occured at;
14 * INTERFACE:
15 * void upd_child_errmsg (parent, errmsg)
17 * ARGUMENTS (I=input, O=output, I&O=input and output):
18 * (I) char *parent; name of caller function
19 * (I&O) char *errmsg; already contain error message upon entry;
20 * will get name of parent tacked in front of
21 * existing array content;
22 * RETURN: none;
23 *********************************************************************
25 #if PROTOTYPE_NEEDED
26 void upd_child_errmsg (char *parent, char *errmsg)
27 #else
28 void upd_child_errmsg (parent, errmsg)
29 char *parent;
30 char *errmsg;
31 #endif
33 char temp[500], *func="upd_child_errmsg";
35 DPRINT1 ("Entering %s\n", func);
36 DPRINT2 ("Tacking '%s' in front of '%s'\n", parent, errmsg);
39 * A.1 IF (the error message is null) THEN
40 * RETURN error msg "FuncName: no Error msg avail!"
41 * ELSE
42 * RETURN error msg "FuncName: " + errmsg
43 * ENDIF
45 if (errmsg[0]=='\0')
46 sprintf (errmsg, "%s: no Error msg avail!\n", parent);
47 else {
48 sprintf (temp, "%s: %s", parent, errmsg);
49 strncpy (errmsg, temp, 500);
52 DPRINT1 ("ErrMsg is now-> %s\n", errmsg);
53 DPRINT1 ("Leaving %s\n", func);
55 * END OF FUNCTION