aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorBrian Ashworth <bosrsf04@gmail.com>2018-05-30 15:06:25 -0400
committerBrian Ashworth <bosrsf04@gmail.com>2018-06-02 08:07:44 -0400
commit51bb9d8573efce7c46703d070ad963ba7d8dee76 (patch)
tree09b1eb80df4d2002a5e1406a32f8ae545942e1e7 /common
parent7c810dc344c28d1876c5ee158cb0806289d0f813 (diff)
downloadsway-51bb9d8573efce7c46703d070ad963ba7d8dee76.tar.xz
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) {