00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #ifndef _INC_BEFORE_SYSTEM
00039 #warning Failed to include "before_system.h"
00040 #include "before_system.h"
00041 #endif
00042
00043 #include <stdio.h>
00044 #include <sys/types.h>
00045 #include <sys/stat.h>
00046 #include <stdarg.h>
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070 #define MIN_INODES 100
00071 #define MIN_BLOCKS 2048
00072
00073
00074
00075
00076
00077
00078
00079 #define GNUC_HAPPY 1
00080
00081
00082
00083
00084
00085
00086
00087 #define APPLE_QUOTE 1
00088
00089
00090
00091
00092
00093
00094 #define DESKJET_STATUS_FIX 1
00095
00096
00097
00098
00099
00100
00101
00102
00103 #define PPR_DSC_PREFIX "TCHCT"
00104
00105
00106
00107
00108 #define CRUFT_AUTH 1
00109
00110
00111
00112
00113
00114
00115
00116 #ifndef USER_PPR
00117 #define USER_PPR "ppr"
00118 #endif
00119 #ifndef GROUP_PPR
00120 #define GROUP_PPR "ppr"
00121 #endif
00122 #ifndef USER_PPRWWW
00123 #define USER_PPRWWW "pprwww"
00124 #endif
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139 #ifndef CONFDIR
00140 #define CONFDIR "/etc/ppr"
00141 #endif
00142 #ifndef HOMEDIR
00143 #define HOMEDIR "/usr/lib/ppr"
00144 #endif
00145 #ifndef SHAREDIR
00146 #define SHAREDIR "/usr/share/ppr"
00147 #endif
00148 #ifndef VAR_SPOOL_PPR
00149 #define VAR_SPOOL_PPR "/var/spool/ppr"
00150 #endif
00151 #ifndef TEMPDIR
00152 #define TEMPDIR "/tmp"
00153 #endif
00154 #ifndef SYSBINDIR
00155 #define SYSBINDIR "/usr/bin"
00156 #endif
00157 #ifndef XWINBINDIR
00158 #define XWINBINDIR "/usr/bin/X11"
00159 #endif
00160
00161
00162 #define RUNDIR VAR_SPOOL_PPR"/run"
00163 #define VAR_PRINTERS VAR_SPOOL_PPR"/printers"
00164
00165
00166 #define PPR_CONF CONFDIR"/ppr.conf"
00167
00168
00169 #define DBNAME CONFDIR"/charge_users.db"
00170 #define MEDIAFILE CONFDIR"/media.db"
00171 #define NEWPRN_CONFIG CONFDIR"/newprn.conf"
00172 #define UPRINTCONF CONFDIR"/uprint.conf"
00173 #define UPRINTREMOTECONF CONFDIR"/uprint-remote.conf"
00174
00175
00176 #define MFMODES SHAREDIR"/lib/mfmodes.conf"
00177 #define FONTSUB SHAREDIR"/lib/fontsub.conf"
00178 #define LW_MESSAGES_CONF SHAREDIR"/lib/lw-messages.conf"
00179 #define PJL_MESSAGES_CONF SHAREDIR"/lib/pjl-messages.conf"
00180 #define EDITPSCONF HOMEDIR"/editps/editps.conf"
00181 #define CHARSETSCONF SHAREDIR"/lib/charsets.conf"
00182 #define FONTSCONF SHAREDIR"/lib/fonts.conf"
00183 #define PAGESIZES_CONF SHAREDIR"/lib/pagesizes.conf"
00184 #define PSERRORS_CONF SHAREDIR"/lib/pserrors.conf"
00185
00186
00187 #define PRCONF CONFDIR"/printers"
00188 #define GRCONF CONFDIR"/groups"
00189 #define ALIASCONF CONFDIR"/aliases"
00190 #define MOUNTEDDIR CONFDIR"/mounted"
00191 #define ACLDIR CONFDIR"/acl"
00192
00193
00194 #define NEXTIDFILE RUNDIR"/lastid_ppr"
00195 #define FIFO_NAME VAR_SPOOL_PPR"/PIPE"
00196 #define PPRD_LOCKFILE RUNDIR"/pprd.pid"
00197
00198
00199 #define FILTDIR HOMEDIR"/filters"
00200 #define INTDIR HOMEDIR"/interfaces"
00201 #define COMDIR HOMEDIR"/commentators"
00202 #define RESPONDERDIR HOMEDIR"/responders"
00203 #define PPDDIR SHAREDIR"/PPDFiles"
00204 #define STATIC_CACHEDIR SHAREDIR"/cache"
00205
00206
00207 #define QUEUEDIR VAR_SPOOL_PPR"/queue"
00208 #define DATADIR VAR_SPOOL_PPR"/jobs"
00209 #define ALERTDIR VAR_PRINTERS"/alerts"
00210 #define STATUSDIR VAR_PRINTERS"/status"
00211 #define LOGDIR VAR_SPOOL_PPR"/logs"
00212 #define CACHEDIR VAR_SPOOL_PPR"/cache"
00213 #define ADDRESS_CACHE VAR_PRINTERS"/addr_cache"
00214 #define FONT_INDEX VAR_SPOOL_PPR"/fontindex.db"
00215 #define PPD_INDEX VAR_SPOOL_PPR"/ppdindex.db"
00216
00217
00218 #define STATE_UPDATE_FILE RUNDIR"/state_update"
00219 #define STATE_UPDATE_MAXLINES 1000
00220 #define STATE_UPDATE_PPRDRV_FILE RUNDIR"/state_update_pprdrv"
00221 #define STATE_UPDATE_PPRDRV_MAXBYTES 30000
00222
00223
00224 #define PRINTLOG_PATH LOGDIR"/printlog"
00225
00226
00227 #define PPRDRV_PATH HOMEDIR"/lib/pprdrv"
00228 #define PPAD_PATH HOMEDIR"/bin/ppad"
00229 #define PPOP_PATH HOMEDIR"/bin/ppop"
00230 #define PPR_PATH HOMEDIR"/bin/ppr"
00231 #define TBCP2BIN_PATH HOMEDIR"/lib/tbcp2bin"
00232 #define PPR2SAMBA_PATH HOMEDIR"/bin/ppr2samba"
00233 #define TAIL_STATUS_PATH HOMEDIR"/lib/tail_status"
00234 #define PPJOB_PATH HOMEDIR"/bin/ppjob"
00235
00236
00237
00238
00239
00240 #define MAX_LINE 1024
00241 #define MAX_CONT 32
00242 #define MAX_TOKENIZED 512
00243 #define MAX_TOKENS 20
00244 #define MAX_PPR_PATH 128
00245
00246 #define MAX_BINNAME 16
00247 #define MAX_MEDIANAME 16
00248 #define MAX_COLOURNAME 16
00249 #define MAX_TYPENAME 16
00250
00251 #define MAX_DOCMEDIA 4
00252
00253 #define MAX_DESTNAME 16
00254 #define MAX_NODENAME 16
00255 #define MAX_NODES 25
00256 #define MAX_PRINTERS 250
00257 #define MAX_BINS 10
00258 #define MAX_GROUPS 150
00259 #define MAX_GROUPSIZE 8
00260 #define MAX_ALIASES 150
00261
00262 #define MAX_STATUS_MESSAGE 80
00263
00264 #define MAX_PPD_NEST 10
00265 #define MAX_PPD_LINE 255
00266 #define MAX_VMOPTIONS 50
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278 #define PASS2
00279 #include "sysdep.h"
00280 #undef PASS2
00281
00282
00283 #ifndef SHORT_INT
00284 typedef short int SHORT_INT;
00285 #endif
00286
00287
00288
00289 #undef signal
00290 #define signal(a,b) signal_interupting(a,b)
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303 #define LOCALEDIR SHAREDIR"/locale"
00304 #define PACKAGE "PPR"
00305 #define PACKAGE_INTERFACES "PPR"
00306 #define PACKAGE_PPRD "PPRD"
00307 #define PACKAGE_PPRDRV "PPRDRV"
00308 #define PACKAGE_PAPSRV "PAPSRV"
00309 #define PACKAGE_PAPD "PAPD"
00310 #define PACKAGE_PPRWWW "PPRWWW"
00311
00312 #ifdef INTERNATIONAL
00313 #define _(String) gettext(String)
00314 #else
00315 #define gettext(String) (String)
00316 #define _(String) (String)
00317 #endif
00318
00319 #define gettext_noop(String) (String)
00320 #define N_(String) (String)
00321 #define X_(String) (String)
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335 #ifdef __GNUC__
00336 #define GNUC_HAPPY 1
00337 #endif
00338
00339
00340
00341
00342
00343
00344 #define APPLE_QUOTE 1
00345
00346
00347
00348
00349
00350
00351
00352
00353
00354
00355 #define DEST_DISALLOWED "/\n\r\t \b~"
00356 #define DEST_DISALLOWED_LEADING ".-"
00357
00358
00359
00360
00361
00362
00363 #define PPR_UMASK UNIX_022
00364
00365
00366
00367
00368
00369 #define PPR_PPRD_UMASK UNIX_002
00370
00371
00372
00373
00374 #define PPR_JOBS_UMASK S_IRWXO
00375
00376
00377
00378
00379
00380
00381 #define PPR_INTERFACE_UMASK UNIX_077
00382 #define PPR_FILTER_UMASK UNIX_077
00383
00384
00385 #define EXTENSION_DPS 1
00386 #define EXTENSION_CMYK 2
00387 #define EXTENSION_Composite 4
00388 #define EXTENSION_FileSystem 8
00389
00390
00391
00392
00393
00394
00395 #define BANNER_DONTCARE 0
00396 #define BANNER_YESPLEASE 1
00397 #define BANNER_NOTHANKYOU 2
00398
00399
00400 #define BANNER_FORBIDDEN 0
00401 #define BANNER_DISCOURAGED 1
00402 #define BANNER_ENCOURAGED 2
00403 #define BANNER_REQUIRED 3
00404 #define BANNER_INVALID 4
00405
00406
00407
00408
00409
00410
00411 #define FONT_TYPE_1 1
00412 #define FONT_TYPE_3 2
00413 #define FONT_TYPE_42 4
00414 #define FONT_MACTRUETYPE 8
00415 #define FONT_TYPE_TTF 16
00416
00417
00418 #define FONT_MODE_MACTRUETYPE S_IXUSR
00419 #define FONT_MODE_TYPE_1 S_IXGRP
00420 #define FONT_MODE_TYPE_42 S_IXOTH
00421
00422
00423
00424
00425
00426
00427 #define TT_UNKNOWN 0
00428 #define TT_NONE 1
00429 #define TT_ACCEPT68K 2
00430 #define TT_TYPE42 3
00431
00432
00433
00434
00435 #define JOB_FLAG_SAVE 1
00436 #define JOB_FLAG_DO_NOTIFY 2
00437 #define JOB_FLAG_NOTIFYING 4
00438 #define JOB_FLAG_QUESTION_UNANSWERED 8
00439 #define JOB_FLAG_QUESTION_ASKING_NOW 16
00440
00441
00442
00443
00444
00445
00446 struct PPD_PROTOCOLS
00447 {
00448 gu_boolean TBCP;
00449 gu_boolean PJL;
00450 } ;
00451
00452
00453 #define CODES_DEFAULT -1
00454 #define CODES_UNKNOWN 0
00455 #define CODES_Clean7Bit 1
00456 #define CODES_Clean8Bit 2
00457 #define CODES_Binary 3
00458 #define CODES_TBCP 4
00459
00460
00461
00462
00463 enum RES_SEARCH
00464 {
00465 RES_SEARCH_CACHE,
00466 RES_SEARCH_FONTINDEX,
00467 RES_SEARCH_END
00468 };
00469
00470
00471 char *datestamp(void);
00472 void tokenize(void);
00473 extern char *tokens[];
00474 extern int tokens_count;
00475 const char *quote(const char *);
00476 int destination_protected(const char *destnode, const char *destname);
00477 char *money(int amount_times_ten);
00478 char *local_jobid(const char *destname, int id, int subid, const char *homenode);
00479 char *remote_jobid(const char *destnode, const char *destname, int id, int subid, const char *homenode);
00480 const char *network_destspec(const char *destnode, const char *destname);
00481 int pagesize(const char keyword[], char **corrected_keyword, double *width, double *length, gu_boolean *envelope);
00482 const char *noalloc_find_cached_resource(const char res_type[], const char res_name[], double version, int revision, const enum RES_SEARCH search_list[], int *new_revision, int *features, enum RES_SEARCH *where_found);
00483 char *find_cached_resource(const char res_type[], const char res_name[], double version, int revision, const enum RES_SEARCH search_list[], int *new_revision, int *features, enum RES_SEARCH *where_found);
00484 int get_responder_width(const char *name);
00485 double convert_dimension(const char *string);
00486 void filter_options_error(int exlevel, struct OPTIONS_STATE *o, const char *format, ...)
00487 #ifdef __GNUC__
00488 __attribute__ ((noreturn))
00489 #endif
00490 ;
00491 const char *pap_strerror(int err);
00492 const char *nbp_strerror(int err);
00493 const char *pap_look_string(int n);
00494 char *ppr_get_command(const char *prompt, int machine_input);
00495 const char *ppr_get_nodename(void)
00496 #ifdef __GNUC__
00497 __attribute__ ((const))
00498 #endif
00499 ;
00500
00501 char *ppd_find_file(const char ppdname[]);
00502 int ppd_open(const char name[], FILE *errors);
00503 char *ppd_readline(void);
00504 void *ppdobj_new(const char ppdname[]);
00505 void ppdobj_delete(void *p);
00506 char *ppdobj_readline(void *p);
00507 void *ppd_finish_quoted_string(void *obj, char *initial_segment);
00508 char *ppd_finish_QuotedValue(void *obj, char *initial_segment);
00509 int ppd_decode_QuotedValue(char *p);
00510
00511 void set_ppr_env(void);
00512 void prune_env(void);
00513 gu_boolean is_unsafe_ps_name(const char name[]);
00514 gu_boolean is_pap_PrinterError(const unsigned char *status);
00515 gu_boolean user_acl_allows(const char user[], const char acl[]);
00516 void ppr_fnamef(char target[], const char pattern[], ...);
00517 gu_boolean interface_default_feedback(const char interface[], const struct PPD_PROTOCOLS *prot);
00518 int interface_default_jobbreak(const char interface[], const struct PPD_PROTOCOLS *prot);
00519 int interface_default_codes(const char interface[], const struct PPD_PROTOCOLS *prot);
00520 void valert(const char printername[], int dateflag, const char string[], va_list args);
00521 void alert(const char printername[], int dateflag, const char string[], ...);
00522 void tail_status(gu_boolean tail_pprd, gu_boolean tail_pprdrv, gu_boolean (*callback)(char *p, void *extra), int timeout, void *extra);
00523 const char *dest_ppdfile(const char destnode[], const char destname[]);
00524
00525
00526
00527
00528
00529
00530 void error(const char string[], ...)
00531 #ifdef __GNUC__
00532 __attribute__ ((format (printf, 1, 2)))
00533 #endif
00534 ;
00535
00536
00537