1 | #ifndef DEEPEE_H |
---|
2 | #define DEEPEE_H |
---|
3 | /* |
---|
4 | * Copyright Milan Technology Inc., 1991, 1992 |
---|
5 | */ |
---|
6 | |
---|
7 | /* @(#)dp.h 2.1 10/9/92 */ |
---|
8 | |
---|
9 | #include <sys/types.h> |
---|
10 | #include <sys/stat.h> |
---|
11 | #include <stdio.h> |
---|
12 | #ifdef XPG3 |
---|
13 | #include <unistd.h> |
---|
14 | #endif |
---|
15 | |
---|
16 | #include <signal.h> |
---|
17 | |
---|
18 | #include <fcntl.h> |
---|
19 | #include <sgtty.h> |
---|
20 | #include <sys/file.h> |
---|
21 | #include <sys/socket.h> |
---|
22 | |
---|
23 | #ifdef LPD |
---|
24 | #include <sys/un.h> |
---|
25 | #endif |
---|
26 | |
---|
27 | #ifdef ATT |
---|
28 | #include <sys/in.h> |
---|
29 | |
---|
30 | #else |
---|
31 | #include <netinet/in.h> |
---|
32 | #endif |
---|
33 | |
---|
34 | #include <netdb.h> |
---|
35 | |
---|
36 | #ifdef INTERACTIVE |
---|
37 | #include <net/errno.h> |
---|
38 | #endif |
---|
39 | #include <errno.h> |
---|
40 | |
---|
41 | extern int errno; |
---|
42 | #include <sys/time.h> |
---|
43 | #include <syslog.h> |
---|
44 | |
---|
45 | #ifdef SCO |
---|
46 | #include <poll.h> |
---|
47 | #endif |
---|
48 | |
---|
49 | #ifdef _IBMR2 |
---|
50 | #include <sys/select.h> |
---|
51 | #endif |
---|
52 | |
---|
53 | #ifdef XPG3 |
---|
54 | #define bcopy(a, b, c) memcpy(b, a, c) |
---|
55 | #define rindex(a, b) strrchr(a, b) |
---|
56 | #define bzero(a, c) memset(a, (char)0, c) |
---|
57 | #endif |
---|
58 | |
---|
59 | #if !defined( _strcasecmp ) |
---|
60 | #define strcasecmp(a,b) strcmp(a,b) |
---|
61 | #endif |
---|
62 | |
---|
63 | #define SERIAL 2001 |
---|
64 | #define PARALLEL 2000 |
---|
65 | |
---|
66 | #ifndef STDIN_FILENO |
---|
67 | #define STDIN_FILENO 0 |
---|
68 | #endif |
---|
69 | |
---|
70 | #ifndef STDOUT_FILENO |
---|
71 | #define STDOUT_FILENO 1 |
---|
72 | #endif |
---|
73 | |
---|
74 | #define MAX_MAGIC_HEADER 100 |
---|
75 | #define LINGERVAL 1000 |
---|
76 | #define ASCII 0 |
---|
77 | #define POSTSCRIPT 1 |
---|
78 | #define CAT 2 |
---|
79 | #define MAX_BUFFER 2000 |
---|
80 | #define MAXFILELEN 1024 |
---|
81 | #define MAXSTRNGLEN 256 |
---|
82 | #define MAXNAMELEN 256 |
---|
83 | #define MAXLINELEN 256 |
---|
84 | #define APPEND 0 |
---|
85 | #define PREPEND 1 |
---|
86 | |
---|
87 | #define TRUE 1 |
---|
88 | #define FALSE 0 |
---|
89 | |
---|
90 | #define readEnd 0 |
---|
91 | #define writeEnd 1 |
---|
92 | |
---|
93 | /* hsw == Host SoftWare */ |
---|
94 | typedef struct hsw_CONFIG { |
---|
95 | char printer_name[MAXNAMELEN]; |
---|
96 | char hostname[MAXNAMELEN]; |
---|
97 | int ptype; /* used for printer classes */ |
---|
98 | struct hsw_CONFIG *next_printer; |
---|
99 | } hsw_PCONFIG; |
---|
100 | |
---|
101 | typedef struct file_obj { |
---|
102 | char file_name[MAXNAMELEN]; |
---|
103 | struct file_obj *next; |
---|
104 | } file_obj_t, *file_obj_ptr; |
---|
105 | |
---|
106 | |
---|
107 | /* Structure used for notification purposes */ |
---|
108 | |
---|
109 | typedef struct notification { |
---|
110 | int mail; /* Should I notify thru mail ? */ |
---|
111 | int file; /* Should I notify thru file ? */ |
---|
112 | int syslog; /* Should I notify thru syslog file ? */ |
---|
113 | int program; /* notify thru execing a prog */ |
---|
114 | char user[MAXNAMELEN]; /* User name to send mail to */ |
---|
115 | char filename[MAXNAMELEN]; /* Name of such a file */ |
---|
116 | char prog_name[MAXNAMELEN];/* name of prog to exec */ |
---|
117 | } s_notification; |
---|
118 | |
---|
119 | typedef struct Adobe { |
---|
120 | char *prog; |
---|
121 | char *pname; |
---|
122 | char *name; |
---|
123 | char *host; |
---|
124 | char *accountingfile; |
---|
125 | int banner_first, banner_last, verbose_log; |
---|
126 | } s_Adobe; |
---|
127 | |
---|
128 | /* Struct to hold options and other "global" values */ |
---|
129 | typedef struct options { |
---|
130 | int use_control_d; |
---|
131 | int mapflg; |
---|
132 | int ff_flag; |
---|
133 | int dobanner; |
---|
134 | int check_postscript; |
---|
135 | int dataport; |
---|
136 | int send_startfile; |
---|
137 | int send_endfile; |
---|
138 | int real_filter; |
---|
139 | int closewait ; |
---|
140 | int use_printer_classes; |
---|
141 | char *current_dir; |
---|
142 | char *start_string; |
---|
143 | char *end_string; |
---|
144 | char *asciifilter; |
---|
145 | char asciiname[MAXNAMELEN]; |
---|
146 | char start_file[MAXFILELEN]; |
---|
147 | char end_file[MAXFILELEN]; |
---|
148 | char *printer_str; |
---|
149 | |
---|
150 | file_obj_ptr file_list; |
---|
151 | |
---|
152 | s_Adobe adobe; |
---|
153 | s_notification notify_type; |
---|
154 | hsw_PCONFIG *prt_list; /* List of serial and parallel prts*/ |
---|
155 | int acctg; |
---|
156 | } s_options; |
---|
157 | |
---|
158 | /* Function prototypes */ |
---|
159 | |
---|
160 | #if defined(__cplusplus) |
---|
161 | #define EXTERNAL_FUNCTION( funName, params ) extern "C" { funName params; } |
---|
162 | #else |
---|
163 | #if defined(ANSI) || defined(__STDC__) |
---|
164 | #define EXTERNAL_FUNCTION( funName, params ) funName params |
---|
165 | #else |
---|
166 | #define EXTERNAL_FUNCTION( funName, params ) funName() |
---|
167 | #endif |
---|
168 | #endif |
---|
169 | |
---|
170 | EXTERNAL_FUNCTION(void systemNoWait, |
---|
171 | (char* cmd)); |
---|
172 | EXTERNAL_FUNCTION(void sig_child, |
---|
173 | ()); |
---|
174 | EXTERNAL_FUNCTION(int parseCommandLineArgs, |
---|
175 | (int argc, char **argv)); |
---|
176 | EXTERNAL_FUNCTION(void expand_char, |
---|
177 | ()); |
---|
178 | EXTERNAL_FUNCTION(void get_printername, |
---|
179 | (char *printer)); |
---|
180 | EXTERNAL_FUNCTION(void error_notify, |
---|
181 | (int err_no, char* message)); |
---|
182 | EXTERNAL_FUNCTION(void error_protect, |
---|
183 | (int err_no)); |
---|
184 | EXTERNAL_FUNCTION(hsw_PCONFIG* form_printer_list, |
---|
185 | (char* string, hsw_PCONFIG *ptr_ptr, int ptype, int where)); |
---|
186 | EXTERNAL_FUNCTION(char* parse_string, |
---|
187 | (char* str)); |
---|
188 | EXTERNAL_FUNCTION(void add_file, |
---|
189 | (file_obj_ptr *flist, char *file_to_add)); |
---|
190 | EXTERNAL_FUNCTION(int sendfile, |
---|
191 | (int sock, char *file_to_send, int output_dest, |
---|
192 | int check_postscript, char *printer)); |
---|
193 | EXTERNAL_FUNCTION(void check_input, |
---|
194 | (int sock, int output_dest, int timeout)); |
---|
195 | EXTERNAL_FUNCTION(void send_control_d, |
---|
196 | (int sock)); |
---|
197 | EXTERNAL_FUNCTION(void check_alarm, |
---|
198 | ()); |
---|
199 | EXTERNAL_FUNCTION(char *expand_buffer, |
---|
200 | (char *, int, int *)); |
---|
201 | EXTERNAL_FUNCTION(void send_banner, |
---|
202 | ()); |
---|
203 | EXTERNAL_FUNCTION(void update_status_file,(char *message,int status_num,int style)); |
---|
204 | EXTERNAL_FUNCTION(void write_buffer,(int sock, char *buffer, int length,char *printer_name,int output_dest)); |
---|
205 | |
---|
206 | EXTERNAL_FUNCTION(void check_write,(int sock)); |
---|
207 | EXTERNAL_FUNCTION(void do_acctg,(char *file)); |
---|
208 | |
---|
209 | #endif /* DEEPEE_H */ |
---|
210 | |
---|
211 | #define APPEND 0 |
---|
212 | #define CREATE 1 |
---|
213 | |
---|
214 | extern s_options g_opt; |
---|