| 25 | */ |
| 26 | |
| 27 | int /* O - Exit status */ |
| 28 | main(void) |
| 29 | { |
| 30 | int status = 0; /* Exit status */ |
| 31 | FILE *fp; /* File to read */ |
| 32 | char contents[8193], /* Contents of file */ |
| 33 | *data; /* Data from PPD */ |
| 34 | size_t contsize, /* File size */ |
| 35 | datasize; /* Data size */ |
| 36 | ppd_file_t *ppd; /* Test PPD */ |
| 37 | |
| 38 | |
| 39 | /* |
| 40 | * Open the PPD and get the data from it... |
| 41 | */ |
| 42 | |
| 43 | ppd = ppdOpenFile("testppdx.ppd"); |
| 44 | data = ppdxReadData(ppd, "EXData", &datasize); |
| 45 | |
| 46 | /* |
| 47 | * Open this source file and read it... |
| 48 | */ |
| 49 | |
| 50 | fp = fopen("testppdx.c", "r"); |
| 51 | if (fp) |
| 52 | { |
| 53 | contsize = fread(contents, 1, sizeof(contents) - 1, fp); |
| 54 | fclose(fp); |
| 55 | contents[contsize] = '\0'; |
| 56 | } |
| 57 | else |
| 58 | { |
| 59 | contents[0] = '\0'; |
| 60 | contsize = 0; |
| 61 | } |
| 62 | |
| 63 | /* |
| 64 | * Compare data... |
| 65 | */ |
| 66 | |
| 67 | if (data) |
| 68 | { |
| 69 | if (contsize != datasize) |
| 70 | { |
| 71 | fprintf(stderr, "ERROR: PPD has %ld bytes, test file is %ld bytes.\n", |
| 72 | (long)datasize, (long)contsize); |
| 73 | status = 1; |
| 74 | } |
| 75 | else if (strcmp(contents, data)) |
| 76 | { |
| 77 | fputs("ERROR: PPD and test file are not the same.\n", stderr); |
| 78 | status = 1; |
| 79 | } |
| 80 | |
| 81 | if (status) |
| 82 | { |
| 83 | if ((fp = fopen("testppdx.dat", "wb")) != NULL) |
| 84 | { |
nothing calls this directly
no test coverage detected