Blame lib/quotearg.h

Packit 33f14e
/* quotearg.h - quote arguments for output
Packit 33f14e
Packit 33f14e
   Copyright (C) 1998-2002, 2004, 2006, 2008-2017 Free Software Foundation,
Packit 33f14e
   Inc.
Packit 33f14e
Packit 33f14e
   This program is free software: you can redistribute it and/or modify
Packit 33f14e
   it under the terms of the GNU General Public License as published by
Packit 33f14e
   the Free Software Foundation; either version 3 of the License, or
Packit 33f14e
   (at your option) any later version.
Packit 33f14e
Packit 33f14e
   This program is distributed in the hope that it will be useful,
Packit 33f14e
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 33f14e
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 33f14e
   GNU General Public License for more details.
Packit 33f14e
Packit 33f14e
   You should have received a copy of the GNU General Public License
Packit 33f14e
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
Packit 33f14e
Packit 33f14e
/* Written by Paul Eggert <eggert@twinsun.com> */
Packit 33f14e
Packit 33f14e
#ifndef QUOTEARG_H_
Packit 33f14e
# define QUOTEARG_H_ 1
Packit 33f14e
Packit 33f14e
# include <stddef.h>
Packit 33f14e
Packit 33f14e
/* Basic quoting styles.  For each style, an example is given on the
Packit 33f14e
   input strings "simple", "\0 \t\n'\"\033?""?/\\", and "a:b", using
Packit 33f14e
   quotearg_buffer, quotearg_mem, and quotearg_colon_mem with that
Packit 33f14e
   style and the default flags and quoted characters.  Note that the
Packit 33f14e
   examples are shown here as valid C strings rather than what
Packit 33f14e
   displays on a terminal (with "??/" as a trigraph for "\\").  */
