| 20 | */ |
| 21 | |
| 22 | int /* O - Exit status */ |
| 23 | main(int argc, /* I - Number of command-line args */ |
| 24 | char *argv[]) /* I - Command-line arguments */ |
| 25 | { |
| 26 | int i; /* Looping var */ |
| 27 | const char *ppdfile = NULL;/* PPD filename */ |
| 28 | ppd_file_t *ppd; /* PPD file */ |
| 29 | int num_options = 0;/* Number of options */ |
| 30 | cups_option_t *options = NULL;/* Options */ |
| 31 | _ppd_cache_t *pc; /* PPD cache and PWG mapping data */ |
| 32 | int num_finishings, /* Number of finishing options */ |
| 33 | finishings[20]; /* Finishing options */ |
| 34 | ppd_choice_t *ppd_bin; /* OutputBin value */ |
| 35 | const char *output_bin; /* output-bin value */ |
| 36 | |
| 37 | if (argc < 2) |
| 38 | { |
| 39 | puts("Usage: ./testcache filename.ppd [name=value ... name=value]"); |
| 40 | return (1); |
| 41 | } |
| 42 | |
| 43 | ppdfile = argv[1]; |
| 44 | if ((ppd = ppdOpenFile(ppdfile)) == NULL) |
| 45 | { |
| 46 | ppd_status_t err; /* Last error in file */ |
| 47 | int line; /* Line number in file */ |
| 48 | |
| 49 | |
| 50 | err = ppdLastError(&line); |
| 51 | |
| 52 | fprintf(stderr, "Unable to open \"%s\": %s on line %d\n", ppdfile, ppdErrorString(err), line); |
| 53 | return (1); |
| 54 | } |
| 55 | |
| 56 | if ((pc = _ppdCacheCreateWithPPD(ppd)) == NULL) |
| 57 | { |
| 58 | fprintf(stderr, "Unable to create PPD cache from \"%s\".\n", ppdfile); |
| 59 | return (1); |
| 60 | } |
| 61 | |
| 62 | for (i = 2; i < argc; i ++) |
| 63 | num_options = cupsParseOptions(argv[i], num_options, &options); |
| 64 | |
| 65 | ppdMarkDefaults(ppd); |
| 66 | cupsMarkOptions(ppd, num_options, options); |
| 67 | |
| 68 | num_finishings = _ppdCacheGetFinishingValues(ppd, pc, (int)sizeof(finishings) / sizeof(finishings[0]), finishings); |
| 69 | |
| 70 | if (num_finishings > 0) |
| 71 | { |
| 72 | fputs("finishings=", stdout); |
| 73 | for (i = 0; i < num_finishings; i ++) |
| 74 | if (i) |
| 75 | printf(",%d", finishings[i]); |
| 76 | else |
| 77 | printf("%d", finishings[i]); |
| 78 | fputs("\n", stdout); |
| 79 | } |
nothing calls this directly
no test coverage detected