/* alias and password should be set already in url */ static void create_the_bookmark(url_t *url) { listitem *li; /* we don't want to be asked again */ url_setalias(ftp->url, url->alias); if(strcmp(ftp->curdir, ftp->homedir) != 0) url_setdirectory(url, ftp->curdir); else url_setdirectory(url, 0); list_clear(gvBookmarks); { char *tmp = NULL; if (asprintf(&tmp, "%s/bookmarks", gvWorkingDirectory) == -1) { fprintf(stderr, _("Failed to allocate memory.\n")); return; } parse_rc(tmp, false); free(tmp); } li = list_search(gvBookmarks, (listsearchfunc)urlcmp, url); if(li) list_delitem(gvBookmarks, li); list_additem(gvBookmarks, url); bookmark_save(0); }
int ftp_reopen(void) { if(ftp && ftp->url) { url_t *u = url_clone(ftp->url); int r; url_setdirectory(u, ftp->curdir); r = ftp_open_url(u, false); if(r == 0) { r = ftp_login(u->username, gvAnonPasswd); } else ftp_close(); url_destroy(u); return r; } return -1; }