Packit 33f14e
enum quoting_style
Packit 33f14e
  {
Packit 33f14e
    /* Output names as-is (ls --quoting-style=literal).  Can result in
Packit 33f14e
       embedded null bytes if QA_ELIDE_NULL_BYTES is not in
Packit 33f14e
       effect.
Packit 33f14e
Packit 33f14e
       quotearg_buffer:
Packit 33f14e
       "simple", "\0 \t\n'\"\033??/\\", "a:b"
Packit 33f14e
       quotearg:
Packit 33f14e
       "simple", " \t\n'\"\033??/\\", "a:b"
Packit 33f14e
       quotearg_colon:
Packit 33f14e
       "simple", " \t\n'\"\033??/\\", "a:b"
Packit 33f14e
    */
Packit 33f14e
    literal_quoting_style,
Packit 33f14e
Packit 33f14e
    /* Quote names for the shell if they contain shell metacharacters
Packit 33f14e
       or would cause ambiguous output (ls --quoting-style=shell).
Packit 33f14e
       Can result in embedded null bytes if QA_ELIDE_NULL_BYTES is not
Packit 33f14e
       in effect.
Packit 33f14e
Packit 33f14e
       quotearg_buffer:
Packit 33f14e
       "simple", "'\0 \t\n'\\''\"\033??/\\'", "a:b"
Packit 33f14e
       quotearg:
Packit 33f14e
       "simple", "' \t\n'\\''\"\033??/\\'", "a:b"
Packit 33f14e
       quotearg_colon:
Packit 33f14e
       "simple", "' \t\n'\\''\"\033??/\\'", "'a:b'"
Packit 33f14e
    */
Packit 33f14e
    shell_quoting_style,
Packit 33f14e
Packit 33f14e
    /* Quote names for the shell, even if they would normally not
Packit 33f14e
       require quoting (ls --quoting-style=shell-always).  Can result
Packit 33f14e
       in embedded null bytes if QA_ELIDE_NULL_BYTES is not in effect.
Packit 33f14e
       Behaves like shell_quoting_style if QA_ELIDE_OUTER_QUOTES is in
Packit 33f14e
       effect.
Packit 33f14e
Packit 33f14e
       quotearg_buffer:
Packit 33f14e
       "'simple'", "'\0 \t\n'\\''\"\033??/\\'", "'a:b'"
Packit 33f14e
       quotearg:
Packit 33f14e
       "'simple'", "' \t\n'\\''\"\033??/\\'", "'a:b'"
Packit 33f14e
       quotearg_colon:
Packit 33f14e
       "'simple'", "' \t\n'\\''\"\033??/\\'", "'a:b'"
Packit 33f14e
    */
Packit 33f14e
    shell_always_quoting_style,
Packit 33f14e
Packit 33f14e
    /* Quote names for the shell if they contain shell metacharacters
Packit 33f14e
       or other problematic characters (ls --quoting-style=shell-escape).
Packit 33f14e
       Non printable characters are quoted using the $'...' syntax,
Packit 33f14e
       which originated in ksh93 and is widely supported by most shells,
Packit 33f14e
       and proposed for inclusion in POSIX.
Packit 33f14e
Packit 33f14e
       quotearg_buffer:
Packit 33f14e
       "simple", "''$'\\0'' '$'\\t\\n'\\''\"'$'\\033''??/\\'", "a:b"
Packit 33f14e
       quotearg:
Packit 33f14e
       "simple", "''$'\\0'' '$'\\t\\n'\\''\"'$'\\033''??/\\'", "a:b"
Packit 33f14e
       quotearg_colon:
Packit 33f14e
       "simple", "''$'\\0'' '$'\\t\\n'\\''\"'$'\\033''??/\\'", "'a:b'"
Packit 33f14e
    */
Packit 33f14e
    shell_escape_quoting_style,
Packit 33f14e
Packit 33f14e
    /* Quote names for the shell even if they would normally not
Packit 33f14e
       require quoting (ls --quoting-style=shell-escape).
Packit 33f14e
       Non printable characters are quoted using the $'...' syntax,
Packit 33f14e
       which originated in ksh93 and is widely supported by most shells,
Packit 33f14e
       and proposed for inclusion in POSIX.  Behaves like
Packit 33f14e
       shell_escape_quoting_style if QA_ELIDE_OUTER_QUOTES is in effect.
Packit 33f14e
Packit 33f14e
       quotearg_buffer:
Packit 33f14e
       "simple", "''$'\\0'' '$'\\t\\n'\\''\"'$'\\033''??/\'", "a:b"
Packit 33f14e
       quotearg:
Packit 33f14e
       "simple", "''$'\\0'' '$'\\t\\n'\\''\"'$'\\033''??/\'", "a:b"
Packit 33f14e
       quotearg_colon:
Packit 33f14e
       "simple", "''$'\\0'' '$'\\t\\n'\\''\"'$'\\033''??/\'", "'a:b'"
Packit 33f14e
    */
Packit 33f14e
    shell_escape_always_quoting_style,
Packit 33f14e
Packit 33f14e
    /* Quote names as for a C language string (ls --quoting-style=c).
Packit 33f14e
       Behaves like c_maybe_quoting_style if QA_ELIDE_OUTER_QUOTES is
Packit 33f14e
       in effect.  Split into consecutive strings if
Packit 33f14e
       QA_SPLIT_TRIGRAPHS.
Packit 33f14e
Packit 33f14e
       quotearg_buffer:
Packit 33f14e
       "\"simple\"", "\"\\0 \\t\\n'\\\"\\033??/\\\\\"", "\"a:b\""
Packit 33f14e
       quotearg:
Packit 33f14e
       "\"simple\"", "\"\\0 \\t\\n'\\\"\\033??/\\\\\"", "\"a:b\""
Packit 33f14e
       quotearg_colon:
Packit 33f14e
       "\"simple\"", "\"\\0 \\t\\n'\\\"\\033??/\\\\\"", "\"a\\:b\""
Packit 33f14e
    */
Packit 33f14e
    c_quoting_style,
Packit 33f14e
Packit 33f14e
    /* Like c_quoting_style except omit the surrounding double-quote
Packit 33f14e
       characters if no quoted characters are encountered.
Packit 33f14e
Packit 33f14e
       quotearg_buffer:
Packit 33f14e
       "simple", "\"\\0 \\t\\n'\\\"\\033??/\\\\\"", "a:b"
Packit 33f14e
       quotearg:
Packit 33f14e
       "simple", "\"\\0 \\t\\n'\\\"\\033??/\\\\\"", "a:b"
Packit 33f14e
       quotearg_colon:
Packit 33f14e
       "simple", "\"\\0 \\t\\n'\\\"\\033??/\\\\\"", "\"a:b\""
Packit 33f14e
    */
Packit 33f14e
    c_maybe_quoting_style,
Packit 33f14e
Packit 33f14e
    /* Like c_quoting_style except always omit the surrounding
Packit 33f14e
       double-quote characters and ignore QA_SPLIT_TRIGRAPHS
Packit 33f14e
       (ls --quoting-style=escape).
Packit 33f14e
Packit 33f14e
       quotearg_buffer:
Packit 33f14e
       "simple", "\\0 \\t\\n'\"\\033??/\\\\", "a:b"
Packit 33f14e
       quotearg:
Packit 33f14e
       "simple", "\\0 \\t\\n'\"\\033??/\\\\", "a:b"
Packit 33f14e
       quotearg_colon:
Packit 33f14e
       "simple", "\\0 \\t\\n'\"\\033??/\\\\", "a\\:b"
Packit 33f14e
    */
Packit 33f14e
    escape_quoting_style,
Packit 33f14e
Packit 33f14e
    /* Like clocale_quoting_style, but use single quotes in the
Packit 33f14e
       default C locale or if the program does not use gettext
Packit 33f14e
       (ls --quoting-style=locale).  For UTF-8 locales, quote
Packit 33f14e
       characters will use Unicode.
Packit 33f14e
Packit 33f14e
       LC_MESSAGES=C
Packit 33f14e
       quotearg_buffer:
Packit 33f14e
       "`simple'", "`\\0 \\t\\n\\'\"\\033??/\\\\'", "`a:b'"
Packit 33f14e
       quotearg:
Packit 33f14e
       "`simple'", "`\\0 \\t\\n\\'\"\\033??/\\\\'", "`a:b'"
Packit 33f14e
       quotearg_colon:
Packit 33f14e
       "`simple'", "`\\0 \\t\\n\\'\"\\033??/\\\\'", "`a\\:b'"
Packit 33f14e
Packit 33f14e
       LC_MESSAGES=pt_PT.utf8
Packit 33f14e
       quotearg_buffer:
Packit 33f14e
       "\302\253simple\302\273",
Packit 33f14e
       "\302\253\\0 \\t\\n'\"\\033??/\\\\\302\253", "\302\253a:b\302\273"
Packit 33f14e
       quotearg:
Packit 33f14e
       "\302\253simple\302\273",
Packit 33f14e
       "\302\253\\0 \\t\\n'\"\\033??/\\\\\302\253", "\302\253a:b\302\273"
Packit 33f14e
       quotearg_colon:
Packit 33f14e
       "\302\253simple\302\273",
Packit 33f14e
       "\302\253\\0 \\t\\n'\"\\033??/\\\\\302\253", "\302\253a\\:b\302\273"
Packit 33f14e
    */
Packit 33f14e
    locale_quoting_style,
Packit 33f14e
Packit 33f14e
    /* Like c_quoting_style except use quotation marks appropriate for
Packit 33f14e
       the locale and ignore QA_SPLIT_TRIGRAPHS
Packit 33f14e
       (ls --quoting-style=clocale).
Packit 33f14e
Packit 33f14e
       LC_MESSAGES=C
Packit 33f14e
       quotearg_buffer:
Packit 33f14e
       "\"simple\"", "\"\\0 \\t\\n'\\\"\\033??/\\\\\"", "\"a:b\""
Packit 33f14e
       quotearg:
Packit 33f14e
       "\"simple\"", "\"\\0 \\t\\n'\\\"\\033??/\\\\\"", "\"a:b\""
Packit 33f14e
       quotearg_colon:
Packit 33f14e
       "\"simple\"", "\"\\0 \\t\\n'\\\"\\033??/\\\\\"", "\"a\\:b\""
Packit 33f14e
Packit 33f14e
       LC_MESSAGES=pt_PT.utf8
Packit 33f14e
       quotearg_buffer:
Packit 33f14e
       "\302\253simple\302\273",
Packit 33f14e
       "\302\253\\0 \\t\\n'\"\\033??/\\\\\302\253", "\302\253a:b\302\273"
Packit 33f14e
       quotearg:
Packit 33f14e
       "\302\253simple\302\273",
Packit 33f14e
       "\302\253\\0 \\t\\n'\"\\033??/\\\\\302\253", "\302\253a:b\302\273"
Packit 33f14e
       quotearg_colon:
Packit 33f14e
       "\302\253simple\302\273",
Packit 33f14e
       "\302\253\\0 \\t\\n'\"\\033??/\\\\\302\253", "\302\253a\\:b\302\273"
Packit 33f14e
    */
Packit 33f14e
    clocale_quoting_style,
Packit 33f14e
Packit 33f14e
    /* Like clocale_quoting_style except use the custom quotation marks
Packit 33f14e
       set by set_custom_quoting.  If custom quotation marks are not
Packit 33f14e
       set, the behavior is undefined.
Packit 33f14e
Packit 33f14e
       left_quote = right_quote = "'"
Packit 33f14e
       quotearg_buffer:
Packit 33f14e
       "'simple'", "'\\0 \\t\\n\\'\"\\033??/\\\\'", "'a:b'"
Packit 33f14e
       quotearg:
Packit 33f14e
       "'simple'", "'\\0 \\t\\n\\'\"\\033??/\\\\'", "'a:b'"
Packit 33f14e
       quotearg_colon:
Packit 33f14e
       "'simple'", "'\\0 \\t\\n\\'\"\\033??/\\\\'", "'a\\:b'"
Packit 33f14e
Packit 33f14e
       left_quote = "(" and right_quote = ")"
Packit 33f14e
       quotearg_buffer:
Packit 33f14e
       "(simple)", "(\\0 \\t\\n'\"\\033??/\\\\)", "(a:b)"
Packit 33f14e
       quotearg:
Packit 33f14e
       "(simple)", "(\\0 \\t\\n'\"\\033??/\\\\)", "(a:b)"
Packit 33f14e
       quotearg_colon:
Packit 33f14e
       "(simple)", "(\\0 \\t\\n'\"\\033??/\\\\)", "(a\\:b)"
Packit 33f14e
Packit 33f14e
       left_quote = ":" and right_quote = " "
Packit 33f14e
       quotearg_buffer:
Packit 33f14e
       ":simple ", ":\\0\\ \\t\\n'\"\\033??/\\\\ ", ":a:b "
Packit 33f14e
       quotearg:
Packit 33f14e
       ":simple ", ":\\0\\ \\t\\n'\"\\033??/\\\\ ", ":a:b "
Packit 33f14e
       quotearg_colon:
Packit 33f14e
       ":simple ", ":\\0\\ \\t\\n'\"\\033??/\\\\ ", ":a\\:b "
Packit 33f14e
Packit 33f14e
       left_quote = "\"'" and right_quote = "'\""
Packit 33f14e
       Notice that this is treated as a single level of quotes or two
Packit 33f14e
       levels where the outer quote need not be escaped within the inner
Packit 33f14e
       quotes.  For two levels where the outer quote must be escaped
Packit 33f14e
       within the inner quotes, you must use separate quotearg
Packit 33f14e
       invocations.
Packit 33f14e
       quotearg_buffer:
Packit 33f14e
       "\"'simple'\"", "\"'\\0 \\t\\n\\'\"\\033??/\\\\'\"", "\"'a:b'\""
Packit 33f14e
       quotearg:
Packit 33f14e
       "\"'simple'\"", "\"'\\0 \\t\\n\\'\"\\033??/\\\\'\"", "\"'a:b'\""
Packit 33f14e
       quotearg_colon:
Packit 33f14e
       "\"'simple'\"", "\"'\\0 \\t\\n\\'\"\\033??/\\\\'\"", "\"'a\\:b'\""
Packit 33f14e
    */
Packit 33f14e
    custom_quoting_style
Packit 33f14e
  };
