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