#include <errno.h>
#include <setjmp.h>
#include <signal.h>
-#include <h/mts.h>
#include <h/tws.h>
#include <h/mime.h>
#include <h/mhparse.h>
};
-/* ftpsbr.c */
-int ftp_get(char *, char *, char *, char *, char *, char *, int, int);
-
/* mhcachesbr.c */
int find_cache(CT, int, int *, char *, char *, int);
CE ce;
static char *username = NULL;
static char *password = NULL;
+ int child_id, i, vecp;
+ char *vec[9];
e = ct->c_ctexbody;
ce = ct->c_cefile;
if ((ftp = context_find(nmhaccessftp)) && !*ftp)
ftp = NULL;
-#ifndef BUILTIN_FTP
if (!ftp)
return NOTOK;
-#endif
switch (openExternal(e->eb_parent, e->eb_content, ce, file, &fd)) {
case NOTOK:
return NOTOK;
}
-#ifdef BUILTIN_FTP
- if (ftp)
-#endif
- {
- int child_id, i, vecp;
- char *vec[9];
-
- vecp = 0;
- vec[vecp++] = mhbasename(ftp);
- vec[vecp++] = e->eb_site;
- vec[vecp++] = user;
- vec[vecp++] = pass;
- vec[vecp++] = e->eb_dir;
- vec[vecp++] = e->eb_name;
- vec[vecp++] = ce->ce_file,
- vec[vecp++] = e->eb_mode &&
- !mh_strcasecmp(e->eb_mode, "ascii") ?
- "ascii" : "binary";
- vec[vecp] = NULL;
-
- fflush(stdout);
-
- for (i = 0; (child_id = fork()) == NOTOK && i < 5; i++)
- sleep(5);
- switch (child_id) {
- case NOTOK:
- adios("fork", "unable to");
- /* NOTREACHED */
+ vecp = 0;
+ vec[vecp++] = mhbasename(ftp);
+ vec[vecp++] = e->eb_site;
+ vec[vecp++] = user;
+ vec[vecp++] = pass;
+ vec[vecp++] = e->eb_dir;
+ vec[vecp++] = e->eb_name;
+ vec[vecp++] = ce->ce_file,
+ vec[vecp++] = e->eb_mode &&
+ !mh_strcasecmp(e->eb_mode, "ascii") ?
+ "ascii" : "binary";
+ vec[vecp] = NULL;
- case OK:
- close(fileno(ce->ce_fp));
- execvp(ftp, vec);
- fprintf(stderr, "unable to exec ");
- perror(ftp);
- _exit(-1);
- /* NOTREACHED */
+ fflush(stdout);
- default:
- if (pidXwait(child_id, NULL)) {
-#ifdef BUILTIN_FTP
-losing_ftp:
-#endif
- username = password = NULL;
- ce->ce_unlink = 1;
- return NOTOK;
- }
- break;
+ for (i = 0; (child_id = fork()) == NOTOK && i < 5; i++)
+ sleep(5);
+ switch (child_id) {
+ case NOTOK:
+ adios("fork", "unable to");
+ /* NOTREACHED */
+
+ case OK:
+ close(fileno(ce->ce_fp));
+ execvp(ftp, vec);
+ fprintf(stderr, "unable to exec ");
+ perror(ftp);
+ _exit(-1);
+ /* NOTREACHED */
+
+ default:
+ if (pidXwait(child_id, NULL)) {
+ username = password = NULL;
+ ce->ce_unlink = 1;
+ return NOTOK;
}
+ break;
}
-#ifdef BUILTIN_FTP
- else if (ftp_get(e->eb_site, user, pass, e->eb_dir, e->eb_name,
- ce->ce_file, e->eb_mode && !mh_strcasecmp(e->eb_mode,
- "ascii"), 0) == NOTOK)
- goto losing_ftp;
-#endif
if (cachefile[0]) {
if (caching)