355b4669e025ff377602b6fc7caaf30dbc218371jacobs/*
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * CDDL HEADER START
355b4669e025ff377602b6fc7caaf30dbc218371jacobs *
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * The contents of this file are subject to the terms of the
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * Common Development and Distribution License (the "License").
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * You may not use this file except in compliance with the License.
355b4669e025ff377602b6fc7caaf30dbc218371jacobs *
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * or http://www.opensolaris.org/os/licensing.
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * See the License for the specific language governing permissions
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * and limitations under the License.
355b4669e025ff377602b6fc7caaf30dbc218371jacobs *
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * When distributing Covered Code, include this CDDL HEADER in each
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * If applicable, add the following below this CDDL HEADER, with the
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * fields enclosed by brackets "[]" replaced with your own identifying
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * information: Portions Copyright [yyyy] [name of copyright owner]
355b4669e025ff377602b6fc7caaf30dbc218371jacobs *
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * CDDL HEADER END
355b4669e025ff377602b6fc7caaf30dbc218371jacobs */
355b4669e025ff377602b6fc7caaf30dbc218371jacobs
355b4669e025ff377602b6fc7caaf30dbc218371jacobs/*
b6c573b6170aa329dfd387cc19f32a7919c4ff4csonam gupta - Sun Microsystems - Bangalore India * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
355b4669e025ff377602b6fc7caaf30dbc218371jacobs *
355b4669e025ff377602b6fc7caaf30dbc218371jacobs */
355b4669e025ff377602b6fc7caaf30dbc218371jacobs
355b4669e025ff377602b6fc7caaf30dbc218371jacobs/* $Id: cancel.c 147 2006-04-25 16:51:06Z njacobs $ */
355b4669e025ff377602b6fc7caaf30dbc218371jacobs
355b4669e025ff377602b6fc7caaf30dbc218371jacobs
355b4669e025ff377602b6fc7caaf30dbc218371jacobs#include <stdio.h>
355b4669e025ff377602b6fc7caaf30dbc218371jacobs#include <stdlib.h>
355b4669e025ff377602b6fc7caaf30dbc218371jacobs#include <unistd.h>
355b4669e025ff377602b6fc7caaf30dbc218371jacobs#include <string.h>
355b4669e025ff377602b6fc7caaf30dbc218371jacobs#include <locale.h>
355b4669e025ff377602b6fc7caaf30dbc218371jacobs#include <libintl.h>
355b4669e025ff377602b6fc7caaf30dbc218371jacobs#include <papi.h>
355b4669e025ff377602b6fc7caaf30dbc218371jacobs#include "common.h"
355b4669e025ff377602b6fc7caaf30dbc218371jacobs
355b4669e025ff377602b6fc7caaf30dbc218371jacobsstatic void
355b4669e025ff377602b6fc7caaf30dbc218371jacobsusage(char *program)
355b4669e025ff377602b6fc7caaf30dbc218371jacobs{
355b4669e025ff377602b6fc7caaf30dbc218371jacobs char *name;
355b4669e025ff377602b6fc7caaf30dbc218371jacobs
355b4669e025ff377602b6fc7caaf30dbc218371jacobs if ((name = strrchr(program, '/')) == NULL)
355b4669e025ff377602b6fc7caaf30dbc218371jacobs name = program;
355b4669e025ff377602b6fc7caaf30dbc218371jacobs else
355b4669e025ff377602b6fc7caaf30dbc218371jacobs name++;
355b4669e025ff377602b6fc7caaf30dbc218371jacobs
355b4669e025ff377602b6fc7caaf30dbc218371jacobs fprintf(stdout, "Usage: %s [-u user] (printer|request-id ...)\n", name);
355b4669e025ff377602b6fc7caaf30dbc218371jacobs exit(1);
355b4669e025ff377602b6fc7caaf30dbc218371jacobs}
355b4669e025ff377602b6fc7caaf30dbc218371jacobs
f0b87b902adb4cdfe4ad24ea596a7311ddbb2953sonam gupta - Sun Microsystems - Bangalore Indiastatic int32_t
f0b87b902adb4cdfe4ad24ea596a7311ddbb2953sonam gupta - Sun Microsystems - Bangalore Indiaget_job_id_requested(papi_job_t job) {
f0b87b902adb4cdfe4ad24ea596a7311ddbb2953sonam gupta - Sun Microsystems - Bangalore India int32_t rid = -1;
f0b87b902adb4cdfe4ad24ea596a7311ddbb2953sonam gupta - Sun Microsystems - Bangalore India
f0b87b902adb4cdfe4ad24ea596a7311ddbb2953sonam gupta - Sun Microsystems - Bangalore India papi_attribute_t **list = papiJobGetAttributeList(job);
f0b87b902adb4cdfe4ad24ea596a7311ddbb2953sonam gupta - Sun Microsystems - Bangalore India papiAttributeListGetInteger(list, NULL,
f0b87b902adb4cdfe4ad24ea596a7311ddbb2953sonam gupta - Sun Microsystems - Bangalore India "job-id-requested", &rid);
f0b87b902adb4cdfe4ad24ea596a7311ddbb2953sonam gupta - Sun Microsystems - Bangalore India
f0b87b902adb4cdfe4ad24ea596a7311ddbb2953sonam gupta - Sun Microsystems - Bangalore India return (rid);
f0b87b902adb4cdfe4ad24ea596a7311ddbb2953sonam gupta - Sun Microsystems - Bangalore India}
f0b87b902adb4cdfe4ad24ea596a7311ddbb2953sonam gupta - Sun Microsystems - Bangalore India
d6083ba53b4a1af428be83ca08578cf93a9038c5jcint
d6083ba53b4a1af428be83ca08578cf93a9038c5jccancel_jobs_for_user(char *user, papi_encryption_t encryption, char *pname) {
d6083ba53b4a1af428be83ca08578cf93a9038c5jc
d6083ba53b4a1af428be83ca08578cf93a9038c5jc papi_status_t status;
d6083ba53b4a1af428be83ca08578cf93a9038c5jc papi_service_t svc = NULL;
d6083ba53b4a1af428be83ca08578cf93a9038c5jc char **printers = NULL;
d6083ba53b4a1af428be83ca08578cf93a9038c5jc int i, exit_code;
d6083ba53b4a1af428be83ca08578cf93a9038c5jc
d6083ba53b4a1af428be83ca08578cf93a9038c5jc if (pname == NULL) {
6b5764c36d253d178caa447fa2a6d7e0c7dfd6e6sonam gupta - Sun Microsystems - Bangalore India status = papiServiceCreate(&svc, NULL, NULL, NULL,
d6083ba53b4a1af428be83ca08578cf93a9038c5jc cli_auth_callback, encryption, NULL);
d6083ba53b4a1af428be83ca08578cf93a9038c5jc printers = interest_list(svc);
d6083ba53b4a1af428be83ca08578cf93a9038c5jc papiServiceDestroy(svc);
d6083ba53b4a1af428be83ca08578cf93a9038c5jc } else {
d6083ba53b4a1af428be83ca08578cf93a9038c5jc list_append(&printers, strdup(pname));
d6083ba53b4a1af428be83ca08578cf93a9038c5jc }
d6083ba53b4a1af428be83ca08578cf93a9038c5jc
d6083ba53b4a1af428be83ca08578cf93a9038c5jc if (printers == NULL)
d6083ba53b4a1af428be83ca08578cf93a9038c5jc exit(0);
d6083ba53b4a1af428be83ca08578cf93a9038c5jc
d6083ba53b4a1af428be83ca08578cf93a9038c5jc for (i = 0; printers[i] != NULL; i++) {
d6083ba53b4a1af428be83ca08578cf93a9038c5jc char *printer = printers[i];
d6083ba53b4a1af428be83ca08578cf93a9038c5jc
6b5764c36d253d178caa447fa2a6d7e0c7dfd6e6sonam gupta - Sun Microsystems - Bangalore India status = papiServiceCreate(&svc, printer, NULL, NULL,
d6083ba53b4a1af428be83ca08578cf93a9038c5jc cli_auth_callback, encryption, NULL);
d6083ba53b4a1af428be83ca08578cf93a9038c5jc
d6083ba53b4a1af428be83ca08578cf93a9038c5jc if (status != PAPI_OK) {
d6083ba53b4a1af428be83ca08578cf93a9038c5jc fprintf(stderr, gettext(
d6083ba53b4a1af428be83ca08578cf93a9038c5jc "Failed to contact service for %s: %s\n"),
d6083ba53b4a1af428be83ca08578cf93a9038c5jc printer, verbose_papi_message(svc, status));
d6083ba53b4a1af428be83ca08578cf93a9038c5jc exit(1);
d6083ba53b4a1af428be83ca08578cf93a9038c5jc }
d6083ba53b4a1af428be83ca08578cf93a9038c5jc exit_code = berkeley_cancel_request(svc, stdout, printer, 1,
d6083ba53b4a1af428be83ca08578cf93a9038c5jc &user);
d6083ba53b4a1af428be83ca08578cf93a9038c5jc
d6083ba53b4a1af428be83ca08578cf93a9038c5jc papiServiceDestroy(svc);
d6083ba53b4a1af428be83ca08578cf93a9038c5jc if (exit_code != 0)
d6083ba53b4a1af428be83ca08578cf93a9038c5jc break;
d6083ba53b4a1af428be83ca08578cf93a9038c5jc }
d6083ba53b4a1af428be83ca08578cf93a9038c5jc free(printers);
d6083ba53b4a1af428be83ca08578cf93a9038c5jc return (exit_code);
d6083ba53b4a1af428be83ca08578cf93a9038c5jc}
d6083ba53b4a1af428be83ca08578cf93a9038c5jc
355b4669e025ff377602b6fc7caaf30dbc218371jacobsint
355b4669e025ff377602b6fc7caaf30dbc218371jacobsmain(int ac, char *av[])
355b4669e025ff377602b6fc7caaf30dbc218371jacobs{
355b4669e025ff377602b6fc7caaf30dbc218371jacobs int exit_code = 0;
355b4669e025ff377602b6fc7caaf30dbc218371jacobs char *user = NULL;
355b4669e025ff377602b6fc7caaf30dbc218371jacobs papi_encryption_t encryption = PAPI_ENCRYPT_NEVER;
355b4669e025ff377602b6fc7caaf30dbc218371jacobs int c;
dcf1b443e6f262cefb7e8babd3bac5fa2736b100sonam gupta - Sun Microsystems - Bangalore India int32_t rid = -1;
2cb53ad67f463fb038a7c555bb0611fb6a8acec7Keerthi Kondaka int first_dest = 0;
2cb53ad67f463fb038a7c555bb0611fb6a8acec7Keerthi Kondaka
355b4669e025ff377602b6fc7caaf30dbc218371jacobs
355b4669e025ff377602b6fc7caaf30dbc218371jacobs (void) setlocale(LC_ALL, "");
355b4669e025ff377602b6fc7caaf30dbc218371jacobs (void) textdomain("SUNW_OST_OSCMD");
355b4669e025ff377602b6fc7caaf30dbc218371jacobs
d6083ba53b4a1af428be83ca08578cf93a9038c5jc if (ac == 1)
d6083ba53b4a1af428be83ca08578cf93a9038c5jc usage(av[0]);
d6083ba53b4a1af428be83ca08578cf93a9038c5jc
355b4669e025ff377602b6fc7caaf30dbc218371jacobs while ((c = getopt(ac, av, "Eu:")) != EOF)
355b4669e025ff377602b6fc7caaf30dbc218371jacobs switch (c) {
355b4669e025ff377602b6fc7caaf30dbc218371jacobs case 'E':
355b4669e025ff377602b6fc7caaf30dbc218371jacobs encryption = PAPI_ENCRYPT_REQUIRED;
355b4669e025ff377602b6fc7caaf30dbc218371jacobs break;
355b4669e025ff377602b6fc7caaf30dbc218371jacobs case 'u':
355b4669e025ff377602b6fc7caaf30dbc218371jacobs user = optarg;
355b4669e025ff377602b6fc7caaf30dbc218371jacobs break;
355b4669e025ff377602b6fc7caaf30dbc218371jacobs default:
355b4669e025ff377602b6fc7caaf30dbc218371jacobs usage(av[0]);
355b4669e025ff377602b6fc7caaf30dbc218371jacobs }
355b4669e025ff377602b6fc7caaf30dbc218371jacobs
355b4669e025ff377602b6fc7caaf30dbc218371jacobs for (c = optind; c < ac; c++) {
355b4669e025ff377602b6fc7caaf30dbc218371jacobs papi_status_t status;
355b4669e025ff377602b6fc7caaf30dbc218371jacobs papi_service_t svc = NULL;
355b4669e025ff377602b6fc7caaf30dbc218371jacobs papi_job_t *jobs = NULL;
355b4669e025ff377602b6fc7caaf30dbc218371jacobs char *printer = NULL;
355b4669e025ff377602b6fc7caaf30dbc218371jacobs int32_t id = -1;
355b4669e025ff377602b6fc7caaf30dbc218371jacobs
2cb53ad67f463fb038a7c555bb0611fb6a8acec7Keerthi Kondaka status = papiServiceCreate(&svc, av[c], NULL, NULL,
d6083ba53b4a1af428be83ca08578cf93a9038c5jc cli_auth_callback, encryption, NULL);
355b4669e025ff377602b6fc7caaf30dbc218371jacobs if (status != PAPI_OK) {
2cb53ad67f463fb038a7c555bb0611fb6a8acec7Keerthi Kondaka if (first_dest == 0) {
2cb53ad67f463fb038a7c555bb0611fb6a8acec7Keerthi Kondaka (void) get_printer_id(av[c], &printer, &id);
2cb53ad67f463fb038a7c555bb0611fb6a8acec7Keerthi Kondaka status = papiServiceCreate(&svc, printer, NULL,
2cb53ad67f463fb038a7c555bb0611fb6a8acec7Keerthi Kondaka NULL, cli_auth_callback, encryption, NULL);
2cb53ad67f463fb038a7c555bb0611fb6a8acec7Keerthi Kondaka }
2cb53ad67f463fb038a7c555bb0611fb6a8acec7Keerthi Kondaka if (status != PAPI_OK) {
b6c573b6170aa329dfd387cc19f32a7919c4ff4csonam gupta - Sun Microsystems - Bangalore India fprintf(stderr, gettext(
b6c573b6170aa329dfd387cc19f32a7919c4ff4csonam gupta - Sun Microsystems - Bangalore India "Failed to contact service for %s: %s\n"),
b6c573b6170aa329dfd387cc19f32a7919c4ff4csonam gupta - Sun Microsystems - Bangalore India printer,
2cb53ad67f463fb038a7c555bb0611fb6a8acec7Keerthi Kondaka verbose_papi_message(svc, status));
2cb53ad67f463fb038a7c555bb0611fb6a8acec7Keerthi Kondaka exit(1);
2cb53ad67f463fb038a7c555bb0611fb6a8acec7Keerthi Kondaka }
2cb53ad67f463fb038a7c555bb0611fb6a8acec7Keerthi Kondaka } else {
2cb53ad67f463fb038a7c555bb0611fb6a8acec7Keerthi Kondaka first_dest = 1;
2cb53ad67f463fb038a7c555bb0611fb6a8acec7Keerthi Kondaka printer = av[c];
355b4669e025ff377602b6fc7caaf30dbc218371jacobs }
355b4669e025ff377602b6fc7caaf30dbc218371jacobs
355b4669e025ff377602b6fc7caaf30dbc218371jacobs#define OUT ((status == PAPI_OK) ? stdout : stderr)
355b4669e025ff377602b6fc7caaf30dbc218371jacobs
355b4669e025ff377602b6fc7caaf30dbc218371jacobs if (id != -1) { /* it's a job */
b6c573b6170aa329dfd387cc19f32a7919c4ff4csonam gupta - Sun Microsystems - Bangalore India char *mesg = gettext("cancelled");
355b4669e025ff377602b6fc7caaf30dbc218371jacobs
f0b87b902adb4cdfe4ad24ea596a7311ddbb2953sonam gupta - Sun Microsystems - Bangalore India /*
f0b87b902adb4cdfe4ad24ea596a7311ddbb2953sonam gupta - Sun Microsystems - Bangalore India * Check if the job-id is job-id-requested
f0b87b902adb4cdfe4ad24ea596a7311ddbb2953sonam gupta - Sun Microsystems - Bangalore India * or job-id. If it is job-id-requested then find
f0b87b902adb4cdfe4ad24ea596a7311ddbb2953sonam gupta - Sun Microsystems - Bangalore India * corresponding job-id and send it to cancel
f0b87b902adb4cdfe4ad24ea596a7311ddbb2953sonam gupta - Sun Microsystems - Bangalore India */
f0b87b902adb4cdfe4ad24ea596a7311ddbb2953sonam gupta - Sun Microsystems - Bangalore India rid = job_to_be_queried(svc, printer, id);
06f61b77bc179f185bf19957b30740c246a13c0dsonam gupta - Sun Microsystems - Bangalore India if (rid < 0) {
06f61b77bc179f185bf19957b30740c246a13c0dsonam gupta - Sun Microsystems - Bangalore India /*
06f61b77bc179f185bf19957b30740c246a13c0dsonam gupta - Sun Microsystems - Bangalore India * Either it is a remote job which cannot be
06f61b77bc179f185bf19957b30740c246a13c0dsonam gupta - Sun Microsystems - Bangalore India * cancelled based on job-id or job-id is
06f61b77bc179f185bf19957b30740c246a13c0dsonam gupta - Sun Microsystems - Bangalore India * not found
06f61b77bc179f185bf19957b30740c246a13c0dsonam gupta - Sun Microsystems - Bangalore India */
355b4669e025ff377602b6fc7caaf30dbc218371jacobs exit_code = 1;
b6c573b6170aa329dfd387cc19f32a7919c4ff4csonam gupta - Sun Microsystems - Bangalore India fprintf(OUT, "%s-%d: %s\n",
b6c573b6170aa329dfd387cc19f32a7919c4ff4csonam gupta - Sun Microsystems - Bangalore India printer, id, gettext("not-found"));
06f61b77bc179f185bf19957b30740c246a13c0dsonam gupta - Sun Microsystems - Bangalore India } else {
06f61b77bc179f185bf19957b30740c246a13c0dsonam gupta - Sun Microsystems - Bangalore India status = papiJobCancel(svc, printer, rid);
06f61b77bc179f185bf19957b30740c246a13c0dsonam gupta - Sun Microsystems - Bangalore India if (status == PAPI_NOT_AUTHORIZED) {
06f61b77bc179f185bf19957b30740c246a13c0dsonam gupta - Sun Microsystems - Bangalore India mesg = papiStatusString(status);
06f61b77bc179f185bf19957b30740c246a13c0dsonam gupta - Sun Microsystems - Bangalore India exit_code = 1;
06f61b77bc179f185bf19957b30740c246a13c0dsonam gupta - Sun Microsystems - Bangalore India } else if (status != PAPI_OK) {
b6c573b6170aa329dfd387cc19f32a7919c4ff4csonam gupta - Sun Microsystems - Bangalore India mesg = gettext(
b6c573b6170aa329dfd387cc19f32a7919c4ff4csonam gupta - Sun Microsystems - Bangalore India verbose_papi_message(
b6c573b6170aa329dfd387cc19f32a7919c4ff4csonam gupta - Sun Microsystems - Bangalore India svc, status));
06f61b77bc179f185bf19957b30740c246a13c0dsonam gupta - Sun Microsystems - Bangalore India exit_code = 1;
06f61b77bc179f185bf19957b30740c246a13c0dsonam gupta - Sun Microsystems - Bangalore India }
06f61b77bc179f185bf19957b30740c246a13c0dsonam gupta - Sun Microsystems - Bangalore India fprintf(OUT, "%s-%d: %s\n", printer, id, mesg);
355b4669e025ff377602b6fc7caaf30dbc218371jacobs }
d6083ba53b4a1af428be83ca08578cf93a9038c5jc
355b4669e025ff377602b6fc7caaf30dbc218371jacobs } else { /* it's a printer */
d6083ba53b4a1af428be83ca08578cf93a9038c5jc if (user == NULL) {
355b4669e025ff377602b6fc7caaf30dbc218371jacobs
d6083ba53b4a1af428be83ca08578cf93a9038c5jc /* Remove first job from printer */
355b4669e025ff377602b6fc7caaf30dbc218371jacobs
d6083ba53b4a1af428be83ca08578cf93a9038c5jc status = papiPrinterListJobs(svc, printer,
d6083ba53b4a1af428be83ca08578cf93a9038c5jc NULL, NULL, 0, &jobs);
d6083ba53b4a1af428be83ca08578cf93a9038c5jc
d6083ba53b4a1af428be83ca08578cf93a9038c5jc if (status != PAPI_OK) {
d6083ba53b4a1af428be83ca08578cf93a9038c5jc fprintf(stderr, gettext(
d6083ba53b4a1af428be83ca08578cf93a9038c5jc "ListJobs %s: %s\n"), printer,
d6083ba53b4a1af428be83ca08578cf93a9038c5jc verbose_papi_message(svc, status));
d6083ba53b4a1af428be83ca08578cf93a9038c5jc exit_code = 1;
d6083ba53b4a1af428be83ca08578cf93a9038c5jc }
d6083ba53b4a1af428be83ca08578cf93a9038c5jc
d6083ba53b4a1af428be83ca08578cf93a9038c5jc if (jobs != NULL && *jobs != NULL) {
b6c573b6170aa329dfd387cc19f32a7919c4ff4csonam gupta - Sun Microsystems - Bangalore India char *mesg = gettext("cancelled");
d03e4ae852e122903f8876fb2ba7df676722d799Jonathan Cowper-Andrewes id = papiJobGetId(*jobs);
d03e4ae852e122903f8876fb2ba7df676722d799Jonathan Cowper-Andrewes
d03e4ae852e122903f8876fb2ba7df676722d799Jonathan Cowper-Andrewes status = papiJobCancel(svc,
d03e4ae852e122903f8876fb2ba7df676722d799Jonathan Cowper-Andrewes printer, id);
d03e4ae852e122903f8876fb2ba7df676722d799Jonathan Cowper-Andrewes
d03e4ae852e122903f8876fb2ba7df676722d799Jonathan Cowper-Andrewes if (status == PAPI_NOT_AUTHORIZED) {
d03e4ae852e122903f8876fb2ba7df676722d799Jonathan Cowper-Andrewes mesg = papiStatusString(status);
d03e4ae852e122903f8876fb2ba7df676722d799Jonathan Cowper-Andrewes exit_code = 1;
d03e4ae852e122903f8876fb2ba7df676722d799Jonathan Cowper-Andrewes } else if (status != PAPI_OK) {
b6c573b6170aa329dfd387cc19f32a7919c4ff4csonam gupta - Sun Microsystems - Bangalore India mesg = gettext(
b6c573b6170aa329dfd387cc19f32a7919c4ff4csonam gupta - Sun Microsystems - Bangalore India verbose_papi_message(
b6c573b6170aa329dfd387cc19f32a7919c4ff4csonam gupta - Sun Microsystems - Bangalore India svc, status));
d03e4ae852e122903f8876fb2ba7df676722d799Jonathan Cowper-Andrewes exit_code = 1;
d03e4ae852e122903f8876fb2ba7df676722d799Jonathan Cowper-Andrewes }
f0b87b902adb4cdfe4ad24ea596a7311ddbb2953sonam gupta - Sun Microsystems - Bangalore India /*
f0b87b902adb4cdfe4ad24ea596a7311ddbb2953sonam gupta - Sun Microsystems - Bangalore India * If job-id-requested exists for this
f0b87b902adb4cdfe4ad24ea596a7311ddbb2953sonam gupta - Sun Microsystems - Bangalore India * job-id then that should be displayed
f0b87b902adb4cdfe4ad24ea596a7311ddbb2953sonam gupta - Sun Microsystems - Bangalore India */
f0b87b902adb4cdfe4ad24ea596a7311ddbb2953sonam gupta - Sun Microsystems - Bangalore India rid = get_job_id_requested(*jobs);
dcf1b443e6f262cefb7e8babd3bac5fa2736b100sonam gupta - Sun Microsystems - Bangalore India if (rid >= 0)
f0b87b902adb4cdfe4ad24ea596a7311ddbb2953sonam gupta - Sun Microsystems - Bangalore India fprintf(OUT, "%s-%d: %s\n",
f0b87b902adb4cdfe4ad24ea596a7311ddbb2953sonam gupta - Sun Microsystems - Bangalore India printer, rid, mesg);
f0b87b902adb4cdfe4ad24ea596a7311ddbb2953sonam gupta - Sun Microsystems - Bangalore India else
f0b87b902adb4cdfe4ad24ea596a7311ddbb2953sonam gupta - Sun Microsystems - Bangalore India fprintf(OUT, "%s-%d: %s\n",
f0b87b902adb4cdfe4ad24ea596a7311ddbb2953sonam gupta - Sun Microsystems - Bangalore India printer, id, mesg);
d6083ba53b4a1af428be83ca08578cf93a9038c5jc }
d6083ba53b4a1af428be83ca08578cf93a9038c5jc papiJobListFree(jobs);
d6083ba53b4a1af428be83ca08578cf93a9038c5jc
d6083ba53b4a1af428be83ca08578cf93a9038c5jc } else {
d6083ba53b4a1af428be83ca08578cf93a9038c5jc /* Purging user's print jobs */
d6083ba53b4a1af428be83ca08578cf93a9038c5jc exit_code = cancel_jobs_for_user(user,
d6083ba53b4a1af428be83ca08578cf93a9038c5jc encryption, printer);
d6083ba53b4a1af428be83ca08578cf93a9038c5jc }
d6083ba53b4a1af428be83ca08578cf93a9038c5jc }
355b4669e025ff377602b6fc7caaf30dbc218371jacobs papiServiceDestroy(svc);
355b4669e025ff377602b6fc7caaf30dbc218371jacobs }
355b4669e025ff377602b6fc7caaf30dbc218371jacobs
d6083ba53b4a1af428be83ca08578cf93a9038c5jc if (optind == ac)
d6083ba53b4a1af428be83ca08578cf93a9038c5jc exit_code = cancel_jobs_for_user(user, encryption, NULL);
d6083ba53b4a1af428be83ca08578cf93a9038c5jc
355b4669e025ff377602b6fc7caaf30dbc218371jacobs return (exit_code);
355b4669e025ff377602b6fc7caaf30dbc218371jacobs}