aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFranklin Wei <git@fwei.tk>2015-05-24 21:55:51 -0400
committerFranklin Wei <git@fwei.tk>2015-05-24 21:55:51 -0400
commit55043a8370101542c7ff304809d9238bf5d32365 (patch)
tree7b984bf33f0a275fea746c7b591e4b12939d0215 /src
parent59a37df4e7dba419a010691583ed8409b1e46a47 (diff)
downloadmarket-sim-55043a8370101542c7ff304809d9238bf5d32365.zip
market-sim-55043a8370101542c7ff304809d9238bf5d32365.tar.gz
market-sim-55043a8370101542c7ff304809d9238bf5d32365.tar.bz2
market-sim-55043a8370101542c7ff304809d9238bf5d32365.tar.xz
fix that hack up a bit
Diffstat (limited to 'src')
-rw-r--r--src/util.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/util.c b/src/util.c
index d46fb11..25b9e43 100644
--- a/src/util.c
+++ b/src/util.c
@@ -415,12 +415,8 @@ void horiz_line_curses(void)
void horiz_line_nocurses(void)
{
struct winsize w;
- w.ws_col = 0;
- ioctl(STDOUT_FILENO, TIOCGWINSZ, &w);
- output("printing heading %d chars long", w.ws_col);
- /* dirty hack for noninteractive mode */
- if(!w.ws_col)
+ if(ioctl(STDOUT_FILENO, TIOCGWINSZ, &w) < 0)
w.ws_col = 80;
for(int i = 0; i < w.ws_col; ++i)
@@ -462,11 +458,9 @@ void heading_nocurses(const char *fmt, ...)
va_end(ap);
struct winsize w;
- w.ws_col = 0;
- ioctl(STDOUT_FILENO, TIOCGWINSZ, &w);
/* dirty hack for noninteractive mode */
- if(!w.ws_col)
+ if(ioctl(STDOUT_FILENO, TIOCGWINSZ, &w) < 0)
w.ws_col = 80;
int len = strlen(text) / 2;