Packit 33f14e
Packit 33f14e
/* Flags for use in set_quoting_flags.  */
Packit 33f14e
enum quoting_flags
Packit 33f14e
  {
Packit 33f14e
    /* Always elide null bytes from styles that do not quote them,
Packit 33f14e
       even when the length of the result is available to the
Packit 33f14e
       caller.  */
Packit 33f14e
    QA_ELIDE_NULL_BYTES = 0x01,
Packit 33f14e
Packit 33f14e
    /* Omit the surrounding quote characters if no escaped characters
Packit 33f14e
       are encountered.  Note that if no other character needs
Packit 33f14e
       escaping, then neither does the escape character.  */
Packit 33f14e
    QA_ELIDE_OUTER_QUOTES = 0x02,
Packit 33f14e
Packit 33f14e
    /* In the c_quoting_style and c_maybe_quoting_style, split ANSI
Packit 33f14e
       trigraph sequences into concatenated strings (for example,
Packit 33f14e
       "?""?/" rather than "??/", which could be confused with
Packit 33f14e
       "\\").  */
Packit 33f14e
    QA_SPLIT_TRIGRAPHS = 0x04
Packit 33f14e
  };
Packit 33f14e
Packit 33f14e
/* For now, --quoting-style=literal is the default, but this may change.  */
Packit 33f14e
# ifndef DEFAULT_QUOTING_STYLE
Packit 33f14e
#  define DEFAULT_QUOTING_STYLE literal_quoting_style
Packit 33f14e
# endif
Packit 33f14e
Packit 33f14e
/* Names of quoting styles and their corresponding values.  */
Packit 33f14e
extern char const *const quoting_style_args[];
Packit 33f14e
extern enum quoting_style const quoting_style_vals[];
Packit 33f14e
Packit 33f14e
struct quoting_options;
Packit 33f14e
Packit 33f14e
/* The functions listed below set and use a hidden variable
Packit 33f14e
   that contains the default quoting style options.  */
