PostgreSQL Source Code  git master
string.h
Go to the documentation of this file.
1 /*
2  * string.h
3  * string handling helpers
4  *
5  * Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
6  * Portions Copyright (c) 1994, Regents of the University of California
7  *
8  * src/include/common/string.h
9  */
10 #ifndef COMMON_STRING_H
11 #define COMMON_STRING_H
12 
13 struct StringInfoData; /* avoid including stringinfo.h here */
14 
15 typedef struct PromptInterruptContext
16 {
17  /* To avoid including <setjmp.h> here, jmpbuf is declared "void *" */
18  void *jmpbuf; /* existing longjmp buffer */
19  volatile bool *enabled; /* flag that enables longjmp-on-interrupt */
20  bool canceled; /* indicates whether cancellation occurred */
22 
23 /* functions in src/common/string.c */
24 extern bool pg_str_endswith(const char *str, const char *end);
25 extern int strtoint(const char *pg_restrict str, char **pg_restrict endptr,
26  int base);
27 extern void pg_clean_ascii(char *str);
28 extern int pg_strip_crlf(char *str);
29 extern bool pg_is_ascii(const char *str);
30 
31 /* functions in src/common/pg_get_line.c */
32 extern char *pg_get_line(FILE *stream, PromptInterruptContext *prompt_ctx);
33 extern bool pg_get_line_buf(FILE *stream, struct StringInfoData *buf);
34 extern bool pg_get_line_append(FILE *stream, struct StringInfoData *buf,
35  PromptInterruptContext *prompt_ctx);
36 
37 /* functions in src/common/sprompt.c */
38 extern char *simple_prompt(const char *prompt, bool echo);
39 extern char *simple_prompt_extended(const char *prompt, bool echo,
40  PromptInterruptContext *prompt_ctx);
41 
42 #endif /* COMMON_STRING_H */
static char * buf
Definition: pg_test_fsync.c:70
char * simple_prompt_extended(const char *prompt, bool echo, PromptInterruptContext *prompt_ctx)
Definition: sprompt.c:53
bool pg_get_line_buf(FILE *stream, struct StringInfoData *buf)
void pg_clean_ascii(char *str)
Definition: string.c:82
char * pg_get_line(FILE *stream, PromptInterruptContext *prompt_ctx)
Definition: pg_get_line.c:59
int pg_strip_crlf(char *str)
Definition: string.c:121
bool pg_is_ascii(const char *str)
Definition: string.c:99
bool pg_get_line_append(FILE *stream, struct StringInfoData *buf, PromptInterruptContext *prompt_ctx)
int strtoint(const char *pg_restrict str, char **pg_restrict endptr, int base)
Definition: string.c:50
bool pg_str_endswith(const char *str, const char *end)
Definition: string.c:31
struct PromptInterruptContext PromptInterruptContext
char * simple_prompt(const char *prompt, bool echo)
Definition: sprompt.c:38
volatile bool * enabled
Definition: string.h:19