[comp.unix.wizards] Bugginess in /etc/printcap and gethostname

raoul@eplunix.UUCP (Nico Garcia) (04/04/91)

We have a kind of strange problem with our printcap when I try to set
it to cope with another printer. When I use this entry, it fails, complaining
about not being able to find the host.

	Suzie|suzie|Gatorshare_printer:\
		:lp=:\
		:rm=GatorBox00346:\
		:rp=Suzie:\
		:sd=/usr/spool/Suzie:\
		:lf=/usr/adm/Suzie-log:

But, if I change the rm to gatorbox, as follows,

	Suzie|suzie|Gatorshare_printer:\
		:lp=:\
		:rm=gatorbox:\
		:rp=Suzie:\
		:sd=/usr/spool/Suzie:\
		:lf=/usr/adm/Suzie-log:

The entry in /etc/hosts for our gatorbox is as follows:

	192.9.200.100		GatorBox00346 gatorbox	# LocalTalk gateway

Apparently, when getting hostnames, the "gethostbyname" does a
conversion to lower case, as follows:

	[code from gethostnameadr.c]

	gethostbyname(nam)

	[...code...]
	
		while (*nam)
			if (isupper(*nam))
				*lp++ = tolower(*nam++);
			else
				*lp++ = *nam++;
		*lp = '\0';

	[...more code...]


Our system is a Vax 11/750, running mosty BSD 4.3. Can anyone explain
to me *why* the !@#$ thing does a conversion of hostnames to lower
case? Or if there is any reason I should not just comment out the
if statement (we do have a source license)?

-- 
			Nico Garcia
			Designs by Geniuses for use by Idiots
			eplunix!cirl!raoul@eddie.mit.edu

clyde@ut-emx.cc.utexas.edu (Clyde W. Hoover) (04/05/91)

In article <1057@eplunix.UUCP>, raoul@eplunix.UUCP (Nico Garcia) writes:

|> Apparently, when getting hostnames, the "gethostbyname" does a
|> conversion to lower case ( ... )

|> Our system is a Vax 11/750, running mosty BSD 4.3. Can anyone explain
|> to me *why* the !@#$ thing does a conversion of hostnames to lower
|> case? Or if there is any reason I should not just comment out the
|> if statement (we do have a source license)?

Because Internet host names are case insensitive, as per some RFC.
There may be a bug in gethostnameadr.c in that data from the host file
should be treated the same as the hostname argument (i.e. forced to 
lower case).

Change "GatorBox00346" to "gatorbox00346" in hosts and printcap or fix the
comparasion in gethostnameadr.c to be truly case-insensitive.

Clyde Hoover (Shouter-To-Dead-Parrots)	|
UNIX/VMS Services			| "Forward my mail to the corner
Compuatation Center, UT Austin 		|  of Pork and Beans"
clyde@emx.utexas.edu			|