]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Start integrating some of the new CUPS APIs from v3 so we have a clean
authorMichael R Sweet <msweet@msweet.org>
Sun, 3 Sep 2023 22:11:07 +0000 (18:11 -0400)
committerMichael R Sweet <msweet@msweet.org>
Mon, 4 Sep 2023 20:34:03 +0000 (16:34 -0400)
transition.

59 files changed:
backend/ipp.c
berkeley/lpq.c
berkeley/lpr.c
berkeley/lprm.c
cgi-bin/admin.c
cgi-bin/classes.c
cgi-bin/ipp-var.c
cgi-bin/jobs.c
cgi-bin/printers.c
cups/api-admin.shtml
cups/auth.c
cups/cups-private.h
cups/cups.h
cups/dest-job.c
cups/dest-localization.c
cups/dest-options.c
cups/dest.c
cups/getdevices.c
cups/http-support.c
cups/http.c
cups/ipp-vars.c
cups/ipp.c
cups/ppd-util.c
cups/request.c
cups/tempfile.c
cups/testadmin.c
cups/testclient.c
cups/testcreds.c
cups/testcups.c
cups/testdest.c
cups/testipp.c
cups/testppd.c
cups/testthreads.c
cups/tlscheck.c
cups/usersys.c
cups/util.c
doc/help/api-admin.html
doc/help/cupspm.html
scheduler/client.c
scheduler/cups-lpd.c
scheduler/cupsfilter.c
scheduler/ipp.c
scheduler/printers.c
scheduler/testlpd.c
scheduler/testspeed.c
scheduler/testsub.c
systemv/cancel.c
systemv/cupsaccept.c
systemv/cupsctl.c
systemv/lp.c
systemv/lpadmin.c
systemv/lpinfo.c
systemv/lpmove.c
systemv/lpoptions.c
systemv/lpstat.c
tools/ippeveprinter.c
tools/ippeveps.c
tools/ippfind.c
tools/ipptool.c

index c733c16f2480cc2bf7695cb1028ebc94885f88aa..326278cddc33b22307f35d16b3454f81a4554706 100644 (file)
@@ -820,7 +820,7 @@ main(int  argc,                             /* I - Number of command-line args */
       trust = httpCredentialsGetTrust(creds, hostname);
       httpCredentialsString(creds, credinfo, sizeof(credinfo));
 
-      fprintf(stderr, "DEBUG: %s (%s)\n", trust_msgs[trust], cupsLastErrorString());
+      fprintf(stderr, "DEBUG: %s (%s)\n", trust_msgs[trust], cupsGetErrorString());
       fprintf(stderr, "DEBUG: Printer credentials: %s\n", credinfo);
 
       if (!httpLoadCredentials(NULL, &lcreds, hostname))
@@ -930,10 +930,10 @@ main(int  argc,                           /* I - Number of command-line args */
     }
 
     supported  = cupsDoRequest(http, request, resource);
-    ipp_status = cupsLastError();
+    ipp_status = cupsGetError();
 
     fprintf(stderr, "DEBUG: Get-Printer-Attributes: %s (%s)\n",
-            ippErrorString(ipp_status), cupsLastErrorString());
+            ippErrorString(ipp_status), cupsGetErrorString());
 
     if (ipp_status <= IPP_STATUS_OK_CONFLICTING)
       password_tries = 0;
@@ -1478,10 +1478,10 @@ main(int  argc,                         /* I - Number of command-line args */
 
     response = cupsDoRequest(http, request, resource);
 
-    ipp_status = cupsLastError();
+    ipp_status = cupsGetError();
 
     fprintf(stderr, "DEBUG: Validate-Job: %s (%s)\n",
-            ippErrorString(ipp_status), cupsLastErrorString());
+            ippErrorString(ipp_status), cupsGetErrorString());
     debug_attributes(response);
 
     if ((job_auth = ippFindAttribute(response, "job-authorization-uri",
@@ -1682,11 +1682,11 @@ main(int  argc,                         /* I - Number of command-line args */
       ippDelete(request);
     }
 
-    ipp_status = cupsLastError();
+    ipp_status = cupsGetError();
 
     fprintf(stderr, "DEBUG: %s: %s (%s)\n",
             (num_files > 1 || create_job) ? "Create-Job" : "Print-Job",
-            ippErrorString(ipp_status), cupsLastErrorString());
+            ippErrorString(ipp_status), cupsGetErrorString());
     debug_attributes(response);
 
     if (ipp_status > IPP_STATUS_OK_CONFLICTING)
@@ -1877,15 +1877,15 @@ main(int  argc,                         /* I - Number of command-line args */
        response = cupsGetResponse(http, resource);
        ippDelete(request);
 
-       fprintf(stderr, "DEBUG: Send-Document: %s (%s)\n", ippErrorString(cupsLastError()), cupsLastErrorString());
+       fprintf(stderr, "DEBUG: Send-Document: %s (%s)\n", ippErrorString(cupsGetError()), cupsGetErrorString());
         debug_attributes(response);
 
-       if (cupsLastError() > IPP_STATUS_OK_CONFLICTING && !job_canceled)
+       if (cupsGetError() > IPP_STATUS_OK_CONFLICTING && !job_canceled)
        {
          ipp_attribute_t *reasons = ippFindAttribute(response, "job-state-reasons", IPP_TAG_KEYWORD);
                                        /* job-state-reasons values */
 
-         ipp_status = cupsLastError();
+         ipp_status = cupsGetError();
 
           if (ippContainsString(reasons, "document-format-error"))
             ipp_status = IPP_STATUS_ERROR_DOCUMENT_FORMAT_ERROR;
@@ -2031,7 +2031,7 @@ main(int  argc,                           /* I - Number of command-line args */
 
       check_printer_state(http, uri, resource, argv[2], version);
 
-      if (cupsLastError() <= IPP_STATUS_OK_CONFLICTING)
+      if (cupsGetError() <= IPP_STATUS_OK_CONFLICTING)
         password_tries = 0;
 
      /*
@@ -2064,7 +2064,7 @@ main(int  argc,                           /* I - Number of command-line args */
 
       httpReconnect2(http, 30000, NULL);
       response   = cupsDoRequest(http, request, resource);
-      ipp_status = cupsLastError();
+      ipp_status = cupsGetError();
 
       if (ipp_status == IPP_STATUS_ERROR_NOT_FOUND || ipp_status == IPP_STATUS_ERROR_NOT_POSSIBLE)
       {
@@ -2081,7 +2081,7 @@ main(int  argc,                           /* I - Number of command-line args */
       }
 
       fprintf(stderr, "DEBUG: Get-Job-Attributes: %s (%s)\n",
-             ippErrorString(ipp_status), cupsLastErrorString());
+             ippErrorString(ipp_status), cupsGetErrorString());
       debug_attributes(response);
 
       if (ipp_status <= IPP_STATUS_OK_CONFLICTING)
@@ -2178,7 +2178,7 @@ main(int  argc,                           /* I - Number of command-line args */
   {
     cancel_job(http, uri, job_id, resource, argv[2], version);
 
-    if (cupsLastError() > IPP_STATUS_OK_CONFLICTING)
+    if (cupsGetError() > IPP_STATUS_OK_CONFLICTING)
       _cupsLangPrintFilter(stderr, "ERROR", _("Unable to cancel print job."));
   }
 
@@ -2188,7 +2188,7 @@ main(int  argc,                           /* I - Number of command-line args */
 
   check_printer_state(http, uri, resource, argv[2], version);
 
-  if (cupsLastError() <= IPP_STATUS_OK_CONFLICTING)
+  if (cupsGetError() <= IPP_STATUS_OK_CONFLICTING)
     password_tries = 0;
 
  /*
@@ -2426,7 +2426,7 @@ check_printer_state(
   }
 
   fprintf(stderr, "DEBUG: Get-Printer-Attributes: %s (%s)\n",
-         ippErrorString(cupsLastError()), cupsLastErrorString());
+         ippErrorString(cupsGetError()), cupsGetErrorString());
   debug_attributes(response);
   ippDelete(response);
 
@@ -2544,7 +2544,7 @@ monitor_printer(
                                                    monitor->resource,
                                                   monitor->user,
                                                   monitor->version);
-      if (cupsLastError() <= IPP_STATUS_OK_CONFLICTING)
+      if (cupsGetError() <= IPP_STATUS_OK_CONFLICTING)
         password_tries = 0;
 
       if (monitor->job_id == 0 && monitor->create_job)
@@ -2586,9 +2586,9 @@ monitor_printer(
       response = cupsDoRequest(http, request, monitor->resource);
 
       fprintf(stderr, "DEBUG: (monitor) %s: %s (%s)\n", ippOpString(job_op),
-             ippErrorString(cupsLastError()), cupsLastErrorString());
+             ippErrorString(cupsGetError()), cupsGetErrorString());
 
-      if (cupsLastError() <= IPP_STATUS_OK_CONFLICTING)
+      if (cupsGetError() <= IPP_STATUS_OK_CONFLICTING)
         password_tries = 0;
 
       if (job_op == IPP_OP_GET_JOB_ATTRIBUTES)
@@ -2761,9 +2761,9 @@ monitor_printer(
       cancel_job(http, monitor->uri, monitor->job_id, monitor->resource,
                  monitor->user, monitor->version);
 
-      if (cupsLastError() > IPP_STATUS_OK_CONFLICTING)
+      if (cupsGetError() > IPP_STATUS_OK_CONFLICTING)
       {
-       fprintf(stderr, "DEBUG: (monitor) cancel_job() = %s\n", cupsLastErrorString());
+       fprintf(stderr, "DEBUG: (monitor) cancel_job() = %s\n", cupsGetErrorString());
        _cupsLangPrintFilter(stderr, "ERROR", _("Unable to cancel print job."));
       }
     }
index 017f3e83f028f80ab4d0511f24ad65a5d4fecd0d..1cc7d0a1f36e70a3efabc3c22cd1381652aa0967 100644 (file)
@@ -130,8 +130,8 @@ main(int  argc,                             /* I - Number of command-line arguments */
 
              if ((named_dest = cupsGetNamedDest(http, dest, instance)) == NULL)
              {
-               if (cupsLastError() == IPP_STATUS_ERROR_BAD_REQUEST ||
-                   cupsLastError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED)
+               if (cupsGetError() == IPP_STATUS_ERROR_BAD_REQUEST ||
+                   cupsGetError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED)
                  _cupsLangPrintf(stderr, _("%s: Error - add '/version=1.1' to server name."), argv[0]);
                else if (instance)
                  _cupsLangPrintf(stderr, _("%s: Error - unknown destination \"%s/%s\"."), argv[0], dest, instance);
@@ -201,8 +201,8 @@ main(int  argc,                             /* I - Number of command-line arguments */
   {
     if ((named_dest = cupsGetNamedDest(http, NULL, NULL)) == NULL)
     {
-      if (cupsLastError() == IPP_STATUS_ERROR_BAD_REQUEST ||
-          cupsLastError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED)
+      if (cupsGetError() == IPP_STATUS_ERROR_BAD_REQUEST ||
+          cupsGetError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED)
       {
        _cupsLangPrintf(stderr,
                        _("%s: Error - add '/version=1.1' to server name."),
@@ -390,7 +390,7 @@ show_jobs(const char *command,              /* I - Command name */
   }
   else
     ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
-                 "requesting-user-name", NULL, cupsUser());
+                 "requesting-user-name", NULL, cupsGetUser());
 
   ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
                 "requested-attributes",
@@ -406,7 +406,7 @@ show_jobs(const char *command,              /* I - Command name */
   {
     if (response->request.status.status_code > IPP_OK_CONFLICT)
     {
-      _cupsLangPrintf(stderr, "%s: %s", command, cupsLastErrorString());
+      _cupsLangPrintf(stderr, "%s: %s", command, cupsGetErrorString());
       ippDelete(response);
       return (0);
     }
@@ -543,7 +543,7 @@ show_jobs(const char *command,              /* I - Command name */
   }
   else
   {
-    _cupsLangPrintf(stderr, "%s: %s", command, cupsLastErrorString());
+    _cupsLangPrintf(stderr, "%s: %s", command, cupsGetErrorString());
     return (0);
   }
 
@@ -597,7 +597,7 @@ show_printer(const char *command,   /* I - Command name */
   {
     if (response->request.status.status_code > IPP_OK_CONFLICT)
     {
-      _cupsLangPrintf(stderr, "%s: %s", command, cupsLastErrorString());
+      _cupsLangPrintf(stderr, "%s: %s", command, cupsGetErrorString());
       ippDelete(response);
       return;
     }
@@ -624,7 +624,7 @@ show_printer(const char *command,   /* I - Command name */
     ippDelete(response);
   }
   else
-    _cupsLangPrintf(stderr, "%s: %s", command, cupsLastErrorString());
+    _cupsLangPrintf(stderr, "%s: %s", command, cupsGetErrorString());
 }
 
 
index a0d5f5fda39f5667d7acb4f0a32231f532e6e113..dc371f6c380253377b61d6a061ebe1824c30e3ac 100644 (file)
@@ -182,7 +182,7 @@ main(int  argc,                             /* I - Number of command-line arguments */
              {
                char    email[1024];    /* EMail address */
 
-               snprintf(email, sizeof(email), "mailto:%s@%s", cupsUser(), httpGetHostname(NULL, buffer, sizeof(buffer)));
+               snprintf(email, sizeof(email), "mailto:%s@%s", cupsGetUser(), httpGetHostname(NULL, buffer, sizeof(buffer)));
                num_options = cupsAddOption("notify-recipient-uri", email, num_options, &options);
              }
              break;
@@ -225,13 +225,13 @@ main(int  argc,                           /* I - Number of command-line arguments */
                                                dest->options[j].value,
                                                num_options, &options);
              }
-             else if (cupsLastError() == IPP_STATUS_ERROR_BAD_REQUEST ||
-                      cupsLastError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED)
+             else if (cupsGetError() == IPP_STATUS_ERROR_BAD_REQUEST ||
+                      cupsGetError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED)
              {
                _cupsLangPrintf(stderr, _("%s: Error - add '/version=1.1' to server name."), argv[0]);
                return (1);
              }
-             else if (cupsLastError() == IPP_STATUS_ERROR_NOT_FOUND)
+             else if (cupsGetError() == IPP_STATUS_ERROR_NOT_FOUND)
              {
                _cupsLangPrintf(stderr,
                                _("%s: Error - The printer or class does not exist."), argv[0]);
@@ -340,8 +340,8 @@ main(int  argc,                             /* I - Number of command-line arguments */
                                      dest->options[j].value,
                                      num_options, &options);
     }
-    else if (cupsLastError() == IPP_STATUS_ERROR_BAD_REQUEST ||
-            cupsLastError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED)
+    else if (cupsGetError() == IPP_STATUS_ERROR_BAD_REQUEST ||
+            cupsGetError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED)
     {
       _cupsLangPrintf(stderr,
                      _("%s: Error - add '/version=1.1' to server "
@@ -352,8 +352,8 @@ main(int  argc,                             /* I - Number of command-line arguments */
 
   if (printer == NULL)
   {
-    if (!cupsGetNamedDest(NULL, NULL, NULL) && cupsLastError() == IPP_STATUS_ERROR_NOT_FOUND)
-      _cupsLangPrintf(stderr, _("%s: Error - %s"), argv[0], cupsLastErrorString());
+    if (!cupsGetNamedDest(NULL, NULL, NULL) && cupsGetError() == IPP_STATUS_ERROR_NOT_FOUND)
+      _cupsLangPrintf(stderr, _("%s: Error - %s"), argv[0], cupsGetErrorString());
     else
       _cupsLangPrintf(stderr, _("%s: Error - scheduler not responding."), argv[0]);
 
@@ -406,7 +406,7 @@ main(int  argc,                             /* I - Number of command-line arguments */
 
     if (cupsFinishDocument(CUPS_HTTP_DEFAULT, printer) != IPP_OK)
     {
-      _cupsLangPrintf(stderr, "%s: %s", argv[0], cupsLastErrorString());
+      _cupsLangPrintf(stderr, "%s: %s", argv[0], cupsGetErrorString());
       cupsCancelJob2(CUPS_HTTP_DEFAULT, printer, job_id, 0);
       return (1);
     }
@@ -414,7 +414,7 @@ main(int  argc,                             /* I - Number of command-line arguments */
 
   if (job_id < 1)
   {
-    _cupsLangPrintf(stderr, "%s: %s", argv[0], cupsLastErrorString());
+    _cupsLangPrintf(stderr, "%s: %s", argv[0], cupsGetErrorString());
     return (1);
   }
 
index ca4acc39fe12e050dc4ba7d108463058d9ca18f6..0e7acd3cd4cbe31e13558b9d89e16ee728e938fa 100644 (file)
@@ -187,7 +187,7 @@ main(int  argc,                     /* I - Number of command-line arguments */
 
       if (cupsCancelJob2(CUPS_HTTP_DEFAULT, name, job_id, 0) != IPP_OK)
       {
-        _cupsLangPrintf(stderr, "%s: %s", argv[0], cupsLastErrorString());
+        _cupsLangPrintf(stderr, "%s: %s", argv[0], cupsGetErrorString());
        goto error;
       }
 
@@ -202,7 +202,7 @@ main(int  argc,                     /* I - Number of command-line arguments */
 
   if (!did_cancel && cupsCancelJob2(CUPS_HTTP_DEFAULT, name, 0, 0) != IPP_OK)
     {
-      _cupsLangPrintf(stderr, "%s: %s", argv[0], cupsLastErrorString());
+      _cupsLangPrintf(stderr, "%s: %s", argv[0], cupsGetErrorString());
       goto error;
     }
 
index e1b62be28484bf339e2cbc7f3ccb4ae33222a116..4c4205ab04faf2d1d145b57b9e7cb9ba003eff65 100644 (file)
@@ -568,12 +568,12 @@ do_am_class(http_t *http,         /* I - HTTP connection */
 
   ippDelete(cupsDoRequest(http, request, "/admin/"));
 
-  if (cupsLastError() == IPP_NOT_AUTHORIZED)
+  if (cupsGetError() == IPP_NOT_AUTHORIZED)
   {
     puts("Status: 401\n");
     exit(0);
   }
-  else if (cupsLastError() > IPP_OK_CONFLICT)
+  else if (cupsGetError() > IPP_OK_CONFLICT)
   {
     cgiStartHTML(title);
     cgiShowIPPError(modify ? _("Unable to modify class") :
@@ -818,8 +818,8 @@ do_am_printer(http_t *http,         /* I - HTTP connection */
     {
       fprintf(stderr,
               "ERROR: CUPS-Get-Devices request failed with status %x: %s\n",
-             cupsLastError(), cupsLastErrorString());
-      if (cupsLastError() == IPP_NOT_AUTHORIZED)
+             cupsGetError(), cupsGetErrorString());
+      if (cupsGetError() == IPP_NOT_AUTHORIZED)
       {
        puts("Status: 401\n");
        exit(0);
@@ -1187,12 +1187,12 @@ do_am_printer(http_t *http,             /* I - HTTP connection */
     else
       ippDelete(cupsDoRequest(http, request, "/admin/"));
 
-    if (cupsLastError() == IPP_NOT_AUTHORIZED)
+    if (cupsGetError() == IPP_NOT_AUTHORIZED)
     {
       puts("Status: 401\n");
       exit(0);
     }
-    else if (cupsLastError() > IPP_OK_CONFLICT)
+    else if (cupsGetError() > IPP_OK_CONFLICT)
     {
       cgiStartHTML(title);
       cgiShowIPPError(modify ? _("Unable to modify printer") :
@@ -1363,7 +1363,7 @@ do_config_server(http_t *http)            /* I - HTTP connection */
       cgiStartHTML(cgiText(_("Change Settings")));
       cgiSetVariable("MESSAGE",
                      cgiText(_("Unable to change server settings")));
-      cgiSetVariable("ERROR", cupsLastErrorString());
+      cgiSetVariable("ERROR", cupsGetErrorString());
       cgiCopyTemplateLang("error.tmpl");
       cgiEndHTML();
       return;
@@ -1484,7 +1484,7 @@ do_config_server(http_t *http)            /* I - HTTP connection */
 
       if (!cupsAdminSetServerSettings(http, num_newsettings, newsettings))
       {
-        if (cupsLastError() == IPP_NOT_AUTHORIZED)
+        if (cupsGetError() == IPP_NOT_AUTHORIZED)
        {
          puts("Status: 401\n");
          exit(0);
@@ -1493,7 +1493,7 @@ do_config_server(http_t *http)            /* I - HTTP connection */
        cgiStartHTML(cgiText(_("Change Settings")));
        cgiSetVariable("MESSAGE",
                        cgiText(_("Unable to change server settings")));
-       cgiSetVariable("ERROR", cupsLastErrorString());
+       cgiSetVariable("ERROR", cupsGetErrorString());
        cgiCopyTemplateLang("error.tmpl");
       }
       else
@@ -1831,12 +1831,12 @@ do_delete_class(http_t *http)           /* I - HTTP connection */
   * Show the results...
   */
 
-  if (cupsLastError() == IPP_NOT_AUTHORIZED)
+  if (cupsGetError() == IPP_NOT_AUTHORIZED)
   {
     puts("Status: 401\n");
     exit(0);
   }
-  else if (cupsLastError() <= IPP_OK_CONFLICT)
+  else if (cupsGetError() <= IPP_OK_CONFLICT)
   {
    /*
     * Redirect successful updates back to the classes page...
@@ -1847,7 +1847,7 @@ do_delete_class(http_t *http)             /* I - HTTP connection */
 
   cgiStartHTML(cgiText(_("Delete Class")));
 
-  if (cupsLastError() > IPP_OK_CONFLICT)
+  if (cupsGetError() > IPP_OK_CONFLICT)
     cgiShowIPPError(_("Unable to delete class"));
   else
     cgiCopyTemplateLang("class-deleted.tmpl");
@@ -1916,12 +1916,12 @@ do_delete_printer(http_t *http)         /* I - HTTP connection */
   * Show the results...
   */
 
-  if (cupsLastError() == IPP_NOT_AUTHORIZED)
+  if (cupsGetError() == IPP_NOT_AUTHORIZED)
   {
     puts("Status: 401\n");
     exit(0);
   }
-  else if (cupsLastError() <= IPP_OK_CONFLICT)
+  else if (cupsGetError() <= IPP_OK_CONFLICT)
   {
    /*
     * Redirect successful updates back to the printers page...
@@ -1932,7 +1932,7 @@ do_delete_printer(http_t *http)           /* I - HTTP connection */
 
   cgiStartHTML(cgiText(_("Delete Printer")));
 
-  if (cupsLastError() > IPP_OK_CONFLICT)
+  if (cupsGetError() > IPP_OK_CONFLICT)
     cgiShowIPPError(_("Unable to delete printer"));
   else
     cgiCopyTemplateLang("printer-deleted.tmpl");
@@ -2165,7 +2165,7 @@ do_menu(http_t *http)                     /* I - HTTP connection */
   {
     cgiSetVariable("SETTINGS_MESSAGE",
                    cgiText(_("Unable to open cupsd.conf file:")));
-    cgiSetVariable("SETTINGS_ERROR", cupsLastErrorString());
+    cgiSetVariable("SETTINGS_ERROR", cupsGetErrorString());
   }
 
   if ((val = cupsGetOption(CUPS_SERVER_DEBUG_LOGGING, num_settings,
@@ -2341,12 +2341,12 @@ do_set_allowed_users(http_t *http)      /* I - HTTP connection */
 
     cgiStartHTML(cgiText(_("Set Allowed Users")));
 
-    if (cupsLastError() == IPP_NOT_AUTHORIZED)
+    if (cupsGetError() == IPP_NOT_AUTHORIZED)
     {
       puts("Status: 401\n");
       exit(0);
     }
-    else if (cupsLastError() > IPP_OK_CONFLICT)
+    else if (cupsGetError() > IPP_OK_CONFLICT)
       cgiShowIPPError(_("Unable to get printer attributes"));
     else
       cgiCopyTemplateLang("users.tmpl");
@@ -2489,12 +2489,12 @@ do_set_allowed_users(http_t *http)      /* I - HTTP connection */
 
     ippDelete(cupsDoRequest(http, request, "/admin/"));
 
-    if (cupsLastError() == IPP_NOT_AUTHORIZED)
+    if (cupsGetError() == IPP_NOT_AUTHORIZED)
     {
       puts("Status: 401\n");
       exit(0);
     }
-    else if (cupsLastError() > IPP_OK_CONFLICT)
+    else if (cupsGetError() > IPP_OK_CONFLICT)
     {
       cgiStartHTML(cgiText(_("Set Allowed Users")));
       cgiShowIPPError(_("Unable to change printer"));
@@ -2576,12 +2576,12 @@ do_set_default(http_t *http)            /* I - HTTP connection */
 
   ippDelete(cupsDoRequest(http, request, "/admin/"));
 
-  if (cupsLastError() == IPP_NOT_AUTHORIZED)
+  if (cupsGetError() == IPP_NOT_AUTHORIZED)
   {
     puts("Status: 401\n");
     exit(0);
   }
-  else if (cupsLastError() > IPP_OK_CONFLICT)
+  else if (cupsGetError() > IPP_OK_CONFLICT)
   {
     cgiStartHTML(title);
     cgiShowIPPError(_("Unable to set server default"));
@@ -3309,12 +3309,12 @@ do_set_options(http_t *http,            /* I - HTTP connection */
     else
       ippDelete(cupsDoRequest(http, request, "/admin/"));
 
-    if (cupsLastError() == IPP_NOT_AUTHORIZED)
+    if (cupsGetError() == IPP_NOT_AUTHORIZED)
     {
       puts("Status: 401\n");
       exit(0);
     }
-    else if (cupsLastError() > IPP_OK_CONFLICT)
+    else if (cupsGetError() > IPP_OK_CONFLICT)
     {
       cgiStartHTML(title);
       cgiShowIPPError(_("Unable to set options"));
@@ -3408,12 +3408,12 @@ do_set_sharing(http_t *http)            /* I - HTTP connection */
     ippDelete(response);
   }
 
-  if (cupsLastError() == IPP_NOT_AUTHORIZED)
+  if (cupsGetError() == IPP_NOT_AUTHORIZED)
   {
     puts("Status: 401\n");
     exit(0);
   }
-  else if (cupsLastError() > IPP_OK_CONFLICT)
+  else if (cupsGetError() > IPP_OK_CONFLICT)
   {
     cgiStartHTML(cgiText(_("Set Publishing")));
     cgiShowIPPError(_("Unable to change printer-is-shared attribute"));
index 718604ab2bf9cd2f821a9f8268dd82f49ccccf81..d8af6af9e6c633c31c298f4157826e2531eb8058 100644 (file)
@@ -235,12 +235,12 @@ do_class_op(http_t      *http,            /* I - HTTP connection */
   snprintf(resource, sizeof(resource), "/classes/%s", printer);
   ippDelete(cupsDoRequest(http, request, resource));
 
-  if (cupsLastError() == IPP_NOT_AUTHORIZED)
+  if (cupsGetError() == IPP_NOT_AUTHORIZED)
   {
     puts("Status: 401\n");
     exit(0);
   }
-  else if (cupsLastError() > IPP_OK_CONFLICT)
+  else if (cupsGetError() > IPP_OK_CONFLICT)
   {
     cgiStartHTML(title);
     cgiShowIPPError(_("Unable to do maintenance command"));
index 939675e064dad13725d4359df080f774b464ce6a..cb770c3c64034ada7191a13c0276b81ff96e779c 100644 (file)
@@ -472,7 +472,7 @@ cgiMoveJobs(http_t     *http,               /* I - Connection to server */
 
     job_printer_name = strrchr(job_printer_uri, '/') + 1;
 
-    if (cupsLastError() <= IPP_OK_CONFLICT)
+    if (cupsGetError() <= IPP_OK_CONFLICT)
     {
       const char *path = strstr(job_printer_uri, "/printers/");
       if (!path)
@@ -494,7 +494,7 @@ cgiMoveJobs(http_t     *http,               /* I - Connection to server */
     else
       cgiStartHTML(cgiText(_("Move All Jobs")));
 
-    if (cupsLastError() > IPP_OK_CONFLICT)
+    if (cupsGetError() > IPP_OK_CONFLICT)
     {
       if (job_id)
        cgiShowIPPError(_("Unable to move job"));
@@ -575,7 +575,7 @@ cgiPrintCommand(http_t     *http,   /* I - Connection to server */
                              1, &hold_option)) < 1)
   {
     cgiSetVariable("MESSAGE", cgiText(_("Unable to send command to printer driver")));
-    cgiSetVariable("ERROR", cupsLastErrorString());
+    cgiSetVariable("ERROR", cupsGetErrorString());
     cgiStartHTML(title);
     cgiCopyTemplateLang("error.tmpl");
     cgiEndHTML();
@@ -592,10 +592,10 @@ cgiPrintCommand(http_t     *http, /* I - Connection to server */
   if (status == HTTP_CONTINUE)
     cupsFinishDocument(http, dest);
 
-  if (cupsLastError() >= IPP_REDIRECTION_OTHER_SITE)
+  if (cupsGetError() >= IPP_REDIRECTION_OTHER_SITE)
   {
     cgiSetVariable("MESSAGE", cgiText(_("Unable to send command to printer driver")));
-    cgiSetVariable("ERROR", cupsLastErrorString());
+    cgiSetVariable("ERROR", cupsGetErrorString());
     cgiStartHTML(title);
     cgiCopyTemplateLang("error.tmpl");
     cgiEndHTML();
@@ -752,7 +752,7 @@ cgiPrintTestPage(http_t     *http,  /* I - Connection to server */
     ippDelete(response);
   }
 
-  if (cupsLastError() <= IPP_OK_CONFLICT)
+  if (cupsGetError() <= IPP_OK_CONFLICT)
   {
    /*
     * Automatically reload the printer status page...
@@ -762,7 +762,7 @@ cgiPrintTestPage(http_t     *http,  /* I - Connection to server */
     snprintf(refresh, sizeof(refresh), "2;URL=%s", uri);
     cgiSetVariable("refresh_page", refresh);
   }
-  else if (cupsLastError() == IPP_NOT_AUTHORIZED)
+  else if (cupsGetError() == IPP_NOT_AUTHORIZED)
   {
     puts("Status: 401\n");
     exit(0);
@@ -770,7 +770,7 @@ cgiPrintTestPage(http_t     *http,  /* I - Connection to server */
 
   cgiStartHTML(cgiText(_("Print Test Page")));
 
-  if (cupsLastError() > IPP_OK_CONFLICT)
+  if (cupsGetError() > IPP_OK_CONFLICT)
     cgiShowIPPError(_("Unable to print test page"));
   else
   {
@@ -1332,7 +1332,7 @@ void
 cgiShowIPPError(const char *message)   /* I - Contextual message */
 {
   cgiSetVariable("MESSAGE", cgiText(message));
-  cgiSetVariable("ERROR", cupsLastErrorString());
+  cgiSetVariable("ERROR", cupsGetErrorString());
   cgiCopyTemplateLang("error.tmpl");
 }
 
index d6da74444aba4150fa3f2e77ac6811af6f2bb621..f958b449865b749f91d71883bf8cb69dbd28b7db 100644 (file)
@@ -161,7 +161,7 @@ do_job_op(http_t      *http,                /* I - HTTP connection */
 
   ippDelete(cupsDoRequest(http, request, "/jobs"));
 
-  if (cupsLastError() <= IPP_OK_CONFLICT && getenv("HTTP_REFERER"))
+  if (cupsGetError() <= IPP_OK_CONFLICT && getenv("HTTP_REFERER"))
   {
    /*
     * Redirect successful updates back to the parent page...
@@ -174,7 +174,7 @@ do_job_op(http_t      *http,                /* I - HTTP connection */
     cgiFormEncode(url + 6, getenv("HTTP_REFERER"), sizeof(url) - 6);
     cgiSetVariable("refresh_page", url);
   }
-  else if (cupsLastError() == IPP_NOT_AUTHORIZED)
+  else if (cupsGetError() == IPP_NOT_AUTHORIZED)
   {
     puts("Status: 401\n");
     exit(0);
@@ -182,7 +182,7 @@ do_job_op(http_t      *http,                /* I - HTTP connection */
 
   cgiStartHTML(cgiText(_("Jobs")));
 
-  if (cupsLastError() > IPP_OK_CONFLICT)
+  if (cupsGetError() > IPP_OK_CONFLICT)
     cgiShowIPPError(_("Job operation failed"));
   else if (op == IPP_CANCEL_JOB)
     cgiCopyTemplateLang("job-cancel.tmpl");
index 2a33b6832d6d2f124b07e91c57f134a19530e500..937f5e7848a3b58aa43f9a9118661053295113ba 100644 (file)
@@ -244,12 +244,12 @@ do_printer_op(http_t      *http,  /* I - HTTP connection */
   snprintf(resource, sizeof(resource), "/printers/%s", printer);
   ippDelete(cupsDoRequest(http, request, resource));
 
-  if (cupsLastError() == IPP_NOT_AUTHORIZED)
+  if (cupsGetError() == IPP_NOT_AUTHORIZED)
   {
     puts("Status: 401\n");
     exit(0);
   }
-  else if (cupsLastError() > IPP_OK_CONFLICT)
+  else if (cupsGetError() > IPP_OK_CONFLICT)
   {
     cgiStartHTML(title);
     cgiShowIPPError(_("Unable to do maintenance command"));
index 3c1c1fa71420217cbdbf56873733b46443b15173..6aae62939ad00d0ea911dea15460c50eaf650b09 100644 (file)
@@ -47,7 +47,7 @@ enable_web_interface(void)
 
   if (!<a href="#cupsAdminGetServerSettings">cupsAdminGetServerSettings</a>(CUPS_HTTP_DEFAULT, &amp;num_settings, &amp;settings))
   {
-    fprintf(stderr, "ERROR: Unable to get server settings: %s\n", cupsLastErrorString());
+    fprintf(stderr, "ERROR: Unable to get server settings: %s\n", cupsGetErrorString());
     return;
   }
 
@@ -55,7 +55,7 @@ enable_web_interface(void)
 
   if (!<a href="#cupsAdminSetServerSettings">cupsAdminSetServerSettings</a>(CUPS_HTTP_DEFAULT, num_settings, settings))
   {
-    fprintf(stderr, "ERROR: Unable to set server settings: %s\n", cupsLastErrorString());
+    fprintf(stderr, "ERROR: Unable to set server settings: %s\n", cupsGetErrorString());
   }
 
   <a href="api-cups.html#cupsFreeOptions">cupsFreeOptions</a>(num_settings, settings);
index dbcc0a8a8f1f6b3719417498d58f2ff86232a805..0b91760df2514d569954913d8764cceb24d311c9 100644 (file)
@@ -264,7 +264,7 @@ cupsDoAuthentication(
       if (cups_auth_param(schemedata, "username", default_username, sizeof(default_username)))
        cupsSetUser(default_username);
 
-      snprintf(prompt, sizeof(prompt), _cupsLangString(cg->lang_default, _("Password for %s on %s? ")), cupsUser(), http->hostname[0] == '/' ? "localhost" : http->hostname);
+      snprintf(prompt, sizeof(prompt), _cupsLangString(cg->lang_default, _("Password for %s on %s? ")), cupsGetUser(), http->hostname[0] == '/' ? "localhost" : http->hostname);
 
       http->digest_tries  = _cups_strncasecmp(scheme, "Digest", 6) != 0;
       http->userpass[0]   = '\0';
@@ -276,7 +276,7 @@ cupsDoAuthentication(
        return (-1);
       }
 
-      snprintf(http->userpass, sizeof(http->userpass), "%s:%s", cupsUser(), password);
+      snprintf(http->userpass, sizeof(http->userpass), "%s:%s", cupsGetUser(), password);
     }
     else if (http->status == HTTP_STATUS_UNAUTHORIZED)
       http->digest_tries ++;
@@ -420,7 +420,7 @@ _cupsSetNegotiateAuthString(
 
     snprintf(prompt, sizeof(prompt),
              _cupsLangString(cg->lang_default, _("Password for %s on %s? ")),
-            cupsUser(), http->gsshost);
+            cupsGetUser(), http->gsshost);
 
     if ((password = cupsGetPassword2(prompt, http, method, resource)) == NULL)
       return (CUPS_GSS_FAIL);
@@ -429,7 +429,7 @@ _cupsSetNegotiateAuthString(
     * Try to acquire credentials...
     */
 
-    username = cupsUser();
+    username = cupsGetUser();
     if (!strchr(username, '@'))
     {
       snprintf(userbuf, sizeof(userbuf), "%s@%s", username, http->gsshost);
@@ -1084,14 +1084,14 @@ cups_local_auth(http_t *http)           /* I - HTTP connection to server */
       cups_auth_find(www_auth, "PeerCred"))
   {
    /*
-    * Verify that the current cupsUser() matches the current UID...
+    * Verify that the current cupsGetUser() matches the current UID...
     */
 
     struct passwd      pwd;            /* Password information */
     struct passwd      *result;        /* Auxiliary pointer */
     const char         *username;      /* Current username */
 
-    username = cupsUser();
+    username = cupsGetUser();
 
     getpwnam_r(username, &pwd, cg->pw_buf, PW_BUF_SIZE, &result);
     if (result && pwd.pw_uid == getuid())
index e73c61299edaecbc678a228d7a589da4ba373f20..d39a099b786ab5f09c0e37a056ae909f1a0a8af5 100644 (file)
@@ -288,7 +288,7 @@ extern void         _cupsSetHTTPError(http_status_t status) _CUPS_INTERNAL;
 #  ifdef HAVE_GSSAPI
 extern int             _cupsSetNegotiateAuthString(http_t *http, const char *method, const char *resource) _CUPS_PRIVATE;
 #  endif /* HAVE_GSSAPI */
-extern char            *_cupsUserDefault(char *name, size_t namesize) _CUPS_INTERNAL;
+extern char            *_cupsGetUserDefault(char *name, size_t namesize) _CUPS_INTERNAL;
 
 
 /*
index a74d1dc688753c51e5656830d899f3917b1b2d0c..bba0b5059101fb2ecd9dfd71398223eaf46bc0eb 100644 (file)
@@ -1,47 +1,36 @@
-/*
- * API definitions for CUPS.
- *
- * Copyright Â©Â 2021-2023 by OpenPrinting.
- * Copyright Â©Â 2007-2020 by Apple Inc.
- * Copyright Â©Â 1997-2007 by Easy Software Products.
- *
- * Licensed under Apache License v2.0.  See the file "LICENSE" for more
- * information.
- */
+//
+// API definitions for CUPS.
+//
+// Copyright Â©Â 2021-2023 by OpenPrinting.
+// Copyright Â©Â 2007-2020 by Apple Inc.
+// Copyright Â©Â 1997-2007 by Easy Software Products.
+//
+// Licensed under Apache License v2.0.  See the file "LICENSE" for more
+// information.
+//
 
 #ifndef _CUPS_CUPS_H_
 #  define _CUPS_CUPS_H_
-
-/*
- * Include necessary headers...
- */
-
+#  include <stdbool.h>
 #  include <sys/types.h>
 #  if defined(_WIN32) && !defined(__CUPS_SSIZE_T_DEFINED)
 #    define __CUPS_SSIZE_T_DEFINED
 #    include <stddef.h>
-/* Windows does not support the ssize_t type, so map it to __int64... */
-typedef __int64 ssize_t;                       /* @private@ */
-#  endif /* _WIN32 && !__CUPS_SSIZE_T_DEFINED */
-
+// Windows does not support the ssize_t type, so map it to __int64...
+typedef __int64 ssize_t;                       // @private@
+#  endif // _WIN32 && !__CUPS_SSIZE_T_DEFINED
 #  include "file.h"
 #  include "ipp.h"
 #  include "language.h"
 #  include "pwg.h"
-
-
-/*
- * C++ magic...
- */
-
 #  ifdef __cplusplus
 extern "C" {
-#  endif /* __cplusplus */
+#  endif // __cplusplus
 
 
-/*
- * Constants...
- */
+//
+// Constants...
+//
 
 #  define CUPS_VERSION                 2.0500
 #  define CUPS_VERSION_MAJOR           2
@@ -49,8 +38,7 @@ extern "C" {
 #  define CUPS_VERSION_PATCH           0
 
 #  define CUPS_BC_FD                   3
-                                       /* Back-channel file descriptor for
-                                        * select/poll */
+                                       // Back-channel file descriptor for select/poll
 #  define CUPS_DATE_ANY                        (time_t)-1
 #  define CUPS_EXCLUDE_NONE            (const char *)0
 #  define CUPS_FORMAT_AUTO             "application/octet-stream"
@@ -66,48 +54,8 @@ extern "C" {
 #  define CUPS_JOBID_CURRENT           0
 #  define CUPS_LENGTH_VARIABLE         (ssize_t)0
 #  define CUPS_TIMEOUT_DEFAULT         0
-#  define CUPS_WHICHJOBS_ALL           -1
-#  define CUPS_WHICHJOBS_ACTIVE                0
-#  define CUPS_WHICHJOBS_COMPLETED     1
-
-/* Flags for cupsConnectDest and cupsEnumDests */
-#  define CUPS_DEST_FLAGS_NONE         0x00
-                                       /* No flags are set */
-#  define CUPS_DEST_FLAGS_UNCONNECTED  0x01
-                                       /* There is no connection */
-#  define CUPS_DEST_FLAGS_MORE         0x02
-                                       /* There are more destinations */
-#  define CUPS_DEST_FLAGS_REMOVED      0x04
-                                       /* The destination has gone away */
-#  define CUPS_DEST_FLAGS_ERROR                0x08
-                                       /* An error occurred */
-#  define CUPS_DEST_FLAGS_RESOLVING    0x10
-                                       /* The destination address is being
-                                        * resolved */
-#  define CUPS_DEST_FLAGS_CONNECTING   0x20
-                                       /* A connection is being established */
-#  define CUPS_DEST_FLAGS_CANCELED     0x40
-                                       /* Operation was canceled */
-#  define CUPS_DEST_FLAGS_DEVICE        0x80
-                                        /* For @link cupsConnectDest@: Connect to device */
-
-/* Flags for cupsGetDestMediaByName/Size */
-#  define CUPS_MEDIA_FLAGS_DEFAULT     0x00
-                                       /* Find the closest size supported by
-                                        * the printer */
-#  define CUPS_MEDIA_FLAGS_BORDERLESS  0x01
-                                       /* Find a borderless size */
-#  define CUPS_MEDIA_FLAGS_DUPLEX      0x02
-                                       /* Find a size compatible with 2-sided
-                                        * printing */
-#  define CUPS_MEDIA_FLAGS_EXACT       0x04
-                                       /* Find an exact match for the size */
-#  define CUPS_MEDIA_FLAGS_READY       0x08
-                                       /* If the printer supports media
-                                        * sensing, find the size amongst the
-                                        * "ready" media. */
-
-/* Options and values */
+
+// Options and values
 #  define CUPS_COPIES                  "copies"
 #  define CUPS_COPIES_SUPPORTED                "copies-supported"
 
@@ -174,8 +122,9 @@ extern "C" {
 #  define CUPS_PRINT_COLOR_MODE_SUPPORTED "print-color-mode-supported"
 
 #  define CUPS_PRINT_COLOR_MODE_AUTO   "auto"
-#  define CUPS_PRINT_COLOR_MODE_MONOCHROME "monochrome"
+#  define CUPS_PRINT_COLOR_MODE_BI_LEVEL "bi-level"
 #  define CUPS_PRINT_COLOR_MODE_COLOR  "color"
+#  define CUPS_PRINT_COLOR_MODE_MONOCHROME "monochrome"
 
 #  define CUPS_PRINT_QUALITY           "print-quality"
 #  define CUPS_PRINT_QUALITY_SUPPORTED "print-quality-supported"
@@ -192,432 +141,360 @@ extern "C" {
 #  define CUPS_SIDES_TWO_SIDED_LANDSCAPE "two-sided-short-edge"
 
 
-/*
- * Types and structures...
- */
-
-typedef unsigned cups_ptype_t;         /* Printer type/capability bits */
-enum cups_ptype_e                      /* Printer type/capability bit
-                                        * constants */
-{                                      /* Not a typedef'd enum so we can OR */
-  CUPS_PRINTER_LOCAL = 0x0000,         /* Local printer or class */
-  CUPS_PRINTER_CLASS = 0x0001,         /* Printer class */
-  CUPS_PRINTER_REMOTE = 0x0002,                /* Remote printer or class */
-  CUPS_PRINTER_BW = 0x0004,            /* Can do B&W printing */
-  CUPS_PRINTER_COLOR = 0x0008,         /* Can do color printing */
-  CUPS_PRINTER_DUPLEX = 0x0010,                /* Can do two-sided printing */
-  CUPS_PRINTER_STAPLE = 0x0020,                /* Can staple output */
-  CUPS_PRINTER_COPIES = 0x0040,                /* Can do copies in hardware */
-  CUPS_PRINTER_COLLATE = 0x0080,       /* Can quickly collate copies */
-  CUPS_PRINTER_PUNCH = 0x0100,         /* Can punch output */
-  CUPS_PRINTER_COVER = 0x0200,         /* Can cover output */
-  CUPS_PRINTER_BIND = 0x0400,          /* Can bind output */
-  CUPS_PRINTER_SORT = 0x0800,          /* Can sort output */
-  CUPS_PRINTER_SMALL = 0x1000,         /* Can print on Letter/Legal/A4-size media */
-  CUPS_PRINTER_MEDIUM = 0x2000,                /* Can print on Tabloid/B/C/A3/A2-size media */
-  CUPS_PRINTER_LARGE = 0x4000,         /* Can print on D/E/A1/A0-size media */
-  CUPS_PRINTER_VARIABLE = 0x8000,      /* Can print on rolls and custom-size media */
-  CUPS_PRINTER_IMPLICIT = 0x10000,     /* Implicit class @private@
-                                        * @since Deprecated@ */
-  CUPS_PRINTER_DEFAULT = 0x20000,      /* Default printer on network */
-  CUPS_PRINTER_FAX = 0x40000,          /* Fax queue */
-  CUPS_PRINTER_REJECTING = 0x80000,    /* Printer is rejecting jobs */
-  CUPS_PRINTER_DELETE = 0x100000,      /* Delete printer
-                                        * @deprecated@ @exclude all@ */
-  CUPS_PRINTER_NOT_SHARED = 0x200000,  /* Printer is not shared
-                                        * @since CUPS 1.2/macOS 10.5@ */
-  CUPS_PRINTER_AUTHENTICATED = 0x400000,/* Printer requires authentication
-                                        * @since CUPS 1.2/macOS 10.5@ */
-  CUPS_PRINTER_COMMANDS = 0x800000,    /* Printer supports maintenance commands
-                                        * @since CUPS 1.2/macOS 10.5@ */
-  CUPS_PRINTER_DISCOVERED = 0x1000000, /* Printer was discovered @since CUPS 1.2/macOS 10.5@ */
-  CUPS_PRINTER_SCANNER = 0x2000000,    /* Scanner-only device
-                                        * @since CUPS 1.4/macOS 10.6@ @private@ */
-  CUPS_PRINTER_MFP = 0x4000000,                /* Printer with scanning capabilities
-                                        * @since CUPS 1.4/macOS 10.6@ @private@ */
-  CUPS_PRINTER_3D = 0x8000000,         /* Printer with 3D capabilities @exclude all@ @private@ */
-  CUPS_PRINTER_OPTIONS = 0x6fffc       /* ~(CLASS | REMOTE | IMPLICIT |
-                                        * DEFAULT | FAX | REJECTING | DELETE |
-                                        * NOT_SHARED | AUTHENTICATED |
-                                        * COMMANDS | DISCOVERED) @private@ */
+//
+// Types and structures...
+//
+
+enum cups_credpurpose_e                        // X.509 credential purposes
+{
+  CUPS_CREDPURPOSE_SERVER_AUTH = 0x01,         // serverAuth
+  CUPS_CREDPURPOSE_CLIENT_AUTH = 0x02,         // clientAuth
+  CUPS_CREDPURPOSE_CODE_SIGNING = 0x04,                // codeSigning
+  CUPS_CREDPURPOSE_EMAIL_PROTECTION = 0x08,    // emailProtection
+  CUPS_CREDPURPOSE_TIME_STAMPING = 0x10,       // timeStamping
+  CUPS_CREDPURPOSE_OCSP_SIGNING = 0x20,                // OCSPSigning
+  CUPS_CREDPURPOSE_ALL = 0x3f                  // All purposes
 };
+typedef unsigned cups_credpurpose_t;   // Combined X.509 credential purposes for @link cupsCreateCredentials@ and @link cupsCreateCredentialsRequest@
 
-typedef struct cups_option_s           /**** Printer Options ****/
+typedef enum cups_credtype_e           // X.509 credential types for @link cupsCreateCredentials@ and @link cupsCreateCredentialsRequest@
+{
+  CUPS_CREDTYPE_DEFAULT,                       // Default type
+  CUPS_CREDTYPE_RSA_2048_SHA256,               // RSA with 2048-bit keys and SHA-256 hash
+  CUPS_CREDTYPE_RSA_3072_SHA256,               // RSA with 3072-bit keys and SHA-256 hash
+  CUPS_CREDTYPE_RSA_4096_SHA256,               // RSA with 4096-bit keys and SHA-256 hash
+  CUPS_CREDTYPE_ECDSA_P256_SHA256,             // ECDSA using the P-256 curve with SHA-256 hash
+  CUPS_CREDTYPE_ECDSA_P384_SHA256,             // ECDSA using the P-384 curve with SHA-256 hash
+  CUPS_CREDTYPE_ECDSA_P521_SHA256              // ECDSA using the P-521 curve with SHA-256 hash
+} cups_credtype_t;
+
+enum cups_credusage_e                  // X.509 keyUsage flags
 {
-  char         *name;                  /* Name of option */
-  char         *value;                 /* Value of option */
+  CUPS_CREDUSAGE_DIGITAL_SIGNATURE = 0x001,    // digitalSignature
+  CUPS_CREDUSAGE_NON_REPUDIATION = 0x002,      // nonRepudiation/contentCommitment
+  CUPS_CREDUSAGE_KEY_ENCIPHERMENT = 0x004,     // keyEncipherment
+  CUPS_CREDUSAGE_DATA_ENCIPHERMENT = 0x008,    // dataEncipherment
+  CUPS_CREDUSAGE_KEY_AGREEMENT = 0x010,                // keyAgreement
+  CUPS_CREDUSAGE_KEY_CERT_SIGN = 0x020,                // keyCertSign
+  CUPS_CREDUSAGE_CRL_SIGN = 0x040,             // cRLSign
+  CUPS_CREDUSAGE_ENCIPHER_ONLY = 0x080,                // encipherOnly
+  CUPS_CREDUSAGE_DECIPHER_ONLY = 0x100,                // decipherOnly
+  CUPS_CREDUSAGE_DEFAULT_CA = 0x061,           // Defaults for CA certs
+  CUPS_CREDUSAGE_DEFAULT_TLS = 0x005,          // Defaults for TLS certs
+  CUPS_CREDUSAGE_ALL = 0x1ff                   // All keyUsage flags
+};
+typedef unsigned cups_credusage_t;     // Combined X.509 keyUsage flags for @link cupsCreateCredentials@ and @link cupsCreateCredentialsRequest@
+
+enum cups_dest_flags_e                 // Flags for @link cupsConnectDest@ and @link cupsEnumDests@
+{
+  CUPS_DEST_FLAGS_NONE = 0x00,                 // No flags are set
+  CUPS_DEST_FLAGS_UNCONNECTED = 0x01,          // There is no connection
+  CUPS_DEST_FLAGS_MORE = 0x02,                 // There are more destinations
+  CUPS_DEST_FLAGS_REMOVED = 0x04,              // The destination has gone away
+  CUPS_DEST_FLAGS_ERROR = 0x08,                        // An error occurred
+  CUPS_DEST_FLAGS_RESOLVING = 0x10,            // The destination address is being resolved
+  CUPS_DEST_FLAGS_CONNECTING = 0x20,           // A connection is being established
+  CUPS_DEST_FLAGS_CANCELED = 0x40,             // Operation was canceled
+  CUPS_DEST_FLAGS_DEVICE = 0x80                        // For @link cupsConnectDest@: Connect to device
+};
+typedef unsigned cups_dest_flags_t;    // Combined flags for @link cupsConnectDest@ and @link cupsEnumDests@
+
+enum cups_media_flags_e                        // Flags for @link cupsGetDestMediaByName@ and @link cupsGetDestMediaBySize@
+{
+  CUPS_MEDIA_FLAGS_DEFAULT = 0x00,             // Find the closest size supported by the printer
+  CUPS_MEDIA_FLAGS_BORDERLESS = 0x01,          // Find a borderless size
+  CUPS_MEDIA_FLAGS_DUPLEX = 0x02,              // Find a size compatible with 2-sided printing
+  CUPS_MEDIA_FLAGS_EXACT = 0x04,               // Find an exact match for the size
+  CUPS_MEDIA_FLAGS_READY = 0x08                        // If the printer supports media sensing, find the size amongst the "ready" media.
+};
+typedef unsigned cups_media_flags_t;   // Combined flags for @link cupsGetDestMediaByName@ and @link cupsGetDestMediaBySize@
+
+enum cups_ptype_e                      // Printer type/capability flags
+{
+  CUPS_PRINTER_LOCAL = 0x0000,                 // Local printer or class
+  CUPS_PRINTER_CLASS = 0x0001,                 // Printer class
+  CUPS_PRINTER_REMOTE = 0x0002,                        // Remote printer or class
+  CUPS_PRINTER_BW = 0x0004,                    // Can do B&W printing
+  CUPS_PRINTER_COLOR = 0x0008,                 // Can do color printing
+  CUPS_PRINTER_DUPLEX = 0x0010,                        // Can do two-sided printing
+  CUPS_PRINTER_STAPLE = 0x0020,                        // Can staple output
+  CUPS_PRINTER_COPIES = 0x0040,                        // Can do copies in hardware
+  CUPS_PRINTER_COLLATE = 0x0080,               // Can quickly collate copies
+  CUPS_PRINTER_PUNCH = 0x0100,                 // Can punch output
+  CUPS_PRINTER_COVER = 0x0200,                 // Can cover output
+  CUPS_PRINTER_BIND = 0x0400,                  // Can bind output
+  CUPS_PRINTER_SORT = 0x0800,                  // Can sort output
+  CUPS_PRINTER_SMALL = 0x1000,                 // Can print on Letter/Legal/A4-size media
+  CUPS_PRINTER_MEDIUM = 0x2000,                        // Can print on Tabloid/B/C/A3/A2-size media
+  CUPS_PRINTER_LARGE = 0x4000,                 // Can print on D/E/A1/A0-size media
+  CUPS_PRINTER_VARIABLE = 0x8000,              // Can print on rolls and custom-size media
+  CUPS_PRINTER_DEFAULT = 0x20000,              // Default printer on network
+  CUPS_PRINTER_FAX = 0x40000,                  // Fax queue
+  CUPS_PRINTER_REJECTING = 0x80000,            // Printer is rejecting jobs
+  CUPS_PRINTER_NOT_SHARED = 0x200000,          // Printer is not shared
+  CUPS_PRINTER_AUTHENTICATED = 0x400000,       // Printer requires authentication
+  CUPS_PRINTER_COMMANDS = 0x800000,            // Printer supports maintenance commands
+  CUPS_PRINTER_DISCOVERED = 0x1000000,         // Printer was discovered
+  CUPS_PRINTER_SCANNER = 0x2000000,            // Scanner-only device
+  CUPS_PRINTER_MFP = 0x4000000,                        // Printer with scanning capabilities
+  CUPS_PRINTER_3D = 0x8000000,                 // Printer with 3D capabilities @exclude all@ @private@ @deprecated@
+  CUPS_PRINTER_OPTIONS = 0x6fffc               // ~(CLASS | REMOTE | IMPLICIT | DEFAULT | FAX | REJECTING | DELETE | NOT_SHARED | AUTHENTICATED | COMMANDS | DISCOVERED) @private@
+};
+typedef unsigned cups_ptype_t;         // Combined printer type/capability flags
+
+typedef enum cups_whichjobs_e          // Which jobs for @link cupsGetJobs@
+{
+  CUPS_WHICHJOBS_ALL = -1,             // All jobs
+  CUPS_WHICHJOBS_ACTIVE,               // Pending/held/processing jobs
+  CUPS_WHICHJOBS_COMPLETED             // Completed/canceled/aborted jobs
+} cups_whichjobs_t;
+
+typedef struct cups_option_s           // Printer Options
+{
+  char         *name;                  // Name of option
+  char         *value;                 // Value of option
 } cups_option_t;
 
-typedef struct cups_dest_s             /**** Destination ****/
+typedef struct cups_dest_s             // Destination
 {
-  char         *name,                  /* Printer or class name */
-               *instance;              /* Local instance name or NULL */
-  int          is_default;             /* Is this printer the default? */
-  int          num_options;            /* Number of options */
-  cups_option_t        *options;               /* Options */
+  char         *name,                  // Printer or class name
+               *instance;              // Local instance name or `NULL`
+  int          is_default;             // Is this printer the default?
+  int          num_options;            // Number of options
+  cups_option_t        *options;               // Options
 } cups_dest_t;
 
 typedef struct _cups_dinfo_s cups_dinfo_t;
-                                       /* Destination capability and status
-                                        * information @since CUPS 1.6/macOS 10.8@ */
+                                       // Destination capability and status information @since CUPS 1.6/macOS 10.8@
 
-typedef struct cups_job_s              /**** Job ****/
+typedef struct cups_job_s              // Job information
 {
-  int          id;                     /* The job ID */
-  char         *dest;                  /* Printer or class name */
-  char         *title;                 /* Title/job name */
-  char         *user;                  /* User that submitted the job */
-  char         *format;                /* Document format */
-  ipp_jstate_t state;                  /* Job state */
-  int          size;                   /* Size in kilobytes */
-  int          priority;               /* Priority (1-100) */
-  time_t       completed_time;         /* Time the job was completed */
-  time_t       creation_time;          /* Time the job was created */
-  time_t       processing_time;        /* Time the job was processed */
+  int          id;                     // The job ID
+  char         *dest;                  // Printer or class name
+  char         *title;                 // Title/job name
+  char         *user;                  // User that submitted the job
+  char         *format;                // Document format
+  ipp_jstate_t state;                  // Job state
+  int          size;                   // Size in kilobytes
+  int          priority;               // Priority (1-100)
+  time_t       completed_time;         // Time the job was completed
+  time_t       creation_time;          // Time the job was created
+  time_t       processing_time;        // Time the job was processed
 } cups_job_t;
 
-typedef struct cups_size_s             /**** Media Size @since CUPS 1.6/macOS 10.8@ ****/
+typedef struct cups_media_s            // Media information @since CUPS 2.5@
+{
+  char         media[128],             // Media name to use
+               color[128],             // Media color (blank for any/auto)
+               source[128],            // Media source (blank for any/auto)
+               type[128];              // Media type (blank for any/auto)
+  int          width,                  // Width in hundredths of millimeters
+               length,                 // Length in hundredths of millimeters
+               bottom,                 // Bottom margin in hundredths of millimeters
+               left,                   // Left margin in hundredths of millimeters
+               right,                  // Right margin in hundredths of millimeters
+               top;                    // Top margin in hundredths of millimeters
+} cups_media_t;
+
+typedef struct cups_size_s             // Media Size @deprecated@
 {
-  char         media[128];             /* Media name to use */
-  int          width,                  /* Width in hundredths of millimeters */
-               length,                 /* Length in hundredths of
-                                        * millimeters */
-               bottom,                 /* Bottom margin in hundredths of
-                                        * millimeters */
-               left,                   /* Left margin in hundredths of
-                                        * millimeters */
-               right,                  /* Right margin in hundredths of
-                                        * millimeters */
-               top;                    /* Top margin in hundredths of
-                                        * millimeters */
+  char         media[128];             // Media name to use
+  int          width,                  // Width in hundredths of millimeters
+               length,                 // Length in hundredths of millimeters
+               bottom,                 // Bottom margin in hundredths of millimeters
+               left,                   // Left margin in hundredths of millimeters
+               right,                  // Right margin in hundredths of millimeters
+               top;                    // Top margin in hundredths of millimeters
 } cups_size_t;
 
-typedef int (*cups_client_cert_cb_t)(http_t *http, void *tls,
-                                    cups_array_t *distinguished_names,
-                                    void *user_data);
-                                       /* Client credentials callback
-                                        * @since CUPS 1.5/macOS 10.7@ */
+typedef int (*cups_client_cert_cb_t)(http_t *http, void *tls, cups_array_t *distinguished_names, void *user_data);
+                                       // Client credentials callback @deprecated@
+
+typedef bool (*cups_cert_san_cb_t)(const char *common_name, const char *subject_alt_name, void *user_data);
+                                       // Certificate signing subjectAltName callback
 
-typedef int (*cups_dest_cb_t)(void *user_data, unsigned flags,
-                             cups_dest_t *dest);
-                                       /* Destination enumeration callback
-                                        * @since CUPS 1.6/macOS 10.8@ */
+typedef int (*cups_dest_cb_t)(void *user_data, unsigned flags, cups_dest_t *dest);
+                                       // Destination enumeration callback @since CUPS 1.6/macOS 10.8@
 
 #  ifdef __BLOCKS__
 typedef int (^cups_dest_block_t)(unsigned flags, cups_dest_t *dest);
-                                       /* Destination enumeration block
-                                        * @since CUPS 1.6/macOS 10.8@
-                                         * @exclude all@ */
+                                       // Destination enumeration block @deprecated@ @exclude all@
 #  endif /* __BLOCKS__ */
 
 typedef const char *(*cups_oauth_cb_t)(http_t *http, const char *realm, const char *scope, const char *resource, void *user_data);
-                                       /* OAuth callback @since CUPS 2.4@ */
+                                       // OAuth callback @since CUPS 2.4@
 
 typedef const char *(*cups_password_cb_t)(const char *prompt);
-                                       /* Password callback @exclude all@ */
+                                       // Password callback @deprecated@ @exclude all@
 
-typedef const char *(*cups_password_cb2_t)(const char *prompt, http_t *http,
-                                          const char *method,
-                                          const char *resource,
-                                          void *user_data);
-                                       /* New password callback
-                                        * @since CUPS 1.4/macOS 10.6@ */
+typedef const char *(*cups_password_cb2_t)(const char *prompt, http_t *http, const char *method, const char *resource, void *user_data);
+                                       // New password callback @since CUPS 1.4/macOS 10.6@
 
-typedef int (*cups_server_cert_cb_t)(http_t *http, void *tls,
-                                    cups_array_t *certs, void *user_data);
-                                       /* Server credentials callback
-                                        * @since CUPS 1.5/macOS 10.7@ */
+typedef int (*cups_server_cert_cb_t)(http_t *http, void *tls, cups_array_t *certs, void *user_data);
+                                       // Server credentials callback @deprecated@
 
 
-/*
- * Functions...
- */
+//
+// Functions...
+//
 
+extern int             cupsAddDest(const char *name, const char *instance, int num_dests, cups_dest_t **dests) _CUPS_PUBLIC;
+extern int             cupsAddDestMediaOptions(http_t *http, cups_dest_t *dest, cups_dinfo_t *dinfo, unsigned flags, cups_size_t *size, int num_options, cups_option_t **options) _CUPS_DEPRECATED_MSG("Use cupsAddDestMediaOptions2 instead.");
+extern int             cupsAddDestMediaOptions2(http_t *http, cups_dest_t *dest, cups_dinfo_t *dinfo, unsigned flags, cups_media_t *media, int num_options, cups_option_t **options) _CUPS_PUBLIC;
+extern int             cupsAddIntegerOption(const char *name, int value, int num_options, cups_option_t **options) _CUPS_PUBLIC;
+extern int             cupsAddOption(const char *name, const char *value, int num_options, cups_option_t **options) _CUPS_PUBLIC;
+extern bool            cupsAreCredentialsValidForName(const char *common_name, const char *credentials);
+
+extern ipp_status_t    cupsCancelDestJob(http_t *http, cups_dest_t *dest, int job_id) _CUPS_PUBLIC;
 extern int             cupsCancelJob(const char *name, int job_id) _CUPS_PUBLIC;
-extern ipp_t           *cupsDoFileRequest(http_t *http, ipp_t *request,
-                                          const char *resource,
-                                          const char *filename) _CUPS_PUBLIC;
-extern ipp_t           *cupsDoRequest(http_t *http, ipp_t *request,
-                                      const char *resource) _CUPS_PUBLIC;
-extern http_encryption_t cupsEncryption(void);
+extern ipp_status_t    cupsCancelJob2(http_t *http, const char *name, int job_id, int purge) _CUPS_PUBLIC;
+extern int             cupsCheckDestSupported(http_t *http, cups_dest_t *dest, cups_dinfo_t *info, const char *option, const char *value) _CUPS_PUBLIC;
+extern ipp_status_t    cupsCloseDestJob(http_t *http, cups_dest_t *dest, cups_dinfo_t *info, int job_id) _CUPS_PUBLIC;
+extern size_t          cupsConcatString(char *dst, const char *src, size_t dstsize) _CUPS_PUBLIC;
+extern http_t          *cupsConnectDest(cups_dest_t *dest, unsigned flags, int msec, int *cancel, char *resource, size_t resourcesize, cups_dest_cb_t cb, void *user_data) _CUPS_PUBLIC;
+#  ifdef __BLOCKS__
+extern http_t          *cupsConnectDestBlock(cups_dest_t *dest, unsigned flags, int msec, int *cancel, char *resource, size_t resourcesize, cups_dest_block_t block) _CUPS_DEPRECATED;
+#  endif // __BLOCKS__
+extern char            *cupsCopyCredentials(const char *path, const char *common_name) _CUPS_PUBLIC;
+extern char            *cupsCopyCredentialsKey(const char *path, const char *common_name) _CUPS_PUBLIC;
+extern char            *cupsCopyCredentialsRequest(const char *path, const char *common_name) _CUPS_PUBLIC;
+extern int             cupsCopyDest(cups_dest_t *dest, int num_dests, cups_dest_t **dests) _CUPS_PUBLIC;
+extern int             cupsCopyDestConflicts(http_t *http, cups_dest_t *dest, cups_dinfo_t *info, int num_options, cups_option_t *options, const char *new_option, const char *new_value, int *num_conflicts, cups_option_t **conflicts, int *num_resolved, cups_option_t **resolved) _CUPS_PUBLIC;
+extern cups_dinfo_t    *cupsCopyDestInfo(http_t *http, cups_dest_t *dest) _CUPS_PUBLIC;
+extern size_t          cupsCopyString(char *dst, const char *src, size_t dstsize) _CUPS_PUBLIC;
+extern bool            cupsCreateCredentials(const char *path, bool ca_cert, cups_credpurpose_t purpose, cups_credtype_t type, cups_credusage_t usage, const char *organization, const char *org_unit, const char *locality, const char *state_province, const char *country, const char *common_name, size_t num_alt_names, const char * const *alt_names, const char *root_name, time_t expiration_date) _CUPS_PUBLIC;
+extern bool            cupsCreateCredentialsRequest(const char *path, cups_credpurpose_t purpose, cups_credtype_t type, cups_credusage_t usage, const char *organization, const char *org_unit, const char *locality, const char *state_province, const char *country, const char *common_name, size_t num_alt_names, const char * const *alt_names) _CUPS_PUBLIC;
+extern ipp_status_t    cupsCreateDestJob(http_t *http, cups_dest_t *dest, cups_dinfo_t *info, int *job_id, const char *title, int num_options, cups_option_t *options) _CUPS_PUBLIC;
+extern int             cupsCreateJob(http_t *http, const char *name, const char *title, int num_options, cups_option_t *options) _CUPS_PUBLIC;
+extern int             cupsCreateTempFd(const char *prefix, const char *suffix, char *filename, size_t len) _CUPS_PUBLIC;
+extern cups_file_t     *cupsCreateTempFile(const char *prefix, const char *suffix, char *filename, size_t len) _CUPS_PUBLIC;
+
+extern int             cupsDoAuthentication(http_t *http, const char *method, const char *resource) _CUPS_PUBLIC;
+extern ipp_t           *cupsDoFileRequest(http_t *http, ipp_t *request, const char *resource, const char *filename) _CUPS_PUBLIC;
+extern ipp_t           *cupsDoIORequest(http_t *http, ipp_t *request, const char *resource, int infile, int outfile) _CUPS_PUBLIC;
+extern ipp_t           *cupsDoRequest(http_t *http, ipp_t *request, const char *resource) _CUPS_PUBLIC;
+
+extern ipp_attribute_t *cupsEncodeOption(ipp_t *ipp, ipp_tag_t group_tag, const char *name, const char *value) _CUPS_PUBLIC;
+extern void            cupsEncodeOptions(ipp_t *ipp, int num_options, cups_option_t *options) _CUPS_DEPRECATED_MSG("Use cupsEncodeOptions2 instead.");
+extern void            cupsEncodeOptions2(ipp_t *ipp, int num_options, cups_option_t *options, ipp_tag_t group_tag) _CUPS_PUBLIC;
+extern http_encryption_t cupsEncryption(void) _CUPS_DEPRECATED_MSG("Use cupsGetEncryption instead.");
+extern int             cupsEnumDests(cups_dest_flags_t flags, int msec, int *cancel, cups_ptype_t type, cups_ptype_t mask, cups_dest_cb_t cb, void *user_data) _CUPS_PUBLIC;
+#  ifdef __BLOCKS__
+extern int             cupsEnumDestsBlock(unsigned flags, int msec, int *cancel, cups_ptype_t type, cups_ptype_t mask, cups_dest_block_t block) _CUPS_DEPRECATED;
+#  endif // __BLOCKS__
+
+extern ipp_attribute_t *cupsFindDestDefault(http_t *http, cups_dest_t *dest, cups_dinfo_t *dinfo, const char *option) _CUPS_PUBLIC;
+extern ipp_attribute_t *cupsFindDestReady(http_t *http, cups_dest_t *dest, cups_dinfo_t *dinfo, const char *option) _CUPS_PUBLIC;
+extern ipp_attribute_t *cupsFindDestSupported(http_t *http, cups_dest_t *dest, cups_dinfo_t *dinfo, const char *option) _CUPS_PUBLIC;
+extern ipp_status_t    cupsFinishDestDocument(http_t *http, cups_dest_t *dest, cups_dinfo_t *info) _CUPS_PUBLIC;
+extern ipp_status_t    cupsFinishDocument(http_t *http, const char *name) _CUPS_PUBLIC;
+extern void            cupsFreeDestInfo(cups_dinfo_t *dinfo) _CUPS_PUBLIC;
+extern void            cupsFreeDests(int num_dests, cups_dest_t *dests) _CUPS_PUBLIC;
 extern void            cupsFreeJobs(int num_jobs, cups_job_t *jobs) _CUPS_PUBLIC;
+extern void            cupsFreeOptions(int num_options, cups_option_t *options) _CUPS_PUBLIC;
+
 extern int             cupsGetClasses(char ***classes) _CUPS_DEPRECATED_MSG("Use cupsEnumDests instead.");
+extern time_t          cupsGetCredentialsExpiration(const char *credentials) _CUPS_PUBLIC;
+extern char            *cupsGetCredentialsInfo(const char *credentials, char *buffer, size_t bufsize) _CUPS_PUBLIC;
+extern http_trust_t    cupsGetCredentialsTrust(const char *path, const char *common_name, const char *credentials) _CUPS_PUBLIC;
 extern const char      *cupsGetDefault(void) _CUPS_PUBLIC;
-extern int             cupsGetJobs(cups_job_t **jobs, const char *name,
-                                   int myjobs, int whichjobs) _CUPS_PUBLIC;
-extern int             cupsGetPrinters(char ***printers) _CUPS_DEPRECATED_MSG("Use cupsEnumDests instead.");
-extern ipp_status_t    cupsLastError(void) _CUPS_PUBLIC;
-extern int             cupsPrintFile(const char *name, const char *filename,
-                                     const char *title, int num_options,
-                                     cups_option_t *options) _CUPS_PUBLIC;
-extern int             cupsPrintFiles(const char *name, int num_files,
-                                      const char **files, const char *title,
-                                      int num_options, cups_option_t *options) _CUPS_PUBLIC;
-extern char            *cupsTempFile(char *filename, int len) _CUPS_DEPRECATED_MSG("Use cupsTempFd or cupsTempFile2 instead.");
-extern int             cupsTempFd(char *filename, int len) _CUPS_PUBLIC;
-
-extern int             cupsAddDest(const char *name, const char *instance,
-                                   int num_dests, cups_dest_t **dests) _CUPS_PUBLIC;
-extern void            cupsFreeDests(int num_dests, cups_dest_t *dests) _CUPS_PUBLIC;
-extern cups_dest_t     *cupsGetDest(const char *name, const char *instance,
-                                    int num_dests, cups_dest_t *dests) _CUPS_PUBLIC;
+extern const char      *cupsGetDefault2(http_t *http) _CUPS_PUBLIC;
+extern cups_dest_t     *cupsGetDest(const char *name, const char *instance, int num_dests, cups_dest_t *dests) _CUPS_PUBLIC;
+extern int             cupsGetDestMediaByIndex(http_t *http, cups_dest_t *dest, cups_dinfo_t *dinfo, int n, unsigned flags, cups_size_t *size) _CUPS_DEPRECATED_MSG("Use cupsGetDestMediaByIndex2 instead.");
+extern bool            cupsGetDestMediaByIndex2(http_t *http, cups_dest_t *dest, cups_dinfo_t *dinfo, size_t n, unsigned flags, cups_media_t *media) _CUPS_PUBLIC;
+extern int             cupsGetDestMediaByName(http_t *http, cups_dest_t *dest, cups_dinfo_t *dinfo, const char *name, unsigned flags, cups_size_t *size) _CUPS_DEPRECATED_MSG("Use cupsGetDestMediaByName2 instead.");
+extern bool            cupsGetDestMediaByName2(http_t *http, cups_dest_t *dest, cups_dinfo_t *dinfo, const char *name, unsigned flags, cups_media_t *media) _CUPS_PUBLIC;
+extern int             cupsGetDestMediaBySize(http_t *http, cups_dest_t *dest, cups_dinfo_t *dinfo, int width, int length, unsigned flags, cups_size_t *size) _CUPS_DEPRECATED_MSG("Use cupsGetDestMediaBySize2 instead.");
+extern bool            cupsGetDestMediaBySize2(http_t *http, cups_dest_t *dest, cups_dinfo_t *dinfo, int width, int length, unsigned flags, cups_media_t *media) _CUPS_PUBLIC;
+extern int             cupsGetDestMediaCount(http_t *http, cups_dest_t *dest, cups_dinfo_t *dinfo, unsigned flags) _CUPS_PUBLIC;
+extern int             cupsGetDestMediaDefault(http_t *http, cups_dest_t *dest, cups_dinfo_t *dinfo, unsigned flags, cups_size_t *size) _CUPS_DEPRECATED_MSG("Use cupsGetDestMediaDefault2 instead.");
+extern bool            cupsGetDestMediaDefault2(http_t *http, cups_dest_t *dest, cups_dinfo_t *dinfo, unsigned flags, cups_media_t *media) _CUPS_PUBLIC;
+extern cups_dest_t     *cupsGetDestWithURI(const char *name, const char *uri) _CUPS_PUBLIC;
 extern int             cupsGetDests(cups_dest_t **dests) _CUPS_PUBLIC;
+extern int             cupsGetDests2(http_t *http, cups_dest_t **dests) _CUPS_PUBLIC;
+extern http_encryption_t cupsGetEncryption(void) _CUPS_PUBLIC;
+extern ipp_status_t    cupsGetError(void) _CUPS_PUBLIC;
+extern const char      *cupsGetErrorString(void) _CUPS_PUBLIC;
+extern http_status_t   cupsGetFile(http_t *http, const char *resource, const char *filename) _CUPS_PUBLIC;
+extern http_status_t   cupsGetFd(http_t *http, const char *resource, int fd) _CUPS_PUBLIC;
+extern int             cupsGetIntegerOption(const char *name, int num_options, cups_option_t *options) _CUPS_PUBLIC;
+extern int             cupsGetJobs(cups_job_t **jobs, const char *name, int myjobs, int whichjobs) _CUPS_PUBLIC;
+extern int             cupsGetJobs2(http_t *http, cups_job_t **jobs, const char *name, int myjobs, int whichjobs) _CUPS_PUBLIC;
+extern cups_dest_t     *cupsGetNamedDest(http_t *http, const char *name, const char *instance) _CUPS_PUBLIC;
+extern const char      *cupsGetOption(const char *name, int num_options, cups_option_t *options) _CUPS_PUBLIC;
+extern const char      *cupsGetPassword(const char *prompt) _CUPS_DEPRECATED_MSG("Use cupsGetPassword instead.");
+extern const char      *cupsGetPassword2(const char *prompt, http_t *http, const char *method, const char *resource) _CUPS_PUBLIC;
+extern int             cupsGetPrinters(char ***printers) _CUPS_DEPRECATED_MSG("Use cupsEnumDests instead.");
+extern unsigned                cupsGetRand(void) _CUPS_PUBLIC;
+extern ipp_t           *cupsGetResponse(http_t *http, const char *resource) _CUPS_PUBLIC;
+extern const char      *cupsGetServer(void) _CUPS_PUBLIC;
+extern const char      *cupsGetUser(void) _CUPS_PUBLIC;
+extern const char      *cupsGetUserAgent(void) _CUPS_PUBLIC;
+
+extern ssize_t         cupsHashData(const char *algorithm, const void *data, size_t datalen, unsigned char *hash, size_t hashsize) _CUPS_PUBLIC;
+extern const char      *cupsHashString(const unsigned char *hash, size_t hashsize, char *buffer, size_t bufsize) _CUPS_PUBLIC;
+extern ssize_t         cupsHMACData(const char *algorithm, const unsigned char *key, size_t keylen, const void *data, size_t datalen, unsigned char *hash, size_t hashsize) _CUPS_PUBLIC;
+
+extern ipp_status_t    cupsLastError(void) _CUPS_DEPRECATED_MSG("Use cupsGetError instead.");
+extern const char      *cupsLastErrorString(void) _CUPS_DEPRECATED_MSG("Use cupsGetErrorString instead.");
+
+extern const char      *cupsLocalizeDestMedia(http_t *http, cups_dest_t *dest, cups_dinfo_t *info, unsigned flags, cups_size_t *size) _CUPS_DEPRECATED_MSG("Use cupsLocalizeDestMedia2 instead.");
+extern const char      *cupsLocalizeDestMedia2(http_t *http, cups_dest_t *dest, cups_dinfo_t *info, unsigned flags, cups_media_t *media) _CUPS_PUBLIC;
+extern const char      *cupsLocalizeDestOption(http_t *http, cups_dest_t *dest, cups_dinfo_t *info, const char *option) _CUPS_PUBLIC;
+extern const char      *cupsLocalizeDestValue(http_t *http, cups_dest_t *dest, cups_dinfo_t *info, const char *option, const char *value) _CUPS_PUBLIC;
+extern char            *cupsLocalizeNotifySubject(cups_lang_t *lang, ipp_t *event) _CUPS_PUBLIC;
+extern char            *cupsLocalizeNotifyText(cups_lang_t *lang, ipp_t *event) _CUPS_PUBLIC;
+
+extern int             cupsMakeServerCredentials(const char *path, const char *common_name, int num_alt_names, const char **alt_names, time_t expiration_date) _CUPS_DEPRECATED_MSG("Use cupsCreateCredentials instead.");
+
+extern char            *cupsNotifySubject(cups_lang_t *lang, ipp_t *event) _CUPS_DEPRECATED_MSG("Use cupsLocalizeNotifySubject instead.");
+extern char            *cupsNotifyText(cups_lang_t *lang, ipp_t *event) _CUPS_DEPRECATED_MSG("Use cupsLocalizeNotifyText instead.");
+
+extern int             cupsParseOptions(const char *arg, int num_options, cups_option_t **options) _CUPS_PUBLIC;
+extern int             cupsPrintFile(const char *name, const char *filename, const char *title, int num_options, cups_option_t *options) _CUPS_PUBLIC;
+extern int             cupsPrintFile2(http_t *http, const char *name, const char *filename, const char *title, int num_options, cups_option_t *options) _CUPS_PUBLIC;
+extern int             cupsPrintFiles(const char *name, int num_files, const char **files, const char *title, int num_options, cups_option_t *options) _CUPS_PUBLIC;
+extern int             cupsPrintFiles2(http_t *http, const char *name, int num_files, const char **files, const char *title, int num_options, cups_option_t *options) _CUPS_PUBLIC;
+extern http_status_t   cupsPutFd(http_t *http, const char *resource, int fd) _CUPS_PUBLIC;
+extern http_status_t   cupsPutFile(http_t *http, const char *resource, const char *filename) _CUPS_PUBLIC;
+
+extern ssize_t         cupsReadResponseData(http_t *http, char *buffer, size_t length) _CUPS_PUBLIC;
+extern int             cupsRemoveDest(const char *name, const char *instance, int num_dests, cups_dest_t **dests) _CUPS_PUBLIC;
+extern int             cupsRemoveOption(const char *name, int num_options, cups_option_t **options) _CUPS_PUBLIC;
+
+extern bool            cupsSaveCredentials(const char *path, const char *common_name, const char *credentials, const char *key) _CUPS_PUBLIC;
+extern http_status_t   cupsSendRequest(http_t *http, ipp_t *request, const char *resource, size_t length) _CUPS_PUBLIC;
+extern const char      *cupsServer(void) _CUPS_DEPRECATED_MSG("Use cupsGetServer instead.");
+extern void            cupsSetClientCertCB(cups_client_cert_cb_t cb, void *user_data) _CUPS_DEPRECATED;
+extern bool            cupsSetClientCredentials(const char *credentials, const char *key) _CUPS_PUBLIC;
+extern int             cupsSetCredentials(cups_array_t *certs) _CUPS_DEPRECATED;
+extern void            cupsSetDefaultDest(const char *name, const char *instance, int num_dests, cups_dest_t *dests) _CUPS_PUBLIC;
 extern void            cupsSetDests(int num_dests, cups_dest_t *dests) _CUPS_PUBLIC;
-
-extern int             cupsAddOption(const char *name, const char *value,
-                                     int num_options, cups_option_t **options) _CUPS_PUBLIC;
-extern void            cupsEncodeOptions(ipp_t *ipp, int num_options,
-                                         cups_option_t *options) _CUPS_PUBLIC;
-extern void            cupsFreeOptions(int num_options,
-                                       cups_option_t *options) _CUPS_PUBLIC;
-extern const char      *cupsGetOption(const char *name, int num_options,
-                                      cups_option_t *options) _CUPS_PUBLIC;
-extern int             cupsParseOptions(const char *arg, int num_options,
-                                        cups_option_t **options) _CUPS_PUBLIC;
-
-extern const char      *cupsGetPassword(const char *prompt) _CUPS_PUBLIC;
-extern const char      *cupsServer(void) _CUPS_PUBLIC;
+extern int             cupsSetDests2(http_t *http, int num_dests, cups_dest_t *dests) _CUPS_PUBLIC;
 extern void            cupsSetEncryption(http_encryption_t e) _CUPS_PUBLIC;
-extern void            cupsSetPasswordCB(cups_password_cb_t cb) _CUPS_PUBLIC;
+extern void            cupsSetOAuthCB(cups_oauth_cb_t cb, void *data) _CUPS_PUBLIC;
+extern void            cupsSetPasswordCB(cups_password_cb_t cb) _CUPS_DEPRECATED_MSG("Use cupsSetPasswordCB2 instead.");
+extern void            cupsSetPasswordCB2(cups_password_cb2_t cb, void *user_data) _CUPS_PUBLIC;
 extern void            cupsSetServer(const char *server) _CUPS_PUBLIC;
+extern void            cupsSetServerCertCB(cups_server_cert_cb_t cb, void *user_data) _CUPS_DEPRECATED;
+extern int             cupsSetServerCredentials(const char *path, const char *common_name, int auto_create) _CUPS_PUBLIC;
 extern void            cupsSetUser(const char *user) _CUPS_PUBLIC;
-extern const char      *cupsUser(void) _CUPS_PUBLIC;
-
-/**** New in CUPS 1.1.20 ****/
-extern int             cupsDoAuthentication(http_t *http, const char *method,
-                                            const char *resource)
-                                            _CUPS_API_1_1_20;
-extern http_status_t   cupsGetFile(http_t *http, const char *resource,
-                                   const char *filename) _CUPS_API_1_1_20;
-extern http_status_t   cupsGetFd(http_t *http, const char *resource, int fd) _CUPS_API_1_1_20;
-extern http_status_t   cupsPutFile(http_t *http, const char *resource,
-                                   const char *filename) _CUPS_API_1_1_20;
-extern http_status_t   cupsPutFd(http_t *http, const char *resource, int fd)
-                                 _CUPS_API_1_1_20;
-
-/**** New in CUPS 1.1.21 ****/
-extern const char      *cupsGetDefault2(http_t *http) _CUPS_API_1_1_21;
-extern int             cupsGetDests2(http_t *http, cups_dest_t **dests)
-                                     _CUPS_API_1_1_21;
-extern int             cupsGetJobs2(http_t *http, cups_job_t **jobs,
-                                    const char *name, int myjobs,
-                                    int whichjobs) _CUPS_API_1_1_21;
-extern int             cupsPrintFile2(http_t *http, const char *name,
-                                      const char *filename,
-                                      const char *title, int num_options,
-                                      cups_option_t *options) _CUPS_API_1_1_21;
-extern int             cupsPrintFiles2(http_t *http, const char *name,
-                                       int num_files, const char **files,
-                                       const char *title, int num_options,
-                                       cups_option_t *options)
-                                       _CUPS_API_1_1_21;
-extern int             cupsSetDests2(http_t *http, int num_dests,
-                                     cups_dest_t *dests) _CUPS_API_1_1_21;
-
-/**** New in CUPS 1.2/macOS 10.5 ****/
-extern void            cupsEncodeOptions2(ipp_t *ipp, int num_options,
-                                          cups_option_t *options,
-                                          ipp_tag_t group_tag) _CUPS_API_1_2;
-extern const char      *cupsLastErrorString(void) _CUPS_API_1_2;
-extern char            *cupsNotifySubject(cups_lang_t *lang, ipp_t *event)
-                                          _CUPS_API_1_2;
-extern char            *cupsNotifyText(cups_lang_t *lang, ipp_t *event)
-                                       _CUPS_API_1_2;
-extern int             cupsRemoveOption(const char *name, int num_options,
-                                        cups_option_t **options) _CUPS_API_1_2;
-extern cups_file_t     *cupsTempFile2(char *filename, int len) _CUPS_API_1_2;
-
-/**** New in CUPS 1.3/macOS 10.5 ****/
-extern ipp_t           *cupsDoIORequest(http_t *http, ipp_t *request,
-                                        const char *resource, int infile,
-                                        int outfile) _CUPS_API_1_3;
-extern int             cupsRemoveDest(const char *name,
-                                      const char *instance,
-                                      int num_dests, cups_dest_t **dests)
-                                      _CUPS_API_1_3;
-extern void            cupsSetDefaultDest(const char *name,
-                                          const char *instance,
-                                          int num_dests,
-                                          cups_dest_t *dests) _CUPS_API_1_3;
-
-/**** New in CUPS 1.4/macOS 10.6 ****/
-extern ipp_status_t    cupsCancelJob2(http_t *http, const char *name,
-                                      int job_id, int purge) _CUPS_API_1_4;
-extern int             cupsCreateJob(http_t *http, const char *name,
-                                     const char *title, int num_options,
-                                     cups_option_t *options) _CUPS_API_1_4;
-extern ipp_status_t    cupsFinishDocument(http_t *http,
-                                          const char *name) _CUPS_API_1_4;
-extern cups_dest_t     *cupsGetNamedDest(http_t *http, const char *name,
-                                         const char *instance) _CUPS_API_1_4;
-extern const char      *cupsGetPassword2(const char *prompt, http_t *http,
-                                         const char *method,
-                                         const char *resource) _CUPS_API_1_4;
-extern ipp_t           *cupsGetResponse(http_t *http,
-                                        const char *resource) _CUPS_API_1_4;
-extern ssize_t         cupsReadResponseData(http_t *http, char *buffer,
-                                            size_t length) _CUPS_API_1_4;
-extern http_status_t   cupsSendRequest(http_t *http, ipp_t *request,
-                                       const char *resource,
-                                       size_t length) _CUPS_API_1_4;
-extern void            cupsSetPasswordCB2(cups_password_cb2_t cb,
-                                          void *user_data) _CUPS_API_1_4;
-extern http_status_t   cupsStartDocument(http_t *http, const char *name,
-                                         int job_id, const char *docname,
-                                         const char *format,
-                                         int last_document) _CUPS_API_1_4;
-extern http_status_t   cupsWriteRequestData(http_t *http, const char *buffer,
-                                            size_t length) _CUPS_API_1_4;
-
-/**** New in CUPS 1.5/macOS 10.7 ****/
-extern void            cupsSetClientCertCB(cups_client_cert_cb_t cb,
-                                           void *user_data) _CUPS_API_1_5;
-extern int             cupsSetCredentials(cups_array_t *certs) _CUPS_API_1_5;
-extern void            cupsSetServerCertCB(cups_server_cert_cb_t cb,
-                                           void *user_data) _CUPS_API_1_5;
-
-/**** New in CUPS 1.6/macOS 10.8 ****/
-extern ipp_status_t    cupsCancelDestJob(http_t *http, cups_dest_t *dest,
-                                         int job_id) _CUPS_API_1_6;
-extern int             cupsCheckDestSupported(http_t *http, cups_dest_t *dest,
-                                              cups_dinfo_t *info,
-                                              const char *option,
-                                              const char *value) _CUPS_API_1_6;
-extern ipp_status_t    cupsCloseDestJob(http_t *http, cups_dest_t *dest,
-                                        cups_dinfo_t *info, int job_id)
-                                        _CUPS_API_1_6;
-extern http_t          *cupsConnectDest(cups_dest_t *dest, unsigned flags,
-                                        int msec, int *cancel,
-                                        char *resource, size_t resourcesize,
-                                        cups_dest_cb_t cb, void *user_data)
-                                        _CUPS_API_1_6;
-#  ifdef __BLOCKS__
-extern http_t          *cupsConnectDestBlock(cups_dest_t *dest,
-                                             unsigned flags, int msec,
-                                             int *cancel, char *resource,
-                                             size_t resourcesize,
-                                             cups_dest_block_t block)
-                                             _CUPS_API_1_6;
-#  endif /* __BLOCKS__ */
-extern int             cupsCopyDest(cups_dest_t *dest, int num_dests,
-                                    cups_dest_t **dests) _CUPS_API_1_6;
-extern cups_dinfo_t    *cupsCopyDestInfo(http_t *http, cups_dest_t *dest)
-                                         _CUPS_API_1_6;
-extern int             cupsCopyDestConflicts(http_t *http, cups_dest_t *dest,
-                                             cups_dinfo_t *info,
-                                             int num_options,
-                                             cups_option_t *options,
-                                             const char *new_option,
-                                             const char *new_value,
-                                             int *num_conflicts,
-                                             cups_option_t **conflicts,
-                                             int *num_resolved,
-                                             cups_option_t **resolved)
-                                             _CUPS_API_1_6;
-extern ipp_status_t    cupsCreateDestJob(http_t *http, cups_dest_t *dest,
-                                         cups_dinfo_t *info, int *job_id,
-                                         const char *title, int num_options,
-                                         cups_option_t *options) _CUPS_API_1_6;
-extern int             cupsEnumDests(unsigned flags, int msec, int *cancel,
-                                     cups_ptype_t type, cups_ptype_t mask,
-                                     cups_dest_cb_t cb, void *user_data)
-                                     _CUPS_API_1_6;
-#  ifdef __BLOCKS__
-extern int             cupsEnumDestsBlock(unsigned flags, int msec,
-                                          int *cancel, cups_ptype_t type,
-                                          cups_ptype_t mask,
-                                          cups_dest_block_t block)
-                                          _CUPS_API_1_6;
-#  endif /* __BLOCKS__ */
-extern ipp_status_t    cupsFinishDestDocument(http_t *http,
-                                              cups_dest_t *dest,
-                                              cups_dinfo_t *info)
-                                              _CUPS_API_1_6;
-extern void            cupsFreeDestInfo(cups_dinfo_t *dinfo) _CUPS_API_1_6;
-extern int             cupsGetDestMediaByName(http_t *http, cups_dest_t *dest,
-                                              cups_dinfo_t *dinfo,
-                                              const char *media,
-                                              unsigned flags,
-                                              cups_size_t *size) _CUPS_API_1_6;
-extern int             cupsGetDestMediaBySize(http_t *http, cups_dest_t *dest,
-                                              cups_dinfo_t *dinfo,
-                                              int width, int length,
-                                              unsigned flags,
-                                              cups_size_t *size) _CUPS_API_1_6;
-extern const char      *cupsLocalizeDestOption(http_t *http, cups_dest_t *dest,
-                                               cups_dinfo_t *info,
-                                               const char *option)
-                                               _CUPS_API_1_6;
-extern const char      *cupsLocalizeDestValue(http_t *http, cups_dest_t *dest,
-                                              cups_dinfo_t *info,
-                                              const char *option,
-                                              const char *value)
-                                              _CUPS_API_1_6;
-extern http_status_t   cupsStartDestDocument(http_t *http, cups_dest_t *dest,
-                                             cups_dinfo_t *info, int job_id,
-                                             const char *docname,
-                                             const char *format,
-                                             int num_options,
-                                             cups_option_t *options,
-                                             int last_document) _CUPS_API_1_6;
-
-/* New in CUPS 1.7 */
-extern ipp_attribute_t *cupsFindDestDefault(http_t *http, cups_dest_t *dest,
-                                            cups_dinfo_t *dinfo,
-                                            const char *option) _CUPS_API_1_7;
-extern ipp_attribute_t *cupsFindDestReady(http_t *http, cups_dest_t *dest,
-                                          cups_dinfo_t *dinfo,
-                                          const char *option) _CUPS_API_1_7;
-extern ipp_attribute_t *cupsFindDestSupported(http_t *http, cups_dest_t *dest,
-                                              cups_dinfo_t *dinfo,
-                                              const char *option)
-                                              _CUPS_API_1_7;
-extern int             cupsGetDestMediaByIndex(http_t *http, cups_dest_t *dest,
-                                               cups_dinfo_t *dinfo, int n,
-                                               unsigned flags,
-                                               cups_size_t *size)
-                                               _CUPS_API_1_7;
-extern int             cupsGetDestMediaCount(http_t *http, cups_dest_t *dest,
-                                             cups_dinfo_t *dinfo,
-                                             unsigned flags) _CUPS_API_1_7;
-extern int             cupsGetDestMediaDefault(http_t *http, cups_dest_t *dest,
-                                               cups_dinfo_t *dinfo,
-                                               unsigned flags,
-                                               cups_size_t *size)
-                                               _CUPS_API_1_7;
-extern void            cupsSetUserAgent(const char *user_agent) _CUPS_API_1_7;
-extern const char      *cupsUserAgent(void) _CUPS_API_1_7;
-
-/* New in CUPS 2.0/macOS 10.10 */
-extern cups_dest_t     *cupsGetDestWithURI(const char *name, const char *uri) _CUPS_API_2_0;
-extern const char      *cupsLocalizeDestMedia(http_t *http, cups_dest_t *dest, cups_dinfo_t *info, unsigned flags, cups_size_t *size) _CUPS_API_2_0;
-extern int             cupsMakeServerCredentials(const char *path, const char *common_name, int num_alt_names, const char **alt_names, time_t expiration_date) _CUPS_API_2_0;
-extern int             cupsSetServerCredentials(const char *path, const char *common_name, int auto_create) _CUPS_API_2_0;
-
-/* New in CUPS 2.2/macOS 10.12 */
-extern ssize_t         cupsHashData(const char *algorithm, const void *data, size_t datalen, unsigned char *hash, size_t hashsize) _CUPS_API_2_2;
-
-/* New in CUPS 2.2.4 */
-extern int             cupsAddIntegerOption(const char *name, int value, int num_options, cups_option_t **options) _CUPS_API_2_2_4;
-extern int             cupsGetIntegerOption(const char *name, int num_options, cups_option_t *options) _CUPS_API_2_2_4;
-
-/* New in CUPS 2.2.7 */
-extern const char      *cupsHashString(const unsigned char *hash, size_t hashsize, char *buffer, size_t bufsize) _CUPS_API_2_2_7;
-
-/* New in CUPS 2.3 */
-extern int             cupsAddDestMediaOptions(http_t *http, cups_dest_t *dest, cups_dinfo_t *dinfo, unsigned flags, cups_size_t *size, int num_options, cups_option_t **options) _CUPS_API_2_3;
-extern ipp_attribute_t *cupsEncodeOption(ipp_t *ipp, ipp_tag_t group_tag, const char *name, const char *value) _CUPS_API_2_3;
-
-/* New in CUPS 2.4 */
-extern void            cupsSetOAuthCB(cups_oauth_cb_t cb, void *data) _CUPS_API_2_4;
-
-/* New in CUPS 2.5 */
-extern size_t          cupsConcatString(char *dst, const char *src, size_t dstsize) _CUPS_PUBLIC;
-extern size_t          cupsCopyString(char *dst, const char *src, size_t dstsize) _CUPS_PUBLIC;
+extern void            cupsSetUserAgent(const char *user_agent) _CUPS_PUBLIC;
+extern bool            cupsSignCredentialsRequest(const char *path, const char *common_name, const char *request, const char *root_name, cups_credpurpose_t allowed_purpose, cups_credusage_t allowed_usage, cups_cert_san_cb_t cb, void *cb_data, time_t expiration_date) _CUPS_PUBLIC;
+extern http_status_t   cupsStartDestDocument(http_t *http, cups_dest_t *dest, cups_dinfo_t *info, int job_id, const char *docname, const char *format, int num_options, cups_option_t *options, int last_document) _CUPS_PUBLIC;
+extern http_status_t   cupsStartDocument(http_t *http, const char *name, int job_id, const char *docname, const char *format, int last_document) _CUPS_PUBLIC;
+
+extern int             cupsTempFd(char *filename, int len) _CUPS_DEPRECATED_MSG("Use cupsCreateTempFd instead.");
+extern char            *cupsTempFile(char *filename, int len) _CUPS_DEPRECATED_MSG("Use cupsCreateTempFd or cupsCreateTempFile instead.");
+extern cups_file_t     *cupsTempFile2(char *filename, int len) _CUPS_DEPRECATED_MSG("Use cupsCreateTempFile instead.");
+
+extern const char      *cupsUser(void) _CUPS_DEPRECATED_MSG("Use cupsGetUser instead.");
+extern const char      *cupsUserAgent(void) _CUPS_DEPRECATED_MSG("Use cupsGetUserAgent instead.");
+
+extern http_status_t   cupsWriteRequestData(http_t *http, const char *buffer, size_t length) _CUPS_PUBLIC;
 
 
 #  ifdef __cplusplus
 }
-#  endif /* __cplusplus */
-
-#endif /* !_CUPS_CUPS_H_ */
+#  endif // __cplusplus
+#endif // !_CUPS_CUPS_H_
index f4e5b335c608dd82c24c29b70614dbf0a4231f27..0f9db3171bff3b196f3c528350fb4c2d9a14ebc5 100644 (file)
@@ -44,13 +44,13 @@ cupsCancelDestJob(http_t      *http,        /* I - Connection to destination */
 
     ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, info->uri);
     ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_INTEGER, "job-id", job_id);
-    ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", NULL, cupsUser());
+    ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", NULL, cupsGetUser());
 
     ippDelete(cupsDoRequest(http, request, info->resource));
     cupsFreeDestInfo(info);
   }
 
-  return (cupsLastError());
+  return (cupsGetError());
 }
 
 
@@ -129,7 +129,7 @@ cupsCloseDestJob(
   ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_INTEGER, "job-id",
                 job_id);
   ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
-               NULL, cupsUser());
+               NULL, cupsGetUser());
   if (ippGetOperation(request) == IPP_OP_SEND_DOCUMENT)
     ippAddBoolean(request, IPP_TAG_OPERATION, "last-document", 1);
 
@@ -139,10 +139,10 @@ cupsCloseDestJob(
 
   ippDelete(cupsDoRequest(http, request, info->resource));
 
-  DEBUG_printf(("1cupsCloseDestJob: %s (%s)", ippErrorString(cupsLastError()),
-                cupsLastErrorString()));
+  DEBUG_printf(("1cupsCloseDestJob: %s (%s)", ippErrorString(cupsGetError()),
+                cupsGetErrorString()));
 
-  return (cupsLastError());
+  return (cupsGetError());
 }
 
 
@@ -210,7 +210,7 @@ cupsCreateDestJob(
   ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
                NULL, info->uri);
   ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
-               NULL, cupsUser());
+               NULL, cupsGetUser());
   if (title)
     ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "job-name", NULL,
                  title);
@@ -237,10 +237,10 @@ cupsCreateDestJob(
   * Return the status code from the Create-Job request...
   */
 
-  DEBUG_printf(("1cupsCreateDestJob: %s (%s)", ippErrorString(cupsLastError()),
-                cupsLastErrorString()));
+  DEBUG_printf(("1cupsCreateDestJob: %s (%s)", ippErrorString(cupsGetError()),
+                cupsGetErrorString()));
 
-  return (cupsLastError());
+  return (cupsGetError());
 }
 
 
@@ -285,9 +285,9 @@ cupsFinishDestDocument(
   ippDelete(cupsGetResponse(http, info->resource));
 
   DEBUG_printf(("1cupsFinishDestDocument: %s (%s)",
-                ippErrorString(cupsLastError()), cupsLastErrorString()));
+                ippErrorString(cupsGetError()), cupsGetErrorString()));
 
-  return (cupsLastError());
+  return (cupsGetError());
 }
 
 
@@ -358,7 +358,7 @@ cupsStartDestDocument(
                NULL, info->uri);
   ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_INTEGER, "job-id", job_id);
   ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
-               NULL, cupsUser());
+               NULL, cupsGetUser());
   if (docname)
     ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "document-name",
                  NULL, docname);
index 73c6491cf2ca79373f095ef0beaac2bae027dd94..2fc6ecfd3ee1d41e43fcf8189612efde21cf8b12 100644 (file)
@@ -399,7 +399,7 @@ cups_create_localizations(
                               30000, NULL)) == NULL)
     {
       DEBUG_printf(("4cups_create_localizations: Unable to connect to "
-                    "%s:%d: %s", hostname, port, cupsLastErrorString()));
+                    "%s:%d: %s", hostname, port, cupsGetErrorString()));
       return;
     }
   }
@@ -411,7 +411,7 @@ cups_create_localizations(
   if ((temp = cupsTempFile2(tempfile, sizeof(tempfile))) == NULL)
   {
     DEBUG_printf(("4cups_create_localizations: Unable to create temporary "
-                  "file: %s", cupsLastErrorString()));
+                  "file: %s", cupsGetErrorString()));
     if (http2 != http)
       httpClose(http2);
     return;
index d0d683d7a60b6ecd06a37a69d691f46b072c2388..d1f0bd4148e23ec644610840b0b5533cbb5826af 100644 (file)
@@ -39,21 +39,12 @@ static void         cups_create_cached(http_t *http, cups_dinfo_t *dinfo,
                                           unsigned flags);
 static void            cups_create_constraints(cups_dinfo_t *dinfo);
 static void            cups_create_defaults(cups_dinfo_t *dinfo);
-static void            cups_create_media_db(cups_dinfo_t *dinfo,
-                                            unsigned flags);
+static void            cups_create_media_db(cups_dinfo_t *dinfo, unsigned flags);
 static void            cups_free_media_db(_cups_media_db_t *mdb);
-static int             cups_get_media_db(http_t *http, cups_dinfo_t *dinfo,
-                                         pwg_media_t *pwg, unsigned flags,
-                                         cups_size_t *size);
+static int             cups_get_media_db(http_t *http, cups_dinfo_t *dinfo, pwg_media_t *pwg, unsigned flags, cups_size_t *size, cups_media_t *media);
 static int             cups_is_close_media_db(_cups_media_db_t *a,
                                               _cups_media_db_t *b);
-static cups_array_t    *cups_test_constraints(cups_dinfo_t *dinfo,
-                                              const char *new_option,
-                                              const char *new_value,
-                                              int num_options,
-                                              cups_option_t *options,
-                                              int *num_conflicts,
-                                              cups_option_t **conflicts);
+static cups_array_t    *cups_test_constraints(cups_dinfo_t *dinfo, const char *new_option, const char *new_value, int num_options, cups_option_t *options, int *num_conflicts, cups_option_t **conflicts);
 static void            cups_update_ready(http_t *http, cups_dinfo_t *dinfo);
 
 
@@ -155,6 +146,104 @@ cupsAddDestMediaOptions(
 }
 
 
+/*
+ * 'cupsAddDestMediaOptions2()' - Add the options corresponding to the specified media information.
+ *
+ * @since CUPS 2.5@
+ */
+
+int                                    /* O  - New number of options */
+cupsAddDestMediaOptions2(
+    http_t        *http,               /* I  - Connection to destination */
+    cups_dest_t   *dest,               /* I  - Destination */
+    cups_dinfo_t  *dinfo,              /* I  - Destination information */
+    unsigned      flags,               /* I  - Media matching flags */
+    cups_media_t  *media,              /* I  - Media information */
+    int           num_options,         /* I  - Current number of options */
+    cups_option_t **options)           /* IO - Options */
+{
+  cups_array_t         *db;            /* Media database */
+  _cups_media_db_t     *mdb;           /* Media database entry */
+  char                 value[2048];    /* Option value */
+
+
+ /*
+  * Range check input...
+  */
+
+  if (!http || !dest || !dinfo || !media || !options)
+  {
+    _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
+    return (num_options);
+  }
+
+ /*
+  * Find the matching media size...
+  */
+
+  if (flags & CUPS_MEDIA_FLAGS_READY)
+    db = dinfo->ready_db;
+  else
+    db = dinfo->media_db;
+
+  DEBUG_printf(("1cupsAddDestMediaOptions2: media->media=\"%s\"", media->media));
+
+  for (mdb = (_cups_media_db_t *)cupsArrayFirst(db); mdb; mdb = (_cups_media_db_t *)cupsArrayNext(db))
+  {
+    if (mdb->key && !strcmp(mdb->key, media->media))
+      break;
+    else if (mdb->size_name && !strcmp(mdb->size_name, media->media))
+      break;
+  }
+
+  if (!mdb)
+  {
+    for (mdb = (_cups_media_db_t *)cupsArrayFirst(db); mdb; mdb = (_cups_media_db_t *)cupsArrayNext(db))
+    {
+      if (mdb->width == media->width && mdb->length == media->length && mdb->bottom == media->bottom && mdb->left == media->left && mdb->right == media->right && mdb->top == media->top)
+       break;
+    }
+  }
+
+  if (!mdb)
+  {
+    for (mdb = (_cups_media_db_t *)cupsArrayFirst(db); mdb; mdb = (_cups_media_db_t *)cupsArrayNext(db))
+    {
+      if (mdb->width == media->width && mdb->length == media->length)
+       break;
+    }
+  }
+
+  if (!mdb)
+  {
+    DEBUG_puts("1cupsAddDestMediaOptions2: Unable to find matching size.");
+    return (num_options);
+  }
+
+  DEBUG_printf(("1cupsAddDestMediaOptions2: MATCH mdb%p [key=\"%s\" size_name=\"%s\" source=\"%s\" type=\"%s\" width=%d length=%d B%d L%d R%d T%d]", (void *)mdb, mdb->key, mdb->size_name, mdb->source, mdb->type, mdb->width, mdb->length, mdb->bottom, mdb->left, mdb->right, mdb->top));
+
+  if (mdb->source)
+  {
+    if (mdb->type)
+      snprintf(value, sizeof(value), "{media-size={x-dimension=%d y-dimension=%d} media-bottom-margin=%d media-left-margin=%d media-right-margin=%d media-top-margin=%d media-source=\"%s\" media-type=\"%s\"}", mdb->width, mdb->length, mdb->bottom, mdb->left, mdb->right, mdb->top, mdb->source, mdb->type);
+    else
+      snprintf(value, sizeof(value), "{media-size={x-dimension=%d y-dimension=%d} media-bottom-margin=%d media-left-margin=%d media-right-margin=%d media-top-margin=%d media-source=\"%s\"}", mdb->width, mdb->length, mdb->bottom, mdb->left, mdb->right, mdb->top, mdb->source);
+  }
+  else if (mdb->type)
+  {
+    snprintf(value, sizeof(value), "{media-size={x-dimension=%d y-dimension=%d} media-bottom-margin=%d media-left-margin=%d media-right-margin=%d media-top-margin=%d media-type=\"%s\"}", mdb->width, mdb->length, mdb->bottom, mdb->left, mdb->right, mdb->top, mdb->type);
+  }
+  else
+  {
+    snprintf(value, sizeof(value), "{media-size={x-dimension=%d y-dimension=%d} media-bottom-margin=%d media-left-margin=%d media-right-margin=%d media-top-margin=%d}", mdb->width, mdb->length, mdb->bottom, mdb->left, mdb->right, mdb->top);
+  }
+
+  num_options = cupsAddOption("media-col", value, num_options, options);
+
+  return (num_options);
+}
+
+
 /*
  * 'cupsCheckDestSupported()' - Check that the option and value are supported
  *                              by the destination.
@@ -763,14 +852,14 @@ cupsCopyDestInfo(
 
     ippSetVersion(request, version / 10, version % 10);
     ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri);
-    ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", NULL, cupsUser());
+    ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", NULL, cupsGetUser());
     ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "requested-attributes", (int)(sizeof(requested_attrs) / sizeof(requested_attrs[0])), NULL, requested_attrs);
     response = cupsDoRequest(http, request, resource);
-    status   = cupsLastError();
+    status   = cupsGetError();
 
     if (status > IPP_STATUS_OK_IGNORED_OR_SUBSTITUTED)
     {
-      DEBUG_printf(("1cupsCopyDestInfo: Get-Printer-Attributes for '%s' returned %s (%s)", dest->name, ippErrorString(status), cupsLastErrorString()));
+      DEBUG_printf(("1cupsCopyDestInfo: Get-Printer-Attributes for '%s' returned %s (%s)", dest->name, ippErrorString(status), cupsGetErrorString()));
 
       ippDelete(response);
       response = NULL;
@@ -1095,6 +1184,103 @@ cupsGetDestMediaByIndex(
 }
 
 
+/*
+ * 'cupsGetDestMediaByIndex2()' - Get specific media information.
+ *
+ * The @code flags@ parameter determines which set of media are indexed.  For
+ * example, passing @code CUPS_MEDIA_FLAGS_BORDERLESS@ will get the Nth
+ * borderless size supported by the printer.
+ *
+ * @since CUPS 2.5@
+ */
+
+bool                                   /* O - `true` on success, `false` on failure */
+cupsGetDestMediaByIndex2(
+    http_t       *http,                        /* I - Connection to destination */
+    cups_dest_t  *dest,                        /* I - Destination */
+    cups_dinfo_t *dinfo,               /* I - Destination information */
+    size_t       n,                    /* I - Media number (0-based) */
+    unsigned     flags,                        /* I - Media flags */
+    cups_media_t *media)               /* O - Media information */
+{
+  _cups_media_db_t     *nsize;         /* Size for N */
+  pwg_media_t          *pwg;           /* PWG media name for size */
+
+
+ /*
+  * Get the default connection as needed...
+  */
+
+  if (!http)
+    http = _cupsConnect();
+
+ /*
+  * Range check input...
+  */
+
+  if (media)
+    memset(media, 0, sizeof(cups_media_t));
+
+  if (!http || !dest || !dinfo || !media)
+  {
+    _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
+    return (false);
+  }
+
+ /*
+  * Load media list as needed...
+  */
+
+  if (flags & CUPS_MEDIA_FLAGS_READY)
+    cups_update_ready(http, dinfo);
+
+  if (!dinfo->cached_db || dinfo->cached_flags != flags)
+    cups_create_cached(http, dinfo, flags);
+
+ /*
+  * Copy the size over and return...
+  */
+
+  if ((nsize = (_cups_media_db_t *)cupsArrayIndex(dinfo->cached_db, n)) == NULL)
+  {
+    _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
+    return (false);
+  }
+
+  if (nsize->size_name)
+  {
+    cupsCopyString(media->media, nsize->size_name, sizeof(media->media));
+  }
+  else if ((pwg = pwgMediaForSize(nsize->width, nsize->length)) != NULL)
+  {
+    cupsCopyString(media->media, pwg->pwg, sizeof(media->media));
+  }
+  else
+  {
+    _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
+    return (false);
+  }
+
+  if (nsize->color)
+    cupsCopyString(media->color, nsize->color, sizeof(media->color));
+
+  if (nsize->source)
+    cupsCopyString(media->source, nsize->source, sizeof(media->source));
+
+  if (nsize->type)
+    cupsCopyString(media->type, nsize->type, sizeof(media->type));
+
+  media->width  = nsize->width;
+  media->length = nsize->length;
+  media->bottom = nsize->bottom;
+  media->left   = nsize->left;
+  media->right  = nsize->right;
+  media->top    = nsize->top;
+
+  return (true);
+}
+
+
 /*
  * 'cupsGetDestMediaByName()' - Get media names, dimensions, and margins.
  *
@@ -1120,7 +1306,7 @@ cupsGetDestMediaByName(
     http_t       *http,                        /* I - Connection to destination */
     cups_dest_t  *dest,                        /* I - Destination */
     cups_dinfo_t *dinfo,               /* I - Destination information */
-    const char   *media,               /* I - Media name */
+    const char   *name,                        /* I - Media name */
     unsigned     flags,                        /* I - Media matching flags */
     cups_size_t  *size)                        /* O - Media size information */
 {
@@ -1141,7 +1327,7 @@ cupsGetDestMediaByName(
   if (size)
     memset(size, 0, sizeof(cups_size_t));
 
-  if (!http || !dest || !dinfo || !media || !size)
+  if (!http || !dest || !dinfo || !name || !size)
   {
     _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
     return (0);
@@ -1151,19 +1337,95 @@ cupsGetDestMediaByName(
   * Lookup the media size name...
   */
 
-  if ((pwg = pwgMediaForPWG(media)) == NULL)
-    if ((pwg = pwgMediaForLegacy(media)) == NULL)
+  if ((pwg = pwgMediaForPWG(name)) == NULL)
+  {
+    if ((pwg = pwgMediaForLegacy(name)) == NULL)
     {
-      DEBUG_printf(("1cupsGetDestMediaByName: Unknown size '%s'.", media));
+      DEBUG_printf(("1cupsGetDestMediaByName: Unknown size '%s'.", name));
       _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Unknown media size name."), 1);
       return (0);
     }
+  }
+
+ /*
+  * Lookup the size...
+  */
+
+  return (cups_get_media_db(http, dinfo, pwg, flags, size, NULL));
+}
+
+
+/*
+ * 'cupsGetDestMediaByName2()' - Get media names, dimensions, and margins.
+ *
+ * The "media" string is a PWG media name.  "Flags" provides some matching
+ * guidance (multiple flags can be combined):
+ *
+ * CUPS_MEDIA_FLAGS_DEFAULT    = find the closest size supported by the printer,
+ * CUPS_MEDIA_FLAGS_BORDERLESS = find a borderless size,
+ * CUPS_MEDIA_FLAGS_DUPLEX     = find a size compatible with 2-sided printing,
+ * CUPS_MEDIA_FLAGS_EXACT      = find an exact match for the size, and
+ * CUPS_MEDIA_FLAGS_READY      = if the printer supports media sensing, find the
+ *                               size amongst the "ready" media.
+ *
+ * The matching result (if any) is returned in the "cups_size_t" structure.
+ *
+ * Returns `true` when there is a match and `false` if there is not a match.
+ *
+ * @since CUPS 1.6/macOS 10.8@
+ */
+
+bool                                   /* O - `true` on match, `false` on failure */
+cupsGetDestMediaByName2(
+    http_t       *http,                        /* I - Connection to destination */
+    cups_dest_t  *dest,                        /* I - Destination */
+    cups_dinfo_t *dinfo,               /* I - Destination information */
+    const char   *name,                        /* I - Media name */
+    unsigned     flags,                        /* I - Media matching flags */
+    cups_media_t *media)               /* O - Media information */
+{
+  pwg_media_t          *pwg;           /* PWG media info */
+
+
+ /*
+  * Get the default connection as needed...
+  */
+
+  if (!http)
+    http = _cupsConnect();
+
+ /*
+  * Range check input...
+  */
+
+  if (media)
+    memset(media, 0, sizeof(cups_media_t));
+
+  if (!http || !dest || !dinfo || !name || !media)
+  {
+    _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
+    return (false);
+  }
+
+ /*
+  * Lookup the media size name...
+  */
+
+  if ((pwg = pwgMediaForPWG(name)) == NULL)
+  {
+    if ((pwg = pwgMediaForLegacy(name)) == NULL)
+    {
+      DEBUG_printf(("1cupsGetDestMediaByName: Unknown size '%s'.", name));
+      _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Unknown media size name."), 1);
+      return (false);
+    }
+  }
 
  /*
   * Lookup the size...
   */
 
-  return (cups_get_media_db(http, dinfo, pwg, flags, size));
+  return (cups_get_media_db(http, dinfo, pwg, flags, NULL, media) != 0);
 }
 
 
@@ -1238,7 +1500,80 @@ cupsGetDestMediaBySize(
   * Lookup the size...
   */
 
-  return (cups_get_media_db(http, dinfo, pwg, flags, size));
+  return (cups_get_media_db(http, dinfo, pwg, flags, size, NULL));
+}
+
+
+/*
+ * 'cupsGetDestMediaBySize2()' - Get media names, dimensions, and margins.
+ *
+ * "Width" and "length" are the dimensions in hundredths of millimeters.
+ * "Flags" provides some matching guidance (multiple flags can be combined):
+ *
+ * CUPS_MEDIA_FLAGS_DEFAULT    = find the closest size supported by the printer,
+ * CUPS_MEDIA_FLAGS_BORDERLESS = find a borderless size,
+ * CUPS_MEDIA_FLAGS_DUPLEX     = find a size compatible with 2-sided printing,
+ * CUPS_MEDIA_FLAGS_EXACT      = find an exact match for the size, and
+ * CUPS_MEDIA_FLAGS_READY      = if the printer supports media sensing, find the
+ *                               size amongst the "ready" media.
+ *
+ * The matching result (if any) is returned in the "cups_size_t" structure.
+ *
+ * Returns `true` when there is a match and `false` if there is not a match.
+ *
+ * @since CUPS 2.5@
+ */
+
+bool                                   /* O - `true` on match, `false` on failure */
+cupsGetDestMediaBySize2(
+    http_t       *http,                        /* I - Connection to destination */
+    cups_dest_t  *dest,                        /* I - Destination */
+    cups_dinfo_t *dinfo,               /* I - Destination information */
+    int         width,                 /* I - Media width in hundredths of millimeters */
+    int         length,                        /* I - Media length in hundredths of millimeters */
+    unsigned     flags,                        /* I - Media matching flags */
+    cups_media_t *media)               /* O - Media information */
+{
+  pwg_media_t          *pwg;           /* PWG media info */
+
+
+ /*
+  * Get the default connection as needed...
+  */
+
+  if (!http)
+    http = _cupsConnect();
+
+ /*
+  * Range check input...
+  */
+
+  if (media)
+    memset(media, 0, sizeof(cups_media_t));
+
+  if (!http || !dest || !dinfo || width <= 0 || length <= 0 || !media)
+  {
+    _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
+    return (false);
+  }
+
+ /*
+  * Lookup the media size name...
+  */
+
+  if ((pwg = pwgMediaForSize(width, length)) == NULL)
+  {
+    DEBUG_printf(("1cupsGetDestMediaBySize2: Invalid size %dx%d.", width,
+                  length));
+    _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Invalid media size."), 1);
+    return (0);
+  }
+
+ /*
+  * Lookup the size...
+  */
+
+  return (cups_get_media_db(http, dinfo, pwg, flags, NULL, media) != 0);
 }
 
 
@@ -1359,6 +1694,74 @@ cupsGetDestMediaDefault(
 }
 
 
+/*
+ * 'cupsGetDestMediaDefault2()' - Get the default size for a destination.
+ *
+ * The @code flags@ parameter determines which default size is returned.  For
+ * example, passing @code CUPS_MEDIA_FLAGS_BORDERLESS@ will return the default
+ * borderless size, typically US Letter or A4, but sometimes 4x6 photo media.
+ *
+ * @since CUPS 2.5@
+ */
+
+bool                                   /* O - `true` on match, `false` on failure */
+cupsGetDestMediaDefault2(
+    http_t       *http,                        /* I - Connection to destination */
+    cups_dest_t  *dest,                        /* I - Destination */
+    cups_dinfo_t *dinfo,               /* I - Destination information */
+    unsigned     flags,                        /* I - Media flags */
+    cups_media_t *media)               /* O - Media information */
+{
+  const char   *name;                  /* Default media size */
+
+
+ /*
+  * Get the default connection as needed...
+  */
+
+  if (!http)
+    http = _cupsConnect();
+
+ /*
+  * Range check input...
+  */
+
+  if (media)
+    memset(media, 0, sizeof(cups_media_t));
+
+  if (!http || !dest || !dinfo || !media)
+  {
+    _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
+    return (0);
+  }
+
+ /*
+  * Get the default media size, if any...
+  */
+
+  if ((name = cupsGetOption("media", dest->num_options, dest->options)) == NULL)
+    name = "na_letter_8.5x11in";
+
+  if (cupsGetDestMediaByName2(http, dest, dinfo, name, flags, media))
+    return (true);
+
+  if (strcmp(name, "na_letter_8.5x11in") && cupsGetDestMediaByName2(http, dest, dinfo, "iso_a4_210x297mm", flags, media))
+    return (true);
+
+  if (strcmp(name, "iso_a4_210x297mm") && cupsGetDestMediaByName2(http, dest, dinfo, "na_letter_8.5x11in", flags, media))
+    return (true);
+
+  if ((flags & CUPS_MEDIA_FLAGS_BORDERLESS) && cupsGetDestMediaByName2(http, dest, dinfo, "na_index_4x6in", flags, media))
+    return (true);
+
+ /*
+  * Fall back to the first matching media size...
+  */
+
+  return (cupsGetDestMediaByIndex2(http, dest, dinfo, 0, flags, media));
+}
+
+
 /*
  * 'cups_add_dconstres()' - Add a constraint or resolver to an array.
  */
@@ -1621,7 +2024,7 @@ cups_collection_string(
                  const ipp_uchar_t *date = ippGetDate(member, j);
                                        /* Date value */
 
-                 year = (date[0] << 8) | date[1];
+                 year = (unsigned)(date[0] << 8) | date[1];
 
                  if (date[9] == 0 && date[10] == 0)
                    snprintf(temp, sizeof(temp), "%04u-%02u-%02uT%02u:%02u:%02uZ", year, date[2], date[3], date[4], date[5], date[6]);
@@ -2282,7 +2685,8 @@ cups_get_media_db(http_t       *http,     /* I - Connection to destination */
                   cups_dinfo_t *dinfo, /* I - Destination information */
                   pwg_media_t  *pwg,   /* I - PWG media info */
                   unsigned     flags,  /* I - Media matching flags */
-                  cups_size_t  *size)  /* O - Media size/margin/name info */
+                  cups_size_t  *size,  /* O - Media size/margin/name info */
+                  cups_media_t *media) /* O - Media information */
 {
   cups_array_t         *db;            /* Which media database to query */
   _cups_media_db_t     *mdb,           /* Current media database entry */
@@ -2517,21 +2921,50 @@ cups_get_media_db(http_t       *http,   /* I - Connection to destination */
   * Return the matching size...
   */
 
-  if (best->key)
-    strlcpy(size->media, best->key, sizeof(size->media));
-  else if (best->size_name)
-    strlcpy(size->media, best->size_name, sizeof(size->media));
-  else if (pwg->pwg)
-    strlcpy(size->media, pwg->pwg, sizeof(size->media));
-  else
-    strlcpy(size->media, "unknown", sizeof(size->media));
+  if (size)
+  {
+    if (best->key)
+      cupsCopyString(size->media, best->key, sizeof(size->media));
+    else if (best->size_name)
+      cupsCopyString(size->media, best->size_name, sizeof(size->media));
+    else if (pwg->pwg)
+      cupsCopyString(size->media, pwg->pwg, sizeof(size->media));
+    else
+      cupsCopyString(size->media, "unknown", sizeof(size->media));
+
+    size->width  = best->width;
+    size->length = best->length;
+    size->bottom = best->bottom;
+    size->left   = best->left;
+    size->right  = best->right;
+    size->top    = best->top;
+  }
+
+  if (media)
+  {
+    if (best->size_name)
+      cupsCopyString(media->media, best->size_name, sizeof(media->media));
+    else if (pwg->pwg)
+      cupsCopyString(media->media, pwg->pwg, sizeof(media->media));
+    else
+      cupsCopyString(media->media, "unknown", sizeof(media->media));
+
+    if (best->color)
+      cupsCopyString(media->color, best->color, sizeof(media->color));
+
+    if (best->source)
+      cupsCopyString(media->source, best->source, sizeof(media->source));
 
-  size->width  = best->width;
-  size->length = best->length;
-  size->bottom = best->bottom;
-  size->left   = best->left;
-  size->right  = best->right;
-  size->top    = best->top;
+    if (best->type)
+      cupsCopyString(media->type, best->type, sizeof(media->type));
+
+    media->width  = best->width;
+    media->length = best->length;
+    media->bottom = best->bottom;
+    media->left   = best->left;
+    media->right  = best->right;
+    media->top    = best->top;
+  }
 
   return (1);
 }
@@ -2828,7 +3261,7 @@ cups_update_ready(http_t       *http,     /* I - Connection to destination */
   ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL,
                dinfo->uri);
   ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
-               NULL, cupsUser());
+               NULL, cupsGetUser());
   ippAddStrings(request, IPP_TAG_OPERATION, IPP_CONST_TAG(IPP_TAG_KEYWORD), "requested-attributes", (int)(sizeof(pattrs) / sizeof(pattrs[0])), NULL, pattrs);
 
   dinfo->ready_attrs = cupsDoRequest(http, request, dinfo->resource);
index 3dc41a4428a31b24a977b8d5abee5c138fb4b8f7..a8c13574869c6860941f2247797d134ee9568523 100644 (file)
@@ -897,7 +897,7 @@ _cupsCreateDest(const char *name,   /* I - Printer name */
   request = ippNewRequest(IPP_OP_CUPS_CREATE_LOCAL_PRINTER);
 
   ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, "ipp://localhost/");
-  ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", NULL, cupsUser());
+  ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", NULL, cupsGetUser());
 
   ippAddString(request, IPP_TAG_PRINTER, IPP_TAG_URI, "device-uri", NULL, device_uri);
   ippAddString(request, IPP_TAG_PRINTER, IPP_TAG_NAME, "printer-name", NULL, name);
@@ -920,7 +920,7 @@ _cupsCreateDest(const char *name,   /* I - Printer name */
   if ((attr = ippFindAttribute(response, "printer-state", IPP_TAG_ENUM)) != NULL)
     state = (ipp_pstate_t)ippGetInteger(attr, 0);
 
-  while (state == IPP_PSTATE_STOPPED && cupsLastError() == IPP_STATUS_OK)
+  while (state == IPP_PSTATE_STOPPED && cupsGetError() == IPP_STATUS_OK)
   {
     sleep(1);
     ippDelete(response);
@@ -928,7 +928,7 @@ _cupsCreateDest(const char *name,   /* I - Printer name */
     request = ippNewRequest(IPP_OP_GET_PRINTER_ATTRIBUTES);
 
     ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri);
-    ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", NULL, cupsUser());
+    ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", NULL, cupsGetUser());
     ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "requested-attributes", NULL, "printer-state");
 
     response = cupsDoRequest(http, request, "/");
@@ -1427,7 +1427,7 @@ _cupsGetDests(http_t       *http, /* I  - Connection to server or
                NULL, pattrs);
 
   ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
-               "requesting-user-name", NULL, cupsUser());
+               "requesting-user-name", NULL, cupsGetUser());
 
   if (name && op != IPP_OP_CUPS_GET_DEFAULT)
   {
@@ -1770,7 +1770,7 @@ cupsGetNamedDest(http_t     *http,        /* I - Connection to server or @code CUPS_HTT
   if (!dest_name)
   {
     set_as_default = 1;
-    dest_name      = _cupsUserDefault(defname, sizeof(defname));
+    dest_name      = _cupsGetUserDefault(defname, sizeof(defname));
 
     if (dest_name)
     {
@@ -2064,7 +2064,7 @@ cupsSetDests2(http_t      *http,  /* I - Connection to server or @code CUPS_HTTP_
 
   num_temps = _cupsGetDests(http, IPP_OP_CUPS_GET_PRINTERS, NULL, &temps, 0, 0);
 
-  if (cupsLastError() >= IPP_STATUS_REDIRECTION_OTHER_SITE)
+  if (cupsGetError() >= IPP_STATUS_REDIRECTION_OTHER_SITE)
   {
     cupsFreeDests(num_temps, temps);
     return (-1);
@@ -2250,12 +2250,12 @@ cupsSetDests2(http_t      *http,        /* I - Connection to server or @code CUPS_HTTP_
 
 
 /*
- * '_cupsUserDefault()' - Get the user default printer from environment
+ * '_cupsGetUserDefault()' - Get the user default printer from environment
  *                        variables and location information.
  */
 
 char *                                 /* O - Default printer or NULL */
-_cupsUserDefault(char   *name,         /* I - Name buffer */
+_cupsGetUserDefault(char   *name,              /* I - Name buffer */
                  size_t namesize)      /* I - Size of name buffer */
 {
   const char   *env;                   /* LPDEST or PRINTER env variable */
@@ -2288,7 +2288,7 @@ _cupsUserDefault(char   *name,            /* I - Name buffer */
   else
     name[0] = '\0';
 
-  DEBUG_printf(("1_cupsUserDefault: Returning \"%s\".", name));
+  DEBUG_printf(("1_cupsGetUserDefault: Returning \"%s\".", name));
 
   return (*name ? name : NULL);
 
@@ -3456,7 +3456,7 @@ cups_enum_dests(
 
   memset(&data, 0, sizeof(data));
 
-  user_default = _cupsUserDefault(data.def_name, sizeof(data.def_name));
+  user_default = _cupsGetUserDefault(data.def_name, sizeof(data.def_name));
 
   snprintf(filename, sizeof(filename), "%s/lpoptions", cg->cups_serverroot);
   data.num_dests = cups_get_dests(filename, NULL, NULL, 1, user_default != NULL, data.num_dests, &data.dests);
index b1fca8616b890a481aa03cdc05686913b2974ddc..2970662ede53f31aabb939fdd0efe36d4c3e490f 100644 (file)
@@ -153,7 +153,7 @@ cupsGetDevices(
   if (status != HTTP_STATUS_OK)
   {
     _cupsSetHTTPError(status);
-    return (cupsLastError());
+    return (cupsGetError());
   }
 
  /*
@@ -256,5 +256,5 @@ cupsGetDevices(
 
   ippDelete(response);
 
-  return (cupsLastError());
+  return (cupsGetError());
 }
index 51a098acdcc1ffe6f9f28bc9f2fd7323930e7fba..387af723f73629de8a297ccad99185bf255566a0 100644 (file)
@@ -1420,7 +1420,7 @@ _httpSetDigestAuthString(
     */
 
     if (http->opaque[0])
-      snprintf(digest, sizeof(digest), "username=\"%s\", realm=\"%s\", nonce=\"%s\", algorithm=%s, qop=auth, opaque=\"%s\", cnonce=\"%s\", nc=%08x, uri=\"%s\", response=\"%s\"", cupsUser(), http->realm, http->nonce, http->algorithm, http->opaque, cnonce, http->nonce_count, resource, kd);
+      snprintf(digest, sizeof(digest), "username=\"%s\", realm=\"%s\", nonce=\"%s\", algorithm=%s, qop=auth, opaque=\"%s\", cnonce=\"%s\", nc=%08x, uri=\"%s\", response=\"%s\"", cupsGetUser(), http->realm, http->nonce, http->algorithm, http->opaque, cnonce, http->nonce_count, resource, kd);
     else
       snprintf(digest, sizeof(digest), "username=\"%s\", realm=\"%s\", nonce=\"%s\", algorithm=%s, qop=auth, cnonce=\"%s\", nc=%08x, uri=\"%s\", response=\"%s\"", username, http->realm, http->nonce, http->algorithm, cnonce, http->nonce_count, resource, kd);
   }
index f3a22d74c0bfff8657360b0c8f12e6d311654cfb..16dc91a437fb9eb887cd630302ad4231f2ed3d11 100644 (file)
@@ -4316,7 +4316,7 @@ http_send(http_t       *http,             /* I - HTTP connection */
     if (http->default_fields[HTTP_FIELD_USER_AGENT])
       httpSetField(http, HTTP_FIELD_USER_AGENT, http->default_fields[HTTP_FIELD_USER_AGENT]);
     else
-      httpSetField(http, HTTP_FIELD_USER_AGENT, cupsUserAgent());
+      httpSetField(http, HTTP_FIELD_USER_AGENT, cupsGetUserAgent());
   }
 
  /*
index 69efbd9aa0751ef28e61cc38a797a8255f90c100..9c7da667f34996721a09044c9e383c316ae40544 100644 (file)
@@ -149,7 +149,7 @@ _ippVarsGet(_ipp_vars_t *v,         /* I - IPP variables */
   else if (!strcmp(name, "resource"))
     return (v->resource);
   else if (!strcmp(name, "user"))
-    return (cupsUser());
+    return (cupsGetUser());
   else
     return (cupsGetOption(name, v->num_vars, v->vars));
 }
index 2afb3fbf222af6938fffbec425afab63aaa1dce9..bfe4ca17c5f6d863e0b208348f7978f4d5389a3f 100644 (file)
@@ -4675,7 +4675,7 @@ ippTimeToDate(time_t t)                   /* I - Time in seconds */
  *
  * This function validates the contents of an attribute based on the name and
  * value tag.  1 is returned if the attribute is valid, 0 otherwise.  On
- * failure, @link cupsLastErrorString@ is set to a human-readable message.
+ * failure, @link cupsGetErrorString@ is set to a human-readable message.
  *
  * @since CUPS 1.7/macOS 10.9@
  */
@@ -5182,7 +5182,7 @@ ippValidateAttribute(
  * 'ippValidateAttributes()' - Validate all attributes in an IPP message.
  *
  * This function validates the contents of the IPP message, including each
- * attribute.  Like @link ippValidateAttribute@, @link cupsLastErrorString@ is
+ * attribute.  Like @link ippValidateAttribute@, @link cupsGetErrorString@ is
  * set to a human-readable message on failure.
  *
  * @since CUPS 1.7/macOS 10.9@
index e0a135bd9d83ca0548648438fbaa5cd24dd96d55..dfb2f63fdaa868f96e9e09fd3b91e7c2bf0d10b3 100644 (file)
@@ -525,7 +525,7 @@ cupsGetServerPPD(http_t     *http,  /* I - Connection to server or @code CUPS_HTT
 
   close(fd);
 
-  if (cupsLastError() != IPP_STATUS_OK)
+  if (cupsGetError() != IPP_STATUS_OK)
   {
     unlink(pg->ppd_filename);
     return (NULL);
@@ -656,7 +656,7 @@ cups_get_printer_uri(
     ippDelete(response);
   }
 
-  if (cupsLastError() != IPP_STATUS_ERROR_NOT_FOUND)
+  if (cupsGetError() != IPP_STATUS_ERROR_NOT_FOUND)
     _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("No printer-uri found"), 1);
 
   *host     = '\0';
index 513c00f6b80929b36133fd32cb96ae6e6ad5b554..16027f084015066767bd261623d06aff7e209ca5 100644 (file)
@@ -294,6 +294,32 @@ cupsDoRequest(http_t     *http,            /* I - Connection to server or @code CUPS_HTTP_
 }
 
 
+/*
+ * 'cupsGetError()' - Return the last IPP status code received on the current thread.
+ *
+ * @since CUPS 2.5@
+ */
+
+ipp_status_t                           /* O - IPP status code from last request */
+cupsGetError(void)
+{
+  return (_cupsGlobals()->last_error);
+}
+
+
+/*
+ * 'cupsGetErrorString()' - Return the last IPP status-message received on the current thread.
+ *
+ * @since CUPS 2.5@
+ */
+
+const char *                           /* O - status-message text from last request */
+cupsGetErrorString(void)
+{
+  return (_cupsGlobals()->last_status_message);
+}
+
+
 /*
  * 'cupsGetResponse()' - Get a response to an IPP request.
  *
@@ -466,28 +492,28 @@ cupsGetResponse(http_t     *http, /* I - Connection to server or @code CUPS_HTTP
 
 
 /*
- * 'cupsLastError()' - Return the last IPP status code received on the current
- *                     thread.
+ * 'cupsLastError()' - Return the last IPP status code received on the current thread.
+ *
+ * @deprecated@
  */
 
 ipp_status_t                           /* O - IPP status code from last request */
 cupsLastError(void)
 {
-  return (_cupsGlobals()->last_error);
+  return (cupsGetError());
 }
 
 
 /*
- * 'cupsLastErrorString()' - Return the last IPP status-message received on the
- *                           current thread.
+ * 'cupsLastErrorString()' - Return the last IPP status-message received on the current thread.
  *
- * @since CUPS 1.2/macOS 10.5@
+ * @deprecated@
  */
 
 const char *                           /* O - status-message text from last request */
 cupsLastErrorString(void)
 {
-  return (_cupsGlobals()->last_status_message);
+  return (cupsGetErrorString());
 }
 
 
index 3b52a1547d32bbb7918050e3971b2d957d3f51ad..b6dca4317e0b7ea8af4ab2e62a05c7bc0f2cac3a 100644 (file)
@@ -1,19 +1,15 @@
-/*
- * Temp file utilities for CUPS.
- *
- * Copyright Â©Â 2007-2018 by Apple Inc.
- * Copyright Â©Â 1997-2006 by Easy Software Products.
- *
- * Licensed under Apache License v2.0.  See the file "LICENSE" for more
- * information.
- */
-
-/*
- * Include necessary headers...
- */
+//
+// Temp file utilities for CUPS.
+//
+// Copyright Â© 2021-2023 by OpenPrinting.
+// Copyright Â©Â 2007-2018 by Apple Inc.
+// Copyright Â©Â 1997-2006 by Easy Software Products.
+//
+// Licensed under Apache License v2.0.  See the file "LICENSE" for more
+// information.
+//
 
 #include "cups-private.h"
-#include "debug-internal.h"
 #include <stdlib.h>
 #include <fcntl.h>
 #include <sys/stat.h>
 #  include <io.h>
 #else
 #  include <unistd.h>
-#endif /* _WIN32 || __EMX__ */
-
-
-/*
- * 'cupsTempFd()' - Creates a temporary file.
- *
- * The temporary filename is returned in the filename buffer.
- * The temporary file is opened for reading and writing.
- */
-
-int                                    /* O - New file descriptor or -1 on error */
-cupsTempFd(char *filename,             /* I - Pointer to buffer */
-           int  len)                   /* I - Size of buffer */
+#endif // _WIN32 || __EMX__
+
+
+//
+// 'cupsCreateTempFd()' - Creates a temporary file descriptor.
+//
+// This function creates a temporary file and associated descriptor.  The unique
+// temporary filename uses the "prefix" and "suffix" arguments and is returned
+// in the "filename" buffer.  The temporary file is opened for reading and
+// writing.
+//
+// @since CUPS 2.5@
+//
+
+int                                    // O - New file descriptor or `-1` on error
+cupsCreateTempFd(const char *prefix,   // I - Filename prefix or `NULL` for none
+                 const char *suffix,   // I - Filename suffix or `NULL` for none
+                 char       *filename, // I - Pointer to buffer
+                 size_t     len)       // I - Size of buffer
 {
-  int          fd;                     /* File descriptor for temp file */
-  int          tries;                  /* Number of tries */
-  const char   *tmpdir;                /* TMPDIR environment var */
+  int          fd;                     // File descriptor for temp file
+  int          tries;                  // Number of tries
+  const char   *tmpdir;                // TMPDIR environment var
 #if (defined(__APPLE__) && defined(_CS_DARWIN_USER_TEMP_DIR)) || defined(_WIN32)
-  char         tmppath[1024];          /* Temporary directory */
-#endif /* (__APPLE__ && _CS_DARWIN_USER_TEMP_DIR) || _WIN32 */
+  char         tmppath[1024];          // Temporary directory
+#endif // (__APPLE__ && _CS_DARWIN_USER_TEMP_DIR) || _WIN32
 #ifdef _WIN32
-  DWORD                curtime;                /* Current time */
+  DWORD                curtime;                // Current time
 #else
-  struct timeval curtime;              /* Current time */
-#endif /* _WIN32 */
-
+  struct timeval curtime;              // Current time
+#endif // _WIN32
 
- /*
-  * See if TMPDIR is defined...
-  */
 
+  // Get the current temporary directory...
 #ifdef _WIN32
   if ((tmpdir = getenv("TEMP")) == NULL)
   {
+    // Use the Windows API to get the system temporary directory...
     GetTempPathA(sizeof(tmppath), tmppath);
     tmpdir = tmppath;
   }
 
 #elif defined(__APPLE__)
- /*
-  * On macOS and iOS, the TMPDIR environment variable is not always the best
-  * location to place temporary files due to sandboxing.  Instead, the confstr
-  * function should be called to get the proper per-user, per-process TMPDIR
-  * value.
-  */
-
+  // On macOS and iOS, the TMPDIR environment variable is not always the best
+  // location to place temporary files due to sandboxing.  Instead, the confstr
+  // function should be called to get the proper per-user, per-process TMPDIR
+  // value.
   if ((tmpdir = getenv("TMPDIR")) != NULL && access(tmpdir, W_OK))
     tmpdir = NULL;
 
@@ -76,69 +73,48 @@ cupsTempFd(char *filename,          /* I - Pointer to buffer */
     if (confstr(_CS_DARWIN_USER_TEMP_DIR, tmppath, sizeof(tmppath)))
       tmpdir = tmppath;
     else
-#endif /* _CS_DARWIN_USER_TEMP_DIR */
-      tmpdir = "/private/tmp";         /* OS X 10.4 and earlier */
+#endif // _CS_DARWIN_USER_TEMP_DIR
+      tmpdir = "/private/tmp";         // macOS 10.4 and earlier
   }
 
 #else
- /*
-  * Previously we put root temporary files in the default CUPS temporary
-  * directory under /var/spool/cups.  However, since the scheduler cleans
-  * out temporary files there and runs independently of the user apps, we
-  * don't want to use it unless specifically told to by cupsd.
-  */
-
+  // Previously we put root temporary files in the default CUPS temporary
+  // directory under /var/spool/cups.  However, since the scheduler cleans
+  // out temporary files there and runs independently of the user apps, we
+  // don't want to use it unless specifically told to by cupsd.
   if ((tmpdir = getenv("TMPDIR")) == NULL)
     tmpdir = "/tmp";
-#endif /* _WIN32 */
-
- /*
-  * Make the temporary name using the specified directory...
-  */
+#endif // _WIN32
 
+  // Make the temporary name using the specified directory...
   tries = 0;
 
   do
   {
 #ifdef _WIN32
-   /*
-    * Get the current time of day...
-    */
-
+    // Get the current time of day...
     curtime =  GetTickCount() + tries;
 
-   /*
-    * Format a string using the hex time values...
-    */
+    // Format a string using the hex time values...
+    snprintf(filename, (size_t)len - 1, "%s/%s%05lx%08lx%s", tmpdir, prefix ? prefix : "", GetCurrentProcessId(), curtime, suffix ? suffix : "");
 
-    snprintf(filename, (size_t)len - 1, "%s/%05lx%08lx", tmpdir, GetCurrentProcessId(), curtime);
 #else
-   /*
-    * Get the current time of day...
-    */
-
+    // Get the current time of day...
     gettimeofday(&curtime, NULL);
 
-   /*
-    * Format a string using the hex time values...
-    */
-
-    snprintf(filename, (size_t)len - 1, "%s/%05x%08x", tmpdir, (unsigned)getpid(), (unsigned)(curtime.tv_sec + curtime.tv_usec + tries));
-#endif /* _WIN32 */
-
-   /*
-    * Open the file in "exclusive" mode, making sure that we don't
-    * stomp on an existing file or someone's symlink crack...
-    */
+    // Format a string using the hex time values...
+    snprintf(filename, (size_t)len - 1, "%s/%s%05x%08x%s", tmpdir, prefix ? prefix : "", (unsigned)getpid(), (unsigned)(curtime.tv_sec + curtime.tv_usec + tries), suffix ? suffix : "");
+#endif // _WIN32
 
+    // Open the file in "exclusive" mode, making sure that we don't
+    // stomp on an existing file or someone's symlink crack...
 #ifdef _WIN32
-    fd = open(filename, _O_CREAT | _O_RDWR | _O_TRUNC | _O_BINARY,
-              _S_IREAD | _S_IWRITE);
+    fd = open(filename, _O_CREAT | _O_RDWR | _O_TRUNC | _O_BINARY, _S_IREAD | _S_IWRITE);
 #elif defined(O_NOFOLLOW)
     fd = open(filename, O_RDWR | O_CREAT | O_EXCL | O_NOFOLLOW, 0600);
 #else
     fd = open(filename, O_RDWR | O_CREAT | O_EXCL, 0600);
-#endif /* _WIN32 */
+#endif // _WIN32
 
     if (fd < 0 && errno != EEXIST)
       break;
@@ -147,27 +123,85 @@ cupsTempFd(char *filename,                /* I - Pointer to buffer */
   }
   while (fd < 0 && tries < 1000);
 
- /*
-  * Return the file descriptor...
-  */
+  // Clear the filename if we didn't create a file...
+  if (fd < 0)
+    *filename = '\0';
 
+  // Return the file descriptor...
   return (fd);
 }
 
 
-/*
- * 'cupsTempFile()' - Generates a temporary filename.
- *
- * The temporary filename is returned in the filename buffer.
- * This function is deprecated and will no longer generate a temporary
- * filename - use @link cupsTempFd@ or @link cupsTempFile2@ instead.
- *
- * @deprecated@
- */
+//
+// 'cupsCreateTempFile()' - Creates a temporary CUPS file.
+//
+// This function creates a temporary file and returns a CUPS file for it.  The
+// unique temporary filename uses the "prefix" and "suffix" arguments and is
+// returned in the "filename" buffer.  The temporary file is opened for writing.
+//
+// @since CUPS 2.5@
+//
+
+cups_file_t *                          // O - CUPS file or `NULL` on error
+cupsCreateTempFile(const char *prefix, // I - Filename prefix or `NULL` for none
+                   const char *suffix,         // I - Filename suffix or `NULL` for none
+                  char       *filename,// I - Pointer to buffer
+                  size_t     len)      // I - Size of buffer
+{
+  cups_file_t  *file;                  // CUPS file
+  int          fd;                     // File descriptor
+
 
-char *                                 /* O - Filename or @code NULL@ on error */
-cupsTempFile(char *filename,           /* I - Pointer to buffer */
-             int  len)                 /* I - Size of buffer */
+  if ((fd = cupsCreateTempFd(prefix, suffix, filename, len)) < 0)
+  {
+    return (NULL);
+  }
+  else if ((file = cupsFileOpenFd(fd, "w")) == NULL)
+  {
+    close(fd);
+    unlink(filename);
+    return (NULL);
+  }
+  else
+  {
+    return (file);
+  }
+}
+
+
+//
+// 'cupsTempFd()' - Create a temporary file descriptor.
+//
+// This function creates a temporary file descriptor and places the filename in
+// the "filename" buffer.  The temporary file descriptor is opened for reading
+// and writing.
+//
+// > Note: This function is deprecated. Use the @link cupsCreateTempFd@
+// > function instead.
+//
+// @deprecated@
+//
+
+int                                    /* O - New file descriptor or -1 on error */
+cupsTempFd(char *filename,             /* I - Pointer to buffer */
+           int  len)                   /* I - Size of buffer */
+{
+  return (cupsCreateTempFd(NULL, NULL, filename, (size_t)len));
+}
+
+
+//
+// 'cupsTempFile()' - Generate a temporary filename (deprecated).
+//
+// This function is deprecated and no longer generates a temporary filename.
+// Use @link cupsCreateTempFd@ or @link cupsCreateTempFile2@ instead.
+//
+// @deprecated@
+//
+
+char *                                 // O - `NULL` (error)
+cupsTempFile(char *filename,           // I - Pointer to buffer */
+             int  len)                 // I - Size of buffer
 {
   (void)len;
 
@@ -178,31 +212,21 @@ cupsTempFile(char *filename,              /* I - Pointer to buffer */
 }
 
 
-/*
- * 'cupsTempFile2()' - Creates a temporary CUPS file.
- *
- * The temporary filename is returned in the filename buffer.
- * The temporary file is opened for writing.
- *
- * @since CUPS 1.2/macOS 10.5@
- */
+//
+// 'cupsTempFile2()' - Creates a temporary CUPS file.
+//
+// This function creates a temporary CUPS file and places the filename in the
+// "filename" buffer.  The temporary file is opened for writing.
+//
+// > Note: This function is deprecated. Use the @link cupsCreateTempFile@
+// > function instead.
+//
+// @deprecated@
+//
 
 cups_file_t *                          /* O - CUPS file or @code NULL@ on error */
 cupsTempFile2(char *filename,          /* I - Pointer to buffer */
               int  len)                        /* I - Size of buffer */
 {
-  cups_file_t  *file;                  /* CUPS file */
-  int          fd;                     /* File descriptor */
-
-
-  if ((fd = cupsTempFd(filename, len)) < 0)
-    return (NULL);
-  else if ((file = cupsFileOpenFd(fd, "w")) == NULL)
-  {
-    close(fd);
-    unlink(filename);
-    return (NULL);
-  }
-  else
-    return (file);
+  return (cupsCreateTempFile(NULL, NULL, filename, (size_t)len));
 }
index 58424eae41e0daa6b99884109220afc646b349d0..256855255f264ffc7acc1dd341ff08a5640ce455 100644 (file)
@@ -59,7 +59,7 @@ main(int  argc,                               /* I - Number of command-line args */
     }
     else
     {
-      printf("Server settings not changed: %s\n", cupsLastErrorString());
+      printf("Server settings not changed: %s\n", cupsGetErrorString());
       return (1);
     }
   }
@@ -78,7 +78,7 @@ main(int  argc,                               /* I - Number of command-line args */
   }
   else
   {
-    printf("    %s\n", cupsLastErrorString());
+    printf("    %s\n", cupsGetErrorString());
     return (1);
   }
 }
index 52dde040f59b2fdf510de72aa4730136ab15ab83..f265285a1c8a1bff2e1fc6c957085b134f389be8 100644 (file)
@@ -676,7 +676,7 @@ monitor_printer(
 
       request = ippNewRequest(IPP_OP_GET_PRINTER_ATTRIBUTES);
       ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, data->uri);
-      ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", NULL, cupsUser());
+      ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", NULL, cupsGetUser());
       ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "requested-attributes", (int)(sizeof(pattrs) / sizeof(pattrs[0])), NULL, pattrs);
 
       response = cupsDoRequest(http, request, data->resource);
@@ -706,7 +706,7 @@ monitor_printer(
         request = ippNewRequest(IPP_OP_GET_JOB_ATTRIBUTES);
         ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, data->uri);
         ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_INTEGER, "job-id", data->job_id);
-        ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", NULL, cupsUser());
+        ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", NULL, cupsGetUser());
         ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "requested-attributes", (int)(sizeof(jattrs) / sizeof(jattrs[0])), NULL, jattrs);
 
         response = cupsDoRequest(http, request, data->resource);
@@ -794,7 +794,7 @@ run_client(
 
   request = ippNewRequest(IPP_OP_GET_PRINTER_ATTRIBUTES);
   ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, ldata.uri);
-  ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", NULL, cupsUser());
+  ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", NULL, cupsGetUser());
   ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "requested-attributes", (int)(sizeof(pattrs) / sizeof(pattrs[0])), NULL, pattrs);
 
   response = cupsDoRequest(http, request, ldata.resource);
@@ -861,7 +861,7 @@ run_client(
   {
     request = ippNewRequest(IPP_OP_CREATE_JOB);
     ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, ldata.uri);
-    ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", NULL, cupsUser());
+    ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", NULL, cupsGetUser());
 
     if ((name = strrchr(ldata.docfile, '/')) != NULL)
       name ++;
@@ -878,25 +878,25 @@ run_client(
     if (verbosity)
       show_attributes("Create-Job response", 0, response);
 
-    if (cupsLastError() == IPP_STATUS_ERROR_BUSY)
+    if (cupsGetError() == IPP_STATUS_ERROR_BUSY)
     {
       puts("Printer is busy - retrying in 5 seconds...");
       sleep(5);
       ippDelete(response);
       response = NULL;
     }
-    else if (cupsLastError() >= IPP_STATUS_REDIRECTION_OTHER_SITE)
+    else if (cupsGetError() >= IPP_STATUS_REDIRECTION_OTHER_SITE)
     {
-      printf("Unable to create print job: %s\n", cupsLastErrorString());
+      printf("Unable to create print job: %s\n", cupsGetErrorString());
 
       ldata.job_state = IPP_JSTATE_ABORTED;
       ippDelete(response);
       response = NULL;
     }
   }
-  while (cupsLastError() == IPP_STATUS_ERROR_BUSY);
+  while (cupsGetError() == IPP_STATUS_ERROR_BUSY);
 
-  if (cupsLastError() >= IPP_STATUS_REDIRECTION_OTHER_SITE)
+  if (cupsGetError() >= IPP_STATUS_REDIRECTION_OTHER_SITE)
     goto cleanup;
 
   if ((attr = ippFindAttribute(response, "job-id", IPP_TAG_INTEGER)) == NULL)
@@ -917,7 +917,7 @@ run_client(
   request = ippNewRequest(IPP_OP_SEND_DOCUMENT);
   ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, ldata.uri);
   ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_INTEGER, "job-id", ldata.job_id);
-  ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", NULL, cupsUser());
+  ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", NULL, cupsGetUser());
   ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_MIMETYPE, "document-format", NULL, ldata.docformat);
   ippAddBoolean(request, IPP_TAG_OPERATION, "last-document", 1);
 
@@ -929,9 +929,9 @@ run_client(
   if (verbosity)
     show_attributes("Send-Document response", 0, response);
 
-  if (cupsLastError() >= IPP_STATUS_REDIRECTION_OTHER_SITE)
+  if (cupsGetError() >= IPP_STATUS_REDIRECTION_OTHER_SITE)
   {
-    printf("Unable to print file: %s\n", cupsLastErrorString());
+    printf("Unable to print file: %s\n", cupsGetErrorString());
 
     ldata.job_state = IPP_JSTATE_ABORTED;
 
index 02d16a8e0cb2b3b859b838e9cffc12db960915cf..a0fc26a6b55486f6b673142848ebdbf9f9b67a55 100644 (file)
@@ -62,7 +62,7 @@ main(int  argc,                               /* I - Number of command-line arguments */
 
     if ((http = httpConnect2(hostname, port, NULL, AF_UNSPEC, HTTP_ENCRYPTION_ALWAYS, 1, 30000, NULL)) == NULL)
     {
-      printf("ERROR: Unable to connect to \"%s\" on port %d: %s\n", hostname, port, cupsLastErrorString());
+      printf("ERROR: Unable to connect to \"%s\" on port %d: %s\n", hostname, port, cupsGetErrorString());
       return (1);
     }
 
@@ -77,7 +77,7 @@ main(int  argc,                               /* I - Number of command-line arguments */
       if (trust == HTTP_TRUST_OK)
         puts("    Trust: OK");
       else
-        printf("    Trust: %s (%s)\n", trusts[trust], cupsLastErrorString());
+        printf("    Trust: %s (%s)\n", trusts[trust], cupsGetErrorString());
       printf("    Expiration: %s\n", httpGetDateString(httpCredentialsGetExpiration(hcreds)));
       printf("    IsValidName: %d\n", httpCredentialsAreValidForName(hcreds, hostname));
       printf("    String: \"%s\"\n", hinfo);
index e8271f8dd1edd474edab8a3013d1b3f92058da44..e71d56f2a6cf5314a2312fb436008541b7cf6df0 100644 (file)
@@ -174,7 +174,7 @@ main(int  argc,                             /* I - Number of command-line arguments */
       if ((http_status = cupsGetPPD3(CUPS_HTTP_DEFAULT, argv[2], &modtime,
                                      buffer, sizeof(buffer))) != HTTP_STATUS_OK)
         printf("Unable to get PPD: %d (%s)\n", (int)http_status,
-               cupsLastErrorString());
+               cupsGetErrorString());
       else
         puts(buffer);
     }
@@ -200,7 +200,7 @@ main(int  argc,                             /* I - Number of command-line arguments */
                                  NULL)) <= 0)
       {
        printf("Unable to create print job on %s: %s\n", argv[1],
-              cupsLastErrorString());
+              cupsGetErrorString());
        return (1);
       }
 
@@ -433,7 +433,7 @@ main(int  argc,                             /* I - Number of command-line arguments */
   if (cupsPrintFile(dest->name, "../test/testfile.pdf", "Test Page",
                     dest->num_options, dest->options) <= 0)
   {
-    printf("FAIL (%s)\n", cupsLastErrorString());
+    printf("FAIL (%s)\n", cupsGetErrorString());
     return (1);
   }
   else
index 9b07e77718fb161c2c5a92cb1b72f7e9d8079062..0a907383c678db55520aa2b94c9063664907f980 100644 (file)
@@ -136,7 +136,7 @@ main(int  argc,                             /* I - Number of command-line arguments */
 
   if (!dest)
   {
-    printf("testdest: Unable to get destination \"%s\": %s\n", argv[i], cupsLastErrorString());
+    printf("testdest: Unable to get destination \"%s\": %s\n", argv[i], cupsGetErrorString());
     return (1);
   }
 
@@ -144,13 +144,13 @@ main(int  argc,                           /* I - Number of command-line arguments */
 
   if ((http = cupsConnectDest(dest, dflags, 30000, NULL, NULL, 0, NULL, NULL)) == NULL)
   {
-    printf("testdest: Unable to connect to destination \"%s\": %s\n", dest->name, cupsLastErrorString());
+    printf("testdest: Unable to connect to destination \"%s\": %s\n", dest->name, cupsGetErrorString());
     return (1);
   }
 
   if ((dinfo = cupsCopyDestInfo(http, dest)) == NULL)
   {
-    printf("testdest: Unable to get information for destination \"%s\": %s\n", dest->name, cupsLastErrorString());
+    printf("testdest: Unable to get information for destination \"%s\": %s\n", dest->name, cupsGetErrorString());
     return (1);
   }
 
@@ -428,7 +428,7 @@ print_file(http_t        *http,             /* I - Connection to destination */
 
   if (cupsCreateDestJob(http, dest, dinfo, &job_id, title, num_options, options) > IPP_STATUS_OK_IGNORED_OR_SUBSTITUTED)
   {
-    printf("Unable to create job: %s\n", cupsLastErrorString());
+    printf("Unable to create job: %s\n", cupsGetErrorString());
     cupsFileClose(fp);
     return;
   }
@@ -437,7 +437,7 @@ print_file(http_t        *http,             /* I - Connection to destination */
 
   if (cupsStartDestDocument(http, dest, dinfo, job_id, title, CUPS_FORMAT_AUTO, 0, NULL, 1) != HTTP_STATUS_CONTINUE)
   {
-    printf("Unable to send document: %s\n", cupsLastErrorString());
+    printf("Unable to send document: %s\n", cupsGetErrorString());
     cupsFileClose(fp);
     return;
   }
@@ -446,7 +446,7 @@ print_file(http_t        *http,             /* I - Connection to destination */
   {
     if (cupsWriteRequestData(http, buffer, (size_t)bytes) != HTTP_STATUS_CONTINUE)
     {
-      printf("Unable to write document data: %s\n", cupsLastErrorString());
+      printf("Unable to write document data: %s\n", cupsGetErrorString());
       break;
     }
   }
@@ -455,7 +455,7 @@ print_file(http_t        *http,             /* I - Connection to destination */
 
   if (cupsFinishDestDocument(http, dest, dinfo) > IPP_STATUS_OK_IGNORED_OR_SUBSTITUTED)
   {
-    printf("Unable to send document: %s\n", cupsLastErrorString());
+    printf("Unable to send document: %s\n", cupsGetErrorString());
     return;
   }
 
index b31aae9ed919a2d239c9ad77aeb6e71c4d0b5b75..f7b01fa476b91c34e306db1b17e217ad72548a2d 100644 (file)
@@ -855,7 +855,7 @@ main(int  argc,                     /* I - Number of command-line arguments */
 
        if (state != IPP_STATE_DATA)
        {
-         printf("Error reading IPP message from \"%s\": %s\n", argv[i], cupsLastErrorString());
+         printf("Error reading IPP message from \"%s\": %s\n", argv[i], cupsGetErrorString());
          status = 1;
 
          ippDelete(request);
@@ -883,7 +883,7 @@ main(int  argc,                     /* I - Number of command-line arguments */
 
        if (state != IPP_STATE_DATA)
        {
-         printf("Error reading IPP message from \"%s\": %s\n", argv[i], cupsLastErrorString());
+         printf("Error reading IPP message from \"%s\": %s\n", argv[i], cupsGetErrorString());
          status = 1;
 
          ippDelete(request);
index c295d478bfe1b4f4ae54490b6a41402ccbf53ce6..7a4746bc95969358a956bf89d7ed18436668ea25 100644 (file)
@@ -1101,7 +1101,7 @@ main(int  argc,                           /* I - Number of command-line arguments */
     http = httpConnect2(host, port, NULL, AF_UNSPEC, !strcmp(scheme, "ipps") ? HTTP_ENCRYPTION_ALWAYS : HTTP_ENCRYPTION_IF_REQUESTED, 1, 30000, NULL);
     if (!http)
     {
-      printf("Unable to connect to \"%s:%d\": %s\n", host, port, cupsLastErrorString());
+      printf("Unable to connect to \"%s:%d\": %s\n", host, port, cupsGetErrorString());
       return (1);
     }
 
@@ -1133,7 +1133,7 @@ main(int  argc,                           /* I - Number of command-line arguments */
 
       if ((filename = cupsGetServerPPD(CUPS_HTTP_DEFAULT, argv[1])) == NULL)
       {
-        printf("%s: %s\n", argv[1], cupsLastErrorString());
+        printf("%s: %s\n", argv[1], cupsGetErrorString());
         return (1);
       }
     }
@@ -1155,7 +1155,7 @@ main(int  argc,                           /* I - Number of command-line arguments */
 
       if (!filename)
       {
-        printf("%s: %s\n", printer, cupsLastErrorString());
+        printf("%s: %s\n", printer, cupsGetErrorString());
         return (1);
       }
     }
@@ -1358,7 +1358,7 @@ main(int  argc,                           /* I - Number of command-line arguments */
 
       puts("\nPPD Cache:");
       if ((pc = _ppdCacheCreateWithPPD(ppd)) == NULL)
-        printf("    Unable to create: %s\n", cupsLastErrorString());
+        printf("    Unable to create: %s\n", cupsGetErrorString());
       else
       {
         _ppdCacheWriteFile(pc, "t.cache", NULL);
index 309077f843fceb4da66377889b4200d2ad8f35f8..f02f08b16702565d316b735cab39090c2cff9328 100644 (file)
@@ -18,7 +18,7 @@
 // Local functions...
 //
 
-static bool    enum_dests_cb(void *_name, unsigned flags, cups_dest_t *dest);
+static int     enum_dests_cb(void *_name, unsigned flags, cups_dest_t *dest);
 static void    *run_query(cups_dest_t *dest);
 static void    show_supported(http_t *http, cups_dest_t *dest, cups_dinfo_t *dinfo, const char *option, const char *value);
 
@@ -44,7 +44,7 @@ main(int  argc,                               // I - Number of command-line arguments
 // 'enum_dests_cb()' - Destination enumeration function...
 //
 
-static bool                            // O - `true` to continue, `false` to stop
+static int                             // O - 1 to continue, 0 to stop
 enum_dests_cb(void        *_name,      // I - Printer name, if any
               unsigned    flags,       // I - Enumeration flags
               cups_dest_t *dest)       // I - Found destination
@@ -58,7 +58,7 @@ enum_dests_cb(void        *_name,     // I - Printer name, if any
 
   // If a name was specified, compare it...
   if (name && strcasecmp(name, dest->name))
-    return (true);                     // Continue
+    return (1);                                // Continue
 
   // Copy the destination and run the query on a separate thread...
   cupsCopyDest(dest, 0, &cdest);
@@ -222,7 +222,7 @@ show_supported(http_t       *http,  // I - Connection to destination
            for (i = 0; i < count; i ++)
            {
              size_t j;                 // Looping var
-             size_t len;               // Length of value
+             int len;          // Length of value
              unsigned char *data = ippGetOctetString(attr, i, &len);
                                        // Pointer to octet string
 
index 0a541f72332fba39087244cc3f11c6ca6bc0aa39..15c934ef1a3dd49987440f5be3b14a2cda29ee73 100644 (file)
@@ -170,7 +170,7 @@ main(int  argc,                             /* I - Number of command-line arguments */
 
   if (!http)
   {
-    printf("%s: ERROR (%s)\n", server, cupsLastErrorString());
+    printf("%s: ERROR (%s)\n", server, cupsGetErrorString());
     return (1);
   }
 
@@ -763,7 +763,7 @@ main(int  argc,                             /* I - Number of command-line arguments */
     httpAssembleURI(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipps", NULL, server, port, resource);
     request = ippNewRequest(IPP_OP_GET_PRINTER_ATTRIBUTES);
     ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri);
-    ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", NULL, cupsUser());
+    ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", NULL, cupsGetUser());
     ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "requested-attributes", (int)(sizeof(pattrs) / sizeof(pattrs[0])), NULL, pattrs);
 
     response = cupsDoRequest(http, request, resource);
index df5cbaea8ea83762526771ce87ad5438716c8489..40817a8f771376c3e52dd93f032af121aea06271 100644 (file)
@@ -113,6 +113,19 @@ static void        cups_set_user(_cups_client_conf_t *cc, const char *value);
 /*
  * 'cupsEncryption()' - Get the current encryption settings.
  *
+ * @deprecated@
+ */
+
+http_encryption_t                      /* O - Encryption settings */
+cupsEncryption(void)
+{
+  return (cupsGetEncryption());
+}
+
+
+/*
+ * 'cupsGetEncryption()' - Get the current encryption settings.
+ *
  * The default encryption setting comes from the CUPS_ENCRYPTION
  * environment variable, then the ~/.cups/client.conf file, and finally the
  * /etc/cups/client.conf file. If not set, the default is
@@ -122,10 +135,12 @@ static void       cups_set_user(_cups_client_conf_t *cc, const char *value);
  * in a program. Multi-threaded programs that override the setting via the
  * @link cupsSetEncryption@ function need to do so in each thread for the same
  * setting to be used.
+ *
+ * @since CUPS 2.5@
  */
 
 http_encryption_t                      /* O - Encryption settings */
-cupsEncryption(void)
+cupsGetEncryption(void)
 {
   _cups_globals_t *cg = _cupsGlobals();        /* Pointer to library globals */
 
@@ -193,7 +208,7 @@ cupsGetPassword2(const char *prompt,        /* I - Prompt string */
 
 
 /*
- * 'cupsServer()' - Return the hostname/address of the current server.
+ * 'cupsGetServer()' - Return the hostname/address of the current server.
  *
  * The default server comes from the CUPS_SERVER environment variable, then the
  * ~/.cups/client.conf file, and finally the /etc/cups/client.conf file. If not
@@ -207,10 +222,12 @@ cupsGetPassword2(const char *prompt,      /* I - Prompt string */
  * Multi-threaded programs that override the server via the
  * @link cupsSetServer@ function need to do so in each thread for the same
  * server to be used.
+ *
+ * @since CUPS 2.5@
  */
 
 const char *                           /* O - Server name */
-cupsServer(void)
+cupsGetServer(void)
 {
   _cups_globals_t *cg = _cupsGlobals();        /* Pointer to library globals */
 
@@ -222,6 +239,75 @@ cupsServer(void)
 }
 
 
+/*
+ * 'cupsGetUser()' - Return the current user's name.
+ *
+ * Note: The current user name is tracked separately for each thread in a
+ * program. Multi-threaded programs that override the user name with the
+ * @link cupsSetUser@ function need to do so in each thread for the same user
+ * name to be used.
+ *
+ * @since CUPS 2.5@
+ */
+
+const char *                           /* O - User name */
+cupsGetUser(void)
+{
+  _cups_globals_t *cg = _cupsGlobals();        /* Pointer to library globals */
+
+
+  if (!cg->user[0])
+    _cupsSetDefaults();
+
+  return (cg->user);
+}
+
+
+/*
+ * 'cupsGetUserAgent()' - Return the default HTTP User-Agent string.
+ *
+ * @since CUPS 2.5@
+ */
+
+const char *                           /* O - User-Agent string */
+cupsGetUserAgent(void)
+{
+  _cups_globals_t *cg = _cupsGlobals();        /* Thread globals */
+
+
+  if (!cg->user_agent[0])
+    cupsSetUserAgent(NULL);
+
+  return (cg->user_agent);
+}
+
+
+/*
+ * 'cupsServer()' - Return the hostname/address of the current server.
+ *
+ * The default server comes from the CUPS_SERVER environment variable, then the
+ * ~/.cups/client.conf file, and finally the /etc/cups/client.conf file. If not
+ * set, the default is the local system - either "localhost" or a domain socket
+ * path.
+ *
+ * The returned value can be a fully-qualified hostname, a numeric IPv4 or IPv6
+ * address, or a domain socket pathname.
+ *
+ * Note: The current server is tracked separately for each thread in a program.
+ * Multi-threaded programs that override the server via the
+ * @link cupsSetServer@ function need to do so in each thread for the same
+ * server to be used.
+ *
+ * @deprecated@
+ */
+
+const char *                           /* O - Server name */
+cupsServer(void)
+{
+  return (cupsGetServer());
+}
+
+
 /*
  * 'cupsSetClientCertCB()' - Set the client certificate callback.
  *
@@ -231,7 +317,7 @@ cupsServer(void)
  * in a program. Multi-threaded programs that override the callback need to do
  * so in each thread for the same callback to be used.
  *
- * @since CUPS 1.5/macOS 10.7@
+ * @deprecated@
  */
 
 void
@@ -239,11 +325,8 @@ cupsSetClientCertCB(
     cups_client_cert_cb_t cb,          /* I - Callback function */
     void                  *user_data)  /* I - User data pointer */
 {
-  _cups_globals_t *cg = _cupsGlobals();        /* Pointer to library globals */
-
-
-  cg->client_cert_cb   = cb;
-  cg->client_cert_data = user_data;
+  (void)cb;
+  (void)user_data;
 }
 
 
@@ -251,27 +334,16 @@ cupsSetClientCertCB(
  * 'cupsSetCredentials()' - Set the default credentials to be used for SSL/TLS
  *                         connections.
  *
- * Note: The default credentials are tracked separately for each thread in a
- * program. Multi-threaded programs that override the setting need to do so in
- * each thread for the same setting to be used.
- *
- * @since CUPS 1.5/macOS 10.7@
+ * @deprecated@
  */
 
 int                                    /* O - Status of call (0 = success) */
 cupsSetCredentials(
     cups_array_t *credentials)         /* I - Array of credentials */
 {
-  _cups_globals_t *cg = _cupsGlobals();        /* Pointer to library globals */
-
+  (void)credentials;
 
-  if (cupsArrayCount(credentials) < 1)
-    return (-1);
-
-  _httpFreeCredentials(cg->tls_credentials);
-  cg->tls_credentials = _httpCreateCredentials(credentials);
-
-  return (cg->tls_credentials ? 0 : -1);
+  return (-1);
 }
 
 
@@ -485,7 +557,7 @@ cupsSetServer(const char *server)   /* I - Server name */
  * in a program. Multi-threaded programs that override the callback need to do
  * so in each thread for the same callback to be used.
  *
- * @since CUPS 1.5/macOS 10.7@
+ * @deprecated@
  */
 
 void
@@ -493,11 +565,8 @@ cupsSetServerCertCB(
     cups_server_cert_cb_t cb,          /* I - Callback function */
     void                 *user_data)   /* I - User data pointer */
 {
-  _cups_globals_t *cg = _cupsGlobals();        /* Pointer to library globals */
-
-
-  cg->server_cert_cb   = cb;
-  cg->server_cert_data = user_data;
+  (void)cb;
+  (void)user_data;
 }
 
 
@@ -679,37 +748,27 @@ cupsSetUserAgent(const char *user_agent)/* I - User-Agent string or @code NULL@
  * program. Multi-threaded programs that override the user name with the
  * @link cupsSetUser@ function need to do so in each thread for the same user
  * name to be used.
+ *
+ * @deprecated@
  */
 
 const char *                           /* O - User name */
 cupsUser(void)
 {
-  _cups_globals_t *cg = _cupsGlobals();        /* Pointer to library globals */
-
-
-  if (!cg->user[0])
-    _cupsSetDefaults();
-
-  return (cg->user);
+  return (cupsGetUser());
 }
 
 
 /*
  * 'cupsUserAgent()' - Return the default HTTP User-Agent string.
  *
- * @since CUPS 1.7/macOS 10.9@
+ * @deprecated@
  */
 
 const char *                           /* O - User-Agent string */
 cupsUserAgent(void)
 {
-  _cups_globals_t *cg = _cupsGlobals();        /* Thread globals */
-
-
-  if (!cg->user_agent[0])
-    cupsSetUserAgent(NULL);
-
-  return (cg->user_agent);
+  return (cupsGetUserAgent());
 }
 
 
index e81e4704d427e77312c93ac5760c98884bcc0ef4..9cc8611c73035d0c69e953a671ed0d1fd745095b 100644 (file)
@@ -29,7 +29,7 @@
  * Pass @code CUPS_JOBID_ALL@ to cancel all jobs or @code CUPS_JOBID_CURRENT@
  * to cancel the current job on the named destination.
  *
- * Use the @link cupsLastError@ and @link cupsLastErrorString@ functions to get
+ * Use the @link cupsGetError@ and @link cupsGetErrorString@ functions to get
  * the cause of any failure.
  *
  * @exclude all@
@@ -53,7 +53,7 @@ cupsCancelJob(const char *name,               /* I - Name of printer or class */
  * Pass @code CUPS_JOBID_ALL@ to cancel all jobs or @code CUPS_JOBID_CURRENT@
  * to cancel the current job on the named destination.
  *
- * Use the @link cupsLastError@ and @link cupsLastErrorString@ functions to get
+ * Use the @link cupsGetError@ and @link cupsGetErrorString@ functions to get
  * the cause of any failure.
  *
  * @since CUPS 1.4/macOS 10.6@ @exclude all@
@@ -118,7 +118,7 @@ cupsCancelJob2(http_t     *http,    /* I - Connection to server or @code CUPS_HTTP_
   }
 
   ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
-               NULL, cupsUser());
+               NULL, cupsGetUser());
 
   if (purge && job_id >= 0)
     ippAddBoolean(request, IPP_TAG_OPERATION, "purge-job", 1);
@@ -131,7 +131,7 @@ cupsCancelJob2(http_t     *http,    /* I - Connection to server or @code CUPS_HTTP_
 
   ippDelete(cupsDoRequest(http, request, "/jobs/"));
 
-  return (cupsLastError());
+  return (cupsGetError());
 }
 
 
@@ -232,7 +232,7 @@ cupsFinishDocument(http_t     *http,        /* I - Connection to server or @code CUPS_H
 
   ippDelete(cupsGetResponse(http, resource));
 
-  return (cupsLastError());
+  return (cupsGetError());
 }
 
 
@@ -332,7 +332,7 @@ cupsGetDefault2(http_t *http)               /* I - Connection to server or @code CUPS_HTTP_DE
   * See if we have a user default printer set...
   */
 
-  if (_cupsUserDefault(cg->def_printer, sizeof(cg->def_printer)))
+  if (_cupsGetUserDefault(cg->def_printer, sizeof(cg->def_printer)))
     return (cg->def_printer);
 
  /*
@@ -506,7 +506,7 @@ cupsGetJobs2(http_t     *http,              /* I - Connection to server or @code CUPS_HTTP_D
                "printer-uri", NULL, uri);
 
   ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
-               "requesting-user-name", NULL, cupsUser());
+               "requesting-user-name", NULL, cupsGetUser());
 
   if (myjobs)
     ippAddBoolean(request, IPP_TAG_OPERATION, "my-jobs", 1);
@@ -932,7 +932,7 @@ cupsStartDocument(
                NULL, printer_uri);
   ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_INTEGER, "job-id", job_id);
   ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
-               NULL, cupsUser());
+               NULL, cupsGetUser());
   if (docname)
     ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "document-name",
                  NULL, docname);
index 62b91c64801d3f042e97e863e879d8c26d920618..d5e9ff5ab49a722a8203e07931646df331c7a2b9 100644 (file)
@@ -347,7 +347,7 @@ enable_web_interface(void)
 
   if (!<a href="#cupsAdminGetServerSettings">cupsAdminGetServerSettings</a>(CUPS_HTTP_DEFAULT, &amp;num_settings, &amp;settings))
   {
-    fprintf(stderr, "ERROR: Unable to get server settings: %s\n", cupsLastErrorString());
+    fprintf(stderr, "ERROR: Unable to get server settings: %s\n", cupsGetErrorString());
     return;
   }
 
@@ -355,7 +355,7 @@ enable_web_interface(void)
 
   if (!<a href="#cupsAdminSetServerSettings">cupsAdminSetServerSettings</a>(CUPS_HTTP_DEFAULT, num_settings, settings))
   {
-    fprintf(stderr, "ERROR: Unable to set server settings: %s\n", cupsLastErrorString());
+    fprintf(stderr, "ERROR: Unable to set server settings: %s\n", cupsGetErrorString());
   }
 
   <a href="api-cups.html#cupsFreeOptions">cupsFreeOptions</a>(num_settings, settings);
index f5da8fe9fd7f1bc04329a206e9a44428bca43df9..57bcbf2dd38525eaf3504b2ee7d045041911339f 100644 (file)
@@ -395,8 +395,8 @@ span.string {
 <li><a href="#cupsSetUser">cupsSetUser</a></li>
 <li><a href="#cupsSetUserAgent">cupsSetUserAgent</a></li>
 <li><a href="#cupsStartDestDocument">cupsStartDestDocument</a></li>
-<li><a href="#cupsUser">cupsUser</a></li>
-<li><a href="#cupsUserAgent">cupsUserAgent</a></li>
+<li><a href="#cupsGetUser">cupsGetUser</a></li>
+<li><a href="#cupsGetUserAgent">cupsGetUserAgent</a></li>
 <li><a href="#httpAcceptConnection">httpAcceptConnection</a></li>
 <li><a href="#httpAddCredential">httpAddCredential</a></li>
 <li><a href="#httpAddrAny">httpAddrAny</a></li>
@@ -809,7 +809,7 @@ int main(void)
 </li>
 <li><p><code>CUPS_DEST_FLAGS_REMOVED</code>: The destination has gone away and should be removed from the list of destinations a user can select.</p>
 </li>
-<li><p><code>CUPS_DEST_FLAGS_ERROR</code>: An error occurred. The reason for the error can be found by calling the <code>cupsLastError</code> and/or <code>cupsLastErrorString</code> functions.</p>
+<li><p><code>CUPS_DEST_FLAGS_ERROR</code>: An error occurred. The reason for the error can be found by calling the <code>cupsGetError</code> and/or <code>cupsGetErrorString</code> functions.</p>
 </li>
 </ul>
 <p>The callback function returns 0 to stop enumeration or 1 to continue.</p>
@@ -1179,7 +1179,7 @@ if (cupsCreateDestJob(CUPS_HTTP_DEFAULT, dest, info,
   printf(&quot;Created job: %d\n&quot;, job_id);
 else
   printf(&quot;Unable to create job: %s\n&quot;,
-         cupsLastErrorString());
+         cupsGetErrorString());
 </code></pre>
 <p>Once the job is created, you submit documents for the job using the <code>cupsStartDestDocument</code>, <code>cupsWriteRequestData</code>, and <code>cupsFinishDestDocument</code> functions:</p>
 <pre><code>http_status_t
@@ -1230,7 +1230,7 @@ if (cupsStartDestDocument(CUPS_HTTP_DEFAULT, dest, info,
     puts(&quot;Document send succeeded.&quot;);
   else
     printf(&quot;Document send failed: %s\n&quot;,
-           cupsLastErrorString());
+           cupsGetErrorString());
 }
 
 fclose(fp);
@@ -1328,17 +1328,17 @@ ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
                                     filename);
 </code></pre>
 <p>Both <code>cupsDoRequest</code> and <code>cupsDoFileRequest</code> free the IPP request. If a valid IPP response is received, it is stored in a new IPP message (<code>ipp_t</code>) and returned to the caller. Otherwise <code>NULL</code> is returned.</p>
-<p>The status from the most recent request can be queried using the <code>cupsLastError</code> function, for example:</p>
-<pre><code>if (cupsLastError() &gt;= IPP_STATUS_ERROR_BAD_REQUEST)
+<p>The status from the most recent request can be queried using the <code>cupsGetError</code> function, for example:</p>
+<pre><code>if (cupsGetError() &gt;= IPP_STATUS_ERROR_BAD_REQUEST)
 {
   /* request failed */
 }
 </code></pre>
-<p>A human-readable error message is also available using the <code>cupsLastErrorString</code> function:</p>
-<pre><code>if (cupsLastError() &gt;= IPP_STATUS_ERROR_BAD_REQUEST)
+<p>A human-readable error message is also available using the <code>cupsGetErrorString</code> function:</p>
+<pre><code>if (cupsGetError() &gt;= IPP_STATUS_ERROR_BAD_REQUEST)
 {
   /* request failed */
-  printf(&quot;Request failed: %s\n&quot;, cupsLastErrorString());
+  printf(&quot;Request failed: %s\n&quot;, cupsGetErrorString());
 }
 </code></pre>
 <h3 class="title" id="processing-the-ipp-response">Processing the IPP Response</h3>
@@ -3744,10 +3744,10 @@ if this is the last document to be submitted in the job.  Returns
 <code>HTTP_CONTINUE</code> on success.
 
 </p>
-<h3 class="function"><a id="cupsUser">cupsUser</a></h3>
+<h3 class="function"><a id="cupsGetUser">cupsGetUser</a></h3>
 <p class="description">Return the current user's name.</p>
 <p class="code">
-const char *cupsUser(void);</p>
+const char *cupsGetUser(void);</p>
 <h4 class="returnvalue">Return Value</h4>
 <p class="description">User name</p>
 <h4 class="discussion">Discussion</h4>
@@ -3755,10 +3755,10 @@ const char *cupsUser(void);</p>
 program. Multi-threaded programs that override the user name with the
 <a href="#cupsSetUser"><code>cupsSetUser</code></a> function need to do so in each thread for the same user
 name to be used.</p>
-<h3 class="function"><span class="info">&#160;CUPS 1.7/macOS 10.9&#160;</span><a id="cupsUserAgent">cupsUserAgent</a></h3>
+<h3 class="function"><span class="info">&#160;CUPS 1.7/macOS 10.9&#160;</span><a id="cupsGetUserAgent">cupsGetUserAgent</a></h3>
 <p class="description">Return the default HTTP User-Agent string.</p>
 <p class="code">
-const char *cupsUserAgent(void);</p>
+const char *cupsGetUserAgent(void);</p>
 <h4 class="returnvalue">Return Value</h4>
 <p class="description">User-Agent string</p>
 <h3 class="function"><span class="info">&#160;CUPS 1.7/macOS 10.9&#160;</span><a id="httpAcceptConnection">httpAcceptConnection</a></h3>
@@ -6979,7 +6979,7 @@ int ippValidateAttribute(<a href="#ipp_attribute_t">ipp_attribute_t</a> *attr);<
 <h4 class="discussion">Discussion</h4>
 <p class="discussion">This function validates the contents of an attribute based on the name and
 value tag.  1 is returned if the attribute is valid, 0 otherwise.  On
-failure, <a href="#cupsLastErrorString"><code>cupsLastErrorString</code></a> is set to a human-readable message.
+failure, <a href="#cupsGetErrorString"><code>cupsGetErrorString</code></a> is set to a human-readable message.
 
 </p>
 <h3 class="function"><span class="info">&#160;CUPS 1.7/macOS 10.9&#160;</span><a id="ippValidateAttributes">ippValidateAttributes</a></h3>
@@ -6995,7 +6995,7 @@ int ippValidateAttributes(<a href="#ipp_t">ipp_t</a> *ipp);</p>
 <p class="description">1 if valid, 0 otherwise</p>
 <h4 class="discussion">Discussion</h4>
 <p class="discussion">This function validates the contents of the IPP message, including each
-attribute.  Like <a href="#ippValidateAttribute"><code>ippValidateAttribute</code></a>, <a href="#cupsLastErrorString"><code>cupsLastErrorString</code></a> is
+attribute.  Like <a href="#ippValidateAttribute"><code>ippValidateAttribute</code></a>, <a href="#cupsGetErrorString"><code>cupsGetErrorString</code></a> is
 set to a human-readable message on failure.
 
 </p>
index 5fb042899bc2da751e1333ab01af0229492cfa4c..08ca3cb390370ca4a975de6f5c7765486b288e1c 100644 (file)
@@ -625,7 +625,7 @@ cupsdReadClient(cupsd_client_t *con)        /* I - Client to read from */
          else
            cupsdLogClient(con, CUPSD_LOG_DEBUG,
                           "HTTP_STATE_WAITING Closing on error: %s",
-                          cupsLastErrorString());
+                          cupsGetErrorString());
 
          cupsdCloseClient(con);
          return;
@@ -1600,7 +1600,7 @@ cupsdReadClient(cupsd_client_t *con)      /* I - Client to read from */
            if ((ipp_state = ippRead(con->http, con->request)) == IPP_STATE_ERROR)
            {
               cupsdLogClient(con, CUPSD_LOG_ERROR, "IPP read error: %s",
-                             cupsLastErrorString());
+                             cupsGetErrorString());
 
              cupsdSendError(con, HTTP_STATUS_BAD_REQUEST, CUPSD_AUTH_NONE);
              cupsdCloseClient(con);
@@ -2640,7 +2640,7 @@ cupsd_start_tls(cupsd_client_t    *con,   /* I - Client connection */
   if (httpEncryption(con->http, e))
   {
     cupsdLogClient(con, CUPSD_LOG_ERROR, "Unable to encrypt connection: %s",
-                   cupsLastErrorString());
+                   cupsGetErrorString());
     return (-1);
   }
 
index e2319f81b496aa02b7b0ccdf8c9faa16c621ea6e..3dc12821f6e58684fd61c43a346174e4f8c8c632 100644 (file)
@@ -352,7 +352,9 @@ create_job(http_t        *http,             /* I - HTTP connection */
     ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "job-name",
                  NULL, title);
 
-  cupsEncodeOptions(request, num_options, options);
+  cupsEncodeOptions2(request, num_options, options, IPP_TAG_OPERATION);
+  cupsEncodeOptions2(request, num_options, options, IPP_TAG_JOB);
+  cupsEncodeOptions2(request, num_options, options, IPP_TAG_SUBSCRIPTION);
 
  /*
   * Do the request...
@@ -362,9 +364,9 @@ create_job(http_t        *http,             /* I - HTTP connection */
 
   response = cupsDoRequest(http, request, uri);
 
-  if (!response || cupsLastError() > IPP_STATUS_OK_CONFLICTING)
+  if (!response || cupsGetError() > IPP_STATUS_OK_CONFLICTING)
   {
-    syslog(LOG_ERR, "Unable to create job - %s", cupsLastErrorString());
+    syslog(LOG_ERR, "Unable to create job - %s", cupsGetErrorString());
 
     ippDelete(response);
 
@@ -473,7 +475,7 @@ get_printer(http_t        *http,    /* I - HTTP connection */
 
   response = cupsDoRequest(http, request, "/");
 
-  if (!response || cupsLastError() > IPP_STATUS_OK_CONFLICTING)
+  if (!response || cupsGetError() > IPP_STATUS_OK_CONFLICTING)
   {
    /*
     * If we can't find the printer by name, look up the printer-name
@@ -506,10 +508,10 @@ get_printer(http_t        *http,  /* I - HTTP connection */
 
     response = cupsDoRequest(http, request, "/");
 
-    if (!response || cupsLastError() > IPP_STATUS_OK_CONFLICTING)
+    if (!response || cupsGetError() > IPP_STATUS_OK_CONFLICTING)
     {
       syslog(LOG_ERR, "Unable to get list of printers - %s",
-             cupsLastErrorString());
+             cupsGetErrorString());
 
       ippDelete(response);
 
@@ -747,9 +749,9 @@ print_file(http_t     *http,                /* I - HTTP connection */
 
   ippDelete(cupsDoFileRequest(http, request, uri, filename));
 
-  if (cupsLastError() > IPP_STATUS_OK_CONFLICTING)
+  if (cupsGetError() > IPP_STATUS_OK_CONFLICTING)
   {
-    syslog(LOG_ERR, "Unable to send document - %s", cupsLastErrorString());
+    syslog(LOG_ERR, "Unable to send document - %s", cupsGetErrorString());
 
     return (-1);
   }
@@ -802,7 +804,7 @@ recv_print_job(
   * Connect to the server...
   */
 
-  http = httpConnect2(cupsServer(), ippPort(), NULL, AF_UNSPEC, cupsEncryption(), 1, 30000, NULL);
+  http = httpConnect2(cupsGetServer(), ippPort(), NULL, AF_UNSPEC, cupsGetEncryption(), 1, 30000, NULL);
   if (!http)
   {
     syslog(LOG_ERR, "Unable to connect to server: %s", strerror(errno));
@@ -899,7 +901,7 @@ recv_print_job(
           }
          else
          {
-           if ((fd = cupsTempFd(control, sizeof(control))) < 0)
+           if ((fd = cupsCreateTempFd(NULL, NULL, control, sizeof(control))) < 0)
            {
              syslog(LOG_ERR, "Unable to open temporary control file \"%s\" - %s",
                     control, strerror(errno));
@@ -935,7 +937,7 @@ recv_print_job(
 
          strlcpy(data[num_data], name, sizeof(data[0]));
 
-          if ((fd = cupsTempFd(temp[num_data], sizeof(temp[0]))) < 0)
+          if ((fd = cupsCreateTempFd(NULL, NULL, temp[num_data], sizeof(temp[0]))) < 0)
          {
            syslog(LOG_ERR, "Unable to open temporary data file \"%s\" - %s",
                   temp[num_data], strerror(errno));
@@ -1228,9 +1230,9 @@ remove_jobs(const char *dest,             /* I - Destination */
   * Try connecting to the local server...
   */
 
-  if ((http = httpConnect2(cupsServer(), ippPort(), NULL, AF_UNSPEC, cupsEncryption(), 1, 30000, NULL)) == NULL)
+  if ((http = httpConnect2(cupsGetServer(), ippPort(), NULL, AF_UNSPEC, cupsGetEncryption(), 1, 30000, NULL)) == NULL)
   {
-    syslog(LOG_ERR, "Unable to connect to server %s: %s", cupsServer(),
+    syslog(LOG_ERR, "Unable to connect to server %s: %s", cupsGetServer(),
            strerror(errno));
     return (1);
   }
@@ -1274,10 +1276,10 @@ remove_jobs(const char *dest,           /* I - Destination */
 
     ippDelete(cupsDoRequest(http, request, "/jobs"));
 
-    if (cupsLastError() > IPP_STATUS_OK_CONFLICTING)
+    if (cupsGetError() > IPP_STATUS_OK_CONFLICTING)
     {
       syslog(LOG_WARNING, "Cancel of job ID %d failed: %s\n", id,
-             cupsLastErrorString());
+             cupsGetErrorString());
       httpClose(http);
       return (1);
     }
@@ -1348,11 +1350,11 @@ send_state(const char *queue,           /* I - Destination */
   * Try connecting to the local server...
   */
 
-  if ((http = httpConnect2(cupsServer(), ippPort(), NULL, AF_UNSPEC, cupsEncryption(), 1, 30000, NULL)) == NULL)
+  if ((http = httpConnect2(cupsGetServer(), ippPort(), NULL, AF_UNSPEC, cupsGetEncryption(), 1, 30000, NULL)) == NULL)
   {
-    syslog(LOG_ERR, "Unable to connect to server %s: %s", cupsServer(),
+    syslog(LOG_ERR, "Unable to connect to server %s: %s", cupsGetServer(),
            strerror(errno));
-    printf("Unable to connect to server %s: %s", cupsServer(), strerror(errno));
+    printf("Unable to connect to server %s: %s", cupsGetServer(), strerror(errno));
     return (1);
   }
 
@@ -1363,8 +1365,8 @@ send_state(const char *queue,             /* I - Destination */
   if (get_printer(http, queue, dest, sizeof(dest), NULL, NULL, NULL, &state))
   {
     syslog(LOG_ERR, "Unable to get printer %s: %s", queue,
-           cupsLastErrorString());
-    printf("Unable to get printer %s: %s", queue, cupsLastErrorString());
+           cupsGetErrorString());
+    printf("Unable to get printer %s: %s", queue, cupsGetErrorString());
     return (1);
   }
 
@@ -1425,9 +1427,9 @@ send_state(const char *queue,             /* I - Destination */
   jobcount = 0;
   response = cupsDoRequest(http, request, "/");
 
-  if (cupsLastError() > IPP_STATUS_OK_CONFLICTING)
+  if (cupsGetError() > IPP_STATUS_OK_CONFLICTING)
   {
-    printf("get-jobs failed: %s\n", cupsLastErrorString());
+    printf("get-jobs failed: %s\n", cupsGetErrorString());
     ippDelete(response);
     return (1);
   }
index dc9ba898a1ca70080340c942564ff9fa4c7225cf..64885ef7d87752ee9f621d32cebf7df71dd13963 100644 (file)
@@ -139,7 +139,7 @@ main(int  argc,                             /* I - Number of command-line args */
   options      = NULL;
   ppdfile      = NULL;
   title        = NULL;
-  user         = cupsUser();
+  user         = cupsGetUser();
   all_filters  = 0;
   removeppd    = 0;
   removeinfile = 0;
@@ -1361,10 +1361,10 @@ get_job_file(const char *job)           /* I - Job ID */
 
   httpClose(http);
 
-  if (cupsLastError() != IPP_OK)
+  if (cupsGetError() != IPP_OK)
   {
     _cupsLangPrintf(stderr, _("cupsfilter: Unable to get job file - %s"),
-                    cupsLastErrorString());
+                    cupsGetErrorString());
     unlink(TempFile);
     exit(1);
   }
index 039167980c008486fb6a118af01a64e5f62bea27..89ca7f17d8b146becbaf1cda64ad698e98433c02 100644 (file)
@@ -1552,7 +1552,7 @@ add_job(cupsd_client_t  *con,             /* I - Client connection */
   else if (!ippValidateAttribute(attr))
   {
     send_ipp_status(con, IPP_ATTRIBUTES, _("Bad job-name value: %s"),
-                    cupsLastErrorString());
+                    cupsGetErrorString());
 
     if ((attr = ippCopyAttribute(con->response, attr, 0)) != NULL)
       attr->group_tag = IPP_TAG_UNSUPPORTED_GROUP;
@@ -5342,7 +5342,7 @@ create_local_bg_thread(
 
   if ((http = httpConnect2(host, port, NULL, AF_UNSPEC, encryption, 1, 30000, NULL)) == NULL)
   {
-    cupsdLogMessage(CUPSD_LOG_ERROR, "%s: Unable to connect to %s:%d: %s", printer->name, host, port, cupsLastErrorString());
+    cupsdLogMessage(CUPSD_LOG_ERROR, "%s: Unable to connect to %s:%d: %s", printer->name, host, port, cupsGetErrorString());
     return (NULL);
   }
 
@@ -5358,9 +5358,9 @@ create_local_bg_thread(
   ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "requested-attributes", (int)(sizeof(pattrs) / sizeof(pattrs[0])), NULL, pattrs);
 
   response = cupsDoRequest(http, request, resource);
-  status   = cupsLastError();
+  status   = cupsGetError();
 
-  cupsdLogMessage(CUPSD_LOG_DEBUG, "%s: Get-Printer-Attributes returned %s (%s)", printer->name, ippErrorString(cupsLastError()), cupsLastErrorString());
+  cupsdLogMessage(CUPSD_LOG_DEBUG, "%s: Get-Printer-Attributes returned %s (%s)", printer->name, ippErrorString(cupsGetError()), cupsGetErrorString());
 
   if (status == IPP_STATUS_ERROR_BAD_REQUEST || status == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED)
   {
@@ -5380,7 +5380,7 @@ create_local_bg_thread(
 
     response = cupsDoRequest(http, request, resource);
 
-    cupsdLogMessage(CUPSD_LOG_DEBUG, "%s: IPP/1.1 Get-Printer-Attributes returned %s (%s)", printer->name, ippErrorString(cupsLastError()), cupsLastErrorString());
+    cupsdLogMessage(CUPSD_LOG_DEBUG, "%s: IPP/1.1 Get-Printer-Attributes returned %s (%s)", printer->name, ippErrorString(cupsGetError()), cupsGetErrorString());
   }
 
  /*
@@ -5401,7 +5401,7 @@ create_local_bg_thread(
     ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
                 "requested-attributes", NULL, "media-col-database");
     response2 = cupsDoRequest(http, request, resource);
-    //ipp_status = cupsLastError();
+    //ipp_status = cupsGetError();
     if (response2)
     {
       if ((attr = ippFindAttribute(response2, "media-col-database",
@@ -5475,7 +5475,7 @@ create_local_bg_thread(
     }
   }
   else
-    cupsdLogMessage(CUPSD_LOG_ERROR, "%s: PPD creation failed: %s", printer->name, cupsLastErrorString());
+    cupsdLogMessage(CUPSD_LOG_ERROR, "%s: PPD creation failed: %s", printer->name, cupsGetErrorString());
 
   ippDelete(response);
 
index 27f656e31ef1663bc5990e33e9e2e28554f43106..722771528d10b82ecff6688237ca16a130ecdb07 100644 (file)
@@ -4047,7 +4047,7 @@ load_ppd(cupsd_printer_t *p)              /* I - Printer */
     p->pc = _ppdCacheCreateWithPPD(ppd);
 
     if (!p->pc)
-      cupsdLogMessage(CUPSD_LOG_WARN, "Unable to create cache of \"%s\": %s", ppd_name, cupsLastErrorString());
+      cupsdLogMessage(CUPSD_LOG_WARN, "Unable to create cache of \"%s\": %s", ppd_name, cupsGetErrorString());
 
     ppdMarkDefaults(ppd);
 
index d974c5269be81fb2260b4000ef2211a71f18644e..b85e681bd67bee0577b7921327bd9bb44ca0fb2a 100644 (file)
@@ -282,7 +282,7 @@ print_job(int  outfd,                       /* I - Command file descriptor */
            "ldfA%03dlocalhost\n"
            "UdfA%03dlocalhost\n"
            "N%s\n",
-          cupsUser(), jobname, sequence, sequence, jobname);
+          cupsGetUser(), jobname, sequence, sequence, jobname);
 
  /*
   * Send the control file...
index 7cd875c972577f7ca3dca94f499ddcd36577eee8..bcf63282b06e86aefaf144cd7bf27e80a433fe4a 100644 (file)
@@ -324,13 +324,13 @@ do_test(const char        *server,        /* I - Server to use */
               0.000001 * (end.tv_usec - start.tv_usec);
     elapsed += reqtime;
 
-    switch (cupsLastError())
+    switch (cupsGetError())
     {
       case IPP_OK :
       case IPP_NOT_FOUND :
           if (verbose)
          {
-           printf("succeeded: %s (%.6f)\n", cupsLastErrorString(), reqtime);
+           printf("succeeded: %s (%.6f)\n", cupsGetErrorString(), reqtime);
            fflush(stdout);
          }
           break;
@@ -340,7 +340,7 @@ do_test(const char        *server,  /* I - Server to use */
            printf("testspeed(%d): %s ", (int)getpid(),
                   ippOpString(ops[i & 3]));
 
-         printf("failed: %s\n", cupsLastErrorString());
+         printf("failed: %s\n", cupsGetErrorString());
           httpClose(http);
          return (1);
     }
index 19d9dffce9aba804d810e9846f0ab558701a0992..5858a06388c07b4bc23e7a44d043ff818828c0f8 100644 (file)
@@ -146,7 +146,7 @@ main(int  argc,                             /* I - Number of command-line arguments */
   }
 
   ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
-               NULL, cupsUser());
+               NULL, cupsGetUser());
 
   ippAddStrings(request, IPP_TAG_SUBSCRIPTION, IPP_TAG_KEYWORD, "notify-events",
                 num_events, NULL, events);
@@ -154,10 +154,10 @@ main(int  argc,                           /* I - Number of command-line arguments */
                "notify-pull-method", NULL, "ippget");
 
   response = cupsDoRequest(http, request, uri);
-  if (cupsLastError() >= IPP_BAD_REQUEST)
+  if (cupsGetError() >= IPP_BAD_REQUEST)
   {
     fprintf(stderr, "Create-%s-Subscription: %s\n",
-            strstr(uri, "/jobs") ? "Job" : "Printer", cupsLastErrorString());
+            strstr(uri, "/jobs") ? "Job" : "Printer", cupsGetErrorString());
     ippDelete(response);
     httpClose(http);
     return (1);
@@ -203,7 +203,7 @@ main(int  argc,                             /* I - Number of command-line arguments */
                    uri);
 
     ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
-                 "requesting-user-name", NULL, cupsUser());
+                 "requesting-user-name", NULL, cupsGetUser());
 
     ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_INTEGER,
                   "notify-subscription-ids", subscription_id);
@@ -213,10 +213,10 @@ main(int  argc,                           /* I - Number of command-line arguments */
 
     response = cupsDoRequest(http, request, uri);
 
-    printf(" %s\n", ippErrorString(cupsLastError()));
+    printf(" %s\n", ippErrorString(cupsGetError()));
 
-    if (cupsLastError() >= IPP_BAD_REQUEST)
-      fprintf(stderr, "Get-Notifications: %s\n", cupsLastErrorString());
+    if (cupsGetError() >= IPP_BAD_REQUEST)
+      fprintf(stderr, "Get-Notifications: %s\n", cupsGetErrorString());
     else if (response)
     {
       print_attributes(response, 0);
@@ -257,17 +257,17 @@ main(int  argc,                           /* I - Number of command-line arguments */
                  uri);
 
   ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
-               NULL, cupsUser());
+               NULL, cupsGetUser());
 
   ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_INTEGER,
                 "notify-subscription-id", subscription_id);
 
   ippDelete(cupsDoRequest(http, request, uri));
 
-  printf(" %s\n", ippErrorString(cupsLastError()));
+  printf(" %s\n", ippErrorString(cupsGetError()));
 
-  if (cupsLastError() >= IPP_BAD_REQUEST)
-    fprintf(stderr, "Cancel-Subscription: %s\n", cupsLastErrorString());
+  if (cupsGetError() >= IPP_BAD_REQUEST)
+    fprintf(stderr, "Cancel-Subscription: %s\n", cupsGetErrorString());
 
  /*
   * Close the connection and return...
index a30ed2ad43eabb83681c1a6d279fa0472eae9028..0588dedc7bc66b606c640a24aea094d905bbb25c 100644 (file)
@@ -288,7 +288,7 @@ main(int  argc,                             /* I - Number of command-line arguments */
       }
       else
        ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
-                     "requesting-user-name", NULL, cupsUser());
+                     "requesting-user-name", NULL, cupsGetUser());
 
       if (purge)
       {
@@ -302,7 +302,7 @@ main(int  argc,                             /* I - Number of command-line arguments */
       * Do the request and get back a response...
       */
 
-      if (op == IPP_CANCEL_JOBS && (!user || _cups_strcasecmp(user, cupsUser())))
+      if (op == IPP_CANCEL_JOBS && (!user || _cups_strcasecmp(user, cupsGetUser())))
         response = cupsDoRequest(http, request, "/admin/");
       else
         response = cupsDoRequest(http, request, "/jobs/");
@@ -312,7 +312,7 @@ main(int  argc,                             /* I - Number of command-line arguments */
       {
        _cupsLangPrintf(stderr, _("%s: %s failed: %s"), argv[0],
                        op == IPP_PURGE_JOBS ? "purge-jobs" : "cancel-job",
-                       cupsLastErrorString());
+                       cupsGetErrorString());
 
           ippDelete(response);
 
@@ -360,7 +360,7 @@ main(int  argc,                             /* I - Number of command-line arguments */
     }
     else
       ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
-                   "requesting-user-name", NULL, cupsUser());
+                   "requesting-user-name", NULL, cupsGetUser());
 
     ippAddBoolean(request, IPP_TAG_OPERATION, "purge-jobs", (char)purge);
 
@@ -375,7 +375,7 @@ main(int  argc,                             /* I - Number of command-line arguments */
     {
       _cupsLangPrintf(stderr, _("%s: %s failed: %s"), argv[0],
                      op == IPP_PURGE_JOBS ? "purge-jobs" : "cancel-job",
-                     cupsLastErrorString());
+                     cupsGetErrorString());
 
       ippDelete(response);
 
index 987cb5bcfadf969dc6b24b5bbaed28dbcb35fd33..dd9cbf22cfe190f7080a3fe94444b81a94c1d191 100644 (file)
@@ -174,7 +174,7 @@ main(int  argc,                             /* I - Number of command-line arguments */
                    "printer-uri", NULL, uri);
 
       ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
-                   "requesting-user-name", NULL, cupsUser());
+                   "requesting-user-name", NULL, cupsGetUser());
 
       if (reason != NULL)
        ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_TEXT,
@@ -186,11 +186,11 @@ main(int  argc,                           /* I - Number of command-line arguments */
 
       ippDelete(cupsDoRequest(CUPS_HTTP_DEFAULT, request, "/admin/"));
 
-      if (cupsLastError() > IPP_OK_CONFLICT)
+      if (cupsGetError() > IPP_OK_CONFLICT)
       {
        _cupsLangPrintf(stderr,
                        _("%s: Operation failed: %s"),
-                       command, ippErrorString(cupsLastError()));
+                       command, ippErrorString(cupsGetError()));
        return (1);
       }
 
@@ -216,9 +216,9 @@ main(int  argc,                             /* I - Number of command-line arguments */
 
        ippDelete(cupsDoRequest(CUPS_HTTP_DEFAULT, request, "/admin/"));
 
-        if (cupsLastError() > IPP_OK_CONFLICT)
+        if (cupsGetError() > IPP_OK_CONFLICT)
        {
-         _cupsLangPrintf(stderr, "%s: %s", command, cupsLastErrorString());
+         _cupsLangPrintf(stderr, "%s: %s", command, cupsGetErrorString());
          return (1);
        }
       }
index cd84f0c4247692f64ecf983d62cbd9781905da35..3124577bc467097a1a2c414959a692e1dbb7adb2 100644 (file)
@@ -189,13 +189,13 @@ main(int  argc,                           /* I - Number of command-line args */
   {
     if (!cupsAdminSetServerSettings(http, num_settings, settings))
     {
-      _cupsLangPrintf(stderr, "cupsctl: %s", cupsLastErrorString());
+      _cupsLangPrintf(stderr, "cupsctl: %s", cupsGetErrorString());
       return (1);
     }
   }
   else if (!cupsAdminGetServerSettings(http, &num_settings, &settings))
   {
-    _cupsLangPrintf(stderr, "cupsctl: %s", cupsLastErrorString());
+    _cupsLangPrintf(stderr, "cupsctl: %s", cupsGetErrorString());
     return (1);
   }
   else
index 7e85e04ee68c930be6c8755591098f49ecd8cbbe..da5ba6ee345f0adf2e47da68d26937eb204e7091 100644 (file)
@@ -150,15 +150,15 @@ main(int  argc,                           /* I - Number of command-line arguments */
                                                dest->options[j].value,
                                                num_options, &options);
              }
-             else if (cupsLastError() == IPP_STATUS_ERROR_BAD_REQUEST ||
-                      cupsLastError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED)
+             else if (cupsGetError() == IPP_STATUS_ERROR_BAD_REQUEST ||
+                      cupsGetError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED)
              {
                _cupsLangPrintf(stderr,
                                _("%s: Error - add '/version=1.1' to server "
                                  "name."), argv[0]);
                return (1);
              }
-             else if (cupsLastError() == IPP_STATUS_ERROR_NOT_FOUND)
+             else if (cupsGetError() == IPP_STATUS_ERROR_NOT_FOUND)
              {
                _cupsLangPrintf(stderr,
                                _("%s: Error - The printer or class does not exist."), argv[0]);
@@ -251,7 +251,7 @@ main(int  argc,                             /* I - Number of command-line arguments */
                char    email[1024];    /* EMail address */
 
 
-               snprintf(email, sizeof(email), "mailto:%s@%s", cupsUser(), httpGetHostname(NULL, buffer, sizeof(buffer)));
+               snprintf(email, sizeof(email), "mailto:%s@%s", cupsGetUser(), httpGetHostname(NULL, buffer, sizeof(buffer)));
                num_options = cupsAddOption("notify-recipient-uri", email, num_options, &options);
              }
 
@@ -572,8 +572,8 @@ main(int  argc,                             /* I - Number of command-line arguments */
                                      dest->options[j].value,
                                      num_options, &options);
     }
-    else if (cupsLastError() == IPP_STATUS_ERROR_BAD_REQUEST ||
-            cupsLastError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED)
+    else if (cupsGetError() == IPP_STATUS_ERROR_BAD_REQUEST ||
+            cupsGetError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED)
     {
       _cupsLangPrintf(stderr,
                      _("%s: Error - add '/version=1.1' to server "
@@ -584,8 +584,8 @@ main(int  argc,                             /* I - Number of command-line arguments */
 
   if (printer == NULL)
   {
-    if (!cupsGetNamedDest(NULL, NULL, NULL) && cupsLastError() == IPP_STATUS_ERROR_NOT_FOUND)
-      _cupsLangPrintf(stderr, _("%s: Error - %s"), argv[0], cupsLastErrorString());
+    if (!cupsGetNamedDest(NULL, NULL, NULL) && cupsGetError() == IPP_STATUS_ERROR_NOT_FOUND)
+      _cupsLangPrintf(stderr, _("%s: Error - %s"), argv[0], cupsGetErrorString());
     else
       _cupsLangPrintf(stderr, _("%s: Error - scheduler not responding."), argv[0]);
 
@@ -626,7 +626,7 @@ main(int  argc,                             /* I - Number of command-line arguments */
 
     if (cupsFinishDocument(CUPS_HTTP_DEFAULT, printer) != IPP_OK)
     {
-      _cupsLangPrintf(stderr, "%s: %s", argv[0], cupsLastErrorString());
+      _cupsLangPrintf(stderr, "%s: %s", argv[0], cupsGetErrorString());
       cupsCancelJob2(CUPS_HTTP_DEFAULT, printer, job_id, 0);
       return (1);
     }
@@ -634,7 +634,7 @@ main(int  argc,                             /* I - Number of command-line arguments */
 
   if (job_id < 1)
   {
-    _cupsLangPrintf(stderr, "%s: %s", argv[0], cupsLastErrorString());
+    _cupsLangPrintf(stderr, "%s: %s", argv[0], cupsGetErrorString());
     return (1);
   }
   else if (!silent)
@@ -666,24 +666,24 @@ restart_job(const char *command,  /* I - Command name */
                "job-uri", NULL, uri);
 
   ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
-               "requesting-user-name", NULL, cupsUser());
+               "requesting-user-name", NULL, cupsGetUser());
 
   if (job_hold_until)
     ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "job-hold-until", NULL, job_hold_until);
 
   ippDelete(cupsDoRequest(CUPS_HTTP_DEFAULT, request, "/jobs"));
 
-  if (cupsLastError() == IPP_STATUS_ERROR_BAD_REQUEST ||
-      cupsLastError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED)
+  if (cupsGetError() == IPP_STATUS_ERROR_BAD_REQUEST ||
+      cupsGetError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED)
   {
     _cupsLangPrintf(stderr,
                    _("%s: Error - add '/version=1.1' to server "
                      "name."), command);
     return (1);
   }
-  else if (cupsLastError() > IPP_OK_CONFLICT)
+  else if (cupsGetError() > IPP_OK_CONFLICT)
   {
-    _cupsLangPrintf(stderr, "%s: %s", command, cupsLastErrorString());
+    _cupsLangPrintf(stderr, "%s: %s", command, cupsGetErrorString());
     return (1);
   }
 
@@ -717,23 +717,23 @@ set_job_attrs(
                "job-uri", NULL, uri);
 
   ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
-               "requesting-user-name", NULL, cupsUser());
+               "requesting-user-name", NULL, cupsGetUser());
 
   cupsEncodeOptions(request, num_options, options);
 
   ippDelete(cupsDoRequest(CUPS_HTTP_DEFAULT, request, "/jobs"));
 
-  if (cupsLastError() == IPP_STATUS_ERROR_BAD_REQUEST ||
-      cupsLastError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED)
+  if (cupsGetError() == IPP_STATUS_ERROR_BAD_REQUEST ||
+      cupsGetError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED)
   {
     _cupsLangPrintf(stderr,
                    _("%s: Error - add '/version=1.1' to server "
                      "name."), command);
     return (1);
   }
-  else if (cupsLastError() > IPP_OK_CONFLICT)
+  else if (cupsGetError() > IPP_OK_CONFLICT)
   {
-    _cupsLangPrintf(stderr, "%s: %s", command, cupsLastErrorString());
+    _cupsLangPrintf(stderr, "%s: %s", command, cupsGetErrorString());
     return (1);
   }
 
index 83b28890f248f5257064a4ef966fd54af14f2414..fb1aa67acc45e21cbd261e98bb26b532fa5f899c 100644 (file)
@@ -701,7 +701,7 @@ add_printer_to_class(http_t *http,  /* I - Server connection */
   ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
                "printer-uri", NULL, uri);
   ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
-               NULL, cupsUser());
+               NULL, cupsGetUser());
 
  /*
   * Do the request and get back a response...
@@ -725,7 +725,7 @@ add_printer_to_class(http_t *http,  /* I - Server connection */
   ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
                "printer-uri", NULL, uri);
   ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
-               NULL, cupsUser());
+               NULL, cupsGetUser());
 
  /*
   * See if the printer is already in the class...
@@ -779,9 +779,9 @@ add_printer_to_class(http_t *http,  /* I - Server connection */
   ippDelete(response);
 
   ippDelete(cupsDoRequest(http, request, "/admin/"));
-  if (cupsLastError() > IPP_STATUS_OK_CONFLICTING)
+  if (cupsGetError() > IPP_STATUS_OK_CONFLICTING)
   {
-    _cupsLangPrintf(stderr, _("%s: %s"), "lpadmin", cupsLastErrorString());
+    _cupsLangPrintf(stderr, _("%s: %s"), "lpadmin", cupsGetErrorString());
 
     return (1);
   }
@@ -820,7 +820,7 @@ default_printer(http_t *http,               /* I - Server connection */
   ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
                "printer-uri", NULL, uri);
   ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
-               NULL, cupsUser());
+               NULL, cupsGetUser());
 
  /*
   * Do the request and get back a response...
@@ -828,9 +828,9 @@ default_printer(http_t *http,               /* I - Server connection */
 
   ippDelete(cupsDoRequest(http, request, "/admin/"));
 
-  if (cupsLastError() > IPP_STATUS_OK_CONFLICTING)
+  if (cupsGetError() > IPP_STATUS_OK_CONFLICTING)
   {
-    _cupsLangPrintf(stderr, _("%s: %s"), "lpadmin", cupsLastErrorString());
+    _cupsLangPrintf(stderr, _("%s: %s"), "lpadmin", cupsGetErrorString());
 
     return (1);
   }
@@ -868,7 +868,7 @@ delete_printer(http_t *http,                /* I - Server connection */
   ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
                "printer-uri", NULL, uri);
   ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
-               NULL, cupsUser());
+               NULL, cupsGetUser());
 
  /*
   * Do the request and get back a response...
@@ -876,9 +876,9 @@ delete_printer(http_t *http,                /* I - Server connection */
 
   ippDelete(cupsDoRequest(http, request, "/admin/"));
 
-  if (cupsLastError() > IPP_STATUS_OK_CONFLICTING)
+  if (cupsGetError() > IPP_STATUS_OK_CONFLICTING)
   {
-    _cupsLangPrintf(stderr, _("%s: %s"), "lpadmin", cupsLastErrorString());
+    _cupsLangPrintf(stderr, _("%s: %s"), "lpadmin", cupsGetErrorString());
 
     return (1);
   }
@@ -922,7 +922,7 @@ delete_printer_from_class(
   ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
                "printer-uri", NULL, uri);
   ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
-               NULL, cupsUser());
+               NULL, cupsGetUser());
 
  /*
   * Do the request and get back a response...
@@ -931,7 +931,7 @@ delete_printer_from_class(
   if ((response = cupsDoRequest(http, request, "/classes/")) == NULL ||
       response->request.status.status_code == IPP_STATUS_ERROR_NOT_FOUND)
   {
-    _cupsLangPrintf(stderr, _("%s: %s"), "lpadmin", cupsLastErrorString());
+    _cupsLangPrintf(stderr, _("%s: %s"), "lpadmin", cupsGetErrorString());
 
     ippDelete(response);
 
@@ -983,7 +983,7 @@ delete_printer_from_class(
     ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
                 "printer-uri", NULL, uri);
     ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
-                 "requesting-user-name", NULL, cupsUser());
+                 "requesting-user-name", NULL, cupsGetUser());
   }
   else
   {
@@ -1003,7 +1003,7 @@ delete_printer_from_class(
     ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
                 "printer-uri", NULL, uri);
     ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
-                 "requesting-user-name", NULL, cupsUser());
+                 "requesting-user-name", NULL, cupsGetUser());
 
    /*
     * Delete the printer from the class...
@@ -1027,9 +1027,9 @@ delete_printer_from_class(
 
   ippDelete(cupsDoRequest(http, request, "/admin/"));
 
-  if (cupsLastError() > IPP_STATUS_OK_CONFLICTING)
+  if (cupsGetError() > IPP_STATUS_OK_CONFLICTING)
   {
-    _cupsLangPrintf(stderr, _("%s: %s"), "lpadmin", cupsLastErrorString());
+    _cupsLangPrintf(stderr, _("%s: %s"), "lpadmin", cupsGetErrorString());
 
     return (1);
   }
@@ -1070,7 +1070,7 @@ delete_printer_option(http_t *http,       /* I - Server connection */
   ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
                "printer-uri", NULL, uri);
   ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
-               "requesting-user-name", NULL, cupsUser());
+               "requesting-user-name", NULL, cupsGetUser());
   ippAddInteger(request, IPP_TAG_PRINTER, IPP_TAG_DELETEATTR, option, 0);
 
  /*
@@ -1079,9 +1079,9 @@ delete_printer_option(http_t *http,       /* I - Server connection */
 
   ippDelete(cupsDoRequest(http, request, "/admin/"));
 
-  if (cupsLastError() > IPP_STATUS_OK_CONFLICTING)
+  if (cupsGetError() > IPP_STATUS_OK_CONFLICTING)
   {
-    _cupsLangPrintf(stderr, _("%s: %s"), "lpadmin", cupsLastErrorString());
+    _cupsLangPrintf(stderr, _("%s: %s"), "lpadmin", cupsGetErrorString());
 
     return (1);
   }
@@ -1116,13 +1116,13 @@ enable_printer(http_t *http,            /* I - Server connection */
 
   httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL, "localhost", ippPort(), "/printers/%s", printer);
   ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri);
-  ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", NULL, cupsUser());
+  ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", NULL, cupsGetUser());
 
   ippDelete(cupsDoRequest(http, request, "/admin/"));
 
-  if (cupsLastError() > IPP_STATUS_OK_CONFLICTING)
+  if (cupsGetError() > IPP_STATUS_OK_CONFLICTING)
   {
-    _cupsLangPrintf(stderr, _("%s: %s"), "lpadmin", cupsLastErrorString());
+    _cupsLangPrintf(stderr, _("%s: %s"), "lpadmin", cupsGetErrorString());
 
     return (1);
   }
@@ -1130,13 +1130,13 @@ enable_printer(http_t *http,            /* I - Server connection */
   request = ippNewRequest(IPP_OP_RESUME_PRINTER);
 
   ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri);
-  ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", NULL, cupsUser());
+  ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", NULL, cupsGetUser());
 
   ippDelete(cupsDoRequest(http, request, "/admin/"));
 
-  if (cupsLastError() > IPP_STATUS_OK_CONFLICTING)
+  if (cupsGetError() > IPP_STATUS_OK_CONFLICTING)
   {
-    _cupsLangPrintf(stderr, _("%s: %s"), "lpadmin", cupsLastErrorString());
+    _cupsLangPrintf(stderr, _("%s: %s"), "lpadmin", cupsGetErrorString());
 
     return (1);
   }
@@ -1180,7 +1180,7 @@ get_printer_type(http_t *http,            /* I - Server connection */
   ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
                "requested-attributes", NULL, "printer-type");
   ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
-               "requesting-user-name", NULL, cupsUser());
+               "requesting-user-name", NULL, cupsGetUser());
 
  /*
   * Do the request...
@@ -1255,7 +1255,7 @@ set_printer_options(
     request = ippNewRequest(IPP_OP_CUPS_ADD_MODIFY_PRINTER);
 
   ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri);
-  ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", NULL, cupsUser());
+  ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", NULL, cupsGetUser());
 
  /*
   * Add the options...
@@ -1474,9 +1474,9 @@ set_printer_options(
   * Check the response...
   */
 
-  if (cupsLastError() > IPP_STATUS_OK_CONFLICTING)
+  if (cupsGetError() > IPP_STATUS_OK_CONFLICTING)
   {
-    _cupsLangPrintf(stderr, _("%s: %s"), "lpadmin", cupsLastErrorString());
+    _cupsLangPrintf(stderr, _("%s: %s"), "lpadmin", cupsGetErrorString());
 
     return (1);
   }
index 0b33ff7e636528db758d5afda629eb7f40105f9c..34f6f35a206ef094b5d24d8cfe7e5f02adfbd84f 100644 (file)
@@ -295,7 +295,7 @@ show_devices(
   if (cupsGetDevices(CUPS_HTTP_DEFAULT, timeout, include_schemes,
                      exclude_schemes, device_cb, &long_status) != IPP_OK)
   {
-    _cupsLangPrintf(stderr, "lpinfo: %s", cupsLastErrorString());
+    _cupsLangPrintf(stderr, "lpinfo: %s", cupsGetErrorString());
     return (1);
   }
 
@@ -374,7 +374,7 @@ show_models(
 
     if (response->request.status.status_code > IPP_OK_CONFLICT)
     {
-      _cupsLangPrintf(stderr, "lpinfo: %s", cupsLastErrorString());
+      _cupsLangPrintf(stderr, "lpinfo: %s", cupsGetErrorString());
       ippDelete(response);
       return (1);
     }
@@ -473,7 +473,7 @@ show_models(
   }
   else
   {
-    _cupsLangPrintf(stderr, "lpinfo: %s", cupsLastErrorString());
+    _cupsLangPrintf(stderr, "lpinfo: %s", cupsGetErrorString());
 
     return (1);
   }
index fad96f5f2c17909e37f9b9ac04734f004e87f526..c8a3dc77357731f93eb323f718c9af561e2c0c13 100644 (file)
@@ -177,7 +177,7 @@ move_job(http_t     *http,          /* I - HTTP connection to server */
   }
 
   ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
-               NULL, cupsUser());
+               NULL, cupsGetUser());
 
   httpAssembleURIf(HTTP_URI_CODING_ALL, printer_uri, sizeof(printer_uri),
                    "ipp", NULL, "localhost", 0, "/printers/%s", dest);
@@ -190,9 +190,9 @@ move_job(http_t     *http,          /* I - HTTP connection to server */
 
   ippDelete(cupsDoRequest(http, request, "/jobs"));
 
-  if (cupsLastError() > IPP_OK_CONFLICT)
+  if (cupsGetError() > IPP_OK_CONFLICT)
   {
-    _cupsLangPrintf(stderr, "lpmove: %s", cupsLastErrorString());
+    _cupsLangPrintf(stderr, "lpmove: %s", cupsGetErrorString());
     return (1);
   }
   else
index 08746c000cf70c8e3223411aecb93580668a2cc0..381553145713c2b3b083ff9a8f2d186cde0e1151 100644 (file)
@@ -490,7 +490,7 @@ list_options(cups_dest_t *dest)             /* I - Destination to list */
   if ((http = cupsConnectDest(dest, CUPS_DEST_FLAGS_NONE, 30000, NULL, resource, sizeof(resource), NULL, NULL)) == NULL)
   {
     _cupsLangPrintf(stderr, _("lpoptions: Unable to get PPD file for %s: %s"),
-                   dest->name, cupsLastErrorString());
+                   dest->name, cupsGetErrorString());
     return;
   }
 
@@ -499,7 +499,7 @@ list_options(cups_dest_t *dest)             /* I - Destination to list */
     httpClose(http);
 
     _cupsLangPrintf(stderr, _("lpoptions: Unable to get PPD file for %s: %s"),
-                   dest->name, cupsLastErrorString());
+                   dest->name, cupsGetErrorString());
     return;
   }
 
index eb1531c1e92e5fa3c5c08589829cf7250a3af040..457300f98d9b702d4a85380b40cc5ea04dddb98e 100644 (file)
@@ -180,7 +180,7 @@ main(int  argc,                             /* I - Number of command-line arguments */
                  cupsFreeDests(num_dests, dests);
                  num_dests = cupsGetDests(&dests);
 
-                 if (num_dests == 0 && (cupsLastError() == IPP_STATUS_ERROR_BAD_REQUEST || cupsLastError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED))
+                 if (num_dests == 0 && (cupsGetError() == IPP_STATUS_ERROR_BAD_REQUEST || cupsGetError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED))
                  {
                    _cupsLangPrintf(stderr, _("%s: Error - add '/version=1.1' to server name."), argv[0]);
                    return (1);
@@ -224,8 +224,8 @@ main(int  argc,                             /* I - Number of command-line arguments */
                num_dests = dests ? 1 : 0;
 
                if (num_dests == 0 &&
-                   (cupsLastError() == IPP_STATUS_ERROR_BAD_REQUEST ||
-                    cupsLastError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED))
+                   (cupsGetError() == IPP_STATUS_ERROR_BAD_REQUEST ||
+                    cupsGetError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED))
                {
                  _cupsLangPrintf(stderr, _("%s: Error - add '/version=1.1' to server name."), argv[0]);
                  return (1);
@@ -357,8 +357,8 @@ main(int  argc,                             /* I - Number of command-line arguments */
                  num_dests = cupsGetDests(&dests);
 
                  if (num_dests == 0 &&
-                     (cupsLastError() == IPP_STATUS_ERROR_BAD_REQUEST ||
-                      cupsLastError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED))
+                     (cupsGetError() == IPP_STATUS_ERROR_BAD_REQUEST ||
+                      cupsGetError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED))
                  {
                    _cupsLangPrintf(stderr, _("%s: Error - add '/version=1.1' to server name."), argv[0]);
                    return (1);
@@ -385,8 +385,8 @@ main(int  argc,                             /* I - Number of command-line arguments */
                num_dests = cupsGetDests(&dests);
 
                if (num_dests == 0 &&
-                   (cupsLastError() == IPP_STATUS_ERROR_BAD_REQUEST ||
-                    cupsLastError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED))
+                   (cupsGetError() == IPP_STATUS_ERROR_BAD_REQUEST ||
+                    cupsGetError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED))
                {
                  _cupsLangPrintf(stderr, _("%s: Error - add '/version=1.1' to server name."), argv[0]);
                  return (1);
@@ -407,8 +407,8 @@ main(int  argc,                             /* I - Number of command-line arguments */
                num_dests = cupsGetDests(&dests);
 
                if (num_dests == 0 &&
-                   (cupsLastError() == IPP_STATUS_ERROR_BAD_REQUEST ||
-                    cupsLastError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED))
+                   (cupsGetError() == IPP_STATUS_ERROR_BAD_REQUEST ||
+                    cupsGetError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED))
                {
                  _cupsLangPrintf(stderr, _("%s: Error - add '/version=1.1' to server name."), argv[0]);
                  return (1);
@@ -469,8 +469,8 @@ main(int  argc,                             /* I - Number of command-line arguments */
                  num_dests = cupsGetDests(&dests);
 
                  if (num_dests == 0 &&
-                     (cupsLastError() == IPP_STATUS_ERROR_BAD_REQUEST ||
-                      cupsLastError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED))
+                     (cupsGetError() == IPP_STATUS_ERROR_BAD_REQUEST ||
+                      cupsGetError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED))
                  {
                    _cupsLangPrintf(stderr, _("%s: Error - add '/version=1.1' to server name."), argv[0]);
                    return (1);
@@ -495,7 +495,7 @@ main(int  argc,                             /* I - Number of command-line arguments */
   }
 
   if (!op)
-    status |= show_jobs(NULL, cupsUser(), long_status, ranking, which);
+    status |= show_jobs(NULL, cupsGetUser(), long_status, ranking, which);
 
   return (status);
 }
@@ -535,8 +535,8 @@ check_dest(const char  *command,    /* I  - Command name */
 
       if ((*dests = cupsGetNamedDest(CUPS_HTTP_DEFAULT, printer, pptr)) == NULL)
       {
-       if (cupsLastError() == IPP_STATUS_ERROR_BAD_REQUEST ||
-           cupsLastError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED)
+       if (cupsGetError() == IPP_STATUS_ERROR_BAD_REQUEST ||
+           cupsGetError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED)
          _cupsLangPrintf(stderr,
                          _("%s: Error - add '/version=1.1' to server name."),
                          command);
@@ -596,8 +596,8 @@ check_dest(const char  *command,    /* I  - Command name */
 
     if (!cupsGetDest(printer, NULL, *num_dests, *dests))
     {
-      if (cupsLastError() == IPP_STATUS_ERROR_BAD_REQUEST ||
-          cupsLastError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED)
+      if (cupsGetError() == IPP_STATUS_ERROR_BAD_REQUEST ||
+          cupsGetError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED)
        _cupsLangPrintf(stderr,
                        _("%s: Error - add '/version=1.1' to server name."),
                        command);
@@ -711,7 +711,7 @@ show_accepting(const char  *printers,       /* I - Destinations */
                NULL, pattrs);
 
   ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
-               NULL, cupsUser());
+               NULL, cupsGetUser());
 
  /*
   * Do the request and get back a response...
@@ -719,13 +719,13 @@ show_accepting(const char  *printers,     /* I - Destinations */
 
   response = cupsDoRequest(CUPS_HTTP_DEFAULT, request, "/");
 
-  if (cupsLastError() == IPP_STATUS_ERROR_SERVICE_UNAVAILABLE)
+  if (cupsGetError() == IPP_STATUS_ERROR_SERVICE_UNAVAILABLE)
   {
     _cupsLangPrintf(stderr, _("%s: Scheduler is not running."), "lpstat");
     ippDelete(response);
     return (1);
   }
-  else if (cupsLastError() == IPP_STATUS_ERROR_BAD_REQUEST || cupsLastError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED)
+  else if (cupsGetError() == IPP_STATUS_ERROR_BAD_REQUEST || cupsGetError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED)
   {
     _cupsLangPrintf(stderr,
                    _("%s: Error - add '/version=1.1' to server name."),
@@ -733,9 +733,9 @@ show_accepting(const char  *printers,       /* I - Destinations */
     ippDelete(response);
     return (1);
   }
-  else if (cupsLastError() > IPP_STATUS_OK_CONFLICTING)
+  else if (cupsGetError() > IPP_STATUS_OK_CONFLICTING)
   {
-    _cupsLangPrintf(stderr, "lpstat: %s", cupsLastErrorString());
+    _cupsLangPrintf(stderr, "lpstat: %s", cupsGetErrorString());
     ippDelete(response);
     return (1);
   }
@@ -896,7 +896,7 @@ show_classes(const char *dests)             /* I - Destinations */
                NULL, cattrs);
 
   ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
-               NULL, cupsUser());
+               NULL, cupsGetUser());
 
  /*
   * Do the request and get back a response...
@@ -904,14 +904,14 @@ show_classes(const char *dests)           /* I - Destinations */
 
   response = cupsDoRequest(CUPS_HTTP_DEFAULT, request, "/");
 
-  if (cupsLastError() == IPP_STATUS_ERROR_SERVICE_UNAVAILABLE)
+  if (cupsGetError() == IPP_STATUS_ERROR_SERVICE_UNAVAILABLE)
   {
     _cupsLangPrintf(stderr, _("%s: Scheduler is not running."), "lpstat");
     ippDelete(response);
     return (1);
   }
-  if (cupsLastError() == IPP_STATUS_ERROR_BAD_REQUEST ||
-      cupsLastError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED)
+  if (cupsGetError() == IPP_STATUS_ERROR_BAD_REQUEST ||
+      cupsGetError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED)
   {
     _cupsLangPrintf(stderr,
                    _("%s: Error - add '/version=1.1' to server name."),
@@ -919,9 +919,9 @@ show_classes(const char *dests)             /* I - Destinations */
     ippDelete(response);
     return (1);
   }
-  else if (cupsLastError() > IPP_STATUS_OK_CONFLICTING)
+  else if (cupsGetError() > IPP_STATUS_OK_CONFLICTING)
   {
-    _cupsLangPrintf(stderr, "lpstat: %s", cupsLastErrorString());
+    _cupsLangPrintf(stderr, "lpstat: %s", cupsGetErrorString());
     ippDelete(response);
     return (1);
   }
@@ -930,7 +930,7 @@ show_classes(const char *dests)             /* I - Destinations */
   {
     if (response->request.status.status_code > IPP_OK_CONFLICT)
     {
-      _cupsLangPrintf(stderr, "lpstat: %s", cupsLastErrorString());
+      _cupsLangPrintf(stderr, "lpstat: %s", cupsGetErrorString());
       ippDelete(response);
       return (1);
     }
@@ -1160,7 +1160,7 @@ show_devices(const char  *printers,       /* I - Destinations */
                NULL, pattrs);
 
   ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
-               NULL, cupsUser());
+               NULL, cupsGetUser());
 
  /*
   * Do the request and get back a response...
@@ -1168,14 +1168,14 @@ show_devices(const char  *printers,     /* I - Destinations */
 
   response = cupsDoRequest(CUPS_HTTP_DEFAULT, request, "/");
 
-  if (cupsLastError() == IPP_STATUS_ERROR_SERVICE_UNAVAILABLE)
+  if (cupsGetError() == IPP_STATUS_ERROR_SERVICE_UNAVAILABLE)
   {
     _cupsLangPrintf(stderr, _("%s: Scheduler is not running."), "lpstat");
     ippDelete(response);
     return (1);
   }
-  if (cupsLastError() == IPP_STATUS_ERROR_BAD_REQUEST ||
-      cupsLastError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED)
+  if (cupsGetError() == IPP_STATUS_ERROR_BAD_REQUEST ||
+      cupsGetError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED)
   {
     _cupsLangPrintf(stderr,
                    _("%s: Error - add '/version=1.1' to server name."),
@@ -1183,9 +1183,9 @@ show_devices(const char  *printers,       /* I - Destinations */
     ippDelete(response);
     return (1);
   }
-  else if (cupsLastError() > IPP_STATUS_OK_CONFLICTING)
+  else if (cupsGetError() > IPP_STATUS_OK_CONFLICTING)
   {
-    _cupsLangPrintf(stderr, "lpstat: %s", cupsLastErrorString());
+    _cupsLangPrintf(stderr, "lpstat: %s", cupsGetErrorString());
     ippDelete(response);
     return (1);
   }
@@ -1355,7 +1355,7 @@ show_jobs(const char *dests,              /* I - Destinations */
                NULL, jattrs);
 
   ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
-               NULL, cupsUser());
+               NULL, cupsGetUser());
 
   ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "which-jobs",
                NULL, which);
@@ -1366,14 +1366,14 @@ show_jobs(const char *dests,            /* I - Destinations */
 
   response = cupsDoRequest(CUPS_HTTP_DEFAULT, request, "/");
 
-  if (cupsLastError() == IPP_STATUS_ERROR_SERVICE_UNAVAILABLE)
+  if (cupsGetError() == IPP_STATUS_ERROR_SERVICE_UNAVAILABLE)
   {
     _cupsLangPrintf(stderr, _("%s: Scheduler is not running."), "lpstat");
     ippDelete(response);
     return (1);
   }
-  if (cupsLastError() == IPP_STATUS_ERROR_BAD_REQUEST ||
-      cupsLastError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED)
+  if (cupsGetError() == IPP_STATUS_ERROR_BAD_REQUEST ||
+      cupsGetError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED)
   {
     _cupsLangPrintf(stderr,
                    _("%s: Error - add '/version=1.1' to server name."),
@@ -1381,9 +1381,9 @@ show_jobs(const char *dests,              /* I - Destinations */
     ippDelete(response);
     return (1);
   }
-  else if (cupsLastError() > IPP_STATUS_OK_CONFLICTING)
+  else if (cupsGetError() > IPP_STATUS_OK_CONFLICTING)
   {
-    _cupsLangPrintf(stderr, "lpstat: %s", cupsLastErrorString());
+    _cupsLangPrintf(stderr, "lpstat: %s", cupsGetErrorString());
     ippDelete(response);
     return (1);
   }
@@ -1601,7 +1601,7 @@ show_printers(const char  *printers,      /* I - Destinations */
                NULL, pattrs);
 
   ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
-               NULL, cupsUser());
+               NULL, cupsGetUser());
 
  /*
   * Do the request and get back a response...
@@ -1609,14 +1609,14 @@ show_printers(const char  *printers,    /* I - Destinations */
 
   response = cupsDoRequest(CUPS_HTTP_DEFAULT, request, "/");
 
-  if (cupsLastError() == IPP_STATUS_ERROR_SERVICE_UNAVAILABLE)
+  if (cupsGetError() == IPP_STATUS_ERROR_SERVICE_UNAVAILABLE)
   {
     _cupsLangPrintf(stderr, _("%s: Scheduler is not running."), "lpstat");
     ippDelete(response);
     return (1);
   }
-  if (cupsLastError() == IPP_STATUS_ERROR_BAD_REQUEST ||
-      cupsLastError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED)
+  if (cupsGetError() == IPP_STATUS_ERROR_BAD_REQUEST ||
+      cupsGetError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED)
   {
     _cupsLangPrintf(stderr,
                    _("%s: Error - add '/version=1.1' to server name."),
@@ -1624,9 +1624,9 @@ show_printers(const char  *printers,      /* I - Destinations */
     ippDelete(response);
     return (1);
   }
-  else if (cupsLastError() > IPP_STATUS_OK_CONFLICTING)
+  else if (cupsGetError() > IPP_STATUS_OK_CONFLICTING)
   {
-    _cupsLangPrintf(stderr, "lpstat: %s", cupsLastErrorString());
+    _cupsLangPrintf(stderr, "lpstat: %s", cupsGetErrorString());
     ippDelete(response);
     return (1);
   }
index fd8fbe7d7c3e58786d85c2d196af1805546a0216..c21dc128e57c4b3cd46e7f04ab6f4640c99c9cc3 100644 (file)
@@ -2640,7 +2640,7 @@ finish_document_uri(
 
     if ((http = httpConnect2(hostname, port, NULL, AF_UNSPEC, encryption, 1, 30000, NULL)) == NULL)
     {
-      respond_ipp(client, IPP_STATUS_ERROR_DOCUMENT_ACCESS, "Unable to connect to %s: %s", hostname, cupsLastErrorString());
+      respond_ipp(client, IPP_STATUS_ERROR_DOCUMENT_ACCESS, "Unable to connect to %s: %s", hostname, cupsGetErrorString());
 
       close(job->fd);
       job->fd = -1;
@@ -5798,7 +5798,7 @@ process_client(ippeve_client_t *client)   /* I - Client */
 
        if (httpEncryption(client->http, HTTP_ENCRYPTION_ALWAYS))
        {
-         fprintf(stderr, "%s Unable to encrypt connection: %s\n", client->hostname, cupsLastErrorString());
+         fprintf(stderr, "%s Unable to encrypt connection: %s\n", client->hostname, cupsGetErrorString());
          break;
         }
 
@@ -6007,7 +6007,7 @@ process_http(ippeve_client_t *client)     /* I - Client connection */
 
       if (httpEncryption(client->http, HTTP_ENCRYPTION_REQUIRED))
       {
-        fprintf(stderr, "%s Unable to encrypt connection: %s\n", client->hostname, cupsLastErrorString());
+        fprintf(stderr, "%s Unable to encrypt connection: %s\n", client->hostname, cupsGetErrorString());
        return (0);
       }
 
@@ -6263,7 +6263,7 @@ process_http(ippeve_client_t *client)     /* I - Client connection */
        {
          if (ipp_state == IPP_STATE_ERROR)
          {
-            fprintf(stderr, "%s IPP read error (%s).\n", client->hostname, cupsLastErrorString());
+            fprintf(stderr, "%s IPP read error (%s).\n", client->hostname, cupsGetErrorString());
            respond_http(client, HTTP_STATUS_BAD_REQUEST, NULL, NULL, 0);
            return (0);
          }
@@ -6801,9 +6801,9 @@ process_job(ippeve_job_t *job)            /* I - Job */
         snprintf(service, sizeof(service), "%d", port);
 
         if ((addrlist = httpAddrGetList(host, AF_UNSPEC, service)) == NULL)
-          fprintf(stderr, "[Job %d] Unable to find \"%s\": %s\n", job->id, host, cupsLastErrorString());
+          fprintf(stderr, "[Job %d] Unable to find \"%s\": %s\n", job->id, host, cupsGetErrorString());
         else if (!httpAddrConnect2(addrlist, &mystdout, 30000, &(job->cancel)))
-          fprintf(stderr, "[Job %d] Unable to connect to \"%s\": %s\n", job->id, host, cupsLastErrorString());
+          fprintf(stderr, "[Job %d] Unable to connect to \"%s\": %s\n", job->id, host, cupsGetErrorString());
 
         httpAddrFreeList(addrlist);
       }
index 50f4553b311700ec28c31aedfe5ed49cc2a636e3..977aa370fdbb8e613ca4926baaac23e13c036c8c 100644 (file)
@@ -248,7 +248,7 @@ dsc_header(int num_pages)           /* I - Number of pages or 0 if not known */
   const char   *job_id = getenv("IPP_JOB_ID");
                                        /* job-id value */
 
-  ppdEmitJCL(ppd, stdout, job_id ? atoi(job_id) : 0, cupsUser(), job_name ? job_name : "Unknown");
+  ppdEmitJCL(ppd, stdout, job_id ? atoi(job_id) : 0, cupsGetUser(), job_name ? job_name : "Unknown");
 #endif /* !CUPS_LITE */
 
   puts("%!PS-Adobe-3.0");
@@ -816,7 +816,7 @@ pdf_to_ps(const char    *filename,  /* I - Filename */
 
   pdf_argv[0] = "printer";
   pdf_argv[1] = job_id;
-  pdf_argv[2] = cupsUser();
+  pdf_argv[2] = cupsGetUser();
   pdf_argv[3] = job_name;
   pdf_argv[4] = "1";
   pdf_argv[5] = pdf_options;
index 2e4272653df91bcedaebdd743a53c35931240b3a..0785f1954d150eb9893f9d061fa669c16206de9b 100644 (file)
@@ -2292,23 +2292,23 @@ list_service(ippfind_srv_t *service)    /* I - Service */
       ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL,
                    service->uri);
       ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
-                   "requesting-user-name", NULL, cupsUser());
+                   "requesting-user-name", NULL, cupsGetUser());
       ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
                     "requested-attributes",
                     (int)(sizeof(rattrs) / sizeof(rattrs[0])), NULL, rattrs);
 
       response = cupsDoRequest(http, request, service->resource);
 
-      if (cupsLastError() == IPP_STATUS_ERROR_BAD_REQUEST && version > 11)
+      if (cupsGetError() == IPP_STATUS_ERROR_BAD_REQUEST && version > 11)
         version = 11;
     }
-    while (cupsLastError() > IPP_STATUS_OK_EVENTS_COMPLETE && version > 11);
+    while (cupsGetError() > IPP_STATUS_OK_EVENTS_COMPLETE && version > 11);
 
    /*
     * Show results...
     */
 
-    if (cupsLastError() > IPP_STATUS_OK_EVENTS_COMPLETE)
+    if (cupsGetError() > IPP_STATUS_OK_EVENTS_COMPLETE)
     {
       _cupsLangPrintf(stdout, "%s: unavailable", service->uri);
       return (0);
index 756aa10cf552e5c083ed653b781489e954d1d91a..8468b52099c6f6beb10166dce320dc1f02fd2499 100644 (file)
@@ -944,7 +944,7 @@ do_monitor_printer_state(
 
   if ((http = httpConnect2(host, port, NULL, data->family, encryption, 1, 30000, NULL)) == NULL)
   {
-    print_fatal_error(data, "Unable to connect to \"%s\" on port %d - %s", host, port, cupsLastErrorString());
+    print_fatal_error(data, "Unable to connect to \"%s\" on port %d - %s", host, port, cupsGetErrorString());
     return (0);
   }
 
@@ -966,7 +966,7 @@ do_monitor_printer_state(
   ippSetRequestId(request, data->request_id * 100 - 1);
   ippSetVersion(request, data->version / 10, data->version % 10);
   ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, data->monitor_uri);
-  ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", NULL, cupsUser());
+  ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", NULL, cupsGetUser());
 
   for (i = data->num_monitor_expects, expect = data->monitor_expects, num_pattrs = 0; i > 0; i --, expect ++)
   {
@@ -1471,7 +1471,7 @@ do_test(_ipp_file_t    *f,                /* I - IPP data file */
       * No response, log error...
       */
 
-      add_stringf(data->errors, "IPP request failed with status %s (%s)", ippErrorString(cupsLastError()), cupsLastErrorString());
+      add_stringf(data->errors, "IPP request failed with status %s (%s)", ippErrorString(cupsGetError()), cupsGetErrorString());
     }
     else
     {
@@ -1613,7 +1613,7 @@ do_test(_ipp_file_t    *f,                /* I - IPP data file */
        }
 
        if (!ippValidateAttribute(attrptr))
-         cupsArrayAdd(data->errors, (void *)cupsLastErrorString());
+         cupsArrayAdd(data->errors, (void *)cupsGetErrorString());
 
        if (ippGetName(attrptr))
        {
@@ -1686,7 +1686,7 @@ do_test(_ipp_file_t    *f,                /* I - IPP data file */
            continue;
 
          if (!data->statuses[i].repeat_match || repeat_count >= data->statuses[i].repeat_limit)
-           add_stringf(data->errors, "EXPECTED: STATUS %s (got %s)", ippErrorString(data->statuses[i].status), ippErrorString(cupsLastError()));
+           add_stringf(data->errors, "EXPECTED: STATUS %s (got %s)", ippErrorString(data->statuses[i].status), ippErrorString(cupsGetError()));
        }
 
        if ((attrptr = ippFindAttribute(response, "status-message", IPP_TAG_TEXT)) != NULL)
@@ -1975,7 +1975,7 @@ do_test(_ipp_file_t    *f,                /* I - IPP data file */
     cupsFilePuts(data->outfile, "<key>Successful</key>\n");
     cupsFilePuts(data->outfile, data->prev_pass ? "<true />\n" : "<false />\n");
     cupsFilePuts(data->outfile, "<key>StatusCode</key>\n");
-    print_xml_string(data->outfile, "string", ippErrorString(cupsLastError()));
+    print_xml_string(data->outfile, "string", ippErrorString(cupsGetError()));
     cupsFilePuts(data->outfile, "<key>ResponseAttributes</key>\n");
     cupsFilePuts(data->outfile, "<array>\n");
     cupsFilePuts(data->outfile, "<dict>\n");
@@ -2040,7 +2040,7 @@ do_test(_ipp_file_t    *f,                /* I - IPP data file */
     if (!data->prev_pass || (data->verbosity && response))
     {
       cupsFilePrintf(cupsFileStdout(), "        RECEIVED: %lu bytes in response\n", (unsigned long)ippLength(response));
-      cupsFilePrintf(cupsFileStdout(), "        status-code = %s (%s)\n", ippErrorString(cupsLastError()), cupsLastErrorString());
+      cupsFilePrintf(cupsFileStdout(), "        status-code = %s (%s)\n", ippErrorString(cupsGetError()), cupsGetErrorString());
 
       if (data->verbosity && response)
       {
@@ -2050,7 +2050,7 @@ do_test(_ipp_file_t    *f,                /* I - IPP data file */
     }
   }
   else if (!data->prev_pass && data->output != IPPTOOL_OUTPUT_QUIET)
-    fprintf(stderr, "%s\n", cupsLastErrorString());
+    fprintf(stderr, "%s\n", cupsGetErrorString());
 
   if (data->prev_pass && data->output >= IPPTOOL_OUTPUT_LIST && !data->verbosity && data->num_displayed > 0)
   {
@@ -2222,7 +2222,7 @@ do_tests(const char     *testfile,        /* I - Test file to use */
 
   if ((data->http = httpConnect2(data->vars->host, data->vars->port, NULL, data->family, encryption, 1, 30000, NULL)) == NULL)
   {
-    print_fatal_error(data, "Unable to connect to \"%s\" on port %d - %s", data->vars->host, data->vars->port, cupsLastErrorString());
+    print_fatal_error(data, "Unable to connect to \"%s\" on port %d - %s", data->vars->host, data->vars->port, cupsGetErrorString());
     return (0);
   }