]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Mirror 1.1.x changes.
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Thu, 22 Aug 2002 01:43:40 +0000 (01:43 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Thu, 22 Aug 2002 01:43:40 +0000 (01:43 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/branches/branch-1.2@2717 7a7537e8-13f0-0310-91df-b6672ffda945

systemv/accept.c
systemv/cancel.c
systemv/lpadmin.c
systemv/lpinfo.c
systemv/lpmove.c
systemv/lpstat.c

index b4883eebd8077f626813db88c9a7886ff2770248..249598751d39b4430940fdd8da4d6c523af4a833 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: accept.c,v 1.11.2.6 2002/05/16 14:00:17 mike Exp $"
+ * "$Id: accept.c,v 1.11.2.7 2002/08/22 01:43:39 mike Exp $"
  *
  *   "accept", "disable", "enable", and "reject" commands for the Common
  *   UNIX Printing System (CUPS).
@@ -49,19 +49,13 @@ main(int  argc,                     /* I - Number of command-line arguments */
   http_t       *http;          /* HTTP connection to server */
   int          i;              /* Looping var */
   char         *command,       /* Command to do */
-               hostname[HTTP_MAX_URI],
-                               /* Name of host */
-               printer[HTTP_MAX_URI],
-                               /* Name of printer or class */
                uri[1024],      /* Printer URI */
                *reason;        /* Reason for reject/disable */
-  const char   *server;        /* Server name */
   ipp_t                *request;       /* IPP request */
   ipp_t                *response;      /* IPP response */
   ipp_op_t     op;             /* Operation */
   cups_lang_t  *language;      /* Language */
   int          cancel;         /* Cancel jobs? */
-  http_encryption_t encryption;        /* Encryption? */
 
 
  /*
@@ -89,10 +83,8 @@ main(int  argc,                      /* I - Number of command-line arguments */
     return (1);
   }
 
-  server     = cupsServer();
-  http       = NULL;
-  reason     = NULL;
-  encryption = cupsEncryption();
+  http   = NULL;
+  reason = NULL;
 
  /*
   * Process command-line arguments...
@@ -104,13 +96,13 @@ main(int  argc,                    /* I - Number of command-line arguments */
       {
         case 'E' : /* Encrypt */
 #ifdef HAVE_LIBSSL
-           encryption = HTTP_ENCRYPT_REQUIRED;
+           cupsSetEncryption(HTTP_ENCRYPT_REQUIRED);
 
            if (http)
-             httpEncryption(http, encryption);
+             httpEncryption(http, HTTP_ENCRYPT_REQUIRED);
 #else
             fprintf(stderr, "%s: Sorry, no encryption support compiled in!\n",
-                   argv[0]);
+                   command);
 #endif /* HAVE_LIBSSL */
            break;
 
@@ -123,7 +115,7 @@ main(int  argc,                     /* I - Number of command-line arguments */
              httpClose(http);
 
            if (argv[i][2] != '\0')
-             server = argv[i] + 2;
+             cupsSetServer(argv[i] + 2);
            else
            {
              i ++;
@@ -134,16 +126,7 @@ main(int  argc,                    /* I - Number of command-line arguments */
                return (1);
              }
 
-              server = argv[i];
-           }
-
-            http = httpConnectEncrypt(server, ippPort(), encryption);
-
-           if (http == NULL)
-           {
-             fputs(argv[0], stderr);
-             perror(": Unable to connect to server");
-             return (1);
+              cupsSetServer(argv[i]);
            }
            break;
 
@@ -174,21 +157,12 @@ main(int  argc,                   /* I - Number of command-line arguments */
       * Accept/disable/enable/reject a destination...
       */
 
-      if (sscanf(argv[i], "%1023[^@]@%1023s", printer, hostname) == 1)
-       strlcpy(hostname, server, sizeof(hostname));
-
-      if (http != NULL && strcasecmp(http->hostname, hostname) != 0)
-      {
-       httpClose(http);
-       http = NULL;
-      }
-
       if (http == NULL)
-        http = httpConnectEncrypt(hostname, ippPort(), encryption);
+        http = httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption());
 
       if (http == NULL)
       {
-       fputs(argv[0], stderr);
+       fputs(command, stderr);
        perror(": Unable to connect to server");
        return (1);
       }
@@ -216,7 +190,7 @@ main(int  argc,                     /* I - Number of command-line arguments */
       ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
                    "attributes-natural-language", NULL, language->language);
 
-      snprintf(uri, sizeof(uri), "ipp://%s:%d/printers/%s", hostname, ippPort(), printer);
+      snprintf(uri, sizeof(uri), "ipp://localhost/printers/%s", argv[i]);
       ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
                    "printer-uri", NULL, uri);
 
@@ -274,7 +248,6 @@ main(int  argc,                     /* I - Number of command-line arguments */
        ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
                      "attributes-natural-language", NULL, language->language);
 
-       snprintf(uri, sizeof(uri), "ipp://%s:%d/printers/%s", hostname, ippPort(), printer);
        ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
                      "printer-uri", NULL, uri);
 
@@ -306,5 +279,5 @@ main(int  argc,                     /* I - Number of command-line arguments */
 
 
 /*
- * End of "$Id: accept.c,v 1.11.2.6 2002/05/16 14:00:17 mike Exp $".
+ * End of "$Id: accept.c,v 1.11.2.7 2002/08/22 01:43:39 mike Exp $".
  */
index 215be7ce666d606f2e6d40db80d25c5411aeffd3..ada2b229b9c63b9f8ea4b99db3f9c1a83c2be562 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: cancel.c,v 1.19.2.7 2002/08/21 20:00:17 mike Exp $"
+ * "$Id: cancel.c,v 1.19.2.8 2002/08/22 01:43:39 mike Exp $"
  *
  *   "cancel" command for the Common UNIX Printing System (CUPS).
  *
@@ -57,7 +57,6 @@ main(int  argc,                       /* I - Number of command-line arguments */
   ipp_t                *response;      /* IPP response */
   ipp_op_t     op;             /* Operation */
   cups_lang_t  *language;      /* Language */
-  http_encryption_t encryption;        /* Encryption? */
 
 
  /*
@@ -68,7 +67,6 @@ main(int  argc,                       /* I - Number of command-line arguments */
   job_id     = 0;
   dest       = NULL;
   http       = NULL;
-  encryption = cupsEncryption();
   num_dests  = 0;
   dests      = NULL;
 
@@ -82,10 +80,10 @@ main(int  argc,                     /* I - Number of command-line arguments */
       {
         case 'E' : /* Encrypt */
 #ifdef HAVE_LIBSSL
-           encryption = HTTP_ENCRYPT_REQUIRED;
+           cupsSetEncryption(HTTP_ENCRYPT_REQUIRED);
 
            if (http)
-             httpEncryption(http, encryption);
+             httpEncryption(http, HTTP_ENCRYPT_REQUIRED);
 #else
             fprintf(stderr, "%s: Sorry, no encryption support compiled in!\n",
                    argv[0]);
@@ -208,7 +206,7 @@ main(int  argc,                     /* I - Number of command-line arguments */
 
       if (http == NULL)
        if ((http = httpConnectEncrypt(cupsServer(), ippPort(),
-                                      encryption)) == NULL)
+                                      cupsEncryption())) == NULL)
        {
          fputs("cancel: Unable to contact server!\n", stderr);
          return (1);
@@ -286,5 +284,5 @@ main(int  argc,                     /* I - Number of command-line arguments */
 
 
 /*
- * End of "$Id: cancel.c,v 1.19.2.7 2002/08/21 20:00:17 mike Exp $".
+ * End of "$Id: cancel.c,v 1.19.2.8 2002/08/22 01:43:39 mike Exp $".
  */
index 561c98eeafadc1423c4a44c8a03734eb716d4895..c09ff648aa8ffd1ac9afbe1f3e049221b74ca902 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: lpadmin.c,v 1.22.2.12 2002/08/15 19:48:37 mike Exp $"
+ * "$Id: lpadmin.c,v 1.22.2.13 2002/08/22 01:43:39 mike Exp $"
  *
  *   "lpadmin" command for the Common UNIX Printing System (CUPS).
  *
@@ -90,14 +90,12 @@ main(int  argc,                     /* I - Number of command-line arguments */
                *val;           /* Pointer to allow/deny value */
   int          num_options;    /* Number of options */
   cups_option_t        *options;       /* Options */
-  http_encryption_t encryption;        /* Encryption? */
 
 
   http        = NULL;
   printer     = NULL;
   num_options = 0;
   options     = NULL;
-  encryption  = cupsEncryption();
 
   for (i = 1; i < argc; i ++)
     if (argv[i][0] == '-')
@@ -106,7 +104,8 @@ main(int  argc,                     /* I - Number of command-line arguments */
         case 'c' : /* Add printer to class */
            if (!http)
            {
-              http = httpConnectEncrypt(cupsServer(), ippPort(), encryption);
+              http = httpConnectEncrypt(cupsServer(), ippPort(),
+                                       cupsEncryption());
 
              if (http == NULL)
              {
@@ -149,7 +148,8 @@ main(int  argc,                     /* I - Number of command-line arguments */
         case 'd' : /* Set as default destination */
            if (!http)
            {
-              http = httpConnectEncrypt(cupsServer(), ippPort(), encryption);
+              http = httpConnectEncrypt(cupsServer(), ippPort(),
+                                       cupsEncryption());
 
              if (http == NULL)
              {
@@ -185,10 +185,13 @@ main(int  argc,                   /* I - Number of command-line arguments */
 
         case 'h' : /* Connect to host */
            if (http)
+           {
              httpClose(http);
+             http = NULL;
+           }
 
            if (argv[i][2] != '\0')
-             http = httpConnectEncrypt(argv[i] + 2, ippPort(), encryption);
+             cupsSetServer(argv[i] + 2);
            else
            {
              i ++;
@@ -198,23 +201,16 @@ main(int  argc,                   /* I - Number of command-line arguments */
                fputs("lpadmin: Expected hostname after \'-h\' option!\n", stderr);
                return (1);
               }
-             else
-               http = httpConnectEncrypt(argv[i], ippPort(), encryption);
-           }
 
-           if (http == NULL)
-           {
-             perror("lpadmin: Unable to connect to server");
-             return (1);
+              cupsSetServer(argv[i]);
            }
-           else
-             cupsSetServer(http->hostname);
            break;
 
         case 'i' : /* Use the specified interface script */
            if (!http)
            {
-              http = httpConnectEncrypt(cupsServer(), ippPort(), encryption);
+              http = httpConnectEncrypt(cupsServer(), ippPort(),
+                                       cupsEncryption());
 
              if (http == NULL)
              {
@@ -250,10 +246,10 @@ main(int  argc,                   /* I - Number of command-line arguments */
            if (printer == NULL)
            {
 #ifdef HAVE_LIBSSL
-             cupsSetEncryption(encryption = HTTP_ENCRYPT_REQUIRED);
+             cupsSetEncryption(HTTP_ENCRYPT_REQUIRED);
 
              if (http)
-               httpEncryption(http, encryption);
+               httpEncryption(http, HTTP_ENCRYPT_REQUIRED);
 #else
               fprintf(stderr, "%s: Sorry, no encryption support compiled in!\n",
                      argv[0]);
@@ -263,7 +259,8 @@ main(int  argc,                     /* I - Number of command-line arguments */
 
            if (!http)
            {
-              http = httpConnectEncrypt(cupsServer(), ippPort(), encryption);
+              http = httpConnectEncrypt(cupsServer(), ippPort(),
+                                       cupsEncryption());
 
              if (http == NULL)
              {
@@ -278,7 +275,8 @@ main(int  argc,                     /* I - Number of command-line arguments */
         case 'm' : /* Use the specified standard script/PPD file */
            if (!http)
            {
-              http = httpConnectEncrypt(cupsServer(), ippPort(), encryption);
+              http = httpConnectEncrypt(cupsServer(), ippPort(),
+                                       cupsEncryption());
 
              if (http == NULL)
              {
@@ -330,7 +328,8 @@ main(int  argc,                     /* I - Number of command-line arguments */
         case 'p' : /* Add/modify a printer */
            if (!http)
            {
-              http = httpConnectEncrypt(cupsServer(), ippPort(), encryption);
+              http = httpConnectEncrypt(cupsServer(), ippPort(),
+                                       cupsEncryption());
 
              if (http == NULL)
              {
@@ -364,7 +363,8 @@ main(int  argc,                     /* I - Number of command-line arguments */
         case 'r' : /* Remove printer from class */
            if (!http)
            {
-              http = httpConnectEncrypt(cupsServer(), ippPort(), encryption);
+              http = httpConnectEncrypt(cupsServer(), ippPort(),
+                                       cupsEncryption());
 
              if (http == NULL)
              {
@@ -437,7 +437,8 @@ main(int  argc,                     /* I - Number of command-line arguments */
         case 'v' : /* Set the device-uri attribute */
            if (!http)
            {
-              http = httpConnectEncrypt(cupsServer(), ippPort(), encryption);
+              http = httpConnectEncrypt(cupsServer(), ippPort(),
+                                       cupsEncryption());
 
              if (http == NULL)
              {
@@ -472,7 +473,8 @@ main(int  argc,                     /* I - Number of command-line arguments */
         case 'x' : /* Delete a printer */
            if (!http)
            {
-              http = httpConnectEncrypt(cupsServer(), ippPort(), encryption);
+              http = httpConnectEncrypt(cupsServer(), ippPort(),
+                                       cupsEncryption());
 
              if (http == NULL)
              {
@@ -509,7 +511,8 @@ main(int  argc,                     /* I - Number of command-line arguments */
         case 'D' : /* Set the printer-info attribute */
            if (!http)
            {
-              http = httpConnectEncrypt(cupsServer(), ippPort(), encryption);
+              http = httpConnectEncrypt(cupsServer(), ippPort(),
+                                       cupsEncryption());
 
              if (http == NULL)
              {
@@ -556,7 +559,8 @@ main(int  argc,                     /* I - Number of command-line arguments */
         case 'L' : /* Set the printer-location attribute */
            if (!http)
            {
-              http = httpConnectEncrypt(cupsServer(), ippPort(), encryption);
+              http = httpConnectEncrypt(cupsServer(), ippPort(),
+                                       cupsEncryption());
 
              if (http == NULL)
              {
@@ -591,7 +595,8 @@ main(int  argc,                     /* I - Number of command-line arguments */
         case 'P' : /* Use the specified PPD file */
            if (!http)
            {
-              http = httpConnectEncrypt(cupsServer(), ippPort(), encryption);
+              http = httpConnectEncrypt(cupsServer(), ippPort(),
+                                       cupsEncryption());
 
              if (http == NULL)
              {
@@ -641,7 +646,7 @@ main(int  argc,                     /* I - Number of command-line arguments */
   {
     if (!http)
     {
-      http = httpConnectEncrypt(cupsServer(), ippPort(), encryption);
+      http = httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption());
 
       if (http == NULL)
       {
@@ -1863,5 +1868,5 @@ validate_name(const char *name)   /* I - Name to check */
 
 
 /*
- * End of "$Id: lpadmin.c,v 1.22.2.12 2002/08/15 19:48:37 mike Exp $".
+ * End of "$Id: lpadmin.c,v 1.22.2.13 2002/08/22 01:43:39 mike Exp $".
  */
index b1aaf04e0d791c7e0c3e06f9729c553627ee319d..30e025539dab1a1ea2dacf286f4a676481c519c8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: lpinfo.c,v 1.3.2.4 2002/05/09 03:08:05 mike Exp $"
+ * "$Id: lpinfo.c,v 1.3.2.5 2002/08/22 01:43:40 mike Exp $"
  *
  *   "lpinfo" command for the Common UNIX Printing System (CUPS).
  *
@@ -60,12 +60,10 @@ main(int  argc,                     /* I - Number of command-line arguments */
   int          i;              /* Looping var */
   http_t       *http;          /* Connection to server */
   int          long_status;    /* Long listing? */
-  http_encryption_t encryption;        /* Encryption? */
 
 
   http        = NULL;
   long_status = 0;
-  encryption  = cupsEncryption();
 
   for (i = 1; i < argc; i ++)
     if (argv[i][0] == '-')
@@ -73,10 +71,10 @@ main(int  argc,                     /* I - Number of command-line arguments */
       {
         case 'E' : /* Encrypt */
 #ifdef HAVE_LIBSSL
-           encryption = HTTP_ENCRYPT_REQUIRED;
+           cupsSetEncryption(HTTP_ENCRYPT_REQUIRED);
 
            if (http)
-             httpEncryption(http, encryption);
+             httpEncryption(http, HTTP_ENCRYPT_REQUIRED);
 #else
             fprintf(stderr, "%s: Sorry, no encryption support compiled in!\n",
                    argv[0]);
@@ -90,7 +88,8 @@ main(int  argc,                       /* I - Number of command-line arguments */
         case 'm' : /* Show models */
            if (!http)
            {
-              http = httpConnectEncrypt(cupsServer(), ippPort(), encryption);
+              http = httpConnectEncrypt(cupsServer(), ippPort(),
+                                       cupsEncryption());
 
              if (http == NULL)
              {
@@ -105,7 +104,8 @@ main(int  argc,                     /* I - Number of command-line arguments */
         case 'v' : /* Show available devices */
            if (!http)
            {
-              http = httpConnectEncrypt(cupsServer(), ippPort(), encryption);
+              http = httpConnectEncrypt(cupsServer(), ippPort(),
+                                       cupsEncryption());
 
              if (http == NULL)
              {
@@ -119,10 +119,13 @@ main(int  argc,                   /* I - Number of command-line arguments */
 
         case 'h' : /* Connect to host */
            if (http)
+           {
              httpClose(http);
+             http = NULL;
+           }
 
            if (argv[i][2] != '\0')
-             http = httpConnectEncrypt(argv[i] + 2, ippPort(), encryption);
+             cupsSetServer(argv[i] + 2);
            else
            {
              i ++;
@@ -133,13 +136,7 @@ main(int  argc,                    /* I - Number of command-line arguments */
                return (1);
               }
 
-             http = httpConnectEncrypt(argv[i], ippPort(), encryption);
-           }
-
-           if (http == NULL)
-           {
-             perror("lpinfo: Unable to connect to server");
-             return (1);
+             cupsSetServer(argv[i]);
            }
            break;
 
@@ -440,5 +437,5 @@ show_models(http_t *http,   /* I - HTTP connection to server */
 
 
 /*
- * End of "$Id: lpinfo.c,v 1.3.2.4 2002/05/09 03:08:05 mike Exp $".
+ * End of "$Id: lpinfo.c,v 1.3.2.5 2002/08/22 01:43:40 mike Exp $".
  */
index d960b02025eb670234e6668abdcf4a72fde23c60..89ea5f3b7e6234e29756e50922bf6ff438a75bbb 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: lpmove.c,v 1.5.2.5 2002/06/27 19:49:15 mike Exp $"
+ * "$Id: lpmove.c,v 1.5.2.6 2002/08/22 01:43:40 mike Exp $"
  *
  *   "lpmove" command for the Common UNIX Printing System (CUPS).
  *
@@ -61,15 +61,13 @@ main(int  argc,                     /* I - Number of command-line arguments */
   int          num_dests;      /* Number of destinations */
   cups_dest_t  *dests;         /* Destinations */
   const char   *dest;          /* New destination */
-  http_encryption_t encryption;        /* Encryption? */
 
 
-  http       = NULL;
-  job        = NULL;
-  dest       = NULL;
-  encryption = cupsEncryption();
-  num_dests  = 0;
-  dests      = NULL;
+  http      = NULL;
+  job       = NULL;
+  dest      = NULL;
+  num_dests = 0;
+  dests     = NULL;
 
   for (i = 1; i < argc; i ++)
     if (argv[i][0] == '-')
@@ -77,10 +75,10 @@ main(int  argc,                     /* I - Number of command-line arguments */
       {
         case 'E' : /* Encrypt */
 #ifdef HAVE_LIBSSL
-           encryption = HTTP_ENCRYPT_REQUIRED;
+           cupsSetEncryption(HTTP_ENCRYPT_REQUIRED);
 
            if (http)
-             httpEncryption(http, encryption);
+             httpEncryption(http, HTTP_ENCRYPT_REQUIRED);
 #else
             fprintf(stderr, "%s: Sorry, no encryption support compiled in!\n",
                    argv[0]);
@@ -89,10 +87,13 @@ main(int  argc,                     /* I - Number of command-line arguments */
 
         case 'h' : /* Connect to host */
            if (http)
+           {
              httpClose(http);
+             http = NULL;
+           }
 
            if (argv[i][2] != '\0')
-             http = httpConnectEncrypt(argv[i] + 2, ippPort(), encryption);
+             cupsSetServer(argv[i] + 2);
            else
            {
              i ++;
@@ -103,13 +104,7 @@ main(int  argc,                    /* I - Number of command-line arguments */
                return (1);
               }
 
-             http = httpConnectEncrypt(argv[i], ippPort(), encryption);
-           }
-
-           if (http == NULL)
-           {
-             perror("lpmove: Unable to connect to server");
-             return (1);
+             cupsSetServer(argv[i]);
            }
            break;
 
@@ -144,7 +139,7 @@ main(int  argc,                     /* I - Number of command-line arguments */
 
   if (!http)
   {
-    http = httpConnectEncrypt(cupsServer(), ippPort(), encryption);
+    http = httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption());
 
     if (http == NULL)
     {
@@ -236,5 +231,5 @@ move_job(http_t     *http,  /* I - HTTP connection to server */
 
 
 /*
- * End of "$Id: lpmove.c,v 1.5.2.5 2002/06/27 19:49:15 mike Exp $".
+ * End of "$Id: lpmove.c,v 1.5.2.6 2002/08/22 01:43:40 mike Exp $".
  */
index e0b6b87e8d5ff129fac25489909fc9478e899a62..c844da56feb5c3e25d3db4aa9630b50ff264aeb2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: lpstat.c,v 1.37.2.8 2002/08/09 00:05:30 mike Exp $"
+ * "$Id: lpstat.c,v 1.37.2.9 2002/08/22 01:43:40 mike Exp $"
  *
  *   "lpstat" command for the Common UNIX Printing System (CUPS).
  *
@@ -73,7 +73,6 @@ main(int  argc,                       /* I - Number of command-line arguments */
   cups_dest_t  *dests;         /* User destinations */
   int          long_status;    /* Long status report? */
   int          ranking;        /* Show job ranking? */
-  http_encryption_t encryption;        /* Encryption? */
 
 
   http        = NULL;
@@ -81,7 +80,6 @@ main(int  argc,                       /* I - Number of command-line arguments */
   dests       = NULL;
   long_status = 0;
   ranking     = 0;
-  encryption  = cupsEncryption();
 
   for (i = 1; i < argc; i ++)
     if (argv[i][0] == '-')
@@ -93,10 +91,10 @@ main(int  argc,                     /* I - Number of command-line arguments */
 
         case 'E' : /* Encrypt */
 #ifdef HAVE_LIBSSL
-           encryption = HTTP_ENCRYPT_REQUIRED;
+           cupsSetEncryption(HTTP_ENCRYPT_REQUIRED);
 
            if (http)
-             httpEncryption(http, encryption);
+             httpEncryption(http, HTTP_ENCRYPT_REQUIRED);
 #else
             fprintf(stderr, "%s: Sorry, no encryption support compiled in!\n",
                    argv[0]);
@@ -118,7 +116,8 @@ main(int  argc,                     /* I - Number of command-line arguments */
         case 'a' : /* Show acceptance status */
            if (!http)
            {
-              http = httpConnectEncrypt(cupsServer(), ippPort(), encryption);
+              http = httpConnectEncrypt(cupsServer(), ippPort(),
+                                       cupsEncryption());
 
              if (http == NULL)
              {
@@ -145,7 +144,8 @@ main(int  argc,                     /* I - Number of command-line arguments */
         case 'b' : /* Show both the local and remote status */
            if (!http)
            {
-              http = httpConnectEncrypt(cupsServer(), ippPort(), encryption);
+              http = httpConnectEncrypt(cupsServer(), ippPort(),
+                                       cupsEncryption());
 
              if (http == NULL)
              {
@@ -181,7 +181,8 @@ main(int  argc,                     /* I - Number of command-line arguments */
         case 'c' : /* Show classes and members */
            if (!http)
            {
-              http = httpConnectEncrypt(cupsServer(), ippPort(), encryption);
+              http = httpConnectEncrypt(cupsServer(), ippPort(),
+                                       cupsEncryption());
 
              if (http == NULL)
              {
@@ -215,13 +216,13 @@ main(int  argc,                   /* I - Number of command-line arguments */
            
         case 'h' : /* Connect to host */
            if (http)
+           {
              httpClose(http);
+             http = NULL;
+           }
 
            if (argv[i][2] != '\0')
-           {
-             http = httpConnectEncrypt(argv[i] + 2, ippPort(), encryption);
              cupsSetServer(argv[i] + 2);
-           }
            else
            {
              i ++;
@@ -232,22 +233,16 @@ main(int  argc,                   /* I - Number of command-line arguments */
                return (1);
               }
 
-             http = httpConnectEncrypt(argv[i], ippPort(), encryption);
              cupsSetServer(argv[i]);
            }
-
-           if (http == NULL)
-           {
-             perror("lpstat: Unable to connect to server");
-             return (1);
-           }
            break;
 
         case 'l' : /* Long status or long job status */
 #ifdef __sgi
            if (!http)
            {
-              http = httpConnectEncrypt(cupsServer(), ippPort(), encryption);
+              http = httpConnectEncrypt(cupsServer(), ippPort(),
+                                       cupsEncryption());
 
              if (http == NULL)
              {
@@ -266,7 +261,8 @@ main(int  argc,                     /* I - Number of command-line arguments */
         case 'o' : /* Show jobs by destination */
            if (!http)
            {
-              http = httpConnectEncrypt(cupsServer(), ippPort(), encryption);
+              http = httpConnectEncrypt(cupsServer(), ippPort(),
+                                       cupsEncryption());
 
              if (http == NULL)
              {
@@ -289,7 +285,8 @@ main(int  argc,                     /* I - Number of command-line arguments */
         case 'p' : /* Show printers */
            if (!http)
            {
-              http = httpConnectEncrypt(cupsServer(), ippPort(), encryption);
+              http = httpConnectEncrypt(cupsServer(), ippPort(),
+                                       cupsEncryption());
 
              if (http == NULL)
              {
@@ -315,7 +312,8 @@ main(int  argc,                     /* I - Number of command-line arguments */
         case 'r' : /* Show scheduler status */
            if (!http)
            {
-              http = httpConnectEncrypt(cupsServer(), ippPort(), encryption);
+              http = httpConnectEncrypt(cupsServer(), ippPort(),
+                                       cupsEncryption());
 
              if (http == NULL)
              {
@@ -330,7 +328,8 @@ main(int  argc,                     /* I - Number of command-line arguments */
         case 's' : /* Show summary */
            if (!http)
            {
-              http = httpConnectEncrypt(cupsServer(), ippPort(), encryption);
+              http = httpConnectEncrypt(cupsServer(), ippPort(),
+                                       cupsEncryption());
 
              if (http == NULL)
              {
@@ -350,7 +349,8 @@ main(int  argc,                     /* I - Number of command-line arguments */
         case 't' : /* Show all info */
            if (!http)
            {
-              http = httpConnectEncrypt(cupsServer(), ippPort(), encryption);
+              http = httpConnectEncrypt(cupsServer(), ippPort(),
+                                       cupsEncryption());
 
              if (http == NULL)
              {
@@ -374,7 +374,8 @@ main(int  argc,                     /* I - Number of command-line arguments */
         case 'u' : /* Show jobs by user */
            if (!http)
            {
-              http = httpConnectEncrypt(cupsServer(), ippPort(), encryption);
+              http = httpConnectEncrypt(cupsServer(), ippPort(),
+                                       cupsEncryption());
 
              if (http == NULL)
              {
@@ -397,7 +398,8 @@ main(int  argc,                     /* I - Number of command-line arguments */
         case 'v' : /* Show printer devices */
            if (!http)
            {
-              http = httpConnectEncrypt(cupsServer(), ippPort(), encryption);
+              http = httpConnectEncrypt(cupsServer(), ippPort(),
+                                       cupsEncryption());
 
              if (http == NULL)
              {
@@ -429,7 +431,8 @@ main(int  argc,                     /* I - Number of command-line arguments */
     {
       if (!http)
       {
-       http = httpConnectEncrypt(cupsServer(), ippPort(), encryption);
+       http = httpConnectEncrypt(cupsServer(), ippPort(),
+                                 cupsEncryption());
 
        if (http == NULL)
        {
@@ -445,7 +448,8 @@ main(int  argc,                     /* I - Number of command-line arguments */
   {
     if (!http)
     {
-      http = httpConnectEncrypt(cupsServer(), ippPort(), encryption);
+      http = httpConnectEncrypt(cupsServer(), ippPort(),
+                                cupsEncryption());
 
       if (http == NULL)
       {
@@ -1929,5 +1933,5 @@ show_scheduler(http_t *http)      /* I - HTTP connection to server */
 
 
 /*
- * End of "$Id: lpstat.c,v 1.37.2.8 2002/08/09 00:05:30 mike Exp $".
+ * End of "$Id: lpstat.c,v 1.37.2.9 2002/08/22 01:43:40 mike Exp $".
  */