/* ldactoasc.c *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% * * Part of: LDACtoASC * * Author: E.BERTIN (IAP) * * Contents: Convert LDAC binary format to ASCII. * * Last modify: 04/06/2007 * *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include "ldactoasc.h" #include "fits/fitscat.h" #define SYNTAX "ldactoasc catalog\n" extern const char notokstr[]; /********************************** main ************************************/ int main(int argc, char *argv[]) { catstruct *cat; tabstruct *tab; unsigned short ashort=1; char catname[MAXCHAR]; int a, t, opt,opt2; if (argc<2) { fprintf(OUTPUT, "\n %s Version %s (%s)\n", BANNER, MYVERSION, DATE); fprintf(OUTPUT, "\nFor information, please contact: %s\n", COPYRIGHT); error(EXIT_SUCCESS, "SYNTAX: ", SYNTAX); } /* Test if byteswapping will be needed */ bswapflag = *((char *)&ashort); /* Default parameters */ for (a=1; atab; for (t=cat->ntab; t--; tab=tab->nexttab) if (!strcmp("LDAC_OBJECTS", tab->extname) || !strcmp("OBJECTS", tab->extname)) show_keys(tab, NULL, NULL, 0, NULL, stdout, 1, 1, 0, SHOW_ASCII); free_cat(&cat, 1); exit(EXIT_SUCCESS); } else { error(EXIT_FAILURE,"Cannot open ",catname); return RETURN_ERROR; } }