PostgreSQL Source Code git master
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
string.h
Go to the documentation of this file.
1/*
2 * string.h
3 * string handling helpers
4 *
5 * Portions Copyright (c) 1996-2025, 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#include <signal.h>
14
15struct StringInfoData; /* avoid including stringinfo.h here */
16
18{
19 /* To avoid including <setjmp.h> here, jmpbuf is declared "void *" */
20 void *jmpbuf; /* existing longjmp buffer */
21 volatile sig_atomic_t *enabled; /* flag that enables longjmp-on-interrupt */
22 bool canceled; /* indicates whether cancellation occurred */
24
25/* functions in src/common/string.c */
26extern bool pg_str_endswith(const char *str, const char *end);
27extern int strtoint(const char *pg_restrict str, char **pg_restrict endptr,
28 int base);
29extern char *pg_clean_ascii(const char *str, int alloc_flags);
30extern int pg_strip_crlf(char *str);
31extern bool pg_is_ascii(const char *str);
32
33/* functions in src/common/pg_get_line.c */
34extern char *pg_get_line(FILE *stream, PromptInterruptContext *prompt_ctx);
35extern bool pg_get_line_buf(FILE *stream, struct StringInfoData *buf);
36extern bool pg_get_line_append(FILE *stream, struct StringInfoData *buf,
37 PromptInterruptContext *prompt_ctx);
38
39/* functions in src/common/sprompt.c */
40extern char *simple_prompt(const char *prompt, bool echo);
41extern char *simple_prompt_extended(const char *prompt, bool echo,
42 PromptInterruptContext *prompt_ctx);
43
44#endif /* COMMON_STRING_H */
const char * str
static char * buf
Definition: pg_test_fsync.c:72
char * simple_prompt_extended(const char *prompt, bool echo, PromptInterruptContext *prompt_ctx)
Definition: sprompt.c:53
char * pg_get_line(FILE *stream, PromptInterruptContext *prompt_ctx)
Definition: pg_get_line.c:59
char * pg_clean_ascii(const char *str, int alloc_flags)
Definition: string.c:85
bool pg_get_line_buf(FILE *stream, struct StringInfoData *buf)
int pg_strip_crlf(char *str)
Definition: string.c:154
char * simple_prompt(const char *prompt, bool echo)
Definition: sprompt.c:38
bool pg_is_ascii(const char *str)
Definition: string.c:132
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
volatile sig_atomic_t * enabled
Definition: string.h:21