o ftp passive support, based from elinks.
o bump package name.
This commit is contained in:
parent
89ca92e4fb
commit
c891b5c203
@ -1,10 +1,10 @@
|
||||
# $OpenBSD: Makefile,v 1.9 2002/12/17 17:43:01 fgsch Exp $
|
||||
# $OpenBSD: Makefile,v 1.10 2002/12/28 21:49:14 fgsch Exp $
|
||||
|
||||
COMMENT= "graphics and text browser with javascript support"
|
||||
|
||||
VER= 2.1pre7
|
||||
DISTNAME= links-${VER}
|
||||
PKGNAME= links+-${VER}c
|
||||
PKGNAME= links+-${VER}d
|
||||
CATEGORIES= www
|
||||
MASTER_SITES= http://atrey.karlin.mff.cuni.cz/~clock/twibright/links/download/
|
||||
|
||||
@ -33,7 +33,7 @@ CONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}/include/libpng -I${LOCALBASE}/include" \
|
||||
LDFLAGS="-L${LOCALBASE}/lib"
|
||||
.endif
|
||||
|
||||
post-patch:
|
||||
pre-configure:
|
||||
cp ${FILESDIR}/auth.c ${WRKSRC}
|
||||
cd ${WRKSRC}/intl && /bin/sh synclang
|
||||
|
||||
|
19
www/links+/patches/patch-default_c
Normal file
19
www/links+/patches/patch-default_c
Normal file
@ -0,0 +1,19 @@
|
||||
$OpenBSD: patch-default_c,v 1.1 2002/12/28 21:49:14 fgsch Exp $
|
||||
--- default.c.orig Sat Oct 12 16:46:24 2002
|
||||
+++ default.c Sat Dec 28 18:10:51 2002
|
||||
@@ -1038,6 +1038,7 @@ int aspect_on=1;
|
||||
unsigned char download_dir[MAX_STR_LEN] = "";
|
||||
|
||||
unsigned char default_anon_pass[MAX_STR_LEN] = "somebody@host.domain";
|
||||
+int ftp_passive=0; /* 1=use passive mode */
|
||||
|
||||
/* These are workarounds for some CGI script bugs */
|
||||
struct http_bugs http_bugs = { 0, 1, 1, 0 };
|
||||
@@ -1113,6 +1114,7 @@ struct option links_options[] = {
|
||||
{1, gen_cmd, cp_rd, cp_wr, 0, 0, &bookmarks_codepage, "bookmarks_codepage", "bookmarks-codepage"},
|
||||
{1, gen_cmd, str_rd, str_wr, 0, MAX_STR_LEN, bookmarks_file, "bookmarks_file", "bookmarks-file"},
|
||||
{1, gen_cmd, str_rd, str_wr, 0, MAX_STR_LEN, default_anon_pass, "ftp.anonymous_password", "ftp.anonymous-password"},
|
||||
+ {1, gen_cmd, num_rd, num_wr, 0, 1, &ftp_passive, "ftp.passive", "ftp.passive"},
|
||||
{1, gen_cmd, cp_rd, NULL, 0, 0, &dds.assume_cp, "assume_codepage", "assume-codepage"},
|
||||
{1, NULL, term_rd, term_wr, 0, 0, NULL, "terminal", NULL},
|
||||
{1, NULL, term2_rd, NULL, 0, 0, NULL, "terminal2", NULL},
|
273
www/links+/patches/patch-ftp_c
Normal file
273
www/links+/patches/patch-ftp_c
Normal file
@ -0,0 +1,273 @@
|
||||
$OpenBSD: patch-ftp_c,v 1.1 2002/12/28 21:49:14 fgsch Exp $
|
||||
--- ftp.c.orig Tue May 7 07:13:18 2002
|
||||
+++ ftp.c Sat Dec 28 17:20:00 2002
|
||||
@@ -19,6 +19,7 @@ struct ftp_connection_info {
|
||||
int d;
|
||||
int dpos;
|
||||
int buf_pos;
|
||||
+ int use_pasv; /* Use PASV (yes or no) */
|
||||
unsigned char ftp_buffer[FTP_BUF];
|
||||
unsigned char cmdbuf[1];
|
||||
};
|
||||
@@ -39,7 +40,58 @@ void ftp_got_final_response(struct conne
|
||||
void got_something_from_data_connection(struct connection *);
|
||||
void ftp_end_request(struct connection *);
|
||||
|
||||
-int get_ftp_response(struct connection *c, struct read_buffer *rb, int part)
|
||||
+/* Parse EPSV or PASV response for address and/or port.
|
||||
+ * int *n should point to a sizeof(int) * 6 space.
|
||||
+ * It returns zero on error or count of parsed numbers.
|
||||
+ * It returns an error if:
|
||||
+ * - there's more than 6 or less than 1 numbers.
|
||||
+ * - a number is strictly greater than max.
|
||||
+ *
|
||||
+ * On success, array of integers *n is filled with numbers starting
|
||||
+ * from end of array (ie. if we found one number, you can access it using
|
||||
+ * n[5]).
|
||||
+ *
|
||||
+ * Important:
|
||||
+ * Negative numbers aren't handled so -123 is taken as 123.
|
||||
+ * We don't take care about separators.
|
||||
+*/
|
||||
+static int parse_psv_resp(unsigned char *data, int *n, int max_value)
|
||||
+{
|
||||
+ unsigned char *p = data;
|
||||
+ int i = 5;
|
||||
+
|
||||
+ memset(n, 0, 6 * sizeof(int));
|
||||
+
|
||||
+ if (*p < ' ') return 0;
|
||||
+
|
||||
+ /* Find the end. */
|
||||
+ while (*p >= ' ') p++;
|
||||
+
|
||||
+ /* Ignore non-numeric ending chars. */
|
||||
+ while (p != data && (*p < '0' || *p > '9')) p--;
|
||||
+ if (p == data) return 0;
|
||||
+
|
||||
+ while (i >= 0) {
|
||||
+ int x = 1;
|
||||
+
|
||||
+ /* Parse one number. */
|
||||
+ while (p != data && *p >= '0' && *p <= '9') {
|
||||
+ n[i] += (*p - '0') * x;
|
||||
+ if (n[i] > max_value) return 0;
|
||||
+ x *= 10;
|
||||
+ p--;
|
||||
+ }
|
||||
+ /* Ignore non-numeric chars. */
|
||||
+ while (p != data && (*p < '0' || *p > '9')) p--;
|
||||
+ if (p == data) return (6 - i);
|
||||
+ /* Get the next one. */
|
||||
+ i--;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+int get_ftp_response(struct connection *c, struct read_buffer *rb, int part, struct sockaddr_in *sa)
|
||||
{
|
||||
int l;
|
||||
set_timeout(c);
|
||||
@@ -48,6 +100,17 @@ int get_ftp_response(struct connection *
|
||||
unsigned char *e;
|
||||
int k = strtoul(rb->data, (char **)&e, 10);
|
||||
if (e != rb->data + 3 || k < 100) return -1;
|
||||
+ if (sa && k == 227) { /* PASV response parsing. */
|
||||
+ struct sockaddr_in *s = (struct sockaddr_in *) sa;
|
||||
+ int n[6];
|
||||
+
|
||||
+ if (parse_psv_resp(e, (int *) n, 255) != 6)
|
||||
+ return -1;
|
||||
+ memset(s, 0, sizeof(struct sockaddr_in));
|
||||
+ s->sin_family = AF_INET;
|
||||
+ s->sin_addr.s_addr = htonl((n[0] << 24) + (n[1] << 16) + (n[2] << 8) + n[3]);
|
||||
+ s->sin_port = htons((n[4] << 8) + n[5]);
|
||||
+ }
|
||||
if (*e == '-') {
|
||||
int i;
|
||||
for (i = 0; i < rb->len - 5; i++) {
|
||||
@@ -127,7 +190,7 @@ void ftp_logged(struct connection *c)
|
||||
|
||||
void ftp_got_info(struct connection *c, struct read_buffer *rb)
|
||||
{
|
||||
- int g = get_ftp_response(c, rb, 0);
|
||||
+ int g = get_ftp_response(c, rb, 0, NULL);
|
||||
if (g == -1) { setcstate(c, S_FTP_ERROR); abort_connection(c); return; }
|
||||
if (!g) { read_from_socket(c, c->sock1, rb, ftp_got_info); return; }
|
||||
if (g >= 400) { setcstate(c, S_FTP_UNAVAIL); retry_connection(c); return; }
|
||||
@@ -136,7 +199,7 @@ void ftp_got_info(struct connection *c,
|
||||
|
||||
void ftp_got_user_info(struct connection *c, struct read_buffer *rb)
|
||||
{
|
||||
- int g = get_ftp_response(c, rb, 0);
|
||||
+ int g = get_ftp_response(c, rb, 0, NULL);
|
||||
if (g == -1) { setcstate(c, S_FTP_ERROR); abort_connection(c); return; }
|
||||
if (!g) { read_from_socket(c, c->sock1, rb, ftp_got_user_info); return; }
|
||||
if (g >= 530 && g < 540) { setcstate(c, S_FTP_LOGIN); retry_connection(c); return; }
|
||||
@@ -169,7 +232,7 @@ void ftp_got_user_info(struct connection
|
||||
|
||||
void ftp_dummy_info(struct connection *c, struct read_buffer *rb)
|
||||
{
|
||||
- int g = get_ftp_response(c, rb, 0);
|
||||
+ int g = get_ftp_response(c, rb, 0, NULL);
|
||||
if (g == -1) { setcstate(c, S_FTP_ERROR); abort_connection(c); return; }
|
||||
if (!g) { read_from_socket(c, c->sock1, rb, ftp_dummy_info); return; }
|
||||
ftp_retr_file(c, rb);
|
||||
@@ -184,7 +247,7 @@ void ftp_sent_passwd(struct connection *
|
||||
|
||||
void ftp_pass_info(struct connection *c, struct read_buffer *rb)
|
||||
{
|
||||
- int g = get_ftp_response(c, rb, 0);
|
||||
+ int g = get_ftp_response(c, rb, 0, NULL);
|
||||
if (g == -1) { setcstate(c, S_FTP_ERROR); abort_connection(c); return; }
|
||||
if (!g) { read_from_socket(c, c->sock1, rb, ftp_pass_info); setcstate(c, S_LOGIN); return; }
|
||||
if (g >= 530 && g < 540) { setcstate(c, S_FTP_LOGIN); abort_connection(c); return; }
|
||||
@@ -215,7 +278,11 @@ struct ftp_connection_info *add_file_cmd
|
||||
goto oom;
|
||||
}
|
||||
c->info = inf;
|
||||
- if ((ps = get_pasv_socket(c, c->sock1, &c->sock2, pc))) return NULL;
|
||||
+ inf->use_pasv = ftp_passive;
|
||||
+ if (!inf->use_pasv) {
|
||||
+ if ((ps = get_pasv_socket(c, c->sock1, &c->sock2, pc)))
|
||||
+ return NULL;
|
||||
+ }
|
||||
if (!d) {
|
||||
internal("get_url_data failed");
|
||||
setcstate(c, S_INTERNAL);
|
||||
@@ -226,18 +293,23 @@ struct ftp_connection_info *add_file_cmd
|
||||
if (d == de || de[-1] == '/') {
|
||||
inf->dir = 1;
|
||||
inf->pending_commands = 4;
|
||||
- add_to_str(&s, &l, "TYPE A\r\nPORT ");
|
||||
- add_num_to_str(&s, &l, pc[0]);
|
||||
- add_chr_to_str(&s, &l, ',');
|
||||
- add_num_to_str(&s, &l, pc[1]);
|
||||
- add_chr_to_str(&s, &l, ',');
|
||||
- add_num_to_str(&s, &l, pc[2]);
|
||||
- add_chr_to_str(&s, &l, ',');
|
||||
- add_num_to_str(&s, &l, pc[3]);
|
||||
- add_chr_to_str(&s, &l, ',');
|
||||
- add_num_to_str(&s, &l, pc[4]);
|
||||
- add_chr_to_str(&s, &l, ',');
|
||||
- add_num_to_str(&s, &l, pc[5]);
|
||||
+ add_to_str(&s, &l, "TYPE A\r\n");
|
||||
+ if (inf->use_pasv)
|
||||
+ add_to_str(&s, &l, "PASV");
|
||||
+ else {
|
||||
+ add_to_str(&s, &l, "PORT ");
|
||||
+ add_num_to_str(&s, &l, pc[0]);
|
||||
+ add_chr_to_str(&s, &l, ',');
|
||||
+ add_num_to_str(&s, &l, pc[1]);
|
||||
+ add_chr_to_str(&s, &l, ',');
|
||||
+ add_num_to_str(&s, &l, pc[2]);
|
||||
+ add_chr_to_str(&s, &l, ',');
|
||||
+ add_num_to_str(&s, &l, pc[3]);
|
||||
+ add_chr_to_str(&s, &l, ',');
|
||||
+ add_num_to_str(&s, &l, pc[4]);
|
||||
+ add_chr_to_str(&s, &l, ',');
|
||||
+ add_num_to_str(&s, &l, pc[5]);
|
||||
+ }
|
||||
add_to_str(&s, &l, "\r\nCWD /");
|
||||
add_bytes_to_str(&s, &l, d, de - d);
|
||||
add_to_str(&s, &l, "\r\nLIST\r\n");
|
||||
@@ -245,18 +317,23 @@ struct ftp_connection_info *add_file_cmd
|
||||
} else {
|
||||
inf->dir = 0;
|
||||
inf->pending_commands = 3;
|
||||
- add_to_str(&s, &l, "TYPE I\r\nPORT ");
|
||||
- add_num_to_str(&s, &l, pc[0]);
|
||||
- add_chr_to_str(&s, &l, ',');
|
||||
- add_num_to_str(&s, &l, pc[1]);
|
||||
- add_chr_to_str(&s, &l, ',');
|
||||
- add_num_to_str(&s, &l, pc[2]);
|
||||
- add_chr_to_str(&s, &l, ',');
|
||||
- add_num_to_str(&s, &l, pc[3]);
|
||||
- add_chr_to_str(&s, &l, ',');
|
||||
- add_num_to_str(&s, &l, pc[4]);
|
||||
- add_chr_to_str(&s, &l, ',');
|
||||
- add_num_to_str(&s, &l, pc[5]);
|
||||
+ add_to_str(&s, &l, "TYPE I\r\n");
|
||||
+ if (inf->use_pasv)
|
||||
+ add_to_str(&s, &l, "PASV");
|
||||
+ else {
|
||||
+ add_to_str(&s, &l, "PORT ");
|
||||
+ add_num_to_str(&s, &l, pc[0]);
|
||||
+ add_chr_to_str(&s, &l, ',');
|
||||
+ add_num_to_str(&s, &l, pc[1]);
|
||||
+ add_chr_to_str(&s, &l, ',');
|
||||
+ add_num_to_str(&s, &l, pc[2]);
|
||||
+ add_chr_to_str(&s, &l, ',');
|
||||
+ add_num_to_str(&s, &l, pc[3]);
|
||||
+ add_chr_to_str(&s, &l, ',');
|
||||
+ add_num_to_str(&s, &l, pc[4]);
|
||||
+ add_chr_to_str(&s, &l, ',');
|
||||
+ add_num_to_str(&s, &l, pc[5]);
|
||||
+ }
|
||||
if (c->from) {
|
||||
add_to_str(&s, &l, "\r\nREST ");
|
||||
add_num_to_str(&s, &l, c->from);
|
||||
@@ -314,6 +391,8 @@ void ftp_retr_file(struct connection *c,
|
||||
{
|
||||
int g;
|
||||
struct ftp_connection_info *inf = c->info;
|
||||
+ int fd;
|
||||
+ struct sockaddr_in sa;
|
||||
if (0) {
|
||||
rep:
|
||||
if (!fast_ftp) {
|
||||
@@ -322,9 +401,19 @@ void ftp_retr_file(struct connection *c,
|
||||
}
|
||||
}
|
||||
if (inf->pending_commands > 1) {
|
||||
- g = get_ftp_response(c, rb, 0);
|
||||
+ g = get_ftp_response(c, rb, 0, &sa);
|
||||
if (g == -1) { setcstate(c, S_FTP_ERROR); abort_connection(c); return; }
|
||||
if (!g) { read_from_socket(c, c->sock1, rb, ftp_retr_file); setcstate(c, S_GETH); return; }
|
||||
+ if (g == 227) {
|
||||
+ fd = socket(PF_INET, SOCK_STREAM, 0);
|
||||
+ if (fd < 0) {
|
||||
+ setcstate(c, S_FTP_ERROR);
|
||||
+ abort_connection(c);
|
||||
+ return;
|
||||
+ }
|
||||
+ c->sock2 = fd;
|
||||
+ connect(fd, (struct sockaddr *) &sa, sizeof(struct sockaddr_in));
|
||||
+ }
|
||||
inf->pending_commands--;
|
||||
switch (inf->opc - inf->pending_commands) {
|
||||
case 1: /* TYPE */
|
||||
@@ -341,7 +430,7 @@ void ftp_retr_file(struct connection *c,
|
||||
}
|
||||
internal("WHAT???");
|
||||
}
|
||||
- g = get_ftp_response(c, rb, 2);
|
||||
+ g = get_ftp_response(c, rb, 2, NULL);
|
||||
if (!g) { read_from_socket(c, c->sock1, rb, ftp_retr_file); setcstate(c, S_GETH); return; }
|
||||
if (g >= 100 && g < 200) {
|
||||
int est;
|
||||
@@ -369,7 +458,7 @@ void ftp_retr_file(struct connection *c,
|
||||
void ftp_got_final_response(struct connection *c, struct read_buffer *rb)
|
||||
{
|
||||
struct ftp_connection_info *inf = c->info;
|
||||
- int g = get_ftp_response(c, rb, 0);
|
||||
+ int g = get_ftp_response(c, rb, 0, NULL);
|
||||
if (g == -1) { setcstate(c, S_FTP_ERROR); abort_connection(c); return; }
|
||||
if (!g) { read_from_socket(c, c->sock1, rb, ftp_got_final_response); if (c->state != S_TRANS) setcstate(c, S_GETH); return; }
|
||||
if (g == 550) {
|
||||
@@ -477,8 +566,12 @@ void got_something_from_data_connection(
|
||||
int ns;
|
||||
inf->d = 1;
|
||||
set_handlers(c->sock2, NULL, NULL, NULL, NULL);
|
||||
- if ((ns = accept(c->sock2, NULL, NULL)) == -1) goto e;
|
||||
- close(c->sock2);
|
||||
+ if (inf->use_pasv)
|
||||
+ ns = c->sock2;
|
||||
+ else {
|
||||
+ if ((ns = accept(c->sock2, NULL, NULL)) == -1) goto e;
|
||||
+ close(c->sock2);
|
||||
+ }
|
||||
c->sock2 = ns;
|
||||
set_handlers(ns, (void (*)(void *))got_something_from_data_connection, NULL, NULL, c);
|
||||
return;
|
@ -1,15 +1,16 @@
|
||||
$OpenBSD: patch-intl_english_lng,v 1.1 2002/12/17 05:50:51 fgsch Exp $
|
||||
--- intl/english.lng.orig Tue Dec 17 02:35:58 2002
|
||||
+++ intl/english.lng Tue Dec 17 02:36:38 2002
|
||||
@@ -390,6 +390,7 @@ T_DISPLAY_OPTIMIZATION_LCD_BGR,"Display
|
||||
$OpenBSD: patch-intl_english_lng,v 1.2 2002/12/28 21:49:14 fgsch Exp $
|
||||
--- intl/english.lng.orig Sat Nov 2 14:22:52 2002
|
||||
+++ intl/english.lng Sat Dec 28 17:25:28 2002
|
||||
@@ -390,6 +390,8 @@ T_DISPLAY_OPTIMIZATION_LCD_BGR,"Display
|
||||
T_ASPECT_RATIO, "Aspect ratio",
|
||||
T_ASPECT_CORRECTION_ON, "Aspect correction on",
|
||||
T_KEYBOARD_CODEPAGE, "Keyboard codepage",
|
||||
+T_COPY_TO_CLIPBOARD, "Copy to clipboard",
|
||||
+T_USE_PASSIVE, "Use passive mode",
|
||||
T_HK_ADD_BOOKMARK, "A",
|
||||
T_HK_BOOKMARKS, "S",
|
||||
T_HK_GOTO_URL, "G",
|
||||
@@ -460,3 +461,4 @@ T_HK_BEOS_TERMINAL, "B",
|
||||
@@ -460,3 +462,4 @@ T_HK_BEOS_TERMINAL, "B",
|
||||
T_HK_NEW_WINDOW, "N",
|
||||
T_HK_JAVASCRIPT_OPTIONS, "J",
|
||||
T_HK_MISCELANEOUS_OPTIONS, "O",
|
||||
|
@ -1,15 +1,16 @@
|
||||
$OpenBSD: patch-intl_spanish_lng,v 1.1 2002/12/17 13:31:39 fgsch Exp $
|
||||
--- intl/spanish.lng.orig Tue Dec 17 10:19:59 2002
|
||||
+++ intl/spanish.lng Tue Dec 17 10:21:10 2002
|
||||
@@ -390,6 +390,7 @@ T_DISPLAY_OPTIMIZATION_LCD_BGR, NULL,
|
||||
$OpenBSD: patch-intl_spanish_lng,v 1.2 2002/12/28 21:49:14 fgsch Exp $
|
||||
--- intl/spanish.lng.orig Sat Nov 2 14:22:52 2002
|
||||
+++ intl/spanish.lng Sat Dec 28 18:01:24 2002
|
||||
@@ -390,6 +390,8 @@ T_DISPLAY_OPTIMIZATION_LCD_BGR, NULL,
|
||||
T_ASPECT_RATIO, NULL,
|
||||
T_ASPECT_CORRECTION_ON, NULL,
|
||||
T_KEYBOARD_CODEPAGE, NULL,
|
||||
+T_COPY_TO_CLIPBOARD, "Copiar al portapapeles",
|
||||
+T_USE_PASSIVE, "Usar modo pasivo",
|
||||
T_HK_ADD_BOOKMARK, "A",
|
||||
T_HK_BOOKMARKS, "C",
|
||||
T_HK_GOTO_URL, "I",
|
||||
@@ -460,3 +461,4 @@ T_HK_BEOS_TERMINAL, "B",
|
||||
@@ -460,3 +462,4 @@ T_HK_BEOS_TERMINAL, "B",
|
||||
T_HK_NEW_WINDOW, "N",
|
||||
T_HK_JAVASCRIPT_OPTIONS, NULL,
|
||||
T_HK_MISCELANEOUS_OPTIONS, NULL,
|
||||
|
@ -1,6 +1,6 @@
|
||||
$OpenBSD: patch-links_h,v 1.4 2002/12/17 05:50:51 fgsch Exp $
|
||||
$OpenBSD: patch-links_h,v 1.5 2002/12/28 21:49:14 fgsch Exp $
|
||||
--- links.h.orig Sat Nov 2 14:22:41 2002
|
||||
+++ links.h Mon Dec 16 22:23:48 2002
|
||||
+++ links.h Sat Dec 28 17:19:38 2002
|
||||
@@ -137,6 +137,8 @@ x #endif*/
|
||||
#define longlong long
|
||||
#endif
|
||||
@ -37,7 +37,15 @@ $OpenBSD: patch-links_h,v 1.4 2002/12/17 05:50:51 fgsch Exp $
|
||||
|
||||
#define B_ENTER 1
|
||||
#define B_ESC 2
|
||||
@@ -3876,5 +3882,30 @@ void save_bookmarks(void);
|
||||
@@ -3806,6 +3812,7 @@ struct http_bugs {
|
||||
extern struct http_bugs http_bugs;
|
||||
|
||||
extern unsigned char default_anon_pass[];
|
||||
+extern int ftp_passive;
|
||||
|
||||
/* listedit.c */
|
||||
|
||||
@@ -3876,5 +3883,30 @@ void save_bookmarks(void);
|
||||
|
||||
/* Launches bookmark manager */
|
||||
void menu_bookmark_manager(struct terminal *, void *, struct session *);
|
||||
|
@ -1,6 +1,6 @@
|
||||
$OpenBSD: patch-menu_c,v 1.1 2002/09/16 04:11:23 fgsch Exp $
|
||||
--- menu.c.orig Sun Sep 15 10:16:34 2002
|
||||
+++ menu.c Sun Sep 15 10:19:02 2002
|
||||
$OpenBSD: patch-menu_c,v 1.2 2002/12/28 21:49:14 fgsch Exp $
|
||||
--- menu.c.orig Sat Oct 12 16:48:21 2002
|
||||
+++ menu.c Sat Dec 28 18:26:00 2002
|
||||
@@ -324,7 +324,7 @@ void flush_caches(struct terminal *term,
|
||||
/* jde v historii o psteps polozek dozadu */
|
||||
void go_backwards(struct terminal *term, void *psteps, struct session *ses)
|
||||
@ -64,7 +64,91 @@ $OpenBSD: patch-menu_c,v 1.1 2002/09/16 04:11:23 fgsch Exp $
|
||||
}
|
||||
sel = *ptr;
|
||||
if (sel < 0) sel = 0;
|
||||
@@ -1729,7 +1729,7 @@ void miscelaneous_options(struct termina
|
||||
@@ -733,26 +733,68 @@ int dlg_http_options(struct dialog_data
|
||||
return 0;
|
||||
}
|
||||
|
||||
+unsigned char *ftp_labels[] = { TEXT(T_USE_PASSIVE), TEXT(T_PASSWORD_FOR_ANONYMOUS_LOGIN) };
|
||||
+
|
||||
+void ftpopt_fn(struct dialog_data *dlg)
|
||||
+{
|
||||
+ struct terminal *term = dlg->win->term;
|
||||
+ int max = 0, min = 0;
|
||||
+ int w, rw;
|
||||
+ int y = 0;
|
||||
+ checkboxes_width(term, dlg->dlg->udata, &max, max_text_width);
|
||||
+ checkboxes_width(term, dlg->dlg->udata, &min, min_text_width);
|
||||
+ max_text_width(term, ftp_labels[1], &max, AL_LEFT);
|
||||
+ min_text_width(term, ftp_labels[1], &min, AL_LEFT);
|
||||
+ max_buttons_width(term, dlg->items + dlg->n - 2, 2, &max);
|
||||
+ min_buttons_width(term, dlg->items + dlg->n - 2, 2, &min);
|
||||
+ w = term->x * 9 / 10 - 2 * DIALOG_LB;
|
||||
+ if (w > max) w = max;
|
||||
+ if (w < min) w = min;
|
||||
+ if (w > term->x - 2 * DIALOG_LB) w = term->x - 2 * DIALOG_LB;
|
||||
+ if (w < 5) w = 5;
|
||||
+ rw = 0;
|
||||
+ dlg_format_checkboxes(dlg, NULL, dlg->items, dlg->n - 3, 0, &y, w, &rw, dlg->dlg->udata);
|
||||
+ y += gf_val(1, G_BFU_FONT_SIZE);
|
||||
+ dlg_format_text(dlg, NULL, ftp_labels[1], 0, &y, w, &rw, COLOR_DIALOG_TEXT, AL_LEFT);
|
||||
+ y += gf_val(1, 2 * G_BFU_FONT_SIZE);
|
||||
+ dlg_format_buttons(dlg, NULL, dlg->items + dlg->n - 2, 2, 0, &y, w, &rw, AL_CENTER);
|
||||
+ w = rw;
|
||||
+ dlg->xw = rw + 2 * DIALOG_LB;
|
||||
+ dlg->yw = y + 2 * DIALOG_TB;
|
||||
+ center_dlg(dlg);
|
||||
+ draw_dlg(dlg);
|
||||
+ y = dlg->y + DIALOG_TB + gf_val(1, G_BFU_FONT_SIZE);
|
||||
+ dlg_format_checkboxes(dlg, term, dlg->items, dlg->n - 3, dlg->x + DIALOG_LB, &y, w, NULL, dlg->dlg->udata);
|
||||
+ y += gf_val(1, G_BFU_FONT_SIZE);
|
||||
+ dlg_format_text(dlg, term, ftp_labels[1], dlg->x + DIALOG_LB, &y, w, NULL, COLOR_DIALOG_TEXT, AL_LEFT);
|
||||
+ dlg_format_field(dlg, term, dlg->items + 1, dlg->x + DIALOG_LB, &y, w, NULL, AL_LEFT);
|
||||
+ y += gf_val(1, G_BFU_FONT_SIZE);
|
||||
+ dlg_format_buttons(dlg, term, dlg->items + dlg->n - 2, 2, dlg->x + DIALOG_LB, &y, w, &rw, AL_CENTER);
|
||||
+}
|
||||
+
|
||||
int dlg_ftp_options(struct dialog_data *dlg, struct dialog_item_data *di)
|
||||
{
|
||||
struct dialog *d;
|
||||
- if (!(d = mem_alloc(sizeof(struct dialog) + 4 * sizeof(struct dialog_item)))) return 0;
|
||||
- memset(d, 0, sizeof(struct dialog) + 4 * sizeof(struct dialog_item));
|
||||
+ if (!(d = mem_alloc(sizeof(struct dialog) + 5 * sizeof(struct dialog_item)))) return 0;
|
||||
+ memset(d, 0, sizeof(struct dialog) + 5 * sizeof(struct dialog_item));
|
||||
d->title = TEXT(T_FTP_OPTIONS);
|
||||
- d->fn = input_field_fn;
|
||||
- d->udata = TEXT(T_PASSWORD_FOR_ANONYMOUS_LOGIN);
|
||||
- d->items[0].type = D_FIELD;
|
||||
- d->items[0].dlen = MAX_STR_LEN;
|
||||
- d->items[0].data = di->cdata;
|
||||
- d->items[1].type = D_BUTTON;
|
||||
- d->items[1].gid = B_ENTER;
|
||||
- d->items[1].fn = ok_dialog;
|
||||
- d->items[1].text = TEXT(T_OK);
|
||||
+ d->fn = ftpopt_fn;
|
||||
+ d->udata = ftp_labels;
|
||||
+ d->items[0].type = D_CHECKBOX;
|
||||
+ d->items[0].dlen = sizeof(int);
|
||||
+ d->items[0].data = (void *)&ftp_passive;
|
||||
+ d->items[1].type = D_FIELD;
|
||||
+ d->items[1].dlen = MAX_STR_LEN;
|
||||
+ d->items[1].data = di->cdata;
|
||||
d->items[2].type = D_BUTTON;
|
||||
- d->items[2].gid = B_ESC;
|
||||
- d->items[2].fn = cancel_dialog;
|
||||
- d->items[2].text = TEXT(T_CANCEL);
|
||||
- d->items[3].type = D_END;
|
||||
+ d->items[2].gid = B_ENTER;
|
||||
+ d->items[2].fn = ok_dialog;
|
||||
+ d->items[2].text = TEXT(T_OK);
|
||||
+ d->items[3].type = D_BUTTON;
|
||||
+ d->items[3].gid = B_ESC;
|
||||
+ d->items[3].fn = cancel_dialog;
|
||||
+ d->items[3].text = TEXT(T_CANCEL);
|
||||
+ d->items[4].type = D_END;
|
||||
do_dialog(dlg->win->term, d, getml(d, NULL));
|
||||
return 0;
|
||||
}
|
||||
@@ -1729,7 +1771,7 @@ void miscelaneous_options(struct termina
|
||||
|
||||
void menu_set_language(struct terminal *term, void *pcp, struct session *ses)
|
||||
{
|
||||
@ -73,7 +157,7 @@ $OpenBSD: patch-menu_c,v 1.1 2002/09/16 04:11:23 fgsch Exp $
|
||||
cls_redraw_all_terminals();
|
||||
}
|
||||
|
||||
@@ -1741,7 +1741,7 @@ void menu_language_list(struct terminal
|
||||
@@ -1741,7 +1783,7 @@ void menu_language_list(struct terminal
|
||||
if (!(mi = new_menu(1))) return;
|
||||
for (i = 0; i < n_languages(); i++) {
|
||||
n = language_name(i);
|
||||
|
Loading…
Reference in New Issue
Block a user