Blame lib/quotearg.h

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