Packit 33f14e
Packit 33f14e
/* Allocate a new set of quoting options, with contents initially identical
Packit 33f14e
   to O if O is not null, or to the default if O is null.
Packit 33f14e
   It is the caller's responsibility to free the result.  */
Packit 33f14e
struct quoting_options *clone_quoting_options (struct quoting_options *o);
Packit 33f14e
Packit 33f14e
/* Get the value of O's quoting style.  If O is null, use the default.  */
Packit 33f14e
enum quoting_style get_quoting_style (struct quoting_options const *o);
Packit 33f14e
Packit 33f14e
/* In O (or in the default if O is null),
Packit 33f14e
   set the value of the quoting style to S.  */
Packit 33f14e
void set_quoting_style (struct quoting_options *o, enum quoting_style s);
Packit 33f14e
Packit 33f14e
/* In O (or in the default if O is null),
Packit 33f14e
   set the value of the quoting options for character C to I.
Packit 33f14e
   Return the old value.  Currently, the only values defined for I are
Packit 33f14e
   0 (the default) and 1 (which means to quote the character even if
Packit 33f14e
   it would not otherwise be quoted).  C must never be a digit or a
Packit 33f14e
   letter that has special meaning after a backslash (for example, "\t"
Packit 33f14e
   for tab).  */
