Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site ecsvax.UUCP Path: utzoo!linus!decvax!mcnc!ecsvax!bet From: bet@ecsvax.UUCP (Bennett E. Todd III) Newsgroups: net.lang.c Subject: Re: Re: "handy.h" Message-ID: <395@ecsvax.UUCP> Date: Tue, 10-Sep-85 12:01:50 EDT Article-I.D.: ecsvax.395 Posted: Tue Sep 10 12:01:50 1985 Date-Received: Thu, 12-Sep-85 23:43:41 EDT References: <10200006@ada-uts.UUCP> <532@linus.UUCP> <699@whuxl.UUCP> <782@lsuc.UUCP> <702@whuxl.UUCP> Reply-To: bet@ecsvax.UUCP (Bennett E. Todd III) Distribution: net Organization: Duke University Computation Center Lines: 25 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