MCPcopy Create free account
hub / github.com/OpenPrinting/cups / main

Function main

cgi-bin/testhi.c:31–139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29 */
30
31int /* O - Exit status */
32main(int argc, /* I - Number of command-line arguments */
33 char *argv[]) /* I - Command-line arguments */
34{
35 int i; /* Looping var */
36 help_index_t *hi, /* Help index */
37 *search; /* Search index */
38 const char *opt, /* Current option character */
39 *dir = ".", /* Directory to index */
40 *q = NULL, /* Query string */
41 *section = NULL, /* Section string */
42 *filename = NULL; /* Filename string */
43
44
45 /*
46 * Parse the command-line...
47 */
48
49 for (i = 1; i < argc; i ++)
50 {
51 if (argv[i][0] == '-')
52 {
53 if (!strcmp(argv[i], "--help"))
54 {
55 usage();
56 return (0);
57 }
58
59 for (opt = argv[i] + 1; *opt; opt ++)
60 {
61 switch (*opt)
62 {
63 case 'd' : /* -d directory */
64 i ++;
65 if (i < argc)
66 {
67 dir = argv[i];
68 }
69 else
70 {
71 fputs("testhi: Missing directory for \"-d\" option.\n", stderr);
72 return (usage());
73 }
74 break;
75
76 case 's' : /* -s section */
77 i ++;
78 if (i < argc)
79 {
80 section = argv[i];
81 }
82 else
83 {
84 fputs("testhi: Missing section name for \"-s\" option.\n", stderr);
85 return (usage());
86 }
87 break;
88

Callers

nothing calls this directly

Calls 5

helpLoadIndexFunction · 0.85
list_nodesFunction · 0.85
helpSearchIndexFunction · 0.85
helpDeleteIndexFunction · 0.85
usageFunction · 0.70

Tested by

no test coverage detected