"handy.h"

Bennett E. Todd III bet at ecsvax.UUCP
Wed Sep 11 02:01:50 AEST 1985


I like the following:

	#define ISPREFIX(s1, s2) !strncmp(s1, s2, strlen(s1))

It isn't clean, it isn't efficient, but it makes

	if (ISPREFIX("command1", cmdbuff)) {
		...
	} else if (ISPREFIX("command2", cmdbuff)) {
		...

reasonably clean. It refers to s1 twice, and it isn't fully
parenthesized, but it works for this limited application.

Now, somebody want to post a version of the notorious bit-table macros?
God, I wish spell(1) weren't proprietary, those are REALLY cute!

-Bennett
-- 

"Hypocrisy is the vasoline of social intercourse." (Who said that?)

Bennett Todd -- Duke Computation Center, Durham, NC 27706-7756; (919) 684-3695
UUCP: ...{decvax,seismo,philabs,ihnp4,akgua}!mcnc!ecsvax!duccpc!bet



More information about the Comp.lang.c mailing list