diff options
author | Christoph Gysin <christoph.gysin@gmail.com> | 2015-11-25 15:45:50 +0200 |
---|---|---|
committer | Christoph Gysin <christoph.gysin@gmail.com> | 2015-11-25 15:48:27 +0200 |
commit | eeb7f5c0369b3f909fb924af2d9f5b7a2f9e10bf (patch) | |
tree | 4f1ca31c2810e25ab90371fe7dcc9f4f63943a67 | |
parent | Merge pull request #255 from christophgysin/ninja (diff) | |
download | sway-eeb7f5c0369b3f909fb924af2d9f5b7a2f9e10bf.tar.gz sway-eeb7f5c0369b3f909fb924af2d9f5b7a2f9e10bf.tar.zst sway-eeb7f5c0369b3f909fb924af2d9f5b7a2f9e10bf.zip |
config: print line number
-rw-r--r-- | sway/config.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sway/config.c b/sway/config.c index 13865058..539c493b 100644 --- a/sway/config.c +++ b/sway/config.c | |||
@@ -231,15 +231,18 @@ bool read_config(FILE *file, bool is_active) { | |||
231 | bool success = true; | 231 | bool success = true; |
232 | enum cmd_status block = CMD_BLOCK_END; | 232 | enum cmd_status block = CMD_BLOCK_END; |
233 | 233 | ||
234 | int line_number = 0; | ||
234 | char *line; | 235 | char *line; |
235 | while (!feof(file)) { | 236 | while (!feof(file)) { |
236 | line = read_line(file); | 237 | line = read_line(file); |
238 | line_number++; | ||
237 | line = strip_comments(line); | 239 | line = strip_comments(line); |
238 | struct cmd_results *res = config_command(line); | 240 | struct cmd_results *res = config_command(line); |
239 | switch(res->status) { | 241 | switch(res->status) { |
240 | case CMD_FAILURE: | 242 | case CMD_FAILURE: |
241 | case CMD_INVALID: | 243 | case CMD_INVALID: |
242 | sway_log(L_ERROR, "Error on line '%s': %s", line, res->error); | 244 | sway_log(L_ERROR, "Error on line %i '%s': %s", line_number, line, |
245 | res->error); | ||
243 | success = false; | 246 | success = false; |
244 | break; | 247 | break; |
245 | 248 | ||