Packit 33f14e
int set_char_quoting (struct quoting_options *o, char c, int i);
Packit 33f14e
Packit 33f14e
/* In O (or in the default if O is null),
Packit 33f14e
   set the value of the quoting options flag to I, which can be a
Packit 33f14e
   bitwise combination of enum quoting_flags, or 0 for default
Packit 33f14e
   behavior.  Return the old value.  */
Packit 33f14e
int set_quoting_flags (struct quoting_options *o, int i);
Packit 33f14e
Packit 33f14e
/* In O (or in the default if O is null),
Packit 33f14e
   set the value of the quoting style to custom_quoting_style,
Packit 33f14e
   set the left quote to LEFT_QUOTE, and set the right quote to
Packit 33f14e
   RIGHT_QUOTE.  Each of LEFT_QUOTE and RIGHT_QUOTE must be
Packit 33f14e
   null-terminated and can be the empty string.  Because backslashes are
Packit 33f14e
   used for escaping, it does not make sense for RIGHT_QUOTE to contain
Packit 33f14e
   a backslash.  RIGHT_QUOTE must not begin with a digit or a letter
Packit 33f14e
   that has special meaning after a backslash (for example, "\t" for
Packit 33f14e
   tab).  */
Packit 33f14e
void set_custom_quoting (struct quoting_options *o,
Packit 33f14e
                         char const *left_quote,
Packit 33f14e
                         char const *right_quote);
