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 545916cd2Sjpk * Common Development and Distribution License (the "License"). 645916cd2Sjpk * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 217c478bd9Sstevel@tonic-gate /* 2245916cd2Sjpk * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 237c478bd9Sstevel@tonic-gate * Use is subject to license terms. 247c478bd9Sstevel@tonic-gate */ 257c478bd9Sstevel@tonic-gate 267c478bd9Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 271d4c48c4SToomas Soome /* All Rights Reserved */ 287c478bd9Sstevel@tonic-gate 29ace1a5f1Sdp #ifndef _LP_LP_H 30ace1a5f1Sdp #define _LP_LP_H 317c478bd9Sstevel@tonic-gate 32ace1a5f1Sdp #ifdef __cplusplus 33ace1a5f1Sdp extern "C" { 34ace1a5f1Sdp #endif 357c478bd9Sstevel@tonic-gate 36ace1a5f1Sdp #include <errno.h> 37ace1a5f1Sdp #include <fcntl.h> 38ace1a5f1Sdp #include <sys/types.h> 39ace1a5f1Sdp #include <sys/stat.h> 40ace1a5f1Sdp #include <stdio.h> 41ace1a5f1Sdp #include <dirent.h> 427c478bd9Sstevel@tonic-gate 431d4c48c4SToomas Soome /* 441d4c48c4SToomas Soome * Types: 451d4c48c4SToomas Soome */ 467c478bd9Sstevel@tonic-gate 477c478bd9Sstevel@tonic-gate typedef struct SCALED { 487c478bd9Sstevel@tonic-gate float val; /* value of number, scaled according to "sc" */ 497c478bd9Sstevel@tonic-gate char sc; /* 'i' inches, 'c' centimeters, ' ' lines/cols */ 507c478bd9Sstevel@tonic-gate } SCALED; 517c478bd9Sstevel@tonic-gate 527c478bd9Sstevel@tonic-gate typedef struct FALERT { 531d4c48c4SToomas Soome char *shcmd; /* shell command used to perform the alert */ 547c478bd9Sstevel@tonic-gate int Q; /* # requests queued to activate alert */ 557c478bd9Sstevel@tonic-gate int W; /* alert is sent every "W" minutes */ 567c478bd9Sstevel@tonic-gate } FALERT; 577c478bd9Sstevel@tonic-gate 587c478bd9Sstevel@tonic-gate 597c478bd9Sstevel@tonic-gate #define LP_USE_PAPI_ATTR 1 /* use PAPI attributes for printing */ 607c478bd9Sstevel@tonic-gate /* TODO: is this best place for this ? */ 617c478bd9Sstevel@tonic-gate 621d4c48c4SToomas Soome /* 631d4c48c4SToomas Soome * Places: 641d4c48c4SToomas Soome */ 657c478bd9Sstevel@tonic-gate 667c478bd9Sstevel@tonic-gate /* 677c478bd9Sstevel@tonic-gate * These functions no longer exist. The defines take care 687c478bd9Sstevel@tonic-gate * of recompiling code that expects these and the null functions 697c478bd9Sstevel@tonic-gate * in getpaths.c take care of relinking objects that expect these. 707c478bd9Sstevel@tonic-gate */ 717c478bd9Sstevel@tonic-gate #define getpaths() 727c478bd9Sstevel@tonic-gate #define getadminpaths(x) 737c478bd9Sstevel@tonic-gate 741d4c48c4SToomas Soome #define LPDIR "/usr/lib/lp" 751d4c48c4SToomas Soome #define ETCDIR "/etc/lp" 761d4c48c4SToomas Soome #define SPOOLDIR "/var/spool/lp" 771d4c48c4SToomas Soome #define LOGDIR "/var/lp/logs" 787c478bd9Sstevel@tonic-gate 797c478bd9Sstevel@tonic-gate #define TERMINFO "/usr/share/lib/terminfo" 807c478bd9Sstevel@tonic-gate 817c478bd9Sstevel@tonic-gate #define LPUSER "lp" 821d4c48c4SToomas Soome #define ROOTUSER "root" 837c478bd9Sstevel@tonic-gate 841d4c48c4SToomas Soome #define BANG_S "!" 851d4c48c4SToomas Soome #define BANG_C '!' 867c478bd9Sstevel@tonic-gate 877c478bd9Sstevel@tonic-gate #define LOCAL_LPUSER BANG_S LPUSER 881d4c48c4SToomas Soome #define LOCAL_ROOTUSER BANG_S ROOTUSER 891d4c48c4SToomas Soome #define ALL_BANG_ALL NAME_ALL BANG_S NAME_ALL 907c478bd9Sstevel@tonic-gate 917c478bd9Sstevel@tonic-gate /* #define ADMINSDIR "admins" */ 927c478bd9Sstevel@tonic-gate /* # define CLASSESDIR "classes" */ 937c478bd9Sstevel@tonic-gate /* # define FORMSDIR "forms" */ 947c478bd9Sstevel@tonic-gate /* # define INTERFACESDIR "interfaces" */ 957c478bd9Sstevel@tonic-gate /* # define PRINTERSDIR "printers" */ 967c478bd9Sstevel@tonic-gate /* # define PRINTWHEELSDIR "pwheels" */ 977c478bd9Sstevel@tonic-gate /* #define BINDIR "bin" */ 987c478bd9Sstevel@tonic-gate /* #define LOGSDIR "logs" */ 997c478bd9Sstevel@tonic-gate /* #define MODELSDIR "model" */ 1007c478bd9Sstevel@tonic-gate /* #define NETWORKDIR "network" */ 1011d4c48c4SToomas Soome #define FIFOSDIR "fifos" 1027c478bd9Sstevel@tonic-gate /* # define PRIVFIFODIR "private" */ 1037c478bd9Sstevel@tonic-gate /* # define PUBFIFODIR "public" */ 1047c478bd9Sstevel@tonic-gate /* #define REQUESTSDIR "requests" */ 1057c478bd9Sstevel@tonic-gate /* #define SYSTEMDIR "system" */ 1067c478bd9Sstevel@tonic-gate /* #define TEMPDIR "temp" */ 1077c478bd9Sstevel@tonic-gate /* #define TMPDIR "tmp" */ 1087c478bd9Sstevel@tonic-gate 1097c478bd9Sstevel@tonic-gate /* #define SCHEDLOCK "SCHEDLOCK" */ 1107c478bd9Sstevel@tonic-gate /* #define FIFO "FIFO" */ 1117c478bd9Sstevel@tonic-gate 1127c478bd9Sstevel@tonic-gate #define FILTERTABLE "filter.table" 1137c478bd9Sstevel@tonic-gate #define FILTERTABLE_I "filter.table.i" 1147c478bd9Sstevel@tonic-gate 1157c478bd9Sstevel@tonic-gate /* #define DESCRIBEFILE "describe" */ 1167c478bd9Sstevel@tonic-gate /* #define ALIGNFILE "align_ptrn" */ 1171d4c48c4SToomas Soome #define COMMENTFILE "comment" 1181d4c48c4SToomas Soome #define ALLOWFILE "allow" 1191d4c48c4SToomas Soome #define DENYFILE "deny" 1201d4c48c4SToomas Soome #define ALERTSHFILE "alert.sh" 1211d4c48c4SToomas Soome #define ALERTVARSFILE "alert.vars" 1221d4c48c4SToomas Soome #define ALERTPROTOFILE "alert.proto" 1231d4c48c4SToomas Soome #define CONFIGFILE "configuration" 1241d4c48c4SToomas Soome #define FACCESSPREFIX "forms." 1251d4c48c4SToomas Soome #define PACCESSPREFIX "paper." 1261d4c48c4SToomas Soome #define UACCESSPREFIX "users." 1271d4c48c4SToomas Soome #define FALLOWFILE FACCESSPREFIX ALLOWFILE 1281d4c48c4SToomas Soome #define FDENYFILE FACCESSPREFIX DENYFILE 1291d4c48c4SToomas Soome #define UALLOWFILE UACCESSPREFIX ALLOWFILE 1301d4c48c4SToomas Soome #define UDENYFILE UACCESSPREFIX DENYFILE 1317c478bd9Sstevel@tonic-gate /* #define DEFAULTFILE "default" */ 1321d4c48c4SToomas Soome #define STATUSFILE "status" 1337c478bd9Sstevel@tonic-gate /* #define USERSFILE "users" */ 1347c478bd9Sstevel@tonic-gate /* #define NAMEFILE "name" */ 1357c478bd9Sstevel@tonic-gate /* #define XFERFILE "transfer" */ 1367c478bd9Sstevel@tonic-gate /* #define EXECFILE "execute" */ 1371d4c48c4SToomas Soome #define PSTATUSFILE "pstatus" 1381d4c48c4SToomas Soome #define CSTATUSFILE "cstatus" 1397c478bd9Sstevel@tonic-gate /* #define REQLOGFILE "requests" */ 1407c478bd9Sstevel@tonic-gate 1411d4c48c4SToomas Soome #define STANDARD "standard" 1427c478bd9Sstevel@tonic-gate /* #define SLOWFILTER "slow.filter" */ 1431d4c48c4SToomas Soome #define FAULTMESSAGEFILE "faultMessage" 1441d4c48c4SToomas Soome #define FORMMESSAGEFILE "formMessage" 1457c478bd9Sstevel@tonic-gate 1461d4c48c4SToomas Soome #define LPNET "/usr/lib/lp/lpNet" 1477c478bd9Sstevel@tonic-gate 1487c478bd9Sstevel@tonic-gate #ifdef LP_USE_PAPI_ATTR 1497c478bd9Sstevel@tonic-gate #define STANDARD_FOOMATIC "standard_foomatic" 1507c478bd9Sstevel@tonic-gate /* 1517c478bd9Sstevel@tonic-gate * The default model interface script to use if a printer is configured 1527c478bd9Sstevel@tonic-gate * with a PPD (PostScript Printer Definition) file. 1537c478bd9Sstevel@tonic-gate */ 1547c478bd9Sstevel@tonic-gate #define LP_PAPIATTRNAME "attributes" 1557c478bd9Sstevel@tonic-gate /* 1567c478bd9Sstevel@tonic-gate * Job attributes filename extension, 1577c478bd9Sstevel@tonic-gate * eg. /var/spool/lp/temp/123-attributes 1587c478bd9Sstevel@tonic-gate */ 1597c478bd9Sstevel@tonic-gate #endif 1607c478bd9Sstevel@tonic-gate 1611d4c48c4SToomas Soome /* 1621d4c48c4SToomas Soome * Names and phrases: 1631d4c48c4SToomas Soome */ 1647c478bd9Sstevel@tonic-gate 1657c478bd9Sstevel@tonic-gate /* 1667c478bd9Sstevel@tonic-gate * If you change these from macros to defined (char *) strings, 1677c478bd9Sstevel@tonic-gate * be aware that in several places the lengths of the strings 1687c478bd9Sstevel@tonic-gate * are computed using "sizeof()", not "strlen()"! 1697c478bd9Sstevel@tonic-gate */ 1707c478bd9Sstevel@tonic-gate #define NAME_ALL "all" 1717c478bd9Sstevel@tonic-gate #define NAME_ANY "any" 1721d4c48c4SToomas Soome #define NAME_NONE "none" 1737c478bd9Sstevel@tonic-gate #define NAME_TERMINFO "terminfo" 1747c478bd9Sstevel@tonic-gate #define NAME_SIMPLE "simple" 1751d4c48c4SToomas Soome #define NAME_HOLD "hold" 1767c478bd9Sstevel@tonic-gate #define NAME_RESUME "resume" 1771d4c48c4SToomas Soome #define NAME_IMMEDIATE "immediate" 1781d4c48c4SToomas Soome #define NAME_CONTINUE "continue" 1791d4c48c4SToomas Soome #define NAME_BEGINNING "beginning" 1801d4c48c4SToomas Soome #define NAME_WAIT "wait" 1811d4c48c4SToomas Soome #define NAME_MAIL "mail" 1827c478bd9Sstevel@tonic-gate #define NAME_WRITE "write" 1831d4c48c4SToomas Soome #define NAME_QUIET "quiet" 1841d4c48c4SToomas Soome #define NAME_LIST "list" 1851d4c48c4SToomas Soome #define NAME_ON "on" 1861d4c48c4SToomas Soome #define NAME_OFF "off" 1871d4c48c4SToomas Soome #define NAME_OPTIONAL "optional" 1881d4c48c4SToomas Soome #define NAME_ALWAYS "Always" 1891d4c48c4SToomas Soome #define NAME_UNKNOWN "unknown" 1901d4c48c4SToomas Soome #define NAME_REJECTING "rejecting" 1911d4c48c4SToomas Soome #define NAME_ACCEPTING "accepting" 1921d4c48c4SToomas Soome #define NAME_DISABLED "disabled" 1931d4c48c4SToomas Soome #define NAME_ENABLED "enabled" 1941d4c48c4SToomas Soome #define NAME_DIRECT "direct" 1951d4c48c4SToomas Soome #define NAME_PICA "pica" 1961d4c48c4SToomas Soome #define NAME_ELITE "elite" 1971d4c48c4SToomas Soome #define NAME_COMPRESSED "compressed" 1981d4c48c4SToomas Soome #define NAME_ALLOW "allow" 1991d4c48c4SToomas Soome #define NAME_DENY "deny" 2001d4c48c4SToomas Soome #define NAME_ONCE "once" 2011d4c48c4SToomas Soome #define NAME_DEFAULT "default" 2021d4c48c4SToomas Soome #define NAME_KEEP "keep" 2031d4c48c4SToomas Soome 2041d4c48c4SToomas Soome /* 2051d4c48c4SToomas Soome * Common messages: 2061d4c48c4SToomas Soome */ 2071d4c48c4SToomas Soome 2081d4c48c4SToomas Soome #define CUZ_NEW_PRINTER "new printer" 2091d4c48c4SToomas Soome #define CUZ_NEW_DEST "new destination" 2101d4c48c4SToomas Soome #define CUZ_STOPPED "stopped with printer fault" 2111d4c48c4SToomas Soome #define CUZ_FAULT "printer fault" 2121d4c48c4SToomas Soome #define CUZ_LOGIN_PRINTER "disabled by Spooler: login terminal" 2131d4c48c4SToomas Soome #define CUZ_MOUNTING "mounting a form" 2141d4c48c4SToomas Soome #define CUZ_NOFORK "can't fork" 2151d4c48c4SToomas Soome #define CUZ_PRINTING_OK "ready and printing" 2161d4c48c4SToomas Soome 2171d4c48c4SToomas Soome #define TIMEOUT_FAULT \ 2187c478bd9Sstevel@tonic-gate "Timed-out trying to open the printer port.\n" 2197c478bd9Sstevel@tonic-gate 2201d4c48c4SToomas Soome #define OPEN_FAULT \ 2217c478bd9Sstevel@tonic-gate "Failed to open the printer port.\n" 2227c478bd9Sstevel@tonic-gate 2231d4c48c4SToomas Soome #define PUSH_FAULT \ 2247c478bd9Sstevel@tonic-gate "Failed to push module(s) onto the printer port stream.\n" 2257c478bd9Sstevel@tonic-gate 2267c478bd9Sstevel@tonic-gate /* 2277c478bd9Sstevel@tonic-gate * When the Spooler detected the hangup, this message is used. 2287c478bd9Sstevel@tonic-gate */ 2291d4c48c4SToomas Soome #define HANGUP_FAULT \ 2307c478bd9Sstevel@tonic-gate "The connection to the printer dropped; perhaps the printer went off-line!\n" 2317c478bd9Sstevel@tonic-gate 2327c478bd9Sstevel@tonic-gate /* 2337c478bd9Sstevel@tonic-gate * When lp.cat detected the hangup, this message is used. 2347c478bd9Sstevel@tonic-gate */ 2351d4c48c4SToomas Soome #define HANGUP_FAULT_LPCAT \ 2367c478bd9Sstevel@tonic-gate "The connection to the printer dropped; perhaps the printer went off-line.\n" 2377c478bd9Sstevel@tonic-gate 2381d4c48c4SToomas Soome #define INTERRUPT_FAULT \ 2391d4c48c4SToomas Soome "Received an interrupt from the printer. The reason is unknown,\n\ 2401d4c48c4SToomas Soome although a common cause is that the printer's buffer capacity\n\ 2411d4c48c4SToomas Soome was exceeded. Using XON/XOFF flow control, adding carriage-return\n\ 2421d4c48c4SToomas Soome delays, or lowering the baud rate may fix the problem.\n\ 243*bbf21555SRichard Lowe See stty(1) and lpadmin(8) man-pages for help in doing this.\n" 2447c478bd9Sstevel@tonic-gate 2451d4c48c4SToomas Soome #define PIPE_FAULT \ 2467c478bd9Sstevel@tonic-gate "The output ``port'', a FIFO, was closed before all output was written.\n" 2477c478bd9Sstevel@tonic-gate 2481d4c48c4SToomas Soome #define EXIT_FAULT \ 2497c478bd9Sstevel@tonic-gate "The interface program returned with a reserved exit code.\n" 2507c478bd9Sstevel@tonic-gate 2511d4c48c4SToomas Soome /* 2521d4c48c4SToomas Soome * Lp-errno #defines, etc. 2531d4c48c4SToomas Soome */ 2541d4c48c4SToomas Soome 2551d4c48c4SToomas Soome #define LP_EBADSDN 1 2561d4c48c4SToomas Soome #define LP_EBADINT 2 2571d4c48c4SToomas Soome #define LP_EBADNAME 3 2581d4c48c4SToomas Soome #define LP_EBADARG 4 2591d4c48c4SToomas Soome #define LP_ETRAILIN 5 2601d4c48c4SToomas Soome #define LP_ENOCMT 6 2611d4c48c4SToomas Soome #define LP_EBADCTYPE 7 2621d4c48c4SToomas Soome #define LP_ENOALP 8 2631d4c48c4SToomas Soome #define LP_ENULLPTR 9 2641d4c48c4SToomas Soome #define LP_EBADHDR 10 2651d4c48c4SToomas Soome #define LP_ETEMPLATE 11 2661d4c48c4SToomas Soome #define LP_EKEYWORD 12 2671d4c48c4SToomas Soome #define LP_EPATTERN 13 2681d4c48c4SToomas Soome #define LP_ERESULT 14 269*bbf21555SRichard Lowe #define LP_EREGEX 15 /* and see extern int regerrno, regexpr(3GEN) */ 2701d4c48c4SToomas Soome #define LP_ENOMEM 99 2717c478bd9Sstevel@tonic-gate 2727c478bd9Sstevel@tonic-gate extern int lp_errno; 2737c478bd9Sstevel@tonic-gate 2741d4c48c4SToomas Soome /* 2751d4c48c4SToomas Soome * Misc. Macros 2761d4c48c4SToomas Soome */ 2777c478bd9Sstevel@tonic-gate 2787c478bd9Sstevel@tonic-gate #define LP_WS " " /* Whitespace (also list separator) */ 2797c478bd9Sstevel@tonic-gate #define LP_SEP "," /* List separator */ 2801d4c48c4SToomas Soome #define LP_QUOTES "'\"" 2817c478bd9Sstevel@tonic-gate 2821d4c48c4SToomas Soome #define MAIL "mail" 2831d4c48c4SToomas Soome #define WRITE "write" 2847c478bd9Sstevel@tonic-gate 2851d4c48c4SToomas Soome #define STATUS_BREAK "==========" 2867c478bd9Sstevel@tonic-gate 2871d4c48c4SToomas Soome #define STREQU(A, B) ((!(A) || !(B)) ? 0 : (strcmp((A), (B)) == 0)) 2881d4c48c4SToomas Soome #define STRNEQU(A, B, N) ((!(A) || !(B)) ? 0 : (strncmp((A), (B), (N)) == 0)) 2891d4c48c4SToomas Soome #define CS_STREQU(A, B) (cs_strcmp((A), (B)) == 0) 2901d4c48c4SToomas Soome #define CS_STRNEQU(A, B, N) (cs_strncmp((A), (B), (N)) == 0) 2911d4c48c4SToomas Soome #define STRSIZE(X) (sizeof (X) - 1) 2927c478bd9Sstevel@tonic-gate 2937c478bd9Sstevel@tonic-gate /* 2947c478bd9Sstevel@tonic-gate * Almost STREQU but compares null pointers as equal, too. 2957c478bd9Sstevel@tonic-gate */ 2961d4c48c4SToomas Soome #define SAME(A, B) ((A) == (B) || (A) && (B) && STREQU((A), (B))) 2977c478bd9Sstevel@tonic-gate 2987c478bd9Sstevel@tonic-gate #define PRINTF (void)printf 2991d4c48c4SToomas Soome #define SPRINTF (void)sprintf 3001d4c48c4SToomas Soome #define FPRINTF (void)fprintf 3017c478bd9Sstevel@tonic-gate 3027c478bd9Sstevel@tonic-gate #define NB(X) (X? X : "") 3037c478bd9Sstevel@tonic-gate 3041d4c48c4SToomas Soome #define PERROR strerror(errno) 3057c478bd9Sstevel@tonic-gate 3067c478bd9Sstevel@tonic-gate /* 3077c478bd9Sstevel@tonic-gate * Largest number we'll ever expect to get from doing %ld in printf, 3087c478bd9Sstevel@tonic-gate * as a string and number. ULONG_MAX from limits.h gives us the number, 3097c478bd9Sstevel@tonic-gate * but I can't figure out how to get that into a string. 3107c478bd9Sstevel@tonic-gate */ 3111d4c48c4SToomas Soome #define BIGGEST_NUMBER ULONG_MAX 3121d4c48c4SToomas Soome #define BIGGEST_NUMBER_S "4294967295" 3137c478bd9Sstevel@tonic-gate 3147c478bd9Sstevel@tonic-gate /* 3157c478bd9Sstevel@tonic-gate * Largest request ID (numerical part), as string and number. 3167c478bd9Sstevel@tonic-gate * See comment above. 3177c478bd9Sstevel@tonic-gate */ 3181d4c48c4SToomas Soome #define BIGGEST_REQID 999999 3191d4c48c4SToomas Soome #define BIGGEST_REQID_S "999999" 3207c478bd9Sstevel@tonic-gate 3217c478bd9Sstevel@tonic-gate /* 3227c478bd9Sstevel@tonic-gate * Maximum number of files queued per request, as string and number. 3237c478bd9Sstevel@tonic-gate * See earlier comment above. 3247c478bd9Sstevel@tonic-gate */ 3251d4c48c4SToomas Soome #define MOST_FILES 999999 3261d4c48c4SToomas Soome #define MOST_FILES_S "999999" 3277c478bd9Sstevel@tonic-gate 3281d4c48c4SToomas Soome /* 3291d4c48c4SToomas Soome * Alert macros: 3301d4c48c4SToomas Soome */ 3317c478bd9Sstevel@tonic-gate 3327c478bd9Sstevel@tonic-gate /* 3337c478bd9Sstevel@tonic-gate * Type of alert to be S_QUIET'd 3347c478bd9Sstevel@tonic-gate */ 3357c478bd9Sstevel@tonic-gate #define QA_FORM 1 3367c478bd9Sstevel@tonic-gate #define QA_PRINTER 2 3377c478bd9Sstevel@tonic-gate #define QA_PRINTWHEEL 3 3387c478bd9Sstevel@tonic-gate 3391d4c48c4SToomas Soome /* 3401d4c48c4SToomas Soome * File modes: 3411d4c48c4SToomas Soome * (The "NO" prefix is relative to ``others''.) 3421d4c48c4SToomas Soome */ 3437c478bd9Sstevel@tonic-gate 3447c478bd9Sstevel@tonic-gate #define MODE_READ (mode_t)0664 3451d4c48c4SToomas Soome #define MODE_NOREAD (mode_t)0660 3461d4c48c4SToomas Soome #define MODE_EXEC (mode_t)0775 3471d4c48c4SToomas Soome #define MODE_NOEXEC (mode_t)0770 3481d4c48c4SToomas Soome #define MODE_DIR (mode_t)0775 3491d4c48c4SToomas Soome #define MODE_NODIR (mode_t)0770 3507c478bd9Sstevel@tonic-gate 3517c478bd9Sstevel@tonic-gate extern int printlist_qsep; 3527c478bd9Sstevel@tonic-gate 3537c478bd9Sstevel@tonic-gate extern char Lp_Spooldir[], 3547c478bd9Sstevel@tonic-gate Lp_Admins[], 3557c478bd9Sstevel@tonic-gate Lp_Bin[], 3567c478bd9Sstevel@tonic-gate Lp_FIFO[], 3577c478bd9Sstevel@tonic-gate Lp_Logs[], 3587c478bd9Sstevel@tonic-gate Lp_ReqLog[], 3597c478bd9Sstevel@tonic-gate Lp_Model[], 3607c478bd9Sstevel@tonic-gate Lp_Requests[], 3617c478bd9Sstevel@tonic-gate Lp_Secure[], 3627c478bd9Sstevel@tonic-gate Lp_Schedlock[], 3637c478bd9Sstevel@tonic-gate Lp_Slow_Filter[], 3647c478bd9Sstevel@tonic-gate Lp_System[], 3657c478bd9Sstevel@tonic-gate Lp_Temp[], 3667c478bd9Sstevel@tonic-gate Lp_Tmp[], 3677c478bd9Sstevel@tonic-gate Lp_Users[], 3687c478bd9Sstevel@tonic-gate Lp_A[], 3697c478bd9Sstevel@tonic-gate Lp_A_Classes[], 3707c478bd9Sstevel@tonic-gate Lp_A_Forms[], 3717c478bd9Sstevel@tonic-gate Lp_A_Interfaces[], 3727c478bd9Sstevel@tonic-gate Lp_A_Logs[], 3737c478bd9Sstevel@tonic-gate Lp_A_Printers[], 3747c478bd9Sstevel@tonic-gate Lp_A_PrintWheels[], 3757c478bd9Sstevel@tonic-gate Lp_A_Filters[], 3767c478bd9Sstevel@tonic-gate Lp_A_Systems[], 3777c478bd9Sstevel@tonic-gate Lp_Default[], 3787c478bd9Sstevel@tonic-gate Lp_A_Faults[]; 3797c478bd9Sstevel@tonic-gate 3807c478bd9Sstevel@tonic-gate /* 3817c478bd9Sstevel@tonic-gate * File access: 3827c478bd9Sstevel@tonic-gate */ 3837c478bd9Sstevel@tonic-gate 3847c478bd9Sstevel@tonic-gate extern int open_locked(char *, char *, mode_t); 3857c478bd9Sstevel@tonic-gate extern char *fdgets(char *, int, int); 3867c478bd9Sstevel@tonic-gate extern int fdprintf(int, char *, ...); 3877c478bd9Sstevel@tonic-gate extern int fdputs(char *, int); 3887c478bd9Sstevel@tonic-gate extern int fdputc(char, int); 3897c478bd9Sstevel@tonic-gate 3907c478bd9Sstevel@tonic-gate extern int is_printer_uri(char *); 3917c478bd9Sstevel@tonic-gate 3921d4c48c4SToomas Soome FILE *open_lpfile(char *, char *, mode_t); 3931d4c48c4SToomas Soome int close_lpfile(FILE *); 3941d4c48c4SToomas Soome int chown_lppath(char *); 3951d4c48c4SToomas Soome int mkdir_lpdir(char *, int); 3961d4c48c4SToomas Soome int rmfile(char *); 3971d4c48c4SToomas Soome int dumpstring(char *, char *); 3987c478bd9Sstevel@tonic-gate 3991d4c48c4SToomas Soome char *loadstring(char *); 4001d4c48c4SToomas Soome char *loadline(char *); 4011d4c48c4SToomas Soome char *sop_up_rest(int, char *); 4027c478bd9Sstevel@tonic-gate 4037c478bd9Sstevel@tonic-gate /* 4047c478bd9Sstevel@tonic-gate * List manipulation routines: 4057c478bd9Sstevel@tonic-gate */ 4067c478bd9Sstevel@tonic-gate 4071d4c48c4SToomas Soome #define emptylist(LP) (!(LP) || !(LP)[0]) 4087c478bd9Sstevel@tonic-gate 4091d4c48c4SToomas Soome int addlist(char ***, char *); 4101d4c48c4SToomas Soome int addstring(char **, char *); 4111d4c48c4SToomas Soome int appendlist(char ***, char *); 4121d4c48c4SToomas Soome int dellist(char ***, char *); 4131d4c48c4SToomas Soome int joinlist(char ***, char **); 4141d4c48c4SToomas Soome int lenlist(char **); 4151d4c48c4SToomas Soome int printlist(FILE *, char **); 4161d4c48c4SToomas Soome int fdprintlist(int, char **); 4171d4c48c4SToomas Soome int searchlist(char *, char **); 4181d4c48c4SToomas Soome int searchlist_with_terminfo(char *, char **); 4197c478bd9Sstevel@tonic-gate 4201d4c48c4SToomas Soome char **duplist(char **); 4211d4c48c4SToomas Soome char **getlist(char *, char *, char *); 4221d4c48c4SToomas Soome char **dashos(char *); 4231d4c48c4SToomas Soome char **wherelist(char *, char **); 4247c478bd9Sstevel@tonic-gate 4251d4c48c4SToomas Soome char *sprintlist(char **); 4261d4c48c4SToomas Soome char *search_cslist(char *, char **); 4277c478bd9Sstevel@tonic-gate 4281d4c48c4SToomas Soome void freelist(char **); 4291d4c48c4SToomas Soome void printlist_setup(char *, char *, char *, char *); 4301d4c48c4SToomas Soome void printlist_unsetup(void); 4317c478bd9Sstevel@tonic-gate 4327c478bd9Sstevel@tonic-gate /* 4337c478bd9Sstevel@tonic-gate * Scaled decimal number routines: 4347c478bd9Sstevel@tonic-gate */ 4357c478bd9Sstevel@tonic-gate 4361d4c48c4SToomas Soome #define getsdn(S) _getsdn(S, (char **)0, 0) 4371d4c48c4SToomas Soome #define getcpi(S) _getsdn(S, (char **)0, 1) 4387c478bd9Sstevel@tonic-gate 4391d4c48c4SToomas Soome #define N_COMPRESSED 9999 4407c478bd9Sstevel@tonic-gate 4411d4c48c4SToomas Soome void printsdn(FILE *, SCALED); 4421d4c48c4SToomas Soome void fdprintsdn(int, SCALED); 4431d4c48c4SToomas Soome void printsdn_setup(char *, char *, char *); 4441d4c48c4SToomas Soome void printsdn_unsetup(void); 4457c478bd9Sstevel@tonic-gate 4461d4c48c4SToomas Soome SCALED _getsdn(char *, char **, int); 4477c478bd9Sstevel@tonic-gate 4487c478bd9Sstevel@tonic-gate /* 4497c478bd9Sstevel@tonic-gate * File name routines: 4507c478bd9Sstevel@tonic-gate */ 4517c478bd9Sstevel@tonic-gate 4521d4c48c4SToomas Soome char *makepath(char *, ...); 4531d4c48c4SToomas Soome char *getspooldir(void); 4541d4c48c4SToomas Soome char *getrequestfile(char *); 4551d4c48c4SToomas Soome char *getprinterfile(char *, char *); 4561d4c48c4SToomas Soome char *getsystemfile(char *, char *); 4571d4c48c4SToomas Soome char *getclassfile(char *); 4581d4c48c4SToomas Soome char *getfilterfile(char *); 4591d4c48c4SToomas Soome char *getformfile(char *, char *); 4607c478bd9Sstevel@tonic-gate 4617c478bd9Sstevel@tonic-gate /* 4627c478bd9Sstevel@tonic-gate * Additional string manipulation routines: 4637c478bd9Sstevel@tonic-gate */ 4647c478bd9Sstevel@tonic-gate 4651d4c48c4SToomas Soome int cs_strcmp(char *, char *); 4661d4c48c4SToomas Soome int cs_strncmp(char *, char *, int); 4677c478bd9Sstevel@tonic-gate 4687c478bd9Sstevel@tonic-gate /* 4697c478bd9Sstevel@tonic-gate * Syntax checking routines: 4707c478bd9Sstevel@tonic-gate */ 4717c478bd9Sstevel@tonic-gate 4721d4c48c4SToomas Soome int syn_name(char *); 4731d4c48c4SToomas Soome int syn_text(char *); 4741d4c48c4SToomas Soome int syn_comment(char *); 4751d4c48c4SToomas Soome int syn_machine_name(char *); 4761d4c48c4SToomas Soome int syn_option(char *); 4777c478bd9Sstevel@tonic-gate 4787c478bd9Sstevel@tonic-gate /* 4797c478bd9Sstevel@tonic-gate * Alert management routines: 4807c478bd9Sstevel@tonic-gate */ 4817c478bd9Sstevel@tonic-gate 4821d4c48c4SToomas Soome int putalert(char *, char *, FALERT *); 4831d4c48c4SToomas Soome int delalert(char *, char *); 4847c478bd9Sstevel@tonic-gate 4851d4c48c4SToomas Soome FALERT *getalert(char *, char *); 4867c478bd9Sstevel@tonic-gate 4871d4c48c4SToomas Soome void printalert(FILE *, FALERT *, int); 4887c478bd9Sstevel@tonic-gate 4897c478bd9Sstevel@tonic-gate /* 4907c478bd9Sstevel@tonic-gate * Terminfo Database Inquiry Tool 4917c478bd9Sstevel@tonic-gate */ 4927c478bd9Sstevel@tonic-gate 4931d4c48c4SToomas Soome int tidbit(char *, char *, ...); 4941d4c48c4SToomas Soome void untidbit(char *); 4957c478bd9Sstevel@tonic-gate 4967c478bd9Sstevel@tonic-gate /* 4977c478bd9Sstevel@tonic-gate * Auto-restarting and other system calls: 4987c478bd9Sstevel@tonic-gate * The two versions are here to reduce the chance of colliding 4997c478bd9Sstevel@tonic-gate * with similar names in standard libraries (e.g. dial(3C) uses 5007c478bd9Sstevel@tonic-gate * Read/Write). 5017c478bd9Sstevel@tonic-gate */ 5027c478bd9Sstevel@tonic-gate 5031d4c48c4SToomas Soome #define Access _Access 5041d4c48c4SToomas Soome #define Chdir _Chdir 5051d4c48c4SToomas Soome #define Chmod _Chmod 5061d4c48c4SToomas Soome #define Chown _Chown 5071d4c48c4SToomas Soome #define Close _Close 5081d4c48c4SToomas Soome #define Creat _Creat 5091d4c48c4SToomas Soome #define Fcntl _Fcntl 5101d4c48c4SToomas Soome #define Fstat _Fstat 5111d4c48c4SToomas Soome #define Link _Link 5121d4c48c4SToomas Soome #define Lstat _Lstat 5131d4c48c4SToomas Soome #define Mknod _Mknod 5141d4c48c4SToomas Soome #define Open _Open 5151d4c48c4SToomas Soome #define Read _Read 5161d4c48c4SToomas Soome #define Readlink _Readlink 5171d4c48c4SToomas Soome #define Rename _Rename 5181d4c48c4SToomas Soome #define Stat _Stat 5191d4c48c4SToomas Soome #define Symlink _Symlink 5201d4c48c4SToomas Soome #define Unlink _Unlink 5211d4c48c4SToomas Soome #define Wait _Wait 5221d4c48c4SToomas Soome #define Write _Write 5231d4c48c4SToomas Soome 5241d4c48c4SToomas Soome #define Malloc(size) _Malloc(size, __FILE__, __LINE__) 5251d4c48c4SToomas Soome #define Realloc(ptr, size) _Realloc(ptr, size, __FILE__, __LINE__) 5261d4c48c4SToomas Soome #define Calloc(nelem, elsize) _Calloc(nelem, elsize, __FILE__, __LINE__) 5271d4c48c4SToomas Soome #define Strdup(s) _Strdup(s, __FILE__, __LINE__) 5281d4c48c4SToomas Soome #define Free(ptr) _Free(ptr, __FILE__, __LINE__) 5291d4c48c4SToomas Soome 5301d4c48c4SToomas Soome int _Access(char *, int); 5311d4c48c4SToomas Soome int _Chdir(char *); 5321d4c48c4SToomas Soome int _Chmod(char *, int); 5331d4c48c4SToomas Soome int _Chown(char *, int, int); 5341d4c48c4SToomas Soome int _Close(int); 5351d4c48c4SToomas Soome int _Creat(char *, int); 5361d4c48c4SToomas Soome int _Fcntl(int, int, ...); 5371d4c48c4SToomas Soome int _Fstat(int, struct stat *); 5381d4c48c4SToomas Soome int _Link(char *, char *); 5391d4c48c4SToomas Soome int _Lstat(char *, struct stat *); 5401d4c48c4SToomas Soome int _Mknod(char *, int, int); 5411d4c48c4SToomas Soome int _Mkpipe(char *, int, int); 5421d4c48c4SToomas Soome int _Open(char *, int, ... /* mode_t */); 5431d4c48c4SToomas Soome int _Read(int, char *, unsigned int); 5441d4c48c4SToomas Soome int _Readlink(char *, char *, unsigned int); 5451d4c48c4SToomas Soome int _Rename(char *, char *); 5461d4c48c4SToomas Soome int _Symlink(char *, char *); 5471d4c48c4SToomas Soome int _Stat(char *, struct stat *); 5481d4c48c4SToomas Soome int _Unlink(char *); 5491d4c48c4SToomas Soome int _Wait(int *); 5501d4c48c4SToomas Soome int _Write(int, char *, unsigned int); 5511d4c48c4SToomas Soome 5521d4c48c4SToomas Soome void *_Malloc(size_t, const char *, int); 5531d4c48c4SToomas Soome void *_Realloc(void *, size_t, const char *, int); 5541d4c48c4SToomas Soome void *_Calloc(size_t, size_t, const char *, int); 5551d4c48c4SToomas Soome char *_Strdup(const char *, const char *, int); 5561d4c48c4SToomas Soome void _Free(void *, const char *, int); 5577c478bd9Sstevel@tonic-gate 5587c478bd9Sstevel@tonic-gate /* 5597c478bd9Sstevel@tonic-gate * Misc. routines: 5607c478bd9Sstevel@tonic-gate */ 5617c478bd9Sstevel@tonic-gate 5621d4c48c4SToomas Soome int isterminfo(char *); 5631d4c48c4SToomas Soome int isprinter(char *); 5641d4c48c4SToomas Soome int isrequest(char *); 5651d4c48c4SToomas Soome int isnumber(char *); 5667c478bd9Sstevel@tonic-gate 5671d4c48c4SToomas Soome char *getname(void); 5681d4c48c4SToomas Soome char *makestr(char *, ...); 5691d4c48c4SToomas Soome char *strip(char *); 5707c478bd9Sstevel@tonic-gate 5711d4c48c4SToomas Soome void sendmail(char *, char *); 5727c478bd9Sstevel@tonic-gate 5731d4c48c4SToomas Soome extern void (*lp_alloc_fail_handler)(void); 5747c478bd9Sstevel@tonic-gate 5757c478bd9Sstevel@tonic-gate /* 5767c478bd9Sstevel@tonic-gate * Originally part of liblpfs.a and fs.h, now no longer needed 5777c478bd9Sstevel@tonic-gate * since the code doesn't have to work on pre-SVR4.0. 5787c478bd9Sstevel@tonic-gate */ 5797c478bd9Sstevel@tonic-gate #define Opendir opendir 5807c478bd9Sstevel@tonic-gate #define Telldir telldir 5817c478bd9Sstevel@tonic-gate #define Seekdir seekdir 5827c478bd9Sstevel@tonic-gate #define Rewinddir(dirp) Seekdir(dirp, 0L) 5837c478bd9Sstevel@tonic-gate #define Closedir closedir 5847c478bd9Sstevel@tonic-gate #define Readdir readdir 5857c478bd9Sstevel@tonic-gate #define Mkdir mkdir 5867c478bd9Sstevel@tonic-gate #define Rmdir rmdir 5877c478bd9Sstevel@tonic-gate 5887c478bd9Sstevel@tonic-gate #define next_dir(base, ptr) next_x(base, ptr, S_IFDIR) 5897c478bd9Sstevel@tonic-gate #define next_file(base, ptr) next_x(base, ptr, S_IFREG) 5907c478bd9Sstevel@tonic-gate 5911d4c48c4SToomas Soome extern int chownmod(char *, uid_t, gid_t, mode_t); 592df1eb1adSjacobs 593df1eb1adSjacobs 5941d4c48c4SToomas Soome char *next_x(char *, long *, unsigned int); 5957c478bd9Sstevel@tonic-gate 59645916cd2Sjpk /* 59745916cd2Sjpk * Stuff needed for Trusted Extensions 59845916cd2Sjpk */ 59945916cd2Sjpk 60045916cd2Sjpk extern char *get_labeled_zonename(char *); 6011d4c48c4SToomas Soome extern int get_peer_label(int, char **); 60245916cd2Sjpk 60345916cd2Sjpk 604ace1a5f1Sdp #ifdef __cplusplus 605ace1a5f1Sdp } 6067c478bd9Sstevel@tonic-gate #endif 607ace1a5f1Sdp 608ace1a5f1Sdp #endif /* _LP_LP_H */ 609