[EMAIL PROTECTED] (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'"),
                 dirpath);

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
applications.

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.


_______________________________________________
bug-gnulib mailing list
bug-gnulib@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnulib

Reply via email to