Paul Eggert wrote: > > I'll add a comment regarding printf with the "%.*s" directive. > > That works only if the string lacks NULs
Ouch, indeed. > and its length fits into int, > and one must also convert the idx_t length to int (e.g., via a cast > which I find tricky). I've now documented that "%.*s" is NOT the solution. > Although these limitations could be documented, it > might also be good to have an API like quotearg to generate a quoted or > quotable string that can be printed with plain %s. Good point. I've added wrappers around the quotearg functions. Fortunately, most of the quotearg functions already have a *_mem variant that was designed precisely for this case. Bruno