1 // 2 // Test program for message catalog class. 3 // 4 // Copyright © 2020-2024 by OpenPrinting. 5 // Copyright © 2008-2019 by Apple Inc. 6 // 7 // Licensed under Apache License v2.0. See the file "LICENSE" for more 8 // information. 9 // 10 11 // 12 // Include necessary headers... 13 // 14 15 #include "ppdc-private.h" 16 17 18 // 19 // 'main()' - Open a message catalog 20 // 21 22 int // O - Exit status main(int argc,char * argv[])23main(int argc, // I - Number of command-line arguments 24 char *argv[]) // I - Command-line arguments 25 { 26 ppdcCatalog *catalog; // Message catalog 27 ppdcMessage *m; // Current message 28 29 30 if (argc != 2) 31 { 32 puts("Usage: testcatalog filename"); 33 return (1); 34 } 35 36 // Scan the command-line... 37 catalog = new ppdcCatalog(NULL, argv[1]); 38 39 printf("%s: %u messages\n", argv[1], (unsigned)catalog->messages->count); 40 41 for (m = (ppdcMessage *)catalog->messages->first(); 42 m; 43 m = (ppdcMessage *)catalog->messages->next()) 44 printf("%s: %s\n", m->id->value, m->string->value); 45 46 catalog->release(); 47 48 // Return with no errors. 49 return (0); 50 } 51