]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - systemv/lpadmin.c
Merge changes from CUPS 1.4svn-r8628.
[thirdparty/cups.git] / systemv / lpadmin.c
index c0467fa7677d0164dd17b9836a94185f1fb7bd3e..d054fb5422e2bc3fbb3d349c27ada4c527594693 100644 (file)
@@ -1,25 +1,16 @@
 /*
- * "$Id: lpadmin.c 5545 2006-05-18 21:00:56Z mike $"
+ * "$Id: lpadmin.c 7720 2008-07-11 22:46:21Z mike $"
  *
  *   "lpadmin" command for the Common UNIX Printing System (CUPS).
  *
+ *   Copyright 2007-2009 by Apple Inc.
  *   Copyright 1997-2006 by Easy Software Products.
  *
  *   These coded instructions, statements, and computer programs are the
- *   property of Easy Software Products and are protected by Federal
- *   copyright law.  Distribution and use rights are outlined in the file
- *   "LICENSE.txt" which should have been included with this file.  If this
- *   file is missing or damaged please contact Easy Software Products
- *   at:
- *
- *       Attn: CUPS Licensing Information
- *       Easy Software Products
- *       44141 Airport View Drive, Suite 204
- *       Hollywood, Maryland 20636 USA
- *
- *       Voice: (301) 373-9600
- *       EMail: cups-info@cups.org
- *         WWW: http://www.cups.org
+ *   property of Apple Inc. and are protected by Federal copyright
+ *   law.  Distribution and use rights are outlined in the file "LICENSE.txt"
+ *   which should have been included with this file.  If this file is
+ *   file is missing or damaged, see the license at "http://www.cups.org/".
  *
  * Contents:
  *
@@ -92,6 +83,8 @@ main(int  argc,                       /* I - Number of command-line arguments */
   cups_option_t        *options;       /* Options */
 
 
+  _cupsSetLocale(argv);
+
   http        = NULL;
   printer     = NULL;
   num_options = 0;
@@ -921,12 +914,13 @@ add_printer_to_class(http_t *http,        /* I - Server connection */
     attr = ippAddStrings(request, IPP_TAG_PRINTER, IPP_TAG_URI,
                          "member-uris", members->num_values + 1, NULL, NULL);
     for (i = 0; i < members->num_values; i ++)
-      attr->values[i].string.text = strdup(members->values[i].string.text);
+      attr->values[i].string.text = _cupsStrAlloc(members->values[i].string.text);
 
-    attr->values[i].string.text = strdup(uri);
+    attr->values[i].string.text = _cupsStrAlloc(uri);
   }
   else
-    attr = ippAddString(request, IPP_TAG_PRINTER, IPP_TAG_URI, "member-uris", NULL, uri);
+    ippAddString(request, IPP_TAG_PRINTER, IPP_TAG_URI, "member-uris", NULL,
+                 uri);
 
  /*
   * Then send the request...
@@ -1196,7 +1190,8 @@ delete_printer_from_class(
 
     for (j = 0, k = 0; j < members->num_values; j ++)
       if (j != i)
-        attr->values[k ++].string.text = strdup(members->values[j].string.text);
+        attr->values[k ++].string.text =
+           _cupsStrAlloc(members->values[j].string.text);
   }
 
  /*
@@ -1455,9 +1450,7 @@ set_printer_file(http_t *http,            /* I - Server connection */
 
     if ((fd = cupsTempFd(tempfile, sizeof(tempfile))) < 0)
     {
-      _cupsLangPrintf(stderr,
-                      _("lpadmin: Unable to create temporary file: %s\n"),
-                     strerror(errno));
+      _cupsLangPrintError(_("ERROR: Unable to create temporary file"));
       return (1);
     }
 
@@ -1822,10 +1815,10 @@ set_printer_options(
   if ((protocol = cupsGetOption("protocol", num_options, options)) != NULL)
   {
     if (!strcasecmp(protocol, "bcp"))
-      ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "port-monitor",
+      ippAddString(request, IPP_TAG_PRINTER, IPP_TAG_NAME, "port-monitor",
                    NULL, "bcp");
     else if (!strcasecmp(protocol, "tbcp"))
-      ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "port-monitor",
+      ippAddString(request, IPP_TAG_PRINTER, IPP_TAG_NAME, "port-monitor",
                    NULL, "tbcp");
   }
 
@@ -1846,9 +1839,7 @@ set_printer_options(
 
     if ((outfd = cupsTempFd(tempfile, sizeof(tempfile))) < 0)
     {
-      _cupsLangPrintf(stderr,
-                      _("lpadmin: Unable to create temporary file - %s\n"),
-                     strerror(errno));
+      _cupsLangPrintError(_("ERROR: Unable to create temporary file"));
       ippDelete(request);
       unlink(ppdfile);
       return (1);
@@ -1984,5 +1975,5 @@ validate_name(const char *name)           /* I - Name to check */
 
 
 /*
- * End of "$Id: lpadmin.c 5545 2006-05-18 21:00:56Z mike $".
+ * End of "$Id: lpadmin.c 7720 2008-07-11 22:46:21Z mike $".
  */