Blame lib/quotearg.h

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