tech-userlevel archive

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

Re: RFC - add snscanf(3) to stdio

On Mon, Sep 01, 2008 at 02:47:22AM -0400, der Mouse wrote:
 > Passing a non-NUL-terminated string to sscanf is a bug.  It would not
 > be a bug for snscanf, which is much of the point of snscanf.  (As for
 > itohy's point, I think the parallel with sscanf is compelling enough to
 > justify the name even though it is not, strictly, accurate.)

The name is by analogy to strncpy, I think. Or strnlen, which we don't
have but whose intended semantics are clear.

 > Another benefit of snscanf, which I haven't seen mentioned yet, is that
 > it lets you scanf out of a "string" that contains nonterminal NULs,
 > much as you can fscanf out of a file containing NULs.

Does it? I would be surprised if that worked, but if it does it ought
to be called memscanf, not snscanf.

 > FILE *fopenmem(void * /*buf*/, int /*len*/, const char * /*mode*/);

Surely that should be memopen()...

David A. Holland

Home | Main Index | Thread Index | Old Index