]>
git.ipfire.org Git - thirdparty/cups.git/blob - cgi-bin/testhi.c
2340c94a50d4ffb1887c21cd6ad4ef73110c3b8d
2 * Help index test program for CUPS.
4 * Copyright 2007-2011 by Apple Inc.
5 * Copyright 1997-2007 by Easy Software Products.
7 * These coded instructions, statements, and computer programs are the
8 * property of Apple Inc. and are protected by Federal copyright
9 * law. Distribution and use rights are outlined in the file "LICENSE.txt"
10 * which should have been included with this file. If this file is
11 * missing or damaged, see the license at "http://www.cups.org/".
15 * Include necessary headers...
25 static void list_nodes(const char *title
, cups_array_t
*nodes
);
29 * 'main()' - Test the help index code.
32 int /* O - Exit status */
33 main(int argc
, /* I - Number of command-line arguments */
34 char *argv
[]) /* I - Command-line arguments */
36 help_index_t
*hi
, /* Help index */
37 *search
; /* Search index */
41 * Load the help index...
44 hi
= helpLoadIndex("testhi.index", ".");
46 list_nodes("nodes", hi
->nodes
);
47 list_nodes("sorted", hi
->sorted
);
55 search
= helpSearchIndex(hi
, argv
[1], NULL
, argv
[2]);
59 list_nodes(argv
[1], search
->sorted
);
60 helpDeleteIndex(search
);
63 printf("%s (0 nodes)\n", argv
[1]);
69 * Return with no errors...
77 * 'list_nodes()' - List nodes in an array...
81 list_nodes(const char *title
, /* I - Title string */
82 cups_array_t
*nodes
) /* I - Nodes */
84 int i
; /* Looping var */
85 help_node_t
*node
; /* Current node */
88 printf("%s (%d nodes):\n", title
, cupsArrayCount(nodes
));
89 for (i
= 1, node
= (help_node_t
*)cupsArrayFirst(nodes
);
91 i
++, node
= (help_node_t
*)cupsArrayNext(nodes
))
94 printf(" %d: %s#%s \"%s\"", i
, node
->filename
, node
->anchor
,
97 printf(" %d: %s \"%s\"", i
, node
->filename
, node
->text
);
99 printf(" (%d words)\n", cupsArrayCount(node
->words
));