aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/util.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/util.c b/src/util.c
index 9bf7011..e0b7f5b 100644
--- a/src/util.c
+++ b/src/util.c
@@ -414,9 +414,14 @@ void horiz_line_curses(void)
void horiz_line_nocurses(void)
{
- struct winsize sz;
- ioctl(STDOUT_FILENO, TIOCGWINSZ, &sz);
- for(int i = 0; i < sz.ws_col; ++i)
+ struct winsize w;
+ ioctl(STDOUT_FILENO, TIOCGWINSZ, &w);
+
+ /* dirty hack for noninteractive mode */
+ if(!w.ws_col)
+ w.ws_col = 80;
+
+ for(int i = 0; i < w.ws_col; ++i)
output("=");
output("\n");
}
@@ -457,7 +462,9 @@ void heading_nocurses(const char *fmt, ...)
struct winsize w;
ioctl(STDOUT_FILENO, TIOCGWINSZ, &w);
- output("width: %d\n", w.ws_col);
+ /* dirty hack for noninteractive mode */
+ if(!w.ws_col)
+ w.ws_col = 80;
int len = strlen(text) / 2;
int beg_x = w.ws_col / 2 - len;