view usr/src/cmd/lp/lib/lp/llib-llp @ 0:c9caec207d52 b86

Initial porting based on b86
author Koji Uno <koji.uno@sun.com>
date Tue, 02 Jun 2009 18:56:50 +0900
parents
children 1a15d5aaf794
line wrap: on
line source

/*
 * 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
 * or http://www.opensolaris.org/os/licensing.
 * 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
 */
/* LINTLIBRARY */
/* PROTOLIB1 */

/*
 * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
 * Use is subject to license terms.
 */

/*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
/*	  All Rights Reserved  	*/

#pragma ident	"@(#)llib-llp	1.5	05/09/30 SMI"

#include "errno.h"
#include "fcntl.h"
#include "sys/types.h"
#include "sys/stat.h"
#include "stdio.h"
#include "dirent.h"

typedef struct SCALED {
	float	val;	/* value of number, scaled according to "sc" */
	char	sc;	/* 'i' inches, 'c' centimeters, ' ' lines/cols */
}			SCALED;

typedef struct FALERT {
	char *	shcmd;	/* shell command used to perform the alert */
	int	Q;	/* # requests queued to activate alert */
	int	W;	/* alert is sent every "W" minutes */
} FALERT;

extern int	open_locked(char *, char *, mode_t);
extern char	*fdgets(char *, int, int);
extern int	fdprintf(int, char *, ...);
extern int	fdputs(char *, int);
extern int	fdputc(char, int);


FILE		*open_lpfile ( char * , char * , mode_t );
int		close_lpfile ( FILE * );
int		chown_lppath ( char * path );
int		mkdir_lpdir ( char * path , int mode );
int		rmfile ( char * path );
int		dumpstring ( char * path , char * str );

char *		loadstring ( char * path );
char *		loadline ( char * path );
char *		sop_up_rest (int, char * endsop );

int		addlist ( char *** , char * );
int		addstring ( char ** , char * );
int		appendlist ( char *** , char * );
int		dellist ( char *** , char * );
int		joinlist ( char *** , char ** );
int		lenlist ( char ** );
int		printlist ( FILE * , char ** );
int		fdprintlist(int , char ** );
int		searchlist ( char *, char ** );
int		searchlist_with_terminfo ( char * , char ** );

char **		duplist ( char ** );
char **		getlist ( char * , char * , char * );
char **		dashos ( char * );
char **		wherelist ( char * , char ** );

char *		sprintlist ( char ** );
char *		search_cslist ( char * , char ** );

void		freelist ( char ** );
void		printlist_setup ( char * , char * , char * , char * );
void		printlist_unsetup ( void );


void		printsdn ( FILE * , SCALED );
void		fdprintsdn ( int , SCALED );
void		printsdn_setup ( char * , char * , char * );
void		printsdn_unsetup ( void );

SCALED		_getsdn ( char * , char ** , int );

char *		makepath ( char * , ... );
char *		getspooldir ( void );
char *		getrequestfile ( char * );
char *		getprinterfile ( char * , char * );
char *		getsystemfile ( char * , char * );
char *		getclassfile ( char * );
char *		getfilterfile ( char * );
char *		getformfile ( char * , char * );

int		cs_strcmp ( char * , char * );
int		cs_strncmp ( char * , char * , int );

int		syn_name ( char * );
int		syn_text ( char * );
int		syn_comment ( char * );
int		syn_machine_name ( char * );
int		syn_option ( char * );

int		putalert ( char * , char * , FALERT * );
int		delalert ( char * , char * );

FALERT *	getalert ( char * , char * );

void		printalert ( FILE * , FALERT * , int );

int		tidbit ( char * , char * , ... );
void		untidbit ( char * );

int		_Access ( char * , int );
int		_Chdir ( char * );
int		_Chmod ( char * , int );
int		_Chown ( char * , int , int );
int		_Close ( int );
int		_Creat ( char * , int );
int		_Fcntl ( int , int , ... );
int		_Fstat ( int , struct stat * );
int		_Link ( char * , char * );
int		_Lstat ( char * , struct stat * );
int		_Mknod ( char * , int , int );
int		_Mkpipe ( char * , int , int );
int		_Open ( char * , int , ... /* mode_t */ );
int		_Read ( int , char * , unsigned int );
int		_Readlink ( char * , char * , unsigned int );
int		_Rename ( char * , char * );
int		_Symlink ( char * , char * );
int		_Stat ( char * , struct stat * );
int		_Unlink ( char * );
int		_Wait ( int * );
int		_Write ( int , char * , unsigned int );

void *		_Malloc ( size_t , const char * , int );
void *		_Realloc ( void * , size_t , const char * , int );
void *		_Calloc ( size_t , size_t , const char * , int );
char *		_Strdup ( const char * , const char * , int );
void		_Free ( void * , const char * , int );


int		isterminfo ( char * );
int		isprinter ( char * );
int		isrequest ( char * );
int		isnumber ( char * );

char *		getname ( void );
char *		makestr ( char * , ... );
char *		strip ( char * );

void		sendmail ( char * , char * );

void		(*lp_alloc_fail_handler)( void );

char *		next_x  ( char * , long * , unsigned int );