Path: utzoo!attcan!uunet!samsung!uakari.primate.wisc.edu!sdd.hp.com!ucsd!ucbvax!TWG.COM!lefty From: lefty@TWG.COM Newsgroups: comp.protocols.appletalk Subject: Re: Problems with MacTCP hosts file: seems not to be used Message-ID: Date: 24 Oct 90 22:20:17 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 77 Martijn Koster writes: >I've got a slight problem: I'm using MacTCP, and have it set up Message-ID: <9010241459.aa17312@Mercury.TWG.COM> >so it can look-up names. I tested this with the "TCP Example" stack >that came on one of the developer disks. It works fine, but then I >tried adding hostnames in the Hosts file (in the System Folder, and >yes, it's a text only file). This didn't work. I tried the following: > > aa-> A-> 128.243.20.4 > bb.-> A-> 128.243.20.4 > cc.cs.nott.ac.uk-> A-> 128.243.20.4 > dd.cs.nott.ac.uk.-> A-> 128.243.20.4 > ee.nott.ac.uk-> A-> 128.243.20.4 > ff.nott.ac.uk.-> A-> 128.243.20.4 > >The '->' signifies a tab, and lines are nded with a return. >128.243.20.4 does exist, is in fact the machine I'm using now. >And then I tried all the hostnames, but "TCP Example" returned > > $$$ Couldn't get address $$$ > >Can somebody explain what I'm doing wrong? I'd love to RTFM, but >somebody has managed to lose it or something. I believe that the TCP Stack uses Harry Chesley's sample XCMDs, which are supplied as the "Hypercard MacTCP Tool Kit". There is a minor problem with Harry's code to use the MacTCP Domain Name Resolver functions: specifically, when Harry's code opens the resolver, if it isn't supplied with the name of a specific file to open, it passes a pointer to a null _string_ to the Resolver, rather than a null _pointer_. The Resolver only seems to look for a file called "Hosts" in the System Folder if it's passed a null _pointer_. You'll need to make a correction to Harry's XCMD to fix the situation described above--it's a pretty trivial hack. By the way, Harry's code is otherwise impeccable... To make the appropriate fix, find the following lines in the file TCPNameToAddr.c: /* Call open resolver. */ if ((paramPtr->paramCount < 3) || (paramPtr->params[2] == nil)) *str = 0; else strcpy(str,*(paramPtr->params[2])); rc = (*dnr)(OPENRESOLVER, str); They _should_ read: /* Call open resolver. */ if ((paramPtr->paramCount < 3) || (paramPtr->params[2] == nil)) { rc = (*dnr)(OPENRESOLVER, nil); } else { strcpy(str,*(paramPtr->params[2])); rc = (*dnr)(OPENRESOLVER, str); } >Also, has someone written a program to convert a /etc/hosts file to a >MacTCP Hosts file? Sorry, not me... >And lastly, doesn't NCSA Telnet 2.3 use MacTCP name resolver? I ended >up writing a program to convert /etc/hosts to a config.tel file (that >awk script that came with telnet choked on comments). Actually, I don't believe that it does. It's too bad, too, because it's easy to implement and it seems to work real well... Hope this helps... -- David N. Schlesinger (lefty@twg.com) Sr. Software Engineer The Wollongong Group