2 * "$Id: testhi.c 9771 2011-05-12 05:21:56Z mike $"
4 * Help index test program for CUPS.
6 * Copyright 2007-2011 by Apple Inc.
7 * Copyright 1997-2007 by Easy Software Products.
9 * These coded instructions, statements, and computer programs are the
10 * property of Apple Inc. and are protected by Federal copyright
11 * law. Distribution and use rights are outlined in the file "LICENSE.txt"
12 * which should have been included with this file. If this file is
13 * file is missing or damaged, see the license at "http://www.cups.org/".
17 * main() - Test the help index code.
18 * list_nodes() - List nodes in an array...
22 * Include necessary headers...
32 static void list_nodes(const char *title, cups_array_t *nodes);
36 * 'main()' - Test the help index code.
39 int /* O - Exit status */
40 main(int argc, /* I - Number of command-line arguments */
41 char *argv[]) /* I - Command-line arguments */
43 help_index_t *hi, /* Help index */
44 *search; /* Search index */
48 * Load the help index...
51 hi = helpLoadIndex("testhi.index", ".");
53 list_nodes("nodes", hi->nodes);
54 list_nodes("sorted", hi->sorted);
62 search = helpSearchIndex(hi, argv[1], NULL, argv[2]);
66 list_nodes(argv[1], search->sorted);
67 helpDeleteIndex(search);
70 printf("%s (0 nodes)\n", argv[1]);
76 * Return with no errors...
84 * 'list_nodes()' - List nodes in an array...
88 list_nodes(const char *title, /* I - Title string */
89 cups_array_t *nodes) /* I - Nodes */
91 int i; /* Looping var */
92 help_node_t *node; /* Current node */
95 printf("%s (%d nodes):\n", title, cupsArrayCount(nodes));
96 for (i = 1, node = (help_node_t *)cupsArrayFirst(nodes);
98 i ++, node = (help_node_t *)cupsArrayNext(nodes))
101 printf(" %d: %s#%s \"%s\"", i, node->filename, node->anchor,
104 printf(" %d: %s \"%s\"", i, node->filename, node->text);
106 printf(" (%d words)\n", cupsArrayCount(node->words));
112 * End of "$Id: testhi.c 9771 2011-05-12 05:21:56Z mike $".