From e5c0b85f37f6f70f19fac7f19ef9d01c7813389e Mon Sep 17 00:00:00 2001 From: jkh Date: Thu, 16 Jan 1997 11:47:44 +0000 Subject: 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 --- usr.sbin/sliplogin/sliplogin.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'usr.sbin/sliplogin') 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) { -- cgit v1.1