| 21 | */ |
| 22 | |
| 23 | int /* O - Exit status */ |
| 24 | main(int argc, /* I - Number of command-line arguments */ |
| 25 | char *argv[]) /* I - Command-line arguments */ |
| 26 | { |
| 27 | help_index_t *hi, /* Help index */ |
| 28 | *si; /* Search index */ |
| 29 | help_node_t *n; /* Current help node */ |
| 30 | int i; /* Looping var */ |
| 31 | const char *query = NULL; /* Search query */ |
| 32 | const char *cache_dir; /* CUPS_CACHEDIR environment variable */ |
| 33 | const char *docroot; /* CUPS_DOCROOT environment variable */ |
| 34 | const char *helpfile, /* Current help file */ |
| 35 | *helptitle = NULL; /* Current help title */ |
| 36 | const char *topic; /* Current topic */ |
| 37 | char topic_data[1024]; /* Topic form data */ |
| 38 | const char *section; /* Current section */ |
| 39 | char filename[1024], /* Filename */ |
| 40 | directory[1024]; /* Directory */ |
| 41 | cups_file_t *fp; /* Help file */ |
| 42 | char line[1024]; /* Line from file */ |
| 43 | int printable; /* Show printable version? */ |
| 44 | |
| 45 | |
| 46 | /* |
| 47 | * Get any form variables... |
| 48 | */ |
| 49 | |
| 50 | cgiInitialize(); |
| 51 | |
| 52 | printable = cgiGetVariable("PRINTABLE") != NULL; |
| 53 | |
| 54 | /* |
| 55 | * Set the web interface section... |
| 56 | */ |
| 57 | |
| 58 | cgiSetVariable("SECTION", "help"); |
| 59 | cgiSetVariable("REFRESH_PAGE", ""); |
| 60 | |
| 61 | /* |
| 62 | * Load the help index... |
| 63 | */ |
| 64 | |
| 65 | if ((cache_dir = getenv("CUPS_CACHEDIR")) == NULL) |
| 66 | cache_dir = CUPS_CACHEDIR; |
| 67 | |
| 68 | snprintf(filename, sizeof(filename), "%s/help.index", cache_dir); |
| 69 | |
| 70 | if ((docroot = getenv("CUPS_DOCROOT")) == NULL) |
| 71 | docroot = CUPS_DOCROOT; |
| 72 | |
| 73 | snprintf(directory, sizeof(directory), "%s/help", docroot); |
| 74 | |
| 75 | fprintf(stderr, "DEBUG: helpLoadIndex(filename=\"%s\", directory=\"%s\")\n", |
| 76 | filename, directory); |
| 77 | |
| 78 | hi = helpLoadIndex(filename, directory); |
| 79 | if (!hi) |
| 80 | { |
nothing calls this directly
no test coverage detected