mirror of
https://github.com/Stichting-MINIX-Research-Foundation/pkgsrc-ng.git
synced 2025-09-10 13:03:41 -04:00
98 lines
2.7 KiB
Plaintext
98 lines
2.7 KiB
Plaintext
$NetBSD: patch-as,v 1.3 2012/12/24 03:11:25 dholland Exp $
|
|
|
|
- don't use "restrict" as an identifier, it's a keyword now
|
|
- ...? (XXX)
|
|
|
|
--- 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':
|
|
@@ -228,7 +242,7 @@ main (int argc, char **argv)
|
|
tclinit();
|
|
readlineinit();
|
|
if (restrictflg && !gv.restricted)
|
|
- restrict();
|
|
+ setrestricted();
|
|
}
|
|
|
|
/* try to connect to port - if it fails, start server if we are on */
|
|
@@ -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;
|