postgres/src/bin/psql/stringutils.h
Alvaro Herrera 41e3c94cac psql: when tab-completing, use quotes on file names that need them
psql backslash commands that deal with file or directory names require
quotes around those that have spaces, single quotes, or backslashes.
However, tab-completing such names does not provide said quotes, and is
thus almost useless with them.

This patch fixes the problem by having a wrapper function around
rl_filename_completion_function that dequotes on input and quotes on
output.  This eases dealing with such names.

Author: Noah Misch
2012-02-28 01:06:29 -03:00

26 lines
620 B
C

/*
* psql - the PostgreSQL interactive terminal
*
* Copyright (c) 2000-2012, PostgreSQL Global Development Group
*
* src/bin/psql/stringutils.h
*/
#ifndef STRINGUTILS_H
#define STRINGUTILS_H
/* The cooler version of strtok() which knows about quotes and doesn't
* overwrite your input */
extern char *strtokx(const char *s,
const char *whitespace,
const char *delim,
const char *quote,
char escape,
bool e_strings,
bool del_quotes,
int encoding);
extern char *quote_if_needed(const char *source, const char *entails_quote,
char quote, char escape, int encoding);
#endif /* STRINGUTILS_H */