aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorFurkan Sahin <furkan-dev@proton.me>2018-05-30 15:06:25 -0400
committerFurkan Sahin <furkan-dev@proton.me>2018-05-30 15:06:25 -0400
commitc0b8c3eed1f78667802f7967d38d18ea6e63d73c (patch)
tree09b1eb80df4d2002a5e1406a32f8ae545942e1e7 /common
parent26db889abda512b292f3ae3a566b408865ca3941 (diff)
Support braces on next line for config blocks
Diffstat (limited to 'common')
-rw-r--r--common/readline.c14
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) {