diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2021-01-18 00:14:01 -0800 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2021-01-18 00:14:01 -0800 |
| commit | dfdc7bf94a6ec3e5362eb2982d5c5c31edee4239 (patch) | |
| tree | f75267bc34a2d50eafd59d8713a9c8de1543ce16 /files.c | |
| parent | b37c7c3985f54967477df354bd22ab2dae51938e (diff) | |
Fixed error printing code
Diffstat (limited to 'files.c')
| -rw-r--r-- | files.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -213,7 +213,7 @@ void fprint_line(FILE *dest, file_t *f, const char *start, const char *end, cons size_t linenum = get_line_number(f, start); const char *line = get_line(f, linenum); size_t charnum = get_char_number(f, start); - fprintf(dest, "\033[1m%s:%ld:\033[0m ", f->filename, linenum); + fprintf(dest, "\033[1m%s:%ld:\033[0m ", f->filename[0] ? f->filename : "stdin", linenum); va_list args; va_start(args, fmt); @@ -227,7 +227,7 @@ void fprint_line(FILE *dest, file_t *f, const char *start, const char *end, cons linenum, (int)charnum - 1, line, (int)(end - &line[charnum-1]), &line[charnum-1], - (int)(eol - end), end); + (int)(eol - end - 1), end); fprintf(dest, " \033[34;1m"); const char *p = line - 1; for (; p < start; ++p) fputc(' ', dest); |
