]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Add support for "-x" option, now "cancel -a" does not purge, it just cancels all
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Mon, 21 Jan 2013 14:25:46 +0000 (14:25 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Mon, 21 Jan 2013 14:25:46 +0000 (14:25 +0000)
jobs (STR #4103)

git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@10831 7a7537e8-13f0-0310-91df-b6672ffda945

CHANGES.txt
man/cancel.man
scheduler/ipp.c
systemv/cancel.c

index 38f8edf70a8f56b249f1d04204130830d991134a..972000fb51bad830e0330d80d68e083183546b7e 100644 (file)
@@ -1,8 +1,9 @@
-CHANGES.txt - 1.7b1 - 2012-12-11
+CHANGES.txt - 1.7b1 - 2013-01-21
 --------------------------------
 
 CHANGES IN CUPS V1.7b1
 
+       - Added a new "-x" option to the cancel command (STR #4103)
        - Added new IPP APIs for checking values (STR #4167)
        - Added new IPP APis for adding and setting formatted strings.
        - Added new HTTP APIs to support basic server functionality via libcups.
index 5b67f771faff3eb1e1982ad84bd843c91fcafe2f..15adcb22d7135b654c3f711d250060f4ed60a616 100644 (file)
@@ -12,7 +12,7 @@
 .\"   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/".
 .\"
-.TH cancel 1 "CUPS" "20 March 2006" "Apple Inc."
+.TH cancel 1 "CUPS" "21 January 2013" "Apple Inc."
 .SH NAME
 cancel - cancel jobs
 .SH SYNOPSIS
@@ -23,7 +23,7 @@ cancel - cancel jobs
 .I hostname[:port]
 ] [ -u
 .I username
-] [
+] [ -x ] [
 .I id
 ] [
 .I destination
@@ -56,6 +56,10 @@ Chooses an alternate server.
 -u username
 .br
 Cancels jobs owned by \fIusername\fR.
+.TP 5
+-x
+.br
+Deletes job data files in addition to canceling.
 .SH COMPATIBILITY
 Unlike the System V printing system, CUPS allows printer names to
 contain any printable character except SPACE, TAB, "/", or "#".
index 8e92f0f3bf5460f7945f6aac02493c12a010fd4a..50765bb5d2757f9d7ff1f8deffdda0e48174150f 100644 (file)
@@ -3,7 +3,7 @@
  *
  *   IPP routines for the CUPS scheduler.
  *
- *   Copyright 2007-2012 by Apple Inc.
+ *   Copyright 2007-2013 by Apple Inc.
  *   Copyright 1997-2007 by Easy Software Products, all rights reserved.
  *
  *   This file contains Kerberos support code, copyright 2006 by
@@ -3286,8 +3286,12 @@ cancel_all_jobs(cupsd_client_t  *con,    /* I - Client connection */
     {
       for (i = 0; i < job_ids->num_values; i ++)
       {
-       if (!cupsdFindJob(job_ids->values[i].integer))
+       if ((job = cupsdFindJob(job_ids->values[i].integer)) == NULL)
          break;
+
+        if (con->request->request.op.operation_id == IPP_CANCEL_MY_JOBS &&
+            _cups_strcasecmp(job->username, username))
+          break;
       }
 
       if (i < job_ids->num_values)
@@ -3343,6 +3347,10 @@ cancel_all_jobs(cupsd_client_t  *con,    /* I - Client connection */
        if ((job = cupsdFindJob(job_ids->values[i].integer)) == NULL ||
            _cups_strcasecmp(job->dest, printer->name))
          break;
+
+        if (con->request->request.op.operation_id == IPP_CANCEL_MY_JOBS &&
+            _cups_strcasecmp(job->username, username))
+          break;
       }
 
       if (i < job_ids->num_values)
index 9307e19433347c23181769bcf2ae830515d9fdd4..b4f7b56dc5f5083c6a3519f50d67defba14025b9 100644 (file)
@@ -3,7 +3,7 @@
  *
  *   "cancel" command for CUPS.
  *
- *   Copyright 2007-2011 by Apple Inc.
+ *   Copyright 2007-2013 by Apple Inc.
  *   Copyright 1997-2006 by Easy Software Products.
  *
  *   These coded instructions, statements, and computer programs are the
@@ -101,8 +101,7 @@ main(int  argc,                             /* I - Number of command-line arguments */
            break;
 
         case 'a' : /* Cancel all jobs */
-           purge = 1;
-           op    = IPP_PURGE_JOBS;
+           op = IPP_CANCEL_JOBS;
            break;
 
         case 'h' : /* Connect to host */
@@ -151,6 +150,10 @@ main(int  argc,                            /* I - Number of command-line arguments */
            }
            break;
 
+        case 'x' : /* Purge job(s) */
+           purge = 1;
+           break;
+
        default :
            _cupsLangPrintf(stderr,
                            _("%s: Error - unknown option \"%c\"."),
@@ -271,19 +274,22 @@ main(int  argc,                           /* I - Number of command-line arguments */
        ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
                      "requesting-user-name", NULL, user);
        ippAddBoolean(request, IPP_TAG_OPERATION, "my-jobs", 1);
+
+        if (op == IPP_CANCEL_JOBS)
+          op = IPP_CANCEL_MY_JOBS;
       }
       else
        ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
                      "requesting-user-name", NULL, cupsUser());
 
-      if (op == IPP_PURGE_JOBS)
+      if (purge)
        ippAddBoolean(request, IPP_TAG_OPERATION, "purge-jobs", purge);
 
      /*
       * Do the request and get back a response...
       */
 
-      if (op == IPP_PURGE_JOBS && (!user || _cups_strcasecmp(user, cupsUser())))
+      if (op == IPP_CANCEL_JOBS && (!user || _cups_strcasecmp(user, cupsUser())))
         response = cupsDoRequest(http, request, "/admin/");
       else
         response = cupsDoRequest(http, request, "/jobs/");