]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - cgi-bin/html.c
Fix source file header text duplication text duplication.
[thirdparty/cups.git] / cgi-bin / html.c
index 62e0cc517bca7cf60769a5a9d0ed10cd5b6b877e..1ddeb6a20ca905cb34c78cef23ef54961eced76f 100644 (file)
@@ -1,32 +1,14 @@
 /*
- * "$Id: html.c 5548 2006-05-19 19:38:31Z mike $"
+ * HTML support functions for CUPS.
  *
- *   HTML support functions for the Common UNIX Printing System (CUPS).
+ * Copyright 2007-2011 by Apple Inc.
+ * Copyright 1997-2006 by Easy Software Products.
  *
- *   Copyright 1997-2006 by Easy Software Products.
- *
- *   These coded instructions, statements, and computer programs are the
- *   property of Easy Software Products and are protected by Federal
- *   copyright law.  Distribution and use rights are outlined in the file
- *   "LICENSE.txt" which should have been included with this file.  If this
- *   file is missing or damaged please contact Easy Software Products
- *   at:
- *
- *       Attn: CUPS Licensing Information
- *       Easy Software Products
- *       44141 Airport View Drive, Suite 204
- *       Hollywood, Maryland 20636 USA
- *
- *       Voice: (301) 373-9600
- *       EMail: cups-info@cups.org
- *         WWW: http://www.cups.org
- *
- * Contents:
- *
- *   cgiEndHTML()      - End a HTML page.
- *   cgiFormEncode()   - Encode a string as a form variable...
- *   cgiStartHTML()    - Start a HTML page.
- *   cgi_null_passwd() - Return a NULL password for authentication.
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law.  Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file.  If this file is
+ * missing or damaged, see the license at "http://www.cups.org/".
  */
 
 /*
 #include "cgi-private.h"
 
 
+/*
+ * Local globals...
+ */
+
+static const char      *cgi_multipart = NULL;
+                                       /* Multipart separator, if any */
+
+
 /*
  * Local functions...
  */
@@ -59,7 +49,22 @@ cgiEndHTML(void)
 
 
 /*
- * 'cgiFormEncode()' - Encode a string as a form variable...
+ * 'cgiEndMultipart()' - End the delivery of a multipart web page.
+ */
+
+void
+cgiEndMultipart(void)
+{
+  if (cgi_multipart)
+  {
+    printf("\n%s--\n", cgi_multipart);
+    fflush(stdout);
+  }
+}
+
+
+/*
+ * 'cgiFormEncode()' - Encode a string as a form variable.
  */
 
 char *                                 /* O - Destination string */
@@ -86,7 +91,7 @@ cgiFormEncode(char       *dst,                /* I - Destination string */
   for (dstptr = dst; *src && dstptr < dstend;)
   {
     switch (*src)
-    { 
+    {
       case ' ' :
          /*
          * Encode spaces with a "+"...
@@ -153,6 +158,9 @@ cgiStartHTML(const char *title)             /* I - Title of page */
   * Tell the client to expect UTF-8 encoded HTML...
   */
 
+  if (cgi_multipart)
+    puts(cgi_multipart);
+
   puts("Content-Type: text/html;charset=utf-8\n");
 
  /*
@@ -166,6 +174,38 @@ cgiStartHTML(const char *title)            /* I - Title of page */
 }
 
 
+/*
+ * 'cgiStartMultipart()' - Start a multipart delivery of a web page.
+ */
+
+void
+cgiStartMultipart(void)
+{
+  puts("MIME-Version: 1.0\n"
+       "Content-Type: multipart/x-mixed-replace; boundary=\"CUPS-MULTIPART\"\n");
+  fflush(stdout);
+
+  cgi_multipart = "--CUPS-MULTIPART";
+}
+
+
+/*
+ * 'cgiSupportsMultipart()' - Does the browser support multi-part documents?
+ */
+
+int                                    /* O - 1 if multi-part supported, 0 otherwise */
+cgiSupportsMultipart(void)
+{
+ /*
+  * Too many bug reports for browsers that don't support it, and too much pain
+  * to whitelist known-good browsers, so for now we just punt on multi-part
+  * support... :(
+  */
+
+  return (0);
+}
+
+
 /*
  * 'cgi_null_passwd()' - Return a NULL password for authentication.
  */
@@ -180,8 +220,3 @@ cgi_null_passwd(const char *prompt) /* I - Prompt string (unused) */
 
   return (NULL);
 }
-
-
-/*
- * End of "$Id: html.c 5548 2006-05-19 19:38:31Z mike $".
- */