IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 10, 2009, 12:01:54 PM (17 years ago)
Author:
bills
Message:

exit with PS_EXIT_DATA_ERROR if we don't understand the input file.
Allow EXTVER to be an integer to work around MOPS bug

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/pstamp/src/pstampdump.c

    r25156 r25321  
    7979    if (!readFitsFile(fileName, dumpHeader ? &header : NULL, dumpTable ? &array : NULL)) {
    8080        psErrorStackPrint(stderr, "failed to process fits table from: %s\n", fileName);
    81         return 1;
     81        return PS_EXIT_DATA_ERROR;
    8282    }
    8383    if (dumpHeader) {
     
    8585        if (!extname) {
    8686            psErrorStackPrint(stderr, "failed to find EXTNAME in fits header of: %s\n", fileName);
    87             return 1;
     87            return PS_EXIT_DATA_ERROR;
    8888        }
    8989        psString req_name = psMetadataLookupStr(NULL, header, "REQ_NAME");
    9090        if (!req_name) {
    9191            psErrorStackPrint(stderr, "failed to find REQ_NAME in fits header of: %s\n", fileName);
    92             return 1;
     92            return PS_EXIT_DATA_ERROR;
    9393        }
    9494        if (!strcmp(extname, "PS1_PS_REQUEST")) {
    9595            psString extver = psMetadataLookupStr(NULL, header, "EXTVER");
    9696            if (!extver) {
    97                 psErrorStackPrint(stderr, "failed to find EXTVER in fits header of: %s\n", fileName);
    98                 return 1;
     97                // work around bug in MOPS request files
     98                // Accept an integer for the version number
     99                psS32 extver_num = psMetadataLookupS32(NULL, header, "EXTVER");
     100                if (extver_num) {
     101                    psStringAppend(&extver, "%d", extver_num);
     102                } else {
     103                    psErrorStackPrint(stderr, "failed to find EXTVER in fits header of: %s\n", fileName);
     104                    return PS_EXIT_DATA_ERROR;
     105                }
    99106            }
    100107            printf("%s %s %s\n", extname, extver, req_name);
     
    104111        } else {
    105112            psErrorStackPrint(stderr, "do not recognize extname: %s in %s\n", extname, fileName);
    106             return 1;
     113            return PS_EXIT_DATA_ERROR;
    107114        }
    108115    }
Note: See TracChangeset for help on using the changeset viewer.