1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
$NetBSD: patch-as,v 1.2 2005/12/13 21:30:11 joerg Exp $
--- src/main.c.orig 2000-03-15 22:13:28.000000000 +0000
+++ src/main.c
@@ -2,9 +2,9 @@
/* Portions copyright (c) 1990-1993, 1994 Mark J. Reed */
/* For copying and distribution information, see the file COPYING. */
-
+#include <sys/types.h>
#include <sys/wait.h>
-#include <sys/dir.h>
+#include <dirent.h>
#include <pwd.h>
#include <stdlib.h>
#include <string.h>
@@ -19,6 +19,7 @@ static void usage (char *name, int ret);
char *optv[] = { "clear", "list", "who", "restricted", "nickname:", "group:",
"host:", "port:", "password:", "server:", "N:", "help/",
+ "lhost:",
(char *)NULL };
static void
@@ -33,6 +34,7 @@ fprintf(stderr," -group group\t\tsign o
fprintf(stderr," -server name\t\tconnect to server named name.\n");
fprintf(stderr," -host host\t\tconnect to server on host host.\n");
fprintf(stderr," -port port\t\ttry to connect to port port.\n");
+fprintf(stderr," -lhost lhost\t\tconnect from local address lhost.\n");
fprintf(stderr," -list\t\t\tlist known servers, in order.\n");
fprintf(stderr," -clear\t\twipe args from command line.\n");
fprintf(stderr," -who\t\t\tsee who's on; don't sign on.\n");
@@ -56,12 +58,14 @@ main (int argc, char **argv)
static char server[MAX_NICKLEN+1];
static char host[MAX_HOSTLEN+1];
static char pass[MAX_PASSLEN+1];
+ static char lhost[MAX_HOSTLEN+1];
mynick = NULL;
mygroup = "1";
myserver = NULL;
myhost = NULL;
myport = DEFAULTPORT;
+ mylhost = NULL;
switcherr=0;
while ((s = getswitch(argc, argv, optv)) != NULL)
@@ -93,8 +97,18 @@ main (int argc, char **argv)
break;
case 'l':
- listflg++;
- gv.interactive = 0;
+ switch (s[1])
+ {
+ case 'i':
+ listflg++;
+ gv.interactive = 0;
+ break;
+ case 'h':
+ strncpy(lhost,switcharg,MAX_HOSTLEN-1);
+ lhost[MAX_HOSTLEN-1]='\0';
+ mylhost = lhost;
+ break;
+ }
break;
case 'p':
@@ -261,14 +275,14 @@ main (int argc, char **argv)
myport = serverdata->port;
}
- if (connecttoport(myhost, myport) < 0)
+ if (connecttoport(myhost, myport, mylhost) < 0)
{
connected = 0;
if (try)
{
while ((serverdata = getserver())!=NULL)
{
- if (connecttoport(serverdata->host, serverdata->port) == 0)
+ if (connecttoport(serverdata->host, serverdata->port, mylhost) == 0)
{
connected = 1;
break;
|