Blame lib/quotearg.h

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