cancel.c revision 2cb53ad67f463fb038a7c555bb0611fb6a8acec7
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
*/
/* $Id: cancel.c 147 2006-04-25 16:51:06Z njacobs $ */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <locale.h>
#include <libintl.h>
#include <papi.h>
#include "common.h"
static void
{
char *name;
else
name++;
exit(1);
}
static int32_t
"job-id-requested", &rid);
return (rid);
}
int
int i, exit_code;
} else {
}
exit(0);
"Failed to contact service for %s: %s\n"),
exit(1);
}
&user);
if (exit_code != 0)
break;
}
return (exit_code);
}
int
{
int exit_code = 0;
int c;
int first_dest = 0;
(void) textdomain("SUNW_OST_OSCMD");
if (ac == 1)
switch (c) {
case 'E':
break;
case 'u':
break;
default:
}
if (first_dest == 0) {
}
gettext("Failed to contact service for %s:"
" %s\n"), printer,
exit(1);
}
} else {
first_dest = 1;
}
char *mesg = "cancelled";
/*
* Check if the job-id is job-id-requested
* or job-id. If it is job-id-requested then find
* corresponding job-id and send it to cancel
*/
if (rid > 0)
else
if (status == PAPI_NOT_AUTHORIZED) {
exit_code = 1;
exit_code = 1;
}
} else { /* it's a printer */
/* Remove first job from printer */
"ListJobs %s: %s\n"), printer,
exit_code = 1;
}
char *mesg = "cancelled";
if (status == PAPI_NOT_AUTHORIZED) {
exit_code = 1;
exit_code = 1;
}
/*
* If job-id-requested exists for this
* job-id then that should be displayed
*/
if (rid > 0)
else
}
} else {
/* Purging user's print jobs */
}
}
}
return (exit_code);
}