Changeset 11037 for trunk/ippTools/src/regtool.c
- Timestamp:
- Jan 11, 2007, 12:14:40 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/regtool.c (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
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.
