]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - cgi-bin/help.c
Load cups into easysw/current.
[thirdparty/cups.git] / cgi-bin / help.c
index d616f28bdff381cfb8239327471b1c965319dd7f..efee0fe5b9b37152a00deb53feb494f83973a287 100644 (file)
@@ -111,11 +111,12 @@ main(int  argc,                           /* I - Number of command-line arguments */
     fprintf(stderr, "argv[%d]=\"%s\"\n", i, argv[i]);
 
   if ((helpfile = getenv("PATH_INFO")) != NULL)
+  {
     helpfile ++;
-  else if (strstr(argv[0], "help.cgi"))
-    helpfile = NULL;
-  else
-    helpfile = argv[0];
+
+    if (!*helpfile)
+      helpfile = NULL;
+  }
 
   if (helpfile)
   {
@@ -180,6 +181,8 @@ main(int  argc,                             /* I - Number of command-line arguments */
   topic = cgiGetVariable("TOPIC");
   si    = helpSearchIndex(hi, query, topic, helpfile);
 
+  fprintf(stderr, "DEBUG: query=\"%s\", topic=\"%s\"\n", query, topic);
+
   if (si)
   {
     help_node_t        *nn;                    /* Parent node */
@@ -189,9 +192,9 @@ main(int  argc,                             /* I - Number of command-line arguments */
             "DEBUG: si=%p, si->sorted=%p, cupsArrayCount(si->sorted)=%d\n", si,
             si->sorted, cupsArrayCount(si->sorted));
 
-    for (n = (help_node_t *)cupsArrayFirst(si->sorted);
+    for (i = 0, n = (help_node_t *)cupsArrayFirst(si->sorted);
          n;
-        n = (help_node_t *)cupsArrayNext(si->sorted))
+        i ++, n = (help_node_t *)cupsArrayNext(si->sorted))
     {
       if (helpfile && n->anchor)
         snprintf(line, sizeof(line), "#%s", n->anchor);