]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - ppdc/testcatalog.cxx
Merge changes from CUPS 1.4svn-r7715.
[thirdparty/cups.git] / ppdc / testcatalog.cxx
diff --git a/ppdc/testcatalog.cxx b/ppdc/testcatalog.cxx
new file mode 100644 (file)
index 0000000..808738d
--- /dev/null
@@ -0,0 +1,63 @@
+//
+// "$Id$"
+//
+//   Test program for message catalog class.
+//
+//   Copyright 2008 by Apple Inc.
+//
+//   These coded instructions, statements, and computer programs are the
+//   property of Apple Inc. and are protected by Federal copyright
+//   law.  Distribution and use rights are outlined in the file "LICENSE.txt"
+//   which should have been included with this file.  If this file is
+//   file is missing or damaged, see the license at "http://www.cups.org/".
+//
+// Contents:
+//
+//   main() - Open a message catalog 
+//
+
+//
+// Include necessary headers...
+//
+
+#include "ppdc.h"
+
+
+//
+// 'main()' - Open a message catalog 
+//
+
+int                                    // O - Exit status
+main(int  argc,                                // I - Number of command-line arguments
+     char *argv[])                     // I - Command-line arguments
+{
+  ppdcCatalog  *catalog;               // Message catalog
+  ppdcMessage  *m;                     // Current message
+
+
+  if (argc != 2)
+  {
+    puts("Usage: testcatalog filename");
+    return (1);
+  }
+
+  // Scan the command-line...
+  catalog = new ppdcCatalog(NULL, argv[1]);
+
+  printf("%s: %d messages\n", argv[1], catalog->messages->count);
+
+  for (m = (ppdcMessage *)catalog->messages->first();
+       m;
+       m = (ppdcMessage *)catalog->messages->next())
+    printf("%s: %s\n", m->id->value, m->string->value);
+
+  delete catalog;
+
+  // Return with no errors.
+  return (0);
+}
+
+
+//
+// End of "$Id$".
+//