$NetBSD: patch-as,v 1.1 2004/04/13 21:19:48 hubertf Exp $ --- src/main.c.orig Wed Mar 15 23:13:28 2000 +++ src/main.c @@ -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;