git/quote.c

#include "git-compat-util.h"
#include "path.h"
#include "quote.h"
#include "strbuf.h"
#include "strvec.h"

int quote_path_fully =;

static inline int need_bs_quote(char c)
{}

/* Help to copy the thing properly quoted for the shell safety.
 * any single quote is replaced with '\'', any exclamation point
 * is replaced with '\!', and the whole thing is enclosed in a
 * single quote pair.
 *
 * E.g.
 *  original     sq_quote     result
 *  name     ==> name      ==> 'name'
 *  a b      ==> a b       ==> 'a b'
 *  a'b      ==> a'\''b    ==> 'a'\''b'
 *  a!b      ==> a'\!'b    ==> 'a'\!'b'
 */
void sq_quote_buf(struct strbuf *dst, const char *src)
{}

void sq_quote_buf_pretty(struct strbuf *dst, const char *src)
{}

void sq_quotef(struct strbuf *dst, const char *fmt, ...)
{}

void sq_quote_argv(struct strbuf *dst, const char **argv)
{}

/*
 * Legacy function to append each argv value, quoted as necessasry,
 * with whitespace before each value.  This results in a leading
 * space in the result.
 */
void sq_quote_argv_pretty(struct strbuf *dst, const char **argv)
{}

/*
 * Append each argv value, quoted as necessary, with whitespace between them.
 */
void sq_append_quote_argv_pretty(struct strbuf *dst, const char **argv)
{}

char *sq_dequote_step(char *arg, char **next)
{}

char *sq_dequote(char *arg)
{}

static int sq_dequote_to_argv_internal(char *arg,
				       const char ***argv, int *nr, int *alloc,
				       struct strvec *array)
{}

int sq_dequote_to_argv(char *arg, const char ***argv, int *nr, int *alloc)
{}

int sq_dequote_to_strvec(char *arg, struct strvec *array)
{}

/* 1 means: quote as octal
 * 0 means: quote as octal if (quote_path_fully)
 * -1 means: never quote
 * c: quote as "\\c"
 */
#define X8(x)
#define X16(x)
static signed char const cq_lookup[256] =;

static inline int cq_must_quote(char c)
{}

/* returns the longest prefix not needing a quote up to maxlen if positive.
   This stops at the first \0 because it's marked as a character needing an
   escape */
static size_t next_quote_pos(const char *s, ssize_t maxlen)
{}

/*
 * C-style name quoting.
 *
 * (1) if sb and fp are both NULL, inspect the input name and counts the
 *     number of bytes that are needed to hold c_style quoted version of name,
 *     counting the double quotes around it but not terminating NUL, and
 *     returns it.
 *     However, if name does not need c_style quoting, it returns 0.
 *
 * (2) if sb or fp are not NULL, it emits the c_style quoted version
 *     of name, enclosed with double quotes if asked and needed only.
 *     Return value is the same as in (1).
 */
static size_t quote_c_style_counted(const char *name, ssize_t maxlen,
				    struct strbuf *sb, FILE *fp, unsigned flags)
{}

size_t quote_c_style(const char *name, struct strbuf *sb, FILE *fp, unsigned flags)
{}

void quote_two_c_style(struct strbuf *sb, const char *prefix, const char *path,
		       unsigned flags)
{}

void write_name_quoted(const char *name, FILE *fp, int terminator)
{}

void write_name_quoted_relative(const char *name, const char *prefix,
				FILE *fp, int terminator)
{}

/* quote path as relative to the given prefix */
char *quote_path(const char *in, const char *prefix, struct strbuf *out, unsigned flags)
{}

/*
 * C-style name unquoting.
 *
 * Quoted should point at the opening double quote.
 * + Returns 0 if it was able to unquote the string properly, and appends the
 *   result in the strbuf `sb'.
 * + Returns -1 in case of error, and doesn't touch the strbuf. Though note
 *   that this function will allocate memory in the strbuf, so calling
 *   strbuf_release is mandatory whichever result unquote_c_style returns.
 *
 * Updates endp pointer to point at one past the ending double quote if given.
 */
int unquote_c_style(struct strbuf *sb, const char *quoted, const char **endp)
{}

/* quoting as a string literal for other languages */

void perl_quote_buf(struct strbuf *sb, const char *src)
{}

void perl_quote_buf_with_len(struct strbuf *sb, const char *src, size_t len)
{}

void python_quote_buf(struct strbuf *sb, const char *src)
{}

void tcl_quote_buf(struct strbuf *sb, const char *src)
{}

void basic_regex_quote_buf(struct strbuf *sb, const char *src)
{}