Xref: utzoo comp.lang.c:7602 comp.databases:755 Path: utzoo!mnetor!uunet!lll-winken!lll-lcc!ames!necntc!ima!haddock!karl From: karl@haddock.ISC.COM (Karl Heuer) Newsgroups: comp.lang.c,comp.databases Subject: Re: gotcha in strtok(3) Message-ID: <2722@haddock.ISC.COM> Date: 26 Feb 88 19:53:13 GMT References: <45@vsi.UUCP> Reply-To: karl@haddock.ima.isc.com (Karl Heuer) Organization: Interactive Systems, Boston Lines: 10 In article <45@vsi.UUCP> friedl@vsi.UUCP (Stephen J. Friedl) writes: >I'd like to relate a gotcha that could drive you crazy. We often use >strtok(3) to run through a PATH-type variable to pick apart the individual >pieces. [But it scribbles in your array, which can be a problem.] Another problem is that strtok() doesn't distinguish between "/bin:/etc" and "/bin::/etc", so it's not really appropriate for parsing PATH or /etc/passwd. For the above and other reasons, I never use strtok(). Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.isc.com), The Walking Lint