--- pen-0.15.0/pen.c 2004-07-06 10:44:58.000000000 +0200 +++ pen-0.15.0+first/pen.c 2004-10-18 21:13:06.000000000 +0200 @@ -150,6 +150,7 @@ static int use_poll = 0; static int http = 0; static int client_acl, control_acl; +static int first = 0; static int port; @@ -1129,6 +1130,7 @@ " -Z use SSL compatibility mode\n" " -R require valid peer certificate\n" " -L protocol ssl23 (default), ssl2, ssl3 or tls1\n" + " -1 use always first available server\n" "\n" "example:\n" " pen smtp mailhost1:smtp mailhost2:25 mailhost3\n" @@ -1771,6 +1773,17 @@ if (upfd != -1) goto Success; } + if (first) { + index = 0; + do { + if ((upfd = try_server(index, 0, cli)) != -1) { + if (debuglevel) debug("connecting to first available server %d", index); + goto Success; + } + index++; + } while (index != nservers); + } + if (!stubborn) { index = current; do { @@ -2242,9 +2255,9 @@ int c; #ifdef HAVE_SSL - char *opt = "C:F:S:T:b:c:e:j:l:p:t:u:w:x:DHPWXadfhnrsE:K:G:A:ZRL:"; + char *opt = "C:F:S:T:b:c:e:j:l:p:t:u:w:x:DHPWXadfhnrsE:K:G:A:ZRL:1"; #else - char *opt = "C:F:S:T:b:c:e:j:l:p:t:u:w:x:DHPWXadfhnrs"; + char *opt = "C:F:S:T:b:c:e:j:l:p:t:u:w:x:DHPWXadfhnrs1"; #endif while ((c = getopt(argc, argv, opt)) != -1) { @@ -2364,6 +2377,9 @@ } break; #endif /* HAVE_SSL */ + case '1': + first = 1; + break; case '?': default: usage();