]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Online help fixes.
authorMichael Sweet <michael.r.sweet@gmail.com>
Tue, 19 Dec 2017 05:03:54 +0000 (00:03 -0500)
committerMichael Sweet <michael.r.sweet@gmail.com>
Tue, 19 Dec 2017 05:05:30 +0000 (00:05 -0500)
cgi-bin/help-index.c:
- Fix indexing of indented comments, body elements, etc.
- Add support for anchors via ID attribute.
- Fix anchor scanning bug when the anchor name is quoted.

cgi-bin/testhi.c:
- Add support for specifying section and directory to index.

doc/help/*.html:
- Fix headings and anchors.

cgi-bin/help-index.c
cgi-bin/testhi.c
doc/help/encryption.html
doc/help/firewalls.html

index db7d16124e6be84834410ebc8f305f51bee2081f..8e00f04676b8c951aa212cc6df9ab887e6da5669 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Online help index routines for CUPS.
  *
- * Copyright 2007-2015 by Apple Inc.
+ * Copyright 2007-2017 by Apple Inc.
  * Copyright 1997-2007 by Easy Software Products.
  *
  * Licensed under Apache License v2.0.  See the file "LICENSE" for more information.
@@ -894,13 +894,13 @@ help_load_file(
     * Look for "<TITLE>", "<A NAME", or "<!-- SECTION:" prefix...
     */
 
-    if (!_cups_strncasecmp(line, "<!-- SECTION:", 13))
+    if ((ptr = strstr(line, "<!-- SECTION:")) != NULL)
     {
      /*
       * Got section line, copy it!
       */
 
-      for (ptr = line + 13; isspace(*ptr & 255); ptr ++);
+      for (ptr += 13; isspace(*ptr & 255); ptr ++);
 
       strlcpy(section, ptr, sizeof(section));
       if ((ptr = strstr(section, "-->")) != NULL)
@@ -930,14 +930,23 @@ help_load_file(
        anchor = NULL;
        ptr += 6;
       }
-      else if (!_cups_strncasecmp(ptr, "A NAME=", 7))
+      else
       {
+        char *idptr;                   /* Pointer to ID */
+
+       if (!_cups_strncasecmp(ptr, "A NAME=", 7))
+         ptr += 7;
+       else if ((idptr = strstr(ptr, " ID=")) != NULL)
+         ptr = idptr + 4;
+       else if ((idptr = strstr(ptr, " id=")) != NULL)
+         ptr = idptr + 4;
+       else
+         continue;
+
        /*
         * Found an anchor...
        */
 
-        ptr += 7;
-
        if (*ptr == '\"' || *ptr == '\'')
        {
         /*
@@ -961,7 +970,7 @@ help_load_file(
 
          for (ptr = anchor; *ptr && *ptr != '>' && !isspace(*ptr & 255); ptr ++);
 
-         if (*ptr)
+         if (*ptr != '>')
            *ptr++ = '\0';
          else
            break;
@@ -977,10 +986,8 @@ help_load_file(
         if (*ptr != '>')
          break;
 
-        ptr ++;
+        *ptr++ = '\0';
       }
-      else
-        continue;
 
      /*
       * Now collect text for the link...
index be5fd9cee5377a8e1d746d9f7726eae867139684..dec6bdf765e4135a4a9323782e1b1ddec80ef3df 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Help index test program for CUPS.
  *
- * Copyright 2007-2011 by Apple Inc.
+ * Copyright 2007-2017 by Apple Inc.
  * Copyright 1997-2007 by Easy Software Products.
  *
  * Licensed under Apache License v2.0.  See the file "LICENSE" for more information.
@@ -19,6 +19,7 @@
  */
 
 static void    list_nodes(const char *title, cups_array_t *nodes);
+static int     usage(void);
 
 
 /*
@@ -29,15 +30,82 @@ int                                 /* O - Exit status */
 main(int  argc,                                /* I - Number of command-line arguments */
      char *argv[])                     /* I - Command-line arguments */
 {
+  int          i;                      /* Looping var */
   help_index_t *hi,                    /* Help index */
                *search;                /* Search index */
+  const char   *opt,                   /* Current option character */
+               *dir = ".",             /* Directory to index */
+               *q = NULL,              /* Query string */
+               *section = NULL,        /* Section string */
+               *filename = NULL;       /* Filename string */
+
+
+ /*
+  * Parse the command-line...
+  */
 
+  for (i = 1; i < argc; i ++)
+  {
+    if (argv[i][0] == '-')
+    {
+      if (!strcmp(argv[i], "--help"))
+      {
+        usage();
+        return (0);
+      }
+
+      for (opt = argv[i] + 1; *opt; opt ++)
+      {
+        switch (*opt)
+        {
+          case 'd' : /* -d directory */
+              i ++;
+              if (i < argc)
+              {
+                dir = argv[i];
+              }
+              else
+              {
+                fputs("testhi: Missing directory for \"-d\" option.\n", stderr);
+                return (usage());
+              }
+              break;
+
+          case 's' : /* -s section */
+              i ++;
+              if (i < argc)
+              {
+                section = argv[i];
+              }
+              else
+              {
+                fputs("testhi: Missing section name for \"-s\" option.\n", stderr);
+                return (usage());
+              }
+              break;
+
+          default :
+             fprintf(stderr, "testhi: Unknown option \"-%c\".\n", *opt);
+             return (usage());
+        }
+      }
+    }
+    else if (!q)
+      q = argv[i];
+    else if (!filename)
+      filename = argv[i];
+    else
+    {
+      fprintf(stderr, "testhi: Unknown argument \"%s\".\n", argv[i]);
+      return (usage());
+    }
+  }
 
  /*
   * Load the help index...
   */
 
-  hi = helpLoadIndex("testhi.index", ".");
+  hi = helpLoadIndex("testhi.index", dir);
 
   list_nodes("nodes", hi->nodes);
   list_nodes("sorted", hi->sorted);
@@ -46,9 +114,9 @@ main(int  argc,                              /* I - Number of command-line arguments */
   * Do any searches...
   */
 
-  if (argc > 1)
+  if (q)
   {
-    search = helpSearchIndex(hi, argv[1], NULL, argv[2]);
+    search = helpSearchIndex(hi, q, section, filename);
 
     if (search)
     {
@@ -56,7 +124,7 @@ main(int  argc,                              /* I - Number of command-line arguments */
       helpDeleteIndex(search);
     }
     else
-      printf("%s (0 nodes)\n", argv[1]);
+      printf("%s (0 nodes)\n", q);
   }
 
   helpDeleteIndex(hi);
@@ -95,3 +163,19 @@ list_nodes(const char   *title,             /* I - Title string */
     printf(" (%d words)\n", cupsArrayCount(node->words));
   }
 }
+
+
+/*
+ * 'usage()' - Show program usage.
+ */
+
+static int                             /* O - Exit status */
+usage(void)
+{
+  puts("Usage: ./testhi [options] [\"query\"] [filename]");
+  puts("Options:");
+  puts("-d directory      Specify index directory.");
+  puts("-s section        Specify search section.");
+
+  return (1);
+}
index 3dfa87e8a5262a204774e9f50f751c1ff8b9ec4f..55f4eaf6fe1a8dcac544841ce4eae01eb0e181f1 100644 (file)
@@ -15,7 +15,7 @@
     <p>CUPS supports self-signed, CA-signed, and enterprise certificates, with configurable certificate validation, cipher suite, and SSL/TLS version policies.</p>
     <p>Out of the box, CUPS uses a Trust On First Use ("TOFU") certificate validation policy like the popular Secure Shell (ssh) software, requires TLS/1.0 or higher, only allows secure cipher suites, and automatically creates a "self-signed" certificate and private key for the scheduler so that remote administration operations and printer sharing are encrypted by default.</p>
 
-    <h2>Configuring Client TLS Policies</h2>
+    <h2 class="title" id="CLIENT">Configuring Client TLS Policies</h2>
     <p>The <a href="man-client.conf.html"><var>client.conf</var></a> file controls the client TLS policies. The default policy is:</p>
     <pre class="command">
 AllowAnyRoot Yes
@@ -39,11 +39,11 @@ ValidateCerts Yes
 SSLOptions AllowRC4 AllowSSL3
 </pre>
 
-    <h2>Configuring Server TLS Policies</h2>
+    <h2 class="title" id="SERVER">Configuring Server TLS Policies</h2>
     <p>Two directives in the <a href="man-cups-files.conf.html"><var>cups-files.conf</var></a> file control the server (scheduler) TLS policies - <a href="man-cups-files.conf.html#CreateSelfSignedCerts"><code>CreateSelfSignedCerts</code></a> and <a href="man-cups-files.conf.html#ServerKeychain"><code>ServerKeychain</code></a>. The default policy creates self-signed certificates as needed.</p>
     <p>The <a href="man-cupsd.conf.html#DefaultEncryption"><code>DefaultEncryption</code></a> and <a href="man-cupsd.conf.html#Encryption"><code>Encryption</code></a> directives in the <a href="man-cupsd.conf.html"><var>cupsd.conf</var></a> file control whether encryption is used. The default configuration requires encryption for remote access whenever authentication is required.</p>
 
-    <h2><a name="PLATFORM">Platform Differences</a></h2>
+    <h2 class="title" id="PLATFORM">Platform Differences</h2>
     <h3>macOS<sup>&reg;</sup></h3>
     <p>On macOS, client configuration settings for ordinary users are stored in the <var>~/Library/Preferences/org.cups.PrintingPrefs.plist</var> file. System-wide and user certificates are stored in the system and login keychains, with private CUPS keychains being used for self-signed and CUPS-managed certificates.</p>
     <h3>Windows<sup>&reg;</sup></h3>
index 5b1c6faaf106ee0ef40844fedc497908afbe3f4e..60df1ddf411be6842592f95b3a6d771953a9ce37 100644 (file)
@@ -10,7 +10,7 @@
 
     <p>This help document describes the ports that CUPS uses so that firewall administrators can allow traffic used for printing.</p>
 
-    <h2 class="title">Ports Used for Printer Sharing</h2>
+    <h2 class="title" id="SHARING">Ports Used for Printer Sharing</h2>
 
     <p>Table 1 lists the ports that are used for IPP printer sharing via CUPS.</p>
 
@@ -41,7 +41,7 @@
     </table></div>
 
 
-    <h2 class="title">Ports Used for Network Printers</h2>
+    <h2 class="title" id="PRINTERS">Ports Used for Network Printers</h2>
 
     <p>Table 3 lists the outgoing ports that are used for network printers.</p>