diff options
| author | Thorsten Töpper <atsutane@freethoughts.de> | 2025-06-24 22:01:17 +0200 |
|---|---|---|
| committer | Thorsten Töpper <atsutane@freethoughts.de> | 2025-06-24 22:08:12 +0200 |
| commit | 111f1bb981d6d6ed6f9116dc297d74ad20010401 (patch) | |
| tree | fbc5ce385cdef509db30e39eced10c88b40c64cf /src/output.c | |
| parent | 0937d5cb650544a8a3e729ffc783c74df1abea3e (diff) | |
| download | dir_monitor-111f1bb981d6d6ed6f9116dc297d74ad20010401.tar.gz dir_monitor-111f1bb981d6d6ed6f9116dc297d74ad20010401.tar.bz2 | |
output: limit fputc_all_cols to 72-144
Diffstat (limited to 'src/output.c')
| -rw-r--r-- | src/output.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/output.c b/src/output.c index 254d73f..396f3ef 100644 --- a/src/output.c +++ b/src/output.c @@ -34,7 +34,13 @@ void out_print_time_by_option(struct list_node *ptr); inline int fputc_all_cols(char c, FILE *fdout) { struct winsize terminal; ioctl(STDOUT_FILENO, TIOCGWINSZ, &terminal); - return fputc_width_x(c, ((terminal.ws_col == 0) ? 72 : terminal.ws_col), fdout); + /* Somehow not always ws_col == 0, instead > 300 characters */ + if (terminal.ws_col == 0) { + terminal.ws_col = 72; + } else if (terminal.ws_col > 144) { + terminal.ws_col = 144; + } + return fputc_width_x(c, terminal.ws_col, fdout); } |