Packit 33f14e
Packit 33f14e
/* Place into buffer BUFFER (of size BUFFERSIZE) a quoted version of
Packit 33f14e
   argument ARG (of size ARGSIZE), using O to control quoting.
Packit 33f14e
   If O is null, use the default.
Packit 33f14e
   Terminate the output with a null character, and return the written
Packit 33f14e
   size of the output, not counting the terminating null.
Packit 33f14e
   If BUFFERSIZE is too small to store the output string, return the
Packit 33f14e
   value that would have been returned had BUFFERSIZE been large enough.
Packit 33f14e
   If ARGSIZE is -1, use the string length of the argument for ARGSIZE.
Packit 33f14e
   On output, BUFFER might contain embedded null bytes if ARGSIZE was
Packit 33f14e
   not -1, the style of O does not use backslash escapes, and the
Packit 33f14e
   flags of O do not request elision of null bytes.*/
Packit 33f14e
size_t quotearg_buffer (char *buffer, size_t buffersize,
Packit 33f14e
                        char const *arg, size_t argsize,
Packit 33f14e
                        struct quoting_options const *o);
Packit 33f14e
Packit 33f14e
/* Like quotearg_buffer, except return the result in a newly allocated
Packit 33f14e
   buffer.  It is the caller's responsibility to free the result.  The
Packit 33f14e
   result will not contain embedded null bytes.  */
Packit 33f14e
char *quotearg_alloc (char const *arg, size_t argsize,
Packit 33f14e
                      struct quoting_options const *o);
Packit 33f14e
Packit 33f14e
/* Like quotearg_alloc, except that the length of the result,
Packit 33f14e
   excluding the terminating null byte, is stored into SIZE if it is
Packit 33f14e
   non-NULL.  The result might contain embedded null bytes if ARGSIZE
Packit 33f14e
   was not -1, SIZE was not NULL, the style of O does not use
Packit 33f14e
   backslash escapes, and the flags of O do not request elision of
Packit 33f14e
   null bytes.*/
Packit 33f14e
char *quotearg_alloc_mem (char const *arg, size_t argsize,
Packit 33f14e
                          size_t *size, struct quoting_options const *o);
Packit 33f14e
Packit 33f14e
/* Use storage slot N to return a quoted version of the string ARG.
Packit 33f14e
   Use the default quoting options.
Packit 33f14e
   The returned value points to static storage that can be
Packit 33f14e
   reused by the next call to this function with the same value of N.
Packit 33f14e
   N must be nonnegative.  The output of all functions in the
Packit 33f14e
   quotearg_n family are guaranteed to not contain embedded null
Packit 33f14e
   bytes.*/
Packit 33f14e
char *quotearg_n (int n, char const *arg);
Packit 33f14e
Packit 33f14e
/* Equivalent to quotearg_n (0, ARG).  */
Packit 33f14e
char *quotearg (char const *arg);
Packit 33f14e
Packit 33f14e
/* Use storage slot N to return a quoted version of the argument ARG
Packit 33f14e
   of size ARGSIZE.  This is like quotearg_n (N, ARG), except it can
Packit 33f14e
   quote null bytes.  */
Packit 33f14e
char *quotearg_n_mem (int n, char const *arg, size_t argsize);
Packit 33f14e
Packit 33f14e
/* Equivalent to quotearg_n_mem (0, ARG, ARGSIZE).  */
Packit 33f14e
char *quotearg_mem (char const *arg, size_t argsize);
Packit 33f14e
Packit 33f14e
/* Use style S and storage slot N to return a quoted version of the string ARG.
Packit 33f14e
   This is like quotearg_n (N, ARG), except that it uses S with no other
Packit 33f14e
   options to specify the quoting method.  */
