… | |
… | |
41 | if (strEQ(name, "MSG_MESSAGE")) return UUMSG_MESSAGE; |
41 | if (strEQ(name, "MSG_MESSAGE")) return UUMSG_MESSAGE; |
42 | if (strEQ(name, "MSG_NOTE")) return UUMSG_NOTE; |
42 | if (strEQ(name, "MSG_NOTE")) return UUMSG_NOTE; |
43 | if (strEQ(name, "MSG_PANIC")) return UUMSG_PANIC; |
43 | if (strEQ(name, "MSG_PANIC")) return UUMSG_PANIC; |
44 | if (strEQ(name, "MSG_WARNING")) return UUMSG_WARNING; |
44 | if (strEQ(name, "MSG_WARNING")) return UUMSG_WARNING; |
45 | case 'O': |
45 | case 'O': |
|
|
46 | if (strEQ(name, "OPT_VERSION")) return UUOPT_VERSION; |
|
|
47 | if (strEQ(name, "OPT_FAST")) return UUOPT_FAST; |
|
|
48 | if (strEQ(name, "OPT_DUMBNESS")) return UUOPT_DUMBNESS; |
46 | if (strEQ(name, "OPT_BRACKPOL")) return UUOPT_BRACKPOL; |
49 | if (strEQ(name, "OPT_BRACKPOL")) return UUOPT_BRACKPOL; |
47 | if (strEQ(name, "OPT_DEBUG")) return UUOPT_DEBUG; |
50 | if (strEQ(name, "OPT_VERBOSE")) return UUOPT_VERBOSE; |
48 | if (strEQ(name, "OPT_DESPERATE")) return UUOPT_DESPERATE; |
51 | if (strEQ(name, "OPT_DESPERATE")) return UUOPT_DESPERATE; |
49 | if (strEQ(name, "OPT_DUMBNESS")) return UUOPT_DUMBNESS; |
|
|
50 | if (strEQ(name, "OPT_ENCEXT")) return UUOPT_ENCEXT; |
|
|
51 | if (strEQ(name, "OPT_ERRNO")) return UUOPT_ERRNO; |
|
|
52 | if (strEQ(name, "OPT_FAST")) return UUOPT_FAST; |
|
|
53 | if (strEQ(name, "OPT_IGNMODE")) return UUOPT_IGNMODE; |
|
|
54 | if (strEQ(name, "OPT_IGNREPLY")) return UUOPT_IGNREPLY; |
52 | if (strEQ(name, "OPT_IGNREPLY")) return UUOPT_IGNREPLY; |
55 | if (strEQ(name, "OPT_OVERWRITE")) return UUOPT_OVERWRITE; |
53 | if (strEQ(name, "OPT_OVERWRITE")) return UUOPT_OVERWRITE; |
|
|
54 | if (strEQ(name, "OPT_SAVEPATH")) return UUOPT_SAVEPATH; |
|
|
55 | if (strEQ(name, "OPT_IGNMODE")) return UUOPT_IGNMODE; |
|
|
56 | if (strEQ(name, "OPT_DEBUG")) return UUOPT_DEBUG; |
|
|
57 | if (strEQ(name, "OPT_ERRNO")) return UUOPT_ERRNO; |
|
|
58 | if (strEQ(name, "OPT_PROGRESS")) return UUOPT_PROGRESS; |
|
|
59 | if (strEQ(name, "OPT_USETEXT")) return UUOPT_USETEXT; |
56 | if (strEQ(name, "OPT_PREAMB")) return UUOPT_PREAMB; |
60 | if (strEQ(name, "OPT_PREAMB")) return UUOPT_PREAMB; |
57 | if (strEQ(name, "OPT_PROGRESS")) return UUOPT_PROGRESS; |
|
|
58 | if (strEQ(name, "OPT_SAVEPATH")) return UUOPT_SAVEPATH; |
|
|
59 | if (strEQ(name, "OPT_TINYB64")) return UUOPT_TINYB64; |
61 | if (strEQ(name, "OPT_TINYB64")) return UUOPT_TINYB64; |
60 | if (strEQ(name, "OPT_USETEXT")) return UUOPT_USETEXT; |
62 | if (strEQ(name, "OPT_ENCEXT")) return UUOPT_ENCEXT; |
61 | if (strEQ(name, "OPT_VERBOSE")) return UUOPT_VERBOSE; |
|
|
62 | if (strEQ(name, "OPT_VERSION")) return UUOPT_VERSION; |
|
|
63 | if (strEQ(name, "OPT_REMOVE")) return UUOPT_REMOVE; |
63 | if (strEQ(name, "OPT_REMOVE")) return UUOPT_REMOVE; |
64 | if (strEQ(name, "OPT_MOREMIME")) return UUOPT_MOREMIME; |
64 | if (strEQ(name, "OPT_MOREMIME")) return UUOPT_MOREMIME; |
|
|
65 | if (strEQ(name, "OPT_DOTDOT")) return UUOPT_DOTDOT; |
65 | case 'R': |
66 | case 'R': |
66 | if (strEQ(name, "RET_CANCEL")) return UURET_CANCEL; |
67 | if (strEQ(name, "RET_CANCEL")) return UURET_CANCEL; |
67 | if (strEQ(name, "RET_CONT")) return UURET_CONT; |
68 | if (strEQ(name, "RET_CONT")) return UURET_CONT; |
68 | if (strEQ(name, "RET_EXISTS")) return UURET_EXISTS; |
69 | if (strEQ(name, "RET_EXISTS")) return UURET_EXISTS; |
69 | if (strEQ(name, "RET_ILLVAL")) return UURET_ILLVAL; |
70 | if (strEQ(name, "RET_ILLVAL")) return UURET_ILLVAL; |
… | |
… | |
72 | if (strEQ(name, "RET_NOEND")) return UURET_NOEND; |
73 | if (strEQ(name, "RET_NOEND")) return UURET_NOEND; |
73 | if (strEQ(name, "RET_NOMEM")) return UURET_NOMEM; |
74 | if (strEQ(name, "RET_NOMEM")) return UURET_NOMEM; |
74 | if (strEQ(name, "RET_OK")) return UURET_OK; |
75 | if (strEQ(name, "RET_OK")) return UURET_OK; |
75 | if (strEQ(name, "RET_UNSUP")) return UURET_UNSUP; |
76 | if (strEQ(name, "RET_UNSUP")) return UURET_UNSUP; |
76 | case 'B': |
77 | case 'B': |
77 | if (strEQ(name, "B64ENCODED")) return B64ENCODED; |
78 | if (strEQ(name, "B64_ENCODED")) return B64ENCODED; |
78 | if (strEQ(name, "BH_ENCODED")) return BH_ENCODED; |
79 | if (strEQ(name, "BH_ENCODED")) return BH_ENCODED; |
79 | case 'P': |
80 | case 'P': |
80 | if (strEQ(name, "PT_ENCODED")) return PT_ENCODED; |
81 | if (strEQ(name, "PT_ENCODED")) return PT_ENCODED; |
81 | case 'Q': |
82 | case 'Q': |
82 | if (strEQ(name, "QP_ENCODED")) return QP_ENCODED; |
83 | if (strEQ(name, "QP_ENCODED")) return QP_ENCODED; |
… | |
… | |
179 | PUTBACK; FREETMPS; LEAVE; |
180 | PUTBACK; FREETMPS; LEAVE; |
180 | |
181 | |
181 | return retval; |
182 | return retval; |
182 | } |
183 | } |
183 | |
184 | |
|
|
185 | static char *uu_filename_callback (void *cb, char *subject, char *filename) |
|
|
186 | { |
|
|
187 | dSP; |
|
|
188 | int count; |
|
|
189 | SV *retval; |
|
|
190 | STRLEN dc; |
|
|
191 | |
|
|
192 | ENTER; SAVETMPS; PUSHMARK(SP); EXTEND(SP,3); |
|
|
193 | |
|
|
194 | PUSHs(sv_2mortal(newSVpv(subject, 0))); |
|
|
195 | PUSHs(filename ? sv_2mortal(newSVpv(filename, 0)) : &PL_sv_undef); |
|
|
196 | |
|
|
197 | PUTBACK; count = perl_call_sv ((SV *)cb, G_ARRAY); SPAGAIN; |
|
|
198 | |
|
|
199 | if (count > 1) |
|
|
200 | croak ("filenamecallback perl callback returned more than one argument"); |
|
|
201 | |
|
|
202 | if (count) |
|
|
203 | { |
|
|
204 | _FP_free (filename); |
|
|
205 | |
|
|
206 | retval = POPs; |
|
|
207 | |
|
|
208 | if (SvOK (retval)) |
|
|
209 | { |
|
|
210 | STRLEN len; |
|
|
211 | char *fn = SvPV (retval, len); |
|
|
212 | |
|
|
213 | filename = malloc (len + 1); |
|
|
214 | |
|
|
215 | if (filename) |
|
|
216 | { |
|
|
217 | memcpy (filename, fn, len); |
|
|
218 | filename[len] = 0; |
|
|
219 | } |
|
|
220 | } |
|
|
221 | else |
|
|
222 | filename = 0; |
|
|
223 | } |
|
|
224 | |
|
|
225 | PUTBACK; FREETMPS; LEAVE; |
|
|
226 | |
|
|
227 | return filename; |
|
|
228 | } |
|
|
229 | |
184 | static SV *uu_msg_sv, *uu_busy_sv, *uu_file_sv, *uu_fnamefilter_sv; |
230 | static SV *uu_msg_sv, *uu_busy_sv, *uu_file_sv, *uu_fnamefilter_sv, *uu_filename_sv; |
185 | |
231 | |
186 | #define FUNC_CB(cb) (void *)(sv_setsv (cb ## _sv, func), cb ## _sv), func ? cb ## _callback : NULL |
232 | #define FUNC_CB(cb) (void *)(sv_setsv (cb ## _sv, func), cb ## _sv), func ? cb ## _callback : NULL |
187 | |
233 | |
188 | static int uu_info_file(void *cb, char *info) |
234 | static int uu_info_file(void *cb, char *info) |
189 | { |
235 | { |
… | |
… | |
317 | void |
363 | void |
318 | UUSetFNameFilter(func=0) |
364 | UUSetFNameFilter(func=0) |
319 | SV * func |
365 | SV * func |
320 | CODE: |
366 | CODE: |
321 | UUSetFNameFilter (FUNC_CB(uu_fnamefilter)); |
367 | UUSetFNameFilter (FUNC_CB(uu_fnamefilter)); |
|
|
368 | |
|
|
369 | void |
|
|
370 | UUSetFileNameCallback(func=0) |
|
|
371 | SV * func |
|
|
372 | CODE: |
|
|
373 | UUSetFileNameCallback (FUNC_CB(uu_filename)); |
322 | |
374 | |
323 | char * |
375 | char * |
324 | UUFNameFilter(fname) |
376 | UUFNameFilter(fname) |
325 | char * fname |
377 | char * fname |
326 | |
378 | |
… | |
… | |
575 | p = p->NEXT; |
627 | p = p->NEXT; |
576 | } |
628 | } |
577 | } |
629 | } |
578 | |
630 | |
579 | BOOT: |
631 | BOOT: |
580 | uu_msg_sv = newSVsv(&PL_sv_undef); |
632 | uu_msg_sv = newSVsv(&PL_sv_undef); |
581 | uu_busy_sv = newSVsv(&PL_sv_undef); |
633 | uu_busy_sv = newSVsv(&PL_sv_undef); |
582 | uu_file_sv = newSVsv(&PL_sv_undef); |
634 | uu_file_sv = newSVsv(&PL_sv_undef); |
583 | uu_fnamefilter_sv = newSVsv(&PL_sv_undef); |
635 | uu_fnamefilter_sv = newSVsv(&PL_sv_undef); |
|
|
636 | uu_filename_sv = newSVsv(&PL_sv_undef); |
584 | |
637 | |