Re: [dwm] [PATCH] An experiment with X resources

From: Chris Webb <chris_AT_arachsys.com>
Date: Mon, 24 Sep 2007 19:52:14 +0100

"Anselm R. Garbe" <arg_AT_suckless.org> writes:

> The only questionable issue I don't like is the strsep(3) use,
> because of portability concerns.

Failing all else, I guess a strsep() tokeniser

        while(tag = strsep(&line, " \t\n")) {
                if(!tag[0])
                        continue;
                tags = erealloc(tags, sizeof(char *) * ++ntags);
                tags[ntags - 1] = tag;
        }

can always be expanded to something like this

        do {
                tag = line;
                if (line = strpbrk(line, " \t\n"))
                        *line++ = '\0';
                if !tag[0]
                        continue;
                tags = erealloc(tags, sizeof(char *) * ++ntags);
                tags[ntags - 1] = tag;
        } while (line);

assuming strpbrk is reasonably universal.

Cheers,

Chris.
Received on Mon Sep 24 2007 - 20:52:16 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 14:55:20 UTC