Packit 33f14e
char *quotearg_n_style (int n, enum quoting_style s, char const *arg);
Packit 33f14e
Packit 33f14e
/* Use style S and storage slot N to return a quoted version of the
Packit 33f14e
   argument ARG of size ARGSIZE.  This is like quotearg_n_style
Packit 33f14e
   (N, S, ARG), except it can quote null bytes.  */
Packit 33f14e
char *quotearg_n_style_mem (int n, enum quoting_style s,
Packit 33f14e
                            char const *arg, size_t argsize);
Packit 33f14e
Packit 33f14e
/* Equivalent to quotearg_n_style (0, S, ARG).  */
Packit 33f14e
char *quotearg_style (enum quoting_style s, char const *arg);
Packit 33f14e
Packit 33f14e
/* Equivalent to quotearg_n_style_mem (0, S, ARG, ARGSIZE).  */
Packit 33f14e
char *quotearg_style_mem (enum quoting_style s,
Packit 33f14e
                          char const *arg, size_t argsize);
Packit 33f14e
Packit 33f14e
/* Like quotearg (ARG), except also quote any instances of CH.
Packit 33f14e
   See set_char_quoting for a description of acceptable CH values.  */
Packit 33f14e
char *quotearg_char (char const *arg, char ch);
Packit 33f14e
Packit 33f14e
/* Like quotearg_char (ARG, CH), except it can quote null bytes.  */
Packit 33f14e
char *quotearg_char_mem (char const *arg, size_t argsize, char ch);
Packit 33f14e
Packit 33f14e
/* Equivalent to quotearg_char (ARG, ':').  */
Packit 33f14e
char *quotearg_colon (char const *arg);
Packit 33f14e
Packit 33f14e
/* Like quotearg_colon (ARG), except it can quote null bytes.  */
Packit 33f14e
char *quotearg_colon_mem (char const *arg, size_t argsize);
Packit 33f14e
Packit 33f14e
/* Like quotearg_n_style, except with ':' quoting enabled.  */
Packit 33f14e
char *quotearg_n_style_colon (int n, enum quoting_style s, char const *arg);
Packit 33f14e
Packit 33f14e
/* Like quotearg_n_style (N, S, ARG) but with S as custom_quoting_style
Packit 33f14e
   with left quote as LEFT_QUOTE and right quote as RIGHT_QUOTE.  See
Packit 33f14e
   set_custom_quoting for a description of acceptable LEFT_QUOTE and
Packit 33f14e
   RIGHT_QUOTE values.  */
Packit 33f14e
char *quotearg_n_custom (int n, char const *left_quote,
Packit 33f14e
                         char const *right_quote, char const *arg);
Packit 33f14e
Packit 33f14e
/* Like quotearg_n_custom (N, LEFT_QUOTE, RIGHT_QUOTE, ARG) except it
Packit 33f14e
   can quote null bytes.  */
Packit 33f14e
char *quotearg_n_custom_mem (int n, char const *left_quote,
Packit 33f14e
                             char const *right_quote,
Packit 33f14e
                             char const *arg, size_t argsize);
Packit 33f14e
Packit 33f14e
/* Equivalent to quotearg_n_custom (0, LEFT_QUOTE, RIGHT_QUOTE, ARG).  */
Packit 33f14e
char *quotearg_custom (char const *left_quote, char const *right_quote,
Packit 33f14e
                       char const *arg);
Packit 33f14e
Packit 33f14e
/* Equivalent to quotearg_n_custom_mem (0, LEFT_QUOTE, RIGHT_QUOTE, ARG,
Packit 33f14e
                                        ARGSIZE).  */
Packit 33f14e
char *quotearg_custom_mem (char const *left_quote,
Packit 33f14e
                           char const *right_quote,
Packit 33f14e
                           char const *arg, size_t argsize);
Packit 33f14e
Packit 33f14e
/* Free any dynamically allocated memory.  */
Packit 33f14e
void quotearg_free (void);
Packit 33f14e
Packit 33f14e
#endif /* !QUOTEARG_H_ */