int /* O - Exit status */ main(int argc, /* I - Number of command-line args */ char *argv[]) /* I - Command-line arguments */ { int errors = 0; /* Number of errors */ if (argc == 1) { errors += do_raster_tests(CUPS_RASTER_WRITE); errors += do_raster_tests(CUPS_RASTER_WRITE_COMPRESSED); errors += do_raster_tests(CUPS_RASTER_WRITE_PWG); errors += do_raster_tests(CUPS_RASTER_WRITE_APPLE); } else { int i; /* Looping var */ for (i = 1; i < argc; i ++) errors += do_ras_file(argv[i]); } return (errors); }
int /* O - Exit status */ main(int argc, /* I - Number of command-line args */ char *argv[]) /* I - Command-line arguments */ { int errors; /* Number of errors */ const char *ext; /* Filename extension */ if (argc == 1) { errors = do_ps_tests(); errors += do_raster_tests(CUPS_RASTER_WRITE); errors += do_raster_tests(CUPS_RASTER_WRITE_COMPRESSED); errors += do_raster_tests(CUPS_RASTER_WRITE_PWG); } else { int i; /* Looping var */ int num_options; /* Number of options */ cups_option_t *options; /* Options */ for (errors = 0, num_options = 0, options = NULL, i = 1; i < argc; i ++) { if (argv[i][0] == '-') { if (argv[i][1] == 'o') { if (argv[i][2]) num_options = cupsParseOptions(argv[i] + 2, num_options, &options); else { i ++; if (i < argc) num_options = cupsParseOptions(argv[i], num_options, &options); else { puts("Usage: testraster [-o name=value ...] [filename.ppd ...]"); puts(" testraster [filename.ras ...]"); return (1); } } } else { puts("Usage: testraster [-o name=value ...] [filename.ppd ...]"); puts(" testraster [filename.ras ...]"); return (1); } } else if ((ext = strrchr(argv[i], '.')) != NULL) { if (!strcmp(ext, ".ppd")) errors += do_ppd_tests(argv[i], num_options, options); else errors += do_ras_file(argv[i]); } else { puts("Usage: testraster [-o name=value ...] [filename.ppd ...]"); puts(" testraster [filename.ras ...]"); return (1); } } cupsFreeOptions(num_options, options); } return (errors); }