]>
git.ipfire.org Git - thirdparty/cups.git/blob - cgi-bin/testhi.c
6f09caeb8304d0c5d4e200d5df7b5eaea6a9f41b
2 * "$Id: testhi.c 177 2006-06-21 00:20:03Z jlovell $"
4 * Help index test program for the Common UNIX Printing System (CUPS).
6 * Copyright 1997-2005 by Easy Software Products.
8 * These coded instructions, statements, and computer programs are the
9 * property of Easy Software Products and are protected by Federal
10 * copyright law. Distribution and use rights are outlined in the file
11 * "LICENSE.txt" which should have been included with this file. If this
12 * file is missing or damaged please contact Easy Software Products
15 * Attn: CUPS Licensing Information
16 * Easy Software Products
17 * 44141 Airport View Drive, Suite 204
18 * Hollywood, Maryland 20636 USA
20 * Voice: (301) 373-9600
21 * EMail: cups-info@cups.org
22 * WWW: http://www.cups.org
26 * main() - Test the help index code.
27 * list_nodes() - List nodes in an array...
31 * Include necessary headers...
41 static void list_nodes(const char *title
, cups_array_t
*nodes
);
45 * 'main()' - Test the help index code.
48 int /* O - Exit status */
49 main(int argc
, /* I - Number of command-line arguments */
50 char *argv
[]) /* I - Command-line arguments */
52 help_index_t
*hi
, /* Help index */
53 *search
; /* Search index */
57 * Load the help index...
60 hi
= helpLoadIndex("testhi.index", ".");
62 list_nodes("nodes", hi
->nodes
);
63 list_nodes("sorted", hi
->sorted
);
71 search
= helpSearchIndex(hi
, argv
[1], NULL
, argv
[2]);
75 list_nodes(argv
[1], search
->sorted
);
76 helpDeleteIndex(search
);
79 printf("%s (0 nodes)\n", argv
[1]);
85 * Return with no errors...
93 * 'list_nodes()' - List nodes in an array...
97 list_nodes(const char *title
, /* I - Title string */
98 cups_array_t
*nodes
) /* I - Nodes */
100 int i
; /* Looping var */
101 help_node_t
*node
; /* Current node */
104 printf("%s (%d nodes):\n", title
, cupsArrayCount(nodes
));
105 for (i
= 1, node
= (help_node_t
*)cupsArrayFirst(nodes
);
107 i
++, node
= (help_node_t
*)cupsArrayNext(nodes
))
109 printf(" %d: %s#%s \"%s\"\n", i
, node
->filename
, node
->anchor
,
112 printf(" %d: %s \"%s\"\n", i
, node
->filename
, node
->text
);
117 * End of "$Id: testhi.c 177 2006-06-21 00:20:03Z jlovell $".