diff options
| author | Furkan Sahin <furkan-dev@proton.me> | 2018-05-30 15:06:25 -0400 |
|---|---|---|
| committer | Furkan Sahin <furkan-dev@proton.me> | 2018-05-30 15:06:25 -0400 |
| commit | c0b8c3eed1f78667802f7967d38d18ea6e63d73c (patch) | |
| tree | 09b1eb80df4d2002a5e1406a32f8ae545942e1e7 /common | |
| parent | 26db889abda512b292f3ae3a566b408865ca3941 (diff) | |
Support braces on next line for config blocks
Diffstat (limited to 'common')
| -rw-r--r-- | common/readline.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/common/readline.c b/common/readline.c index ed5801de..abe986c4 100644 --- a/common/readline.c +++ b/common/readline.c @@ -48,6 +48,20 @@ char *read_line(FILE *file) { return string; } +char *peek_line(FILE *file, int offset) { + int pos = ftell(file); + char *line = NULL; + for (int i = 0; i <= offset; i++) { + free(line); + line = read_line(file); + if (!line) { + break; + } + } + fseek(file, pos, SEEK_SET); + return line; +} + char *read_line_buffer(FILE *file, char *string, size_t string_len) { size_t length = 0; if (!string) { |
