diff options
author | jkh <jkh@FreeBSD.org> | 1997-01-16 11:47:44 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 1997-01-16 11:47:44 +0000 |
commit | e5c0b85f37f6f70f19fac7f19ef9d01c7813389e (patch) | |
tree | e363b541ca99c555dcbbe00f249ffccc2d81cdf5 /usr.sbin | |
parent | 42a95278a7a28c4530c0f269551a9f148a5f7426 (diff) | |
download | FreeBSD-src-e5c0b85f37f6f70f19fac7f19ef9d01c7813389e.zip FreeBSD-src-e5c0b85f37f6f70f19fac7f19ef9d01c7813389e.tar.gz |
Modification to sliplogin prints desitination's IP address before
going into SLIP mode, useful for scripts that can automatically
grok IP addresses ala Trumpet Winsock.
Closes PR#2293
Submitted-By: andrew@fortress.org
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/sliplogin/sliplogin.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/usr.sbin/sliplogin/sliplogin.c b/usr.sbin/sliplogin/sliplogin.c index 0537a0b..f018c59 100644 --- a/usr.sbin/sliplogin/sliplogin.c +++ b/usr.sbin/sliplogin/sliplogin.c @@ -105,6 +105,29 @@ int slunit; char loginargs[BUFSIZ]; char loginfile[MAXPATHLEN]; char loginname[BUFSIZ]; +static char raddr[32]; + + +char * +make_ipaddr(void) +{ +static char address[20] =""; +struct hostent *he; +unsigned long ipaddr; +int i; + +address[0] = '\0'; +if ((he = gethostbyname(raddr)) != NULL) { + ipaddr = ntohl(*(long *)he->h_addr_list[0]); + sprintf(address, "%lu.%lu.%lu.%lu", + ipaddr >> 24, + (ipaddr & 0x00ff0000) >> 16, + (ipaddr & 0x0000ff00) >> 8, + (ipaddr & 0x000000ff)); + } + +return address; +} struct slip_modes { char *sm_name; @@ -124,7 +147,6 @@ findid(name) FILE *fp; static char slopt[5][16]; static char laddr[16]; - static char raddr[16]; static char mask[16]; char slparmsfile[MAXPATHLEN]; char user[16]; @@ -386,6 +408,10 @@ main(argc, argv) } (void) fchmod(0, 0600); (void) fprintf(stderr, "starting slip login for %s\n", loginname); + (void) fprintf(stderr, "your address is %s\n\n", make_ipaddr()); + + (void) fflush(stderr); + sleep(1); /* set up the line parameters */ if (tcgetattr(0, &tios) < 0) { |