request.c revision 355b4669e025ff377602b6fc7caaf30dbc218371
/*
* 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 (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <locale.h>
#include "stdio.h"
#include "pwd.h"
#include "lp.h"
#include "strings.h"
#include "msgs.h"
#include "requests.h"
#define WHO_AM_I I_AM_LPSTAT
#include "oam.h"
#include "lpstat.h"
/*
* do_request()
*/
void
do_request(char **list)
{
while (*list) {
"", "", "", "", "");
(void) output (R_INQUIRE_REQUEST_RANK);
} else {
"", "", "", "", "");
(void) output (R_INQUIRE_REQUEST);
}
switch (output(R_INQUIRE_REQUEST_RANK)) {
case MNOINFO:
E_STAT_DONE, *list);
exit_rc = 1;
break;
}
} else {
switch (output(R_INQUIRE_REQUEST)) {
case MNOINFO:
E_STAT_DONE, *list);
exit_rc = 1;
break;
}
}
} else {
switch (output(R_INQUIRE_REQUEST_RANK)) {
case MNOINFO:
E_STAT_BADSTAT, *list);
exit_rc = 1;
}
break;
}
} else {
switch (output(R_INQUIRE_REQUEST)) {
case MNOINFO:
E_STAT_BADSTAT, *list);
exit_rc = 1;
}
break;
}
}
}
list++;
}
return;
}
/*
* do_user()
*/
void
{
while (*list) {
"", "", "", "", "");
(void) output (R_INQUIRE_REQUEST_RANK);
} else {
"", "", "", "", "");
(void) output (R_INQUIRE_REQUEST);
}
} else {
switch (output(R_INQUIRE_REQUEST_RANK)) {
case MNOINFO:
E_STAT_USER, *list);
break;
}
} else {
switch (output(R_INQUIRE_REQUEST)) {
case MNOINFO:
E_STAT_USER, *list);
break;
}
}
}
list++;
}
}
/*
* putoline()
*/
void
{
int showRank;
char date[SZ_DATE_BUFF];
else
/*
* This is the basic time format used in the output. It represents
* all times of the form "Dec 11 11:04" seen in the output.
*/
if (user_name)
char buf[512];
return;
}
return;
if (showRank)
(void) printf(
"%-*s %-*s %*ld %s%s",
LOGMAX-1,
size,
date);
/*
* Unless the -l option is given, we show the CURRENT
* status. Check the status bits in reverse order of
* chronology, i.e. go with the bit that would have been
* set last. Old bits don't get cleared by the Spooler.
* We only have space for 21 characters!
*/
if (state & RS_NOTIFYING)
else if (state & RS_CANCELLED)
else if (state & RS_PRINTED)
else if (state & RS_PRINTING)
else if (state & RS_ADMINHELD)
else if (state & RS_FILTERED)
else if (state & RS_FILTERING)
else if (state & RS_CHANGING)
register char *sep = "\n ";
/*
* Here we show all the interesting states the job
* has gone through. Left to right they are in
* chronological order.
*/
if (state & RS_PRINTING) {
} else if (state & RS_CANCELLED) {
} else if (state & RS_PRINTED) {
/*
* WATCH IT! We make the request ID unusable after
* the next line.
*/
} else {
(void)printf (
gettext("\n\tqueued remotely for %s"),
printer);
else
printer);
}
}
if (character_set && *character_set) {
}
}
if (state & RS_NOTIFYING) {
} else if (state & RS_CHANGING) {
} else if (state & RS_ADMINHELD) {
}
if (state & RS_FILTERED) {
} else if (state & RS_FILTERING) {
}
}
(void) printf("\n");
return;
}