| 64 | } |
| 65 | |
| 66 | void usage(UtilSvc* uSvc, const ISC_STATUS code, const char* msg1 = NULL, const char* msg2 = NULL) |
| 67 | { |
| 68 | if (uSvc->isService()) |
| 69 | { |
| 70 | fb_assert(code); |
| 71 | Arg::Gds gds(code); |
| 72 | if (msg1) |
| 73 | gds << msg1; |
| 74 | if (msg2) |
| 75 | gds << msg2; |
| 76 | gds.raise(); |
| 77 | } |
| 78 | |
| 79 | if (code) |
| 80 | { |
| 81 | printMsg(2, false); // ERROR: |
| 82 | USHORT dummy; |
| 83 | USHORT number = (USHORT) gds__decode(code, &dummy, &dummy); |
| 84 | fb_assert(number); |
| 85 | SafeArg safe; |
| 86 | if (msg1) |
| 87 | safe << msg1; |
| 88 | if (msg2) |
| 89 | safe << msg2; |
| 90 | |
| 91 | printMsg(number, safe); |
| 92 | printf("\n"); |
| 93 | } |
| 94 | |
| 95 | // If the items aren't contiguous, a scheme like in nbackup.cpp will have to be used. |
| 96 | // ASF: This is message codes! |
| 97 | const int MAIN_USAGE[] = {3, 21}; |
| 98 | const int EXAMPLES[] = {22, 27}; |
| 99 | const int NOTES[] = {28, 29}; |
| 100 | |
| 101 | for (int i = MAIN_USAGE[0]; i <= MAIN_USAGE[1]; ++i) |
| 102 | printMsg(i); |
| 103 | |
| 104 | printf("\n"); |
| 105 | for (int i = EXAMPLES[0]; i <= EXAMPLES[1]; ++i) |
| 106 | printMsg(i); |
| 107 | |
| 108 | printf("\n"); |
| 109 | for (int i = NOTES[0]; i <= NOTES[1]; ++i) |
| 110 | printMsg(i); |
| 111 | |
| 112 | exit(FINI_ERROR); |
| 113 | } |
| 114 | } |
| 115 | |
| 116 | |