17c478bd9Sstevel@tonic-gate/* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 57c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 67c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 77c478bd9Sstevel@tonic-gate * with the License. 87c478bd9Sstevel@tonic-gate * 97c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 107c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 117c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 127c478bd9Sstevel@tonic-gate * and limitations under the License. 137c478bd9Sstevel@tonic-gate * 147c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 157c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 167c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 177c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 187c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 197c478bd9Sstevel@tonic-gate * 207c478bd9Sstevel@tonic-gate * CDDL HEADER END 217c478bd9Sstevel@tonic-gate */ 227c478bd9Sstevel@tonic-gate/* LINTLIBRARY */ 237c478bd9Sstevel@tonic-gate/* PROTOLIB1 */ 247c478bd9Sstevel@tonic-gate 257c478bd9Sstevel@tonic-gate/* 26*ace1a5f1Sdp * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 27*ace1a5f1Sdp * Use is subject to license terms. 287c478bd9Sstevel@tonic-gate */ 297c478bd9Sstevel@tonic-gate 307c478bd9Sstevel@tonic-gate/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 317c478bd9Sstevel@tonic-gate/* All Rights Reserved */ 327c478bd9Sstevel@tonic-gate 337c478bd9Sstevel@tonic-gate#pragma ident "%Z%%M% %I% %E% SMI" 347c478bd9Sstevel@tonic-gate 357c478bd9Sstevel@tonic-gate#include "errno.h" 367c478bd9Sstevel@tonic-gate#include "fcntl.h" 377c478bd9Sstevel@tonic-gate#include "sys/types.h" 387c478bd9Sstevel@tonic-gate#include "sys/stat.h" 397c478bd9Sstevel@tonic-gate#include "stdio.h" 407c478bd9Sstevel@tonic-gate#include "dirent.h" 417c478bd9Sstevel@tonic-gate 427c478bd9Sstevel@tonic-gatetypedef struct SCALED { 437c478bd9Sstevel@tonic-gate float val; /* value of number, scaled according to "sc" */ 447c478bd9Sstevel@tonic-gate char sc; /* 'i' inches, 'c' centimeters, ' ' lines/cols */ 457c478bd9Sstevel@tonic-gate} SCALED; 467c478bd9Sstevel@tonic-gate 477c478bd9Sstevel@tonic-gatetypedef struct FALERT { 487c478bd9Sstevel@tonic-gate char * shcmd; /* shell command used to perform the alert */ 497c478bd9Sstevel@tonic-gate int Q; /* # requests queued to activate alert */ 507c478bd9Sstevel@tonic-gate int W; /* alert is sent every "W" minutes */ 517c478bd9Sstevel@tonic-gate} FALERT; 527c478bd9Sstevel@tonic-gate 537c478bd9Sstevel@tonic-gateextern int open_locked(char *, char *, mode_t); 547c478bd9Sstevel@tonic-gateextern char *fdgets(char *, int, int); 557c478bd9Sstevel@tonic-gateextern int fdprintf(int, char *, ...); 567c478bd9Sstevel@tonic-gateextern int fdputs(char *, int); 577c478bd9Sstevel@tonic-gateextern int fdputc(char, int); 587c478bd9Sstevel@tonic-gate 597c478bd9Sstevel@tonic-gate 607c478bd9Sstevel@tonic-gateFILE *open_lpfile ( char * , char * , mode_t ); 617c478bd9Sstevel@tonic-gateint close_lpfile ( FILE * ); 627c478bd9Sstevel@tonic-gateint chown_lppath ( char * path ); 637c478bd9Sstevel@tonic-gateint mkdir_lpdir ( char * path , int mode ); 647c478bd9Sstevel@tonic-gateint rmfile ( char * path ); 657c478bd9Sstevel@tonic-gateint dumpstring ( char * path , char * str ); 667c478bd9Sstevel@tonic-gate 677c478bd9Sstevel@tonic-gatechar * loadstring ( char * path ); 687c478bd9Sstevel@tonic-gatechar * loadline ( char * path ); 697c478bd9Sstevel@tonic-gatechar * sop_up_rest (int, char * endsop ); 707c478bd9Sstevel@tonic-gate 717c478bd9Sstevel@tonic-gateint addlist ( char *** , char * ); 727c478bd9Sstevel@tonic-gateint addstring ( char ** , char * ); 737c478bd9Sstevel@tonic-gateint appendlist ( char *** , char * ); 747c478bd9Sstevel@tonic-gateint dellist ( char *** , char * ); 757c478bd9Sstevel@tonic-gateint joinlist ( char *** , char ** ); 767c478bd9Sstevel@tonic-gateint lenlist ( char ** ); 777c478bd9Sstevel@tonic-gateint printlist ( FILE * , char ** ); 787c478bd9Sstevel@tonic-gateint fdprintlist(int , char ** ); 797c478bd9Sstevel@tonic-gateint searchlist ( char *, char ** ); 807c478bd9Sstevel@tonic-gateint searchlist_with_terminfo ( char * , char ** ); 817c478bd9Sstevel@tonic-gate 827c478bd9Sstevel@tonic-gatechar ** duplist ( char ** ); 837c478bd9Sstevel@tonic-gatechar ** getlist ( char * , char * , char * ); 847c478bd9Sstevel@tonic-gatechar ** dashos ( char * ); 857c478bd9Sstevel@tonic-gatechar ** wherelist ( char * , char ** ); 867c478bd9Sstevel@tonic-gate 877c478bd9Sstevel@tonic-gatechar * sprintlist ( char ** ); 887c478bd9Sstevel@tonic-gatechar * search_cslist ( char * , char ** ); 897c478bd9Sstevel@tonic-gate 907c478bd9Sstevel@tonic-gatevoid freelist ( char ** ); 917c478bd9Sstevel@tonic-gatevoid printlist_setup ( char * , char * , char * , char * ); 927c478bd9Sstevel@tonic-gatevoid printlist_unsetup ( void ); 937c478bd9Sstevel@tonic-gate 947c478bd9Sstevel@tonic-gate 957c478bd9Sstevel@tonic-gatevoid printsdn ( FILE * , SCALED ); 967c478bd9Sstevel@tonic-gatevoid fdprintsdn ( int , SCALED ); 977c478bd9Sstevel@tonic-gatevoid printsdn_setup ( char * , char * , char * ); 987c478bd9Sstevel@tonic-gatevoid printsdn_unsetup ( void ); 997c478bd9Sstevel@tonic-gate 1007c478bd9Sstevel@tonic-gateSCALED _getsdn ( char * , char ** , int ); 1017c478bd9Sstevel@tonic-gate 1027c478bd9Sstevel@tonic-gatechar * makepath ( char * , ... ); 1037c478bd9Sstevel@tonic-gatechar * getspooldir ( void ); 1047c478bd9Sstevel@tonic-gatechar * getrequestfile ( char * ); 1057c478bd9Sstevel@tonic-gatechar * getprinterfile ( char * , char * ); 1067c478bd9Sstevel@tonic-gatechar * getsystemfile ( char * , char * ); 1077c478bd9Sstevel@tonic-gatechar * getclassfile ( char * ); 1087c478bd9Sstevel@tonic-gatechar * getfilterfile ( char * ); 1097c478bd9Sstevel@tonic-gatechar * getformfile ( char * , char * ); 1107c478bd9Sstevel@tonic-gate 1117c478bd9Sstevel@tonic-gateint cs_strcmp ( char * , char * ); 1127c478bd9Sstevel@tonic-gateint cs_strncmp ( char * , char * , int ); 1137c478bd9Sstevel@tonic-gate 1147c478bd9Sstevel@tonic-gateint syn_name ( char * ); 1157c478bd9Sstevel@tonic-gateint syn_text ( char * ); 1167c478bd9Sstevel@tonic-gateint syn_comment ( char * ); 1177c478bd9Sstevel@tonic-gateint syn_machine_name ( char * ); 1187c478bd9Sstevel@tonic-gateint syn_option ( char * ); 1197c478bd9Sstevel@tonic-gate 1207c478bd9Sstevel@tonic-gateint putalert ( char * , char * , FALERT * ); 1217c478bd9Sstevel@tonic-gateint delalert ( char * , char * ); 1227c478bd9Sstevel@tonic-gate 1237c478bd9Sstevel@tonic-gateFALERT * getalert ( char * , char * ); 1247c478bd9Sstevel@tonic-gate 1257c478bd9Sstevel@tonic-gatevoid printalert ( FILE * , FALERT * , int ); 1267c478bd9Sstevel@tonic-gate 1277c478bd9Sstevel@tonic-gateint tidbit ( char * , char * , ... ); 1287c478bd9Sstevel@tonic-gatevoid untidbit ( char * ); 1297c478bd9Sstevel@tonic-gate 1307c478bd9Sstevel@tonic-gateint _Access ( char * , int ); 1317c478bd9Sstevel@tonic-gateint _Chdir ( char * ); 1327c478bd9Sstevel@tonic-gateint _Chmod ( char * , int ); 1337c478bd9Sstevel@tonic-gateint _Chown ( char * , int , int ); 1347c478bd9Sstevel@tonic-gateint _Close ( int ); 1357c478bd9Sstevel@tonic-gateint _Creat ( char * , int ); 1367c478bd9Sstevel@tonic-gateint _Fcntl ( int , int , ... ); 1377c478bd9Sstevel@tonic-gateint _Fstat ( int , struct stat * ); 1387c478bd9Sstevel@tonic-gateint _Link ( char * , char * ); 1397c478bd9Sstevel@tonic-gateint _Lstat ( char * , struct stat * ); 1407c478bd9Sstevel@tonic-gateint _Mknod ( char * , int , int ); 1417c478bd9Sstevel@tonic-gateint _Mkpipe ( char * , int , int ); 1427c478bd9Sstevel@tonic-gateint _Open ( char * , int , ... /* mode_t */ ); 1437c478bd9Sstevel@tonic-gateint _Read ( int , char * , unsigned int ); 1447c478bd9Sstevel@tonic-gateint _Readlink ( char * , char * , unsigned int ); 1457c478bd9Sstevel@tonic-gateint _Rename ( char * , char * ); 1467c478bd9Sstevel@tonic-gateint _Symlink ( char * , char * ); 1477c478bd9Sstevel@tonic-gateint _Stat ( char * , struct stat * ); 1487c478bd9Sstevel@tonic-gateint _Unlink ( char * ); 1497c478bd9Sstevel@tonic-gateint _Wait ( int * ); 1507c478bd9Sstevel@tonic-gateint _Write ( int , char * , unsigned int ); 1517c478bd9Sstevel@tonic-gate 1527c478bd9Sstevel@tonic-gatevoid * _Malloc ( size_t , const char * , int ); 1537c478bd9Sstevel@tonic-gatevoid * _Realloc ( void * , size_t , const char * , int ); 1547c478bd9Sstevel@tonic-gatevoid * _Calloc ( size_t , size_t , const char * , int ); 1557c478bd9Sstevel@tonic-gatechar * _Strdup ( const char * , const char * , int ); 1567c478bd9Sstevel@tonic-gatevoid _Free ( void * , const char * , int ); 1577c478bd9Sstevel@tonic-gate 1587c478bd9Sstevel@tonic-gate 1597c478bd9Sstevel@tonic-gateint isterminfo ( char * ); 1607c478bd9Sstevel@tonic-gateint isprinter ( char * ); 1617c478bd9Sstevel@tonic-gateint isrequest ( char * ); 1627c478bd9Sstevel@tonic-gateint isnumber ( char * ); 1637c478bd9Sstevel@tonic-gate 1647c478bd9Sstevel@tonic-gatechar * getname ( void ); 1657c478bd9Sstevel@tonic-gatechar * makestr ( char * , ... ); 1667c478bd9Sstevel@tonic-gatechar * strip ( char * ); 1677c478bd9Sstevel@tonic-gate 1687c478bd9Sstevel@tonic-gatevoid sendmail ( char * , char * ); 1697c478bd9Sstevel@tonic-gate 1707c478bd9Sstevel@tonic-gatevoid (*lp_alloc_fail_handler)( void ); 1717c478bd9Sstevel@tonic-gate 1727c478bd9Sstevel@tonic-gatechar * next_x ( char * , long * , unsigned int ); 1737c478bd9Sstevel@tonic-gate 174