X-Git-Url: https://git.octo.it/?a=blobdiff_plain;ds=sidebyside;f=git.c;h=157c54914422b197209e24223916f2ba501385ac;hb=ea77e675e564211513ebedb4f5bdcda482d7fd30;hp=c26cac6555e940e1ae5573a99350388f09118b87;hpb=d808111ebdb0b50709527612221eb2970ed6ece9;p=git.git diff --git a/git.c b/git.c index c26cac65..157c5491 100644 --- a/git.c +++ b/git.c @@ -8,6 +8,7 @@ #include #include #include +#include #include "git-compat-util.h" #ifndef PATH_MAX @@ -26,6 +27,16 @@ static int term_columns(void) if (col_string && (n_cols = atoi(col_string)) > 0) return n_cols; +#ifdef TIOCGWINSZ + { + struct winsize ws; + if (!ioctl(1, TIOCGWINSZ, &ws)) { + if (ws.ws_col) + return ws.ws_col; + } + } +#endif + return 80; }