aboutsummaryrefslogtreecommitdiff
path: root/gcc/opts.c
diff options
context:
space:
mode:
authorTobias Burnus <burnus@net-b.de>2014-12-11 09:20:24 +0100
committerTobias Burnus <burnus@gcc.gnu.org>2014-12-11 09:20:24 +0100
commitc9db45aaf49be681ba6e16203ab4b455bfa9746e (patch)
treee31e886ed230649c1e858eb51f469565c87e1754 /gcc/opts.c
parent01ca36af914385acfc864adfae6923768581888a (diff)
downloadgcc-c9db45aaf49be681ba6e16203ab4b455bfa9746e.zip
gcc-c9db45aaf49be681ba6e16203ab4b455bfa9746e.tar.gz
gcc-c9db45aaf49be681ba6e16203ab4b455bfa9746e.tar.bz2
diagnostic.c (get_terminal_width): Renamed from
2014-12-11 Tobias Burnus <burnus@net-b.de> Manuel López-Ibáñez <manu@gcc.gnu.org> gcc/ * diagnostic.c (get_terminal_width): Renamed from * getenv_columns, removed static, and additionally use ioctl to get width. (diagnostic_set_caret_max_width): Update call. * diagnostic.h (get_terminal_width): Add prototype. * opts.c (print_specific_help): Use it for x_help_columns. * doc/invoke.texi (fdiagnostics-show-caret): Document how the width is set. gcc/fortran/ * error.c (gfc_get_terminal_width): Renamed from get_terminal_width and use same-named common function. (gfc_error_init_1): Update call. Co-Authored-By: Manuel López-Ibáñez <manu@gcc.gnu.org> From-SVN: r218619
Diffstat (limited to 'gcc/opts.c')
-rw-r--r--gcc/opts.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/gcc/opts.c b/gcc/opts.c
index 1b4f97e..34a42a5 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -1231,18 +1231,8 @@ print_specific_help (unsigned int include_flags,
the desired maximum width of the output. */
if (opts->x_help_columns == 0)
{
- const char *p;
-
- p = getenv ("COLUMNS");
- if (p != NULL)
- {
- int value = atoi (p);
-
- if (value > 0)
- opts->x_help_columns = value;
- }
-
- if (opts->x_help_columns == 0)
+ opts->x_help_columns = get_terminal_width ();
+ if (opts->x_help_columns == INT_MAX)
/* Use a reasonable default. */
opts->x_help_columns = 80;
}