lpmove.c revision 3ac6dcfa0bf841831d4cfde190aa15173622957c
/*
* 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: lpmove.c 146 2006-03-24 00:26:54Z 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++;
gettext("Usage: %s [request-id] (destination)\n"
exit(1);
}
static int
{
int result = 0;
result = -1;
}
return (result);
}
int
{
int exit_code = 0;
char *destination = NULL;
int c;
(void) textdomain("SUNW_OST_OSCMD");
switch (c) {
case 'E':
break;
default:
}
"Failed to contact service for %s: %s\n"),
exit(1);
}
exit_code = 1;
} else { /* it's a printer */
char message[128];
int count = 0;
/*
* If the user is denied the permission
* to disable then return appropriate msg
*/
/*
* Check if user is denied
* the permission
*/
!= NULL) {
/*
* user is denied
* permission
*/
"UX:lpmove: ERROR:"\
" You aren't allowed"\
" to do that.\n\t"\
" TO FIX: You must"\
" be logged in as"\
" \"lp\" or \"root\".\n"));
exit_code = 1;
} else {
"Disable %s: %s\n"),
exit_code = 1;
}
} else {
"Disable %s: %s\n"),
exit_code = 1;
}
} else {
"destination %s is not accepting"\
" requests\n"), printer);
0, 0, &jobs);
" %s\n"),
exit_code = 1;
}
id, destination) < 0)
exit_code = 1;
else
count++;
}
"total of %d requests moved"\
" from %s to %s\n"),
}
}
}
return (exit_code);
}