2000-01-19 00:30:24 +01:00
|
|
|
/*
|
|
|
|
* psql - the PostgreSQL interactive terminal
|
|
|
|
*
|
2019-01-02 18:44:25 +01:00
|
|
|
* Copyright (c) 2000-2019, PostgreSQL Global Development Group
|
2000-01-19 00:30:24 +01:00
|
|
|
*
|
2010-09-20 22:08:53 +02:00
|
|
|
* src/bin/psql/stringutils.h
|
2000-01-19 00:30:24 +01:00
|
|
|
*/
|
1996-07-09 08:22:35 +02:00
|
|
|
#ifndef STRINGUTILS_H
|
|
|
|
#define STRINGUTILS_H
|
|
|
|
|
1999-11-04 22:56:02 +01:00
|
|
|
/* The cooler version of strtok() which knows about quotes and doesn't
|
|
|
|
* overwrite your input */
|
1999-11-05 00:14:30 +01:00
|
|
|
extern char *strtokx(const char *s,
|
2002-10-19 02:22:14 +02:00
|
|
|
const char *whitespace,
|
1999-11-05 00:14:30 +01:00
|
|
|
const char *delim,
|
|
|
|
const char *quote,
|
2002-10-19 02:22:14 +02:00
|
|
|
char escape,
|
2006-06-01 03:28:00 +02:00
|
|
|
bool e_strings,
|
2002-10-19 02:22:14 +02:00
|
|
|
bool del_quotes,
|
2000-01-15 06:38:50 +01:00
|
|
|
int encoding);
|
2001-10-28 07:26:15 +01:00
|
|
|
|
Add support for piping COPY to/from an external program.
This includes backend "COPY TO/FROM PROGRAM '...'" syntax, and corresponding
psql \copy syntax. Like with reading/writing files, the backend version is
superuser-only, and in the psql version, the program is run in the client.
In the passing, the psql \copy STDIN/STDOUT syntax is subtly changed: if you
the stdin/stdout is quoted, it's now interpreted as a filename. For example,
"\copy foo from 'stdin'" now reads from a file called 'stdin', not from
standard input. Before this, there was no way to specify a filename called
stdin, stdout, pstdin or pstdout.
This creates a new function in pgport, wait_result_to_str(), which can
be used to convert the exit status of a process, as returned by wait(3),
to a human-readable string.
Etsuro Fujita, reviewed by Amit Kapila.
2013-02-27 17:17:21 +01:00
|
|
|
extern void strip_quotes(char *source, char quote, char escape, int encoding);
|
|
|
|
|
2012-02-28 05:06:29 +01:00
|
|
|
extern char *quote_if_needed(const char *source, const char *entails_quote,
|
|
|
|
char quote, char escape, int encoding);
|
|
|
|
|
Phase 2 of pgindent updates.
Change pg_bsd_indent to follow upstream rules for placement of comments
to the right of code, and remove pgindent hack that caused comments
following #endif to not obey the general rule.
Commit e3860ffa4dd0dad0dd9eea4be9cc1412373a8c89 wasn't actually using
the published version of pg_bsd_indent, but a hacked-up version that
tried to minimize the amount of movement of comments to the right of
code. The situation of interest is where such a comment has to be
moved to the right of its default placement at column 33 because there's
code there. BSD indent has always moved right in units of tab stops
in such cases --- but in the previous incarnation, indent was working
in 8-space tab stops, while now it knows we use 4-space tabs. So the
net result is that in about half the cases, such comments are placed
one tab stop left of before. This is better all around: it leaves
more room on the line for comment text, and it means that in such
cases the comment uniformly starts at the next 4-space tab stop after
the code, rather than sometimes one and sometimes two tabs after.
Also, ensure that comments following #endif are indented the same
as comments following other preprocessor commands such as #else.
That inconsistency turns out to have been self-inflicted damage
from a poorly-thought-through post-indent "fixup" in pgindent.
This patch is much less interesting than the first round of indent
changes, but also bulkier, so I thought it best to separate the effects.
Discussion: https://postgr.es/m/E1dAmxK-0006EE-1r@gemulon.postgresql.org
Discussion: https://postgr.es/m/30527.1495162840@sss.pgh.pa.us
2017-06-21 21:18:54 +02:00
|
|
|
#endif /* STRINGUTILS_H */
|