Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 9/5/84; site mot.UUCP
Path: utzoo!utcs!mnetor!mot!fred
From: fred@mot.UUCP (Fred Christiansen)
Newsgroups: net.news.b,net.news.sa
Subject: bug in header.c's use of prefix() from funcs.c?
Message-ID: <339@mot.UUCP>
Date: Thu, 3-Oct-85 17:28:19 EDT
Article-I.D.: mot.339
Posted: Thu Oct  3 17:28:19 1985
Date-Received: Fri, 4-Oct-85 13:34:21 EDT
Distribution: net
Organization: Motorola Microsystems, Tempe, AZ  85282
Lines: 61
Xref: utcs net.news.b:1075 net.news.sa:189

i haven't seen anything on this, but forgive this neophyte if there has been.
in header.c is the following fragment:

	if (prefix(hp->path, FULLSYSNAME))
		fprintf(fp, "Path: %s\n", hp->path);
	else
		fprintf(fp, "Path: %s!%s\n", FULLSYSNAME, hp->path);

which evidently tries to figure out whether or not to add the local system's
name to "Path:".  however, it appears to fail in the event that the local
system's name is a left-anchored substring of the feeding system's name.
the following program demonstrates this: -----------------------------------

#include 
#include 

main() {
	if( prefix("motsj1!bjh", "mot") )
		printf("motsj1/mot, true path\n");
	else
		printf("motsj1/mot, false path\n");
	if( prefix("mot!fred", "motsj1") )
		printf("mot/motsj1, true path\n");
	else
		printf("mot/motsj1, false path\n");
	if( prefix("terak!sohail", "mot") )
		printf("terak/mot, true path\n");
	else
		printf("terak/mot, false path\n");
}

prefix(full, pref)			/* pulled straight from funcs.c */
register char *full, *pref;
{
	register char fc, pc;

	do {
		fc = *full++;
		pc = *pref++;
		if (isupper(fc))
			fc = tolower(fc);
		if (isupper(pc))
			pc = tolower(pc);
	} while (fc == pc);
	if (*--pref == 0)
		return 1;
	else
		return 0;
}
-------------------------------------------------
when you run the program, you discover that the first if returns true,
while the next two return false.  in fact, they should all return false in order
to get the desired effect.
	it appears to me that prefix(), given its other uses, is not the
correct routine to use.
	solutions?  or am i missing something?  thanks ya'll for the help.
-- 
<< Generic disclaimer >>
Fred Christiansen ("Canajun, eh?") @ Motorola Microsystems, Tempe, AZ
UUCP:  {seismo!terak, trwrb!flkvax, utzoo!mnetor, ihnp4!btlunix}!mot!fred
ARPA:  oakhill!mot!fred@ut-sally.ARPA             Telephone:  +1 602-438-3472