bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: new module proposal: split


From: Simon Josefsson
Subject: Re: new module proposal: split
Date: Wed, 06 Sep 2006 09:56:59 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.50 (gnu/linux)

Davide Angelocola <address@hidden> writes:

> On Wednesday 06 September 2006 08:20, Sergey Poznyakoff wrote:
>> In mailutils, we use the function argcv_get:
>>
>> int argcv_get (const char *string, const char *delim, const char *cmnt,
>>                int *argc, char ***argv);
>>
>> which breaks the `string' according to the delimiters in `delim',
>> eventually ignoring anything after the comment starter `cmnt'.  It fills
>> in the array `argv' with the collected tokens and stores the number of
>> them in the memory location pointed to by `argc'.  The array `argv' is
>> NULL terminated.  Quotes and backslashes within `string' are handled in
>> shell-like fashion, i.e. "the \"new string\"" will produce two tokens
>> "the" and "new string".
>>
>> The function returns 0 on success.  Both `delim' and `cmnt' can be NULL.
>>
>> It seems to do just what the proposed split module should be doing,
>> doesn't it?
> argcv_get has more features than split(). It's ok for me to use this in 
> place of split().

A simpler interface, especially with a well-known name as 'split',
which at least to Perl programmers is close to an idiom, has some
separate value.  Perhaps 'split' could be implemented using
'argcv_get'.

Anyway, I like your proposal in general.

/Simon




reply via email to

[Prev in Thread] Current Thread [Next in Thread]