Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!swrinde!ucsd!helios.ee.lbl.gov!me10.lbl.gov!milburn From: milburn@me10.lbl.gov (John Milburn) Newsgroups: comp.sys.hp Subject: Re: Is there a WHOIS for HP-UX? Message-ID: <5021@helios.ee.lbl.gov> Date: 8 Mar 90 04:08:03 GMT References: <850@nisca.ircc.ohio-state.edu> Sender: usenet@helios.ee.lbl.gov Reply-To: JEMilburn@lbl.gov (John Milburn) Organization: Lawrence Berkeley Laboratory, Berkeley, CA Lines: 159 X-Local-Date: 7 Mar 90 20:08:03 PST In article <850@nisca.ircc.ohio-state.edu> frank@hpuxa.ircc.ohio-state.edu (Frank G. Fiamingo) writes: >Is there a "whois" program for HP9000/840? Currently we're >running HP-UX 3.1, and will upgrade soon to 7.0. If you mean the tcp service which does name inquiries to the NIC via internet, here it is. It is known to work under 6.5 and 7.0. -jem -------------------------Cut Here---------------------- #! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create the files: # Makefile # whois.c # This archive created: Wed Mar 7 20:04:13 1990 export PATH; PATH=/bin:/usr/local/bin:$PATH echo shar: extracting "'Makefile'" '(488 characters)' if test -f 'Makefile' then echo shar: will not over-write existing file "'Makefile'" else sed 's/^X//' << \SHAR_EOF > 'Makefile' X# @(#) $Header: Makefile,v 1.4 88/03/07 02:09:50 leres Exp $ (LBL) X# X# Copyright (c) 1980 Regents of the University of California. X# All rights reserved. The Berkeley software License Agreement X# specifies the terms and conditions for redistribution. X# X# @(#)Makefile 5.17 (Berkeley) 6/7/86 X# X# modified for hpux 89/09/23 jem XDESTDIR=/usr/local/bin XCFLAGS= -O X Xall: whois install X X Xwhois: X ${CC} -o whois ${CFLAGS} whois.c -lBSD X Xinstall: X (bsdinstall -s -m 755 whois ${DESTDIR}) X X SHAR_EOF if test 488 -ne "`wc -c < 'Makefile'`" then echo shar: error transmitting "'Makefile'" '(should have been 488 characters)' fi fi # end of overwriting check echo shar: extracting "'whois.c'" '(1908 characters)' if test -f 'whois.c' then echo shar: will not over-write existing file "'whois.c'" else sed 's/^X//' << \SHAR_EOF > 'whois.c' X/* X * Copyright (c) 1980 Regents of the University of California. X * All rights reserved. The Berkeley software License Agreement X * specifies the terms and conditions for redistribution. X */ X X#ifndef lint Xchar copyright[] = X"@(#) Copyright (c) 1980 Regents of the University of California.\n\ X All rights reserved.\n"; X#endif not lint X X#ifndef lint Xstatic char sccsid[] = "@(#)whois.c 5.3 (Berkeley) 2/8/88"; X#endif not lint X X#include X#include X X#include X X#include X#include X X#define NICHOST "nic.ddn.mil" X Xmain(argc, argv) X int argc; X char *argv[]; X{ X int s; X register FILE *sfi, *sfo; X register char c; X char *host = NICHOST; X struct sockaddr_in sin; X struct hostent *hp; X struct servent *sp; X X argc--, argv++; X if (argc > 2 && strcmp(*argv, "-h") == 0) { X argv++, argc--; X host = *argv++; X argc--; X } X if (argc < 1) { X fprintf(stderr, "usage: whois [ -h host ] name\n"); X exit(1); X } X hp = gethostbyname(host); X if (hp == NULL) { X fprintf(stderr, "whois: %s: host unknown\n", host); X exit(1); X } X host = hp->h_name; X s = socket(hp->h_addrtype, SOCK_STREAM, 0, 0); X if (s < 0) { X perror("whois: socket"); X exit(2); X } X bzero((caddr_t)&sin, sizeof (sin)); X sin.sin_family = hp->h_addrtype; X if (bind(s, &sin, sizeof (sin), 0) < 0) { X perror("whois: bind"); X exit(3); X } X bcopy(hp->h_addr, &sin.sin_addr, hp->h_length); X sp = getservbyname("whois", "tcp"); X if (sp == NULL) { X fprintf(stderr, "whois: whois/tcp: unknown service\n"); X exit(4); X } X sin.sin_port = sp->s_port; X if (connect(s, &sin, sizeof (sin), 0) < 0) { X perror("whois: connect"); X exit(5); X } X sfi = fdopen(s, "r"); X sfo = fdopen(s, "w"); X if (sfi == NULL || sfo == NULL) { X perror("fdopen"); X close(s); X exit(1); X } X while(--argc) X fprintf(sfo, "%s ", *argv++); X X fprintf(sfo, "%s\r\n", *argv); X fflush(sfo); X while ((c = getc(sfi)) != EOF) X putchar(c); X} SHAR_EOF if test 1908 -ne "`wc -c < 'whois.c'`" then echo shar: error transmitting "'whois.c'" '(should have been 1908 characters)' fi fi # end of overwriting check # End of shell archive exit 0 JEMilburn@lbl.gov ...!ucbvax!lbl.gov!JEMilburn