sysv-functions.c revision 355b4669e025ff377602b6fc7caaf30dbc218371
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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) 1998-2001 by Sun Microsystems, Inc.
* All rights reserved.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <stdarg.h>
#include <unistd.h>
#include <errno.h>
#include <unistd.h>
#include <syslog.h>
#ifndef SUNOS_4
#include <libintl.h>
#endif
#include "parse.h"
#include "sysv-functions.h"
extern char *getenv(const char *);
#define ALL "all"
static int
{
char *u1,
*h1;
return (0);
return (0);
return (-1);
u1++;
return (0);
}
return (0);
}
return (-1);
}
static int
{
return (-1);
return (0);
return (-1);
}
static char *
{
char *q = NULL,
*p = NULL,
*server,
*printer;
int nd,
rc,
count = 0,
q_size = 0,
p_left = 0;
char err[128];
gettext("server %s not responding\n\n"),
server);
}
if (rc < 0)
do {
p += count;
char *t;
#ifdef SUNOS_4
if (q == NULL) {
} else {
strcpy(t, q);
free(q);
p = t + (p - q);
q = t;
}
#else
p = t + (p - q);
q = t;
}
#endif
}
return (q);
}
{
char *buf;
return (qp);
if (local == 0)
else
_queue_list, (void *)qp);
}
return (qp);
}
/*
* SYSV (lpstat) specific routines
*/
static int
{
return (0);
}
void
{
char id[128],
user[128],
size = 0;
return;
return;
if (*rank >= 0)
if (verbose == 0) {
if (*rank == 1)
(void) printf("\n");
} else
(void) printf("\n\t%s %s\n",
}
#ifdef OLD_LPSTAT
static int
local_printer(char *name)
{
char buf[128];
}
static int
local_class(char *name)
{
char buf[128];
}
int
int description, char *invalid)
{
/*
* Need the fflush to preserve output order when
* output re-directed to a file. Close of old lpstat
* flushes buffers causing old lpstat output to preceed
* all other output to the file.
*/
return (WEXITSTATUS(stat));
} else {
if (stat == -1)
return (errno);
else
return (ENOMSG);
}
} else
return (0);
}
#endif
int
{
#ifdef OLD_LPSTAT
/* see sysv_local_status for reason for fflush */
return (WEXITSTATUS(stat));
} else {
if (stat == -1)
return (errno);
else
return (ENOMSG);
}
}
#endif
case IDLE:
break;
case PRINTING:
break;
case FAULTED:
break;
case RAW:
break;
default:
}
if (description != 0) {
char *desc;
!= NULL) &&
else
}
if (verbose != 0)
(void) printf(
gettext("\tRemote Name: %s\n\tRemote Server: %s\n"),
return (0);
}
int
{
#ifdef OLD_LPSTAT
int result = 0;
/*
* Locally attached printer, so display its accept state using
* the old lpstat utility.
*/
return (result);
}
#endif
else
return (0);
}
#ifdef OLD_LPSTAT
/*
* FUNCTION: sysv_displayLocalLPSTAT()
*
* utility to display the accepting state (-a option) for locally
* attached printers.
* If an alias name is given then the output from lpstat is
* captured and modified to show the alias name instead of the
* printer's real name. Note: this is done because the old lpstat
* can not handle alias names.
*
* PARAMETERS:
* Input: char *pname - printers real name
* char *aname - printers alias name
*
* RETURNS: 0 = completed okay, otherwise error
*
*/
static int
{
/* see sysv_local_status for reason for fflush */
{
/*
* This is a request to display status of an aliased local
* printer, so capture the output from the local lpstat for the
* real printer and then display that output with the alias
* name instead of the real name.
*/
OLD_LPSTAT, pname);
/* execute the local lpstat utility and display output */
{
{
result = 0;
{
}
/*
* finish reading and displaying the
* output from the lpstat utility
*/
{
}
}
}
}
else
{
/*
* Not an alias so directly display output from the
* local lpstat utility
*/
OLD_LPSTAT, pname);
{
}
else
if (result == -1)
{
}
else
{
}
}
return (result);
} /* sysv_displayLocalLPSTAT */
#endif
int
{
char *host;
char *printer;
else
#ifdef OLD_LPSTAT
/* see sysv_local_status for reason for fflush */
return (WEXITSTATUS(stat));
} else {
if (stat == -1)
return (errno);
else
return (ENOMSG);
}
} else
#endif
host);
else
(void) printf(
gettext("system for %s: %s (as printer %s)\n"),
}
return (0);
}
void
{
int lock;
if (lock < 0)
else
}
void
{
char *printer;
ns_printer_t *p;
/*
* Fall back to the printer name out of
* the "bsdaddr" attribute
*/
ns_bsd_addr_t *a =
static char buf[64];
a->printer);
}
}
}
}
printer);
else
}