]>
git.ipfire.org Git - thirdparty/cups.git/blob - cgi-bin/testhi.c
2 * Help index test program for CUPS.
4 * Copyright 2007-2011 by Apple Inc.
5 * Copyright 1997-2007 by Easy Software Products.
7 * Licensed under Apache License v2.0. See the file "LICENSE" for more information.
11 * Include necessary headers...
21 static void list_nodes(const char *title
, cups_array_t
*nodes
);
25 * 'main()' - Test the help index code.
28 int /* O - Exit status */
29 main(int argc
, /* I - Number of command-line arguments */
30 char *argv
[]) /* I - Command-line arguments */
32 help_index_t
*hi
, /* Help index */
33 *search
; /* Search index */
37 * Load the help index...
40 hi
= helpLoadIndex("testhi.index", ".");
42 list_nodes("nodes", hi
->nodes
);
43 list_nodes("sorted", hi
->sorted
);
51 search
= helpSearchIndex(hi
, argv
[1], NULL
, argv
[2]);
55 list_nodes(argv
[1], search
->sorted
);
56 helpDeleteIndex(search
);
59 printf("%s (0 nodes)\n", argv
[1]);
65 * Return with no errors...
73 * 'list_nodes()' - List nodes in an array...
77 list_nodes(const char *title
, /* I - Title string */
78 cups_array_t
*nodes
) /* I - Nodes */
80 int i
; /* Looping var */
81 help_node_t
*node
; /* Current node */
84 printf("%s (%d nodes):\n", title
, cupsArrayCount(nodes
));
85 for (i
= 1, node
= (help_node_t
*)cupsArrayFirst(nodes
);
87 i
++, node
= (help_node_t
*)cupsArrayNext(nodes
))
90 printf(" %d: %s#%s \"%s\"", i
, node
->filename
, node
->anchor
,
93 printf(" %d: %s \"%s\"", i
, node
->filename
, node
->text
);
95 printf(" (%d words)\n", cupsArrayCount(node
->words
));