[Top][All Lists]

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

Re: [bug-gnulib] quote(arg) module usage?

From: Paul Eggert
Subject: Re: [bug-gnulib] quote(arg) module usage?
Date: Sun, 29 May 2005 11:56:07 -0700
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.4 (gnu/linux)

address@hidden (Karl Berry) writes:

> Can someone point me at an example of using the quote(arg) modules?  rms
> wants to know.

gnulib/lib/makepath.c is an example.  Here's how it works:

   #include <quote.h>

          error (0, errno, _("cannot change owner and/or group of %s"),
                 quote (dirpath));

This differs from:

          error (0, errno, _("cannot change owner and/or group of `%s'"),

in that "quote" escapes unusual characters in DIRPATH, e.g., "'" and
control characters like "\n".

Warning: "quote" reuses the storage that it returns.  Hence if you
need more than one thing quoted at the same time, you need to use
quote_n, and also the quote module is not suited for multithreaded

So the quote module itself can't be recommended to everybody.
Instead, people with multithreaded applications would have to use
quotearg_alloc (defined in the quotearg module).  It's more of a pain
to use, though.

reply via email to

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