mirror of
https://github.com/swaywm/sway.git
synced 2024-12-29 16:36:26 +01:00
config: print line number
This commit is contained in:
parent
402c9f4bf0
commit
eeb7f5c036
1 changed files with 4 additions and 1 deletions
|
@ -231,15 +231,18 @@ bool read_config(FILE *file, bool is_active) {
|
||||||
bool success = true;
|
bool success = true;
|
||||||
enum cmd_status block = CMD_BLOCK_END;
|
enum cmd_status block = CMD_BLOCK_END;
|
||||||
|
|
||||||
|
int line_number = 0;
|
||||||
char *line;
|
char *line;
|
||||||
while (!feof(file)) {
|
while (!feof(file)) {
|
||||||
line = read_line(file);
|
line = read_line(file);
|
||||||
|
line_number++;
|
||||||
line = strip_comments(line);
|
line = strip_comments(line);
|
||||||
struct cmd_results *res = config_command(line);
|
struct cmd_results *res = config_command(line);
|
||||||
switch(res->status) {
|
switch(res->status) {
|
||||||
case CMD_FAILURE:
|
case CMD_FAILURE:
|
||||||
case CMD_INVALID:
|
case CMD_INVALID:
|
||||||
sway_log(L_ERROR, "Error on line '%s': %s", line, res->error);
|
sway_log(L_ERROR, "Error on line %i '%s': %s", line_number, line,
|
||||||
|
res->error);
|
||||||
success = false;
|
success = false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue