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