… | |
… | |
15 | */ |
15 | */ |
16 | |
16 | |
17 | #ifndef __UUINT_H__ |
17 | #ifndef __UUINT_H__ |
18 | #define __UUINT_H__ |
18 | #define __UUINT_H__ |
19 | |
19 | |
|
|
20 | #include <stdio.h> |
|
|
21 | |
|
|
22 | #include "uudeview.h" |
|
|
23 | |
20 | /* |
24 | /* |
21 | * This file describes the internal structures, variables and definitions |
25 | * This file describes the internal structures, variables and definitions |
22 | * of UUDeview. It should not be included from other packages. Subject to |
26 | * of UUDeview. It should not be included from other packages. Subject to |
23 | * change without notice. Do not depend on anything here. |
27 | * change without notice. Do not depend on anything here. |
24 | * |
28 | */ |
25 | * $Id: uuint.h,v 1.2.2.5 2004/04/18 19:55:46 root Exp $ |
|
|
26 | */ |
|
|
27 | |
29 | |
28 | #ifndef _ANSI_ARGS_ |
30 | #if COMPILE_SEPERATELY |
29 | #ifdef PROTOTYPES |
31 | #define UULIBINT_VAR extern |
30 | #define _ANSI_ARGS_(c) c |
32 | #define UULIBINT_FUNC |
31 | #else |
33 | #else |
32 | #define _ANSI_ARGS_(c) () |
34 | #define UULIBINT_VAR extern |
33 | #endif |
35 | #define UULIBINT_FUNC static |
34 | #endif |
36 | #endif |
35 | |
37 | |
36 | /* |
38 | /* |
37 | * Busy Polls will be made after processing ... lines |
39 | * Busy Polls will be made after processing ... lines |
38 | */ |
40 | */ |
… | |
… | |
75 | * by zero for b<100 and the result doesn't become larger than 100% |
77 | * by zero for b<100 and the result doesn't become larger than 100% |
76 | */ |
78 | */ |
77 | |
79 | |
78 | #define UUPERCENT(a,b) ((int) ((unsigned long)(a) / \ |
80 | #define UUPERCENT(a,b) ((int) ((unsigned long)(a) / \ |
79 | (((unsigned long)(b)/100)+1))) |
81 | (((unsigned long)(b)/100)+1))) |
80 | |
82 | |
81 | /* |
83 | /* |
82 | * Make the Busy Callback easier. The macro returns true if the BusyCallback |
84 | * Make the Busy Callback easier. The macro returns true if the BusyCallback |
83 | * wants us to terminate. |
85 | * wants us to terminate. |
84 | */ |
86 | */ |
85 | |
87 | |
86 | extern unsigned long uuyctr; |
88 | UULIBINT_VAR unsigned long uuyctr; |
87 | #define UUBUSYPOLL(a,b) (((++uuyctr%BUSY_LINE_TICKS)==0) ? (progress.percent=UUPERCENT((a),(b)),UUBusyPoll()):0) |
89 | #define UUBUSYPOLL(a,b) (((++uuyctr%BUSY_LINE_TICKS)==0) ? (progress.percent=UUPERCENT((a),(b)),UUBusyPoll()):0) |
88 | |
90 | |
89 | /* |
91 | /* |
90 | * How many lines of headers do we need to believe another mail |
92 | * How many lines of headers do we need to believe another mail |
91 | * header is approaching? Use more restrictive values for MIME |
93 | * header is approaching? Use more restrictive values for MIME |
… | |
… | |
96 | int restart; /* restarting after a MIME body (not subpart) */ |
98 | int restart; /* restarting after a MIME body (not subpart) */ |
97 | int afterdata; /* after we had useful data in freestyle mode */ |
99 | int afterdata; /* after we had useful data in freestyle mode */ |
98 | int afternl; /* after an empty line in freestyle mode */ |
100 | int afternl; /* after an empty line in freestyle mode */ |
99 | } headercount; |
101 | } headercount; |
100 | |
102 | |
101 | extern headercount hlcount; |
103 | UULIBINT_VAR headercount hlcount; |
102 | |
104 | |
103 | /* |
105 | /* |
104 | * Information from the headers of a message. Each instance must |
106 | * Information from the headers of a message. Each instance must |
105 | * have its very own copy of the strings. If `mimevers' is NULL, |
107 | * have its very own copy of the strings. If `mimevers' is NULL, |
106 | * then this message does not comply to the MIME standard. |
108 | * then this message does not comply to the MIME standard. |
… | |
… | |
132 | int mimeenc; /* encoding of this MIME file */ |
134 | int mimeenc; /* encoding of this MIME file */ |
133 | char *source; /* source filename */ |
135 | char *source; /* source filename */ |
134 | headers envelope; /* mail envelope headers */ |
136 | headers envelope; /* mail envelope headers */ |
135 | } scanstate; |
137 | } scanstate; |
136 | |
138 | |
137 | /* |
139 | UULIBINT_VAR void *uu_MsgCBArg; |
138 | * Structure that holds the information for a single file / part of |
140 | UULIBINT_VAR void *uu_BusyCBArg; |
139 | * a file. If a subject line is encountered, it is copied to subject; |
141 | UULIBINT_VAR void *uu_FileCBArg; |
140 | * if a begin is found, the mode and name of the file is extracted. |
142 | UULIBINT_VAR void *uu_FFCBArg; |
141 | * flags are set if 'begin' or 'end' is detected and 'uudet' if valid |
143 | UULIBINT_VAR void *uu_FNCBArg; |
142 | * uuencoded data is found. If the file contains a 'From:' line with |
|
|
143 | * a '@' in it (indicating an origin email address), it is preserved |
|
|
144 | * in 'origin'. |
|
|
145 | **/ |
|
|
146 | |
|
|
147 | typedef struct _fileread { |
|
|
148 | char *subject; /* Whole subject line */ |
|
|
149 | char *filename; /* Only filled in if begin detected */ |
|
|
150 | char *origin; /* Whole 'From:' line */ |
|
|
151 | char *mimeid; /* the ID for Mime-encoded files */ |
|
|
152 | char *mimetype; /* Content-Type */ |
|
|
153 | short mode; /* Mode of File (from 'begin') */ |
|
|
154 | int begin; /* begin detected */ |
|
|
155 | int end; /* end detected */ |
|
|
156 | int flags; /* associated flags */ |
|
|
157 | |
|
|
158 | short uudet; /* valid encoded data. value indicates encoding */ |
|
|
159 | short partno; /* Mime-files have a part number within */ |
|
|
160 | short maxpno; /* ... plus the total number of parts */ |
|
|
161 | |
|
|
162 | char *sfname; /* Associated source file */ |
|
|
163 | long startpos; /* ftell() position where data starts */ |
|
|
164 | long length; /* length of data */ |
|
|
165 | } fileread; |
|
|
166 | |
|
|
167 | /* |
|
|
168 | * Structure for holding one part of a file, with some more information |
|
|
169 | * about it. The UUPreProcessPart() function takes one a fileread structure |
|
|
170 | * and produces this uufile structure. |
|
|
171 | * Linked List, ordered by partno. |
|
|
172 | **/ |
|
|
173 | |
|
|
174 | typedef struct _uufile { |
|
|
175 | char *filename; |
|
|
176 | char *subfname; |
|
|
177 | char *mimeid; |
|
|
178 | char *mimetype; |
|
|
179 | short partno; |
|
|
180 | fileread *data; |
|
|
181 | struct _uufile *NEXT; |
|
|
182 | } uufile; |
|
|
183 | |
|
|
184 | extern void *uu_MsgCBArg; |
|
|
185 | extern void *uu_BusyCBArg; |
|
|
186 | extern void *uu_FileCBArg; |
|
|
187 | extern void *uu_FFCBArg; |
|
|
188 | |
144 | |
189 | /* |
145 | /* |
190 | * variables |
146 | * variables |
191 | */ |
147 | */ |
192 | |
148 | |
193 | extern int uu_fast_scanning; |
149 | UULIBINT_VAR int uu_autocheck; |
194 | extern int uu_bracket_policy; |
150 | UULIBINT_VAR int uu_rbuf; |
195 | extern int uu_verbose; |
151 | UULIBINT_VAR int uu_wbuf; |
196 | extern int uu_desperate; |
152 | #define UUSETBUF(fp,buff,size) if (size) setvbuf ((fp), ((buff) = malloc (size)), _IOFBF, (size)) |
197 | extern int uu_ignreply; |
153 | #define UUCLRBUF(size,buff) if (size) free (buff) |
198 | extern int uu_debug; |
|
|
199 | extern int uu_errno; |
|
|
200 | extern int uu_dumbness; |
|
|
201 | extern int uu_overwrite; |
|
|
202 | extern int uu_ignmode; |
|
|
203 | extern int uu_headercount; |
|
|
204 | extern int uu_usepreamble; |
|
|
205 | extern int uu_handletext; |
|
|
206 | extern int uu_tinyb64; |
|
|
207 | extern int uu_remove_input; |
|
|
208 | extern int uu_more_mime; |
|
|
209 | |
154 | |
210 | extern char *uusavepath; |
155 | UULIBINT_VAR int uu_fast_scanning; |
211 | extern char *uuencodeext; |
156 | UULIBINT_VAR int uu_bracket_policy; |
|
|
157 | UULIBINT_VAR int uu_verbose; |
|
|
158 | UULIBINT_VAR int uu_desperate; |
|
|
159 | UULIBINT_VAR int uu_ignreply; |
|
|
160 | UULIBINT_VAR int uu_debug; |
|
|
161 | UULIBINT_VAR int uu_errno; |
|
|
162 | UULIBINT_VAR int uu_dumbness; |
|
|
163 | UULIBINT_VAR int uu_overwrite; |
|
|
164 | UULIBINT_VAR int uu_ignmode; |
|
|
165 | UULIBINT_VAR int uu_headercount; |
|
|
166 | UULIBINT_VAR int uu_usepreamble; |
|
|
167 | UULIBINT_VAR int uu_handletext; |
|
|
168 | UULIBINT_VAR int uu_tinyb64; |
|
|
169 | UULIBINT_VAR int uu_remove_input; |
|
|
170 | UULIBINT_VAR int uu_more_mime; |
|
|
171 | UULIBINT_VAR int uu_dotdot; |
|
|
172 | |
|
|
173 | UULIBINT_VAR char *uusavepath; |
|
|
174 | UULIBINT_VAR char *uuencodeext; |
212 | |
175 | |
213 | /* |
176 | /* |
214 | * Encoding/Decoding tables |
177 | * Encoding/Decoding tables |
215 | */ |
178 | */ |
216 | |
179 | |
217 | extern unsigned char UUEncodeTable[]; |
180 | UULIBINT_VAR unsigned char UUEncodeTable[]; |
218 | extern unsigned char XXEncodeTable[]; |
181 | UULIBINT_VAR unsigned char XXEncodeTable[]; |
219 | extern unsigned char B64EncodeTable[]; |
182 | UULIBINT_VAR unsigned char B64EncodeTable[]; |
220 | extern unsigned char BHEncodeTable[]; |
183 | UULIBINT_VAR unsigned char BHEncodeTable[]; |
221 | |
184 | |
222 | /* |
185 | /* |
223 | * String tables from uustring.c |
186 | * String tables from uustring.c |
224 | */ |
187 | */ |
225 | |
188 | |
226 | extern char *msgnames[]; |
189 | UULIBINT_VAR char *msgnames[]; |
227 | extern char *codenames[]; |
190 | UULIBINT_VAR char *codenames[]; |
228 | extern char *uuretcodes[]; |
191 | UULIBINT_VAR char *uuretcodes[]; |
229 | |
|
|
230 | extern uulist *UUGlobalFileList; |
|
|
231 | |
192 | |
232 | /* |
193 | /* |
233 | * State of MIME variables and current progress |
194 | * State of MIME variables and current progress |
234 | */ |
195 | */ |
235 | |
196 | |
236 | extern int nofnum, mssdepth; |
197 | UULIBINT_VAR int nofnum, mssdepth; |
237 | extern int mimseqno, lastvalid; |
198 | UULIBINT_VAR int mimseqno, lastvalid; |
238 | extern int lastenc; |
199 | UULIBINT_VAR int lastenc; |
239 | extern scanstate multistack[]; |
200 | UULIBINT_VAR scanstate multistack[]; |
240 | extern headers localenv; |
201 | UULIBINT_VAR headers localenv; |
241 | extern scanstate sstate; |
202 | UULIBINT_VAR scanstate sstate; |
242 | extern uuprogress progress; |
203 | UULIBINT_VAR uuprogress progress; |
243 | |
204 | |
244 | /* |
205 | /* |
245 | * mallocable areas |
206 | * mallocable areas |
246 | */ |
207 | */ |
247 | |
208 | |
248 | extern char *uugen_fnbuffer, *uugen_inbuffer; |
209 | UULIBINT_VAR char *uugen_fnbuffer, *uugen_inbuffer; |
249 | extern char *uucheck_lastname, *uucheck_tempname; |
210 | UULIBINT_VAR char *uucheck_lastname, *uucheck_tempname; |
250 | extern char *uuestr_itemp, *uuestr_otemp; |
211 | UULIBINT_VAR char *uuestr_itemp, *uuestr_otemp; |
251 | extern char *uulib_msgstring, *uuncdl_fulline; |
212 | UULIBINT_VAR char *uulib_msgstring, *uuncdl_fulline; |
252 | extern char *uuncdp_oline, *uuscan_shlline, *uuscan_shlline2; |
213 | UULIBINT_VAR char *uuncdp_oline, *uuscan_shlline, *uuscan_shlline2; |
253 | extern char *uuscan_pvvalue, *uuscan_phtext; |
214 | UULIBINT_VAR char *uuscan_pvvalue, *uuscan_phtext; |
254 | extern char *uuscan_sdline, *uuscan_sdbhds1; |
215 | UULIBINT_VAR char *uuscan_sdline, *uuscan_sdbhds1; |
255 | extern char *uuscan_sdbhds2, *uuscan_spline; |
216 | UULIBINT_VAR char *uuscan_sdbhds2, *uuscan_spline; |
256 | extern char *uuutil_bhwtmp; |
217 | UULIBINT_VAR char *uuutil_bhwtmp; |
257 | extern char *uunconc_UUxlat, *uunconc_UUxlen; |
218 | UULIBINT_VAR char *uunconc_UUxlat, *uunconc_UUxlen; |
258 | extern char *uunconc_B64xlat, *uunconc_XXxlat; |
219 | UULIBINT_VAR char *uunconc_B64xlat, *uunconc_XXxlat; |
259 | extern char *uunconc_BHxlat, *uunconc_save; |
220 | UULIBINT_VAR char *uunconc_BHxlat, *uunconc_save; |
260 | |
221 | |
261 | #ifdef __cplusplus |
222 | #ifdef __cplusplus |
262 | extern "C" { |
223 | extern "C" { |
263 | #endif |
224 | #endif |
264 | |
225 | |
265 | extern void (*uu_MsgCallback) _ANSI_ARGS_((void *, char *, int)); |
|
|
266 | extern int (*uu_BusyCallback) _ANSI_ARGS_((void *, uuprogress *)); |
|
|
267 | extern int (*uu_FileCallback) _ANSI_ARGS_((void *, char *, char *, int)); |
|
|
268 | extern char * (*uu_FNameFilter) _ANSI_ARGS_((void *, char *)); |
|
|
269 | |
|
|
270 | /* |
226 | /* |
271 | * Functions from uulib.c that aren't defined in <uudeview.h> |
227 | * Functions from uulib.c that aren't defined in <uudeview.h> |
272 | * Be careful about the definition with variable arguments. |
228 | * Be careful about the definition with variable arguments. |
273 | */ |
229 | */ |
274 | |
230 | |
275 | #if defined(STDC_HEADERS) || defined(HAVE_STDARG_H) |
231 | #define UUMessage(level, ...) UUMessage_ (__FILE__, __LINE__ * 16 + level, __VA_ARGS__) |
276 | int UUMessage _ANSI_ARGS_((char *, int, |
232 | UULIBINT_FUNC int UUMessage_ (const char *, int, const char *, ...); |
277 | int, char *, ...)); |
233 | UULIBINT_FUNC int UUBusyPoll (void); |
278 | #else |
|
|
279 | int UUMessage (); |
|
|
280 | #endif |
|
|
281 | int UUBusyPoll _ANSI_ARGS_((void)); |
|
|
282 | |
234 | |
283 | /* |
235 | /* |
284 | * Functions from uucheck.c |
236 | * Functions from uucheck.c |
285 | */ |
237 | */ |
286 | |
238 | |
287 | uufile * UUPreProcessPart _ANSI_ARGS_((fileread *, int *)); |
239 | UULIBINT_FUNC uufile * UUPreProcessPart (fileread *, int *); |
288 | int UUInsertPartToList _ANSI_ARGS_((uufile *)); |
240 | UULIBINT_FUNC int UUInsertPartToList (uufile *); |
289 | uulist * UUCheckGlobalList _ANSI_ARGS_((void)); |
|
|
290 | |
241 | |
291 | /* |
242 | /* |
292 | * Functions from uuutil.c |
243 | * Functions from uuutil.c |
293 | */ |
244 | */ |
294 | |
245 | |
295 | void UUkillfread _ANSI_ARGS_((fileread *)); |
246 | UULIBINT_FUNC void UUkillfread (fileread *); |
296 | void UUkillfile _ANSI_ARGS_((uufile *)); |
247 | UULIBINT_FUNC void UUkillfile (uufile *); |
297 | void UUkilllist _ANSI_ARGS_((uulist *)); |
248 | UULIBINT_FUNC void UUkilllist (uulist *); |
298 | void UUkillheaders _ANSI_ARGS_((headers *)); |
249 | UULIBINT_FUNC void UUkillheaders (headers *); |
299 | |
250 | |
300 | fileread * ScanPart _ANSI_ARGS_((FILE *, char *, int *)); |
251 | UULIBINT_FUNC fileread *UUScanPart (FILE *, char *, int *); |
301 | |
252 | |
302 | int UUbhdecomp _ANSI_ARGS_((char *, char *, |
253 | UULIBINT_FUNC int UUbhdecomp (char *, char *, |
303 | char *, int *, |
254 | char *, int *, |
304 | size_t, size_t, |
255 | size_t, size_t, |
305 | size_t *)); |
256 | size_t *); |
306 | size_t UUbhwrite _ANSI_ARGS_((char *, size_t, size_t, |
257 | UULIBINT_FUNC size_t UUbhwrite (char *, size_t, size_t, FILE *); |
307 | FILE *)); |
|
|
308 | |
258 | |
309 | /* |
259 | /* |
310 | * Functions from uunconc.c |
260 | * Functions from uunconc.c |
311 | */ |
261 | */ |
312 | |
262 | |
313 | int UURepairData _ANSI_ARGS_((FILE *, char *, |
263 | UULIBINT_FUNC int UURepairData (FILE *, char *, int, int *); |
314 | int, int *)); |
|
|
315 | |
264 | |
316 | void UUInitConc _ANSI_ARGS_((void)); |
265 | UULIBINT_FUNC void UUInitConc (void); |
317 | int UUValidData _ANSI_ARGS_((char *, int, int *)); |
266 | UULIBINT_FUNC int UUValidData (char *, int, int *); |
318 | size_t UUDecodeLine _ANSI_ARGS_((char *, char *, int)); |
267 | UULIBINT_FUNC size_t UUDecodeLine (char *, char *, int); |
319 | int UUDecodeField _ANSI_ARGS_((char *, char *, int)); |
268 | UULIBINT_FUNC int UUDecodeField (char *, char *, int); |
320 | int UUDecodePart _ANSI_ARGS_((FILE *, FILE *, int *, |
269 | UULIBINT_FUNC int UUDecodePart (FILE *, FILE *, int *, |
321 | long, int, int, char *)); |
270 | long, int, int, char *); |
322 | int UUDecode _ANSI_ARGS_((uulist *)); |
271 | UULIBINT_FUNC int UUDecode (uulist *); |
323 | |
272 | |
324 | /* |
273 | /* |
325 | * Message retrieval from uustring.c |
274 | * Message retrieval from uustring.c |
326 | */ |
275 | */ |
327 | |
276 | |
328 | char * uustring _ANSI_ARGS_((int)); |
277 | UULIBINT_FUNC char * uustring (int); |
329 | |
278 | |
330 | /* |
279 | /* |
331 | * From uuscan.c |
280 | * From uuscan.c |
332 | */ |
281 | */ |
333 | |
282 | |
334 | int UUScanHeader _ANSI_ARGS_((FILE *, headers *)); |
283 | UULIBINT_FUNC int UUScanHeader (FILE *, headers *); |
335 | |
284 | |
336 | #ifdef __cplusplus |
285 | #ifdef __cplusplus |
337 | } |
286 | } |
338 | #endif |
287 | #endif |
339 | #endif |
288 | #endif |