Fix xslt_process() to ensure that it inserts a NULL terminator after the
[PostgreSQL.git] / src / bin / psql / common.h
blobedcb2e54fd3d5668665a25fa1ab3a2fd060e637c
1 /*
2 * psql - the PostgreSQL interactive terminal
4 * Copyright (c) 2000-2009, PostgreSQL Global Development Group
6 * $PostgreSQL$
7 */
8 #ifndef COMMON_H
9 #define COMMON_H
11 #include "postgres_fe.h"
12 #include <setjmp.h>
13 #include "libpq-fe.h"
15 #ifdef USE_ASSERT_CHECKING
16 #include <assert.h>
17 #define psql_assert(p) assert(p)
18 #else
19 #define psql_assert(p)
20 #endif
22 #define atooid(x) ((Oid) strtoul((x), NULL, 10))
25 * Safer versions of some standard C library functions. If an
26 * out-of-memory condition occurs, these functions will bail out
27 * safely; therefore, their return value is guaranteed to be non-NULL.
29 extern char *pg_strdup(const char *string);
30 extern void *pg_malloc(size_t size);
31 extern void *pg_malloc_zero(size_t size);
32 extern void *pg_calloc(size_t nmemb, size_t size);
34 extern bool setQFout(const char *fname);
36 extern void
37 psql_error(const char *fmt,...)
38 /* This lets gcc check the format string for consistency. */
39 __attribute__((format(printf, 1, 2)));
41 extern void NoticeProcessor(void *arg, const char *message);
43 extern volatile bool sigint_interrupt_enabled;
45 extern sigjmp_buf sigint_interrupt_jmp;
47 extern volatile bool cancel_pressed;
49 /* Note: cancel_pressed is defined in print.c, see that file for reasons */
51 extern void setup_cancel_handler(void);
53 extern void SetCancelConn(void);
54 extern void ResetCancelConn(void);
56 extern PGresult *PSQLexec(const char *query, bool start_xact);
58 extern bool SendQuery(const char *query);
60 extern bool is_superuser(void);
61 extern bool standard_strings(void);
62 extern const char *session_username(void);
64 extern char *expand_tilde(char **filename);
66 #endif /* COMMON_H */