]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - systemv/lpmove.c
Update svn:keyword properties.
[thirdparty/cups.git] / systemv / lpmove.c
index c515c4ea8a275eaae48a5b2cd6196222277b22d1..54424894f12bb66a56508bf245a1139ed5e5c756 100644 (file)
@@ -1,25 +1,16 @@
 /*
  * "$Id$"
  *
- *   "lpmove" command for the Common UNIX Printing System (CUPS).
+ *   "lpmove" command for CUPS.
  *
+ *   Copyright 2007-2010 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:
  *
  * Include necessary headers...
  */
 
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <cups/string.h>
-#include <cups/cups.h>
-#include <cups/i18n.h>
-#include <cups/debug.h>
+#include <cups/cups-private.h>
 
 
 /*
@@ -66,9 +51,10 @@ main(int  argc,                              /* I - Number of command-line arguments */
                *dest;                  /* New destination */
 
 
+  _cupsSetLocale(argv);
+
   dest      = NULL;
   dests     = NULL;
-  http      = NULL;
   job       = NULL;
   jobid     = 0;
   num_dests = 0;
@@ -82,22 +68,14 @@ main(int  argc,                             /* I - Number of command-line arguments */
 #ifdef HAVE_SSL
            cupsSetEncryption(HTTP_ENCRYPT_REQUIRED);
 
-           if (http)
-             httpEncryption(http, HTTP_ENCRYPT_REQUIRED);
 #else
             _cupsLangPrintf(stderr,
-                           _("%s: Sorry, no encryption support compiled in!\n"),
+                           _("%s: Sorry, no encryption support."),
                            argv[0]);
 #endif /* HAVE_SSL */
            break;
 
         case 'h' : /* Connect to host */
-           if (http)
-           {
-             httpClose(http);
-             http = NULL;
-           }
-
            if (argv[i][2] != '\0')
              cupsSetServer(argv[i] + 2);
            else
@@ -107,7 +85,7 @@ main(int  argc,                              /* I - Number of command-line arguments */
              if (i >= argc)
              {
                _cupsLangPuts(stderr,
-                             _("Error: need hostname after \'-h\' option!\n"));
+                             _("Error: need hostname after \"-h\" option."));
                return (1);
               }
 
@@ -116,7 +94,7 @@ main(int  argc,                              /* I - Number of command-line arguments */
            break;
 
        default :
-           _cupsLangPrintf(stderr, _("lpmove: Unknown option \'%c\'!\n"),
+           _cupsLangPrintf(stderr, _("lpmove: Unknown option \"%c\"."),
                            argv[i][1]);
            return (1);
       }
@@ -128,6 +106,9 @@ main(int  argc,                             /* I - Number of command-line arguments */
       if ((job = strrchr(argv[i], '-')) != NULL &&
           cupsGetDest(argv[i], NULL, num_dests, dests) == NULL)
         jobid = atoi(job + 1);
+      else if (isdigit(argv[i][0] & 255) &&
+               !cupsGetDest(argv[i], NULL, num_dests, dests))
+        jobid = atoi(argv[i]);
       else
         src = argv[i];
     }
@@ -135,28 +116,23 @@ main(int  argc,                           /* I - Number of command-line arguments */
       dest = argv[i];
     else
     {
-      _cupsLangPrintf(stderr, _("lpmove: Unknown argument \'%s\'!\n"),
-                      argv[i]);
+      _cupsLangPrintf(stderr, _("lpmove: Unknown argument \"%s\"."), argv[i]);
       return (1);
     }
 
   if ((!jobid && !src) || !dest)
   {
-    _cupsLangPuts(stdout, _("Usage: lpmove job/src dest\n"));
+    _cupsLangPuts(stdout, _("Usage: lpmove job/src dest"));
     return (1);
   }
 
-  if (!http)
-  {
-    http = httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption());
+  http = httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption());
 
-    if (http == NULL)
-    {
-      _cupsLangPrintf(stderr,
-                      _("lpmove: Unable to connect to server: %s\n"),
-                     strerror(errno));
-      return (1);
-    }
+  if (http == NULL)
+  {
+    _cupsLangPrintf(stderr, _("lpmove: Unable to connect to server: %s"),
+                   strerror(errno));
+    return (1);
   }
 
   return (move_job(http, src, jobid, dest));
@@ -224,7 +200,7 @@ move_job(http_t     *http,          /* I - HTTP connection to server */
 
   if (cupsLastError() > IPP_OK_CONFLICT)
   {
-    _cupsLangPrintf(stderr, "lpmove: %s\n", cupsLastErrorString());
+    _cupsLangPrintf(stderr, "lpmove: %s", cupsLastErrorString());
     return (1);
   }
   else