Changeset 11037
- Timestamp:
- Jan 11, 2007, 12:14:40 PM (19 years ago)
- Location:
- trunk/ippTools
- Files:
-
- 4 added
- 4 edited
-
configure.ac (modified) (1 diff)
-
src/Makefile.am (modified) (4 diffs)
-
src/pxerrors.c (added)
-
src/pxtools.h (modified) (2 diffs)
-
src/pxtoolsErrorCodes.c.in (added)
-
src/pxtoolsErrorCodes.dat (added)
-
src/pxtoolsErrorCodes.h.in (added)
-
src/regtool.c (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/configure.ac
r11032 r11037 32 32 33 33 CFLAGS=${TMP_CFLAGS} 34 35 dnl -- check for psParseErrorCodes -------------------------------------- 36 37 AC_PATH_PROG([ERRORCODES], [psParseErrorCodes], [missing]) 38 if test "$ERRORCODES" = "missing" ; then 39 AC_MSG_ERROR([psParseErrorCodes is required]) 40 fi 34 41 35 42 AC_PROG_PERL_MODULES( -
trunk/ippTools/src/Makefile.am
r11002 r11037 1 1 2 bin_PROGRAMS = \ 2 3 detselect \ … … 12 13 pztool 13 14 14 include_HEADERS = pxtools.h 15 include_HEADERS = \ 16 pxtoolsErrorCodes.h \ 17 pxtools.h 18 15 19 noinst_HEADERS = \ 16 20 dettool.h \ … … 31 35 libpxtools_la_LDFLAGS = -release $(PACKAGE_VERSION) 32 36 libpxtools_la_SOURCES = \ 37 pxtoolsErrorCodes.c \ 38 pxerrors.c \ 33 39 pxconfig.c \ 34 40 pxfault.c \ … … 117 123 tags: 118 124 etags `find . -name \*.[ch] -print` 125 126 # Error codes. 127 BUILT_SOURCES = pxtoolsErrorCodes.h pxtoolsErrorCodes.c 128 CLEANFILES = pxtoolsErrorCodes.h pxtoolsErrorCodes.c 129 130 pxtoolsErrorCodes.h : pxtoolsErrorCodes.dat pxtoolsErrorCodes.h.in 131 $(ERRORCODES) --data=pxtoolsErrorCodes.dat --outdir=. pxtoolsErrorCodes.h 132 133 pxtoolsErrorCodes.c : pxtoolsErrorCodes.dat pxtoolsErrorCodes.c.in pxtoolsErrorCodes.h 134 $(ERRORCODES) --data=pxtoolsErrorCodes.dat --outdir=. pxtoolsErrorCodes.c -
trunk/ippTools/src/pxtools.h
r11002 r11037 27 27 # include <psmodules.h> 28 28 # include <ippdb.h> 29 30 typedef enum { 31 PX_ERROR_NONE = 0x00, 32 PX_ERROR_UNKNOWN = 0x01, 33 PX_ERROR_BAD_DATA = 0x02, 34 PX_ERROR_ID10T = 0x04, 35 } pxErrorCode; 29 # include "pxtoolsErrorCodes.h" 36 30 37 31 // load these values from the db in the init stage … … 71 65 bool pxSetFaultCode(psDB *dbh, const char *tableName, psMetadata *where, psS8 code); 72 66 67 psExit pxerrorGetExitStatus (); 68 73 69 #endif // PXTOOLS_H -
trunk/ippTools/src/regtool.c
r11033 r11037 52 52 int main(int argc, char **argv) 53 53 { 54 psExit exit_status = PS_EXIT_SUCCESS; 55 54 56 psLibInit(NULL); 55 57 … … 72 74 psLibFinalize(); 73 75 74 exit( EXIT_SUCCESS);76 exit(exit_status); 75 77 76 78 FAIL: 79 // use the top-most error to determine the exit status 80 exit_status = pxerrorGetExitStatus(); 81 77 82 psFree(config); 78 83 pmConfigDone(); … … 80 85 psLibFinalize(); 81 86 82 exit( EXIT_FAILURE);87 exit(exit_status); 83 88 } 84 89 … … 90 95 psU64 limit = psMetadataLookupU64(&status, config->args, "-limit"); 91 96 if (!status) { 92 psError(P S_ERR_UNKNOWN, false, "failed to lookup value for -limit");97 psError(PXTOOLS_ERR_PROG, false, "failed to lookup value for -limit"); 93 98 return false; 94 99 } … … 96 101 bool faulted = psMetadataLookupU64(&status, config->args, "-faulted"); 97 102 if (!status) { 98 psError(P S_ERR_UNKNOWN, false, "failed to lookup value for -faulted");103 psError(PXTOOLS_ERR_PROG, false, "failed to lookup value for -faulted"); 99 104 return false; 100 105 } … … 141 146 142 147 if (!p_psDBRunQuery(config->dbh, query)) { 143 psError(PS_ERR_UNKNOWN, false, "database error"); 148 // XXX PS_EXIT_PROG_ERROR (incorrect SQL) or SYS_ERROR (database comms) 149 psError(PXTOOLS_ERR_PROG, false, "database error"); 144 150 psFree(query); 145 151 return false; … … 149 155 psArray *output = p_psDBFetchResult(config->dbh); 150 156 if (!output) { 151 psError(PS_ERR_UNKNOWN, false, "database error"); 157 // XXX PS_EXIT_PROG_ERROR (incorrect SQL) or SYS_ERROR (database comms) 158 psError(PXTOOLS_ERR_PROG, false, "database error"); 152 159 return false; 153 160 } 154 161 if (!psArrayLength(output)) { 155 // XXX check psError here156 psError(PS_ERR_UNKNOWN, false, "no pending newExp rows found");157 162 psFree(output); 158 163 return true; … … 160 165 161 166 bool simple = false; 162 { 163 bool status = false; 164 simple = psMetadataLookupBool(&status, config->args, "-simple"); 165 if (!status) { 166 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple"); 167 return false; 168 } 167 simple = psMetadataLookupBool(&status, config->args, "-simple"); 168 if (!status) { 169 psError(PXTOOLS_ERR_PROG, false, "failed to lookup value for -simple"); 170 return false; 169 171 } 170 172 171 173 // negate simple so the default is true 172 174 if (!ippdbPrintMetadatas(stdout, output, "p0PendingExp", !simple)) { 173 psError(P S_ERR_UNKNOWN, false, "failed to print array");175 psError(PXTOOLS_ERR_PROG, false, "failed to print array"); 174 176 psFree(output); 175 177 return false; … … 188 190 psU64 limit = psMetadataLookupU64(&status, config->args, "-limit"); 189 191 if (!status) { 190 psError(P S_ERR_UNKNOWN, false, "failed to lookup value for -limit");192 psError(PXTOOLS_ERR_PROG, false, "failed to lookup value for -limit"); 191 193 return false; 192 194 } … … 194 196 bool faulted = psMetadataLookupU64(&status, config->args, "-faulted"); 195 197 if (!status) { 196 psError(P S_ERR_UNKNOWN, false, "failed to lookup value for -faulted");198 psError(PXTOOLS_ERR_PROG, false, "failed to lookup value for -faulted"); 197 199 return false; 198 200 } … … 231 233 232 234 if (!p_psDBRunQuery(config->dbh, query)) { 233 psError(PS_ERR_UNKNOWN, false, "database error"); 235 // XXX PS_EXIT_PROG_ERROR (incorrect SQL) or SYS_ERROR (database comms) 236 psError(PXTOOLS_ERR_PROG, false, "database error"); 234 237 psFree(query); 235 238 return false; … … 239 242 psArray *output = p_psDBFetchResult(config->dbh); 240 243 if (!output) { 241 psError(PS_ERR_UNKNOWN, false, "database error"); 244 // XXX PS_EXIT_PROG_ERROR (incorrect SQL) or SYS_ERROR (database comms) 245 psError(PXTOOLS_ERR_PROG, false, "database error"); 242 246 return false; 243 247 } 244 248 if (!psArrayLength(output)) { 245 // XXX check psError here246 psError(PS_ERR_UNKNOWN, false, "no pending newImfile rows found");247 249 psFree(output); 248 250 return true; … … 250 252 251 253 bool simple = false; 252 { 253 bool status = false; 254 simple = psMetadataLookupBool(&status, config->args, "-simple"); 255 if (!status) { 256 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple"); 257 return false; 258 } 254 simple = psMetadataLookupBool(&status, config->args, "-simple"); 255 if (!status) { 256 psError(PXTOOLS_ERR_PROG, false, "failed to lookup value for -simple"); 257 return false; 259 258 } 260 259 261 260 // negate simple so the default is true 262 261 if (!ippdbPrintMetadatas(stdout, output, "newImfile", !simple)) { 263 psError(P S_ERR_UNKNOWN, false, "failed to print array");262 psError(PXTOOLS_ERR_PROG, false, "failed to print array"); 264 263 psFree(output); 265 264 return false; … … 1094 1093 return raw; 1095 1094 } 1096 1097 #if 01098 static psU32 mapCodeStrToInt(const char *codeStr)1099 {1100 if (strcasestr(codeStr, "none")) {1101 return PX_ERROR_NONE;1102 } else if (strcasestr(codeStr, "unknown")) {1103 return PX_ERROR_UNKNOWN;1104 } else if (strcasestr(codeStr, "bad_data")) {1105 return PX_ERROR_BAD_DATA;1106 } else if (strcasestr(codeStr, "id10t")) {1107 return PX_ERROR_ID10T;1108 }1109 1110 psError(PS_ERR_UNKNOWN, true, "invalid fault code string");1111 1112 return (psU32) -1;1113 }1114 #endif
Note:
See TracChangeset
for help on using the changeset viewer.
