4 @c Copyright (C) 2005, 2009--2020 Free Software Foundation, Inc.
6 @c Permission is granted to copy, distribute and/or modify this document
7 @c under the terms of the GNU Free Documentation License, Version 1.3 or
8 @c any later version published by the Free Software Foundation; with no
9 @c Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A
10 @c copy of the license is at <https://www.gnu.org/licenses/fdl-1.3.en.html>.
16 Gnulib provides @samp{quote} and @samp{quotearg} modules to help with
17 quoting text, such as file names, in messages to the user. Here's an
18 example of using @samp{quote}:
23 error (0, errno, _("cannot change owner of %s"), quote (fname));
29 error (0, errno, _("cannot change owner of '%s'"), fname);
32 @noindent in that @code{quote} escapes unusual characters in
33 @code{fname}, e.g., @samp{'} and control characters like @samp{\n}.
36 However, a caveat: @code{quote} reuses the storage that it returns.
37 Hence if you need more than one thing quoted at the same time, you
38 need to use @code{quote_n}.
40 @findex quotearg_alloc
41 Also, the @code{quote} module is not suited for multithreaded applications.
42 In that case, you have to use @code{quotearg_alloc}, defined in the
43 @samp{quotearg} module, which is decidedly less convenient.