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