Index: contrib/libxo/libxo/libxo.c =================================================================== --- contrib/libxo/libxo/libxo.c +++ contrib/libxo/libxo/libxo.c @@ -42,6 +42,7 @@ #include #include #include +#include #include "xo_config.h" #include "xo.h" @@ -268,6 +269,7 @@ char *xo_gt_domain; /* Gettext domain, suitable for dgettext(3) */ xo_encoder_func_t xo_encoder; /* Encoding function */ void *xo_private; /* Private data for external encoders */ + bool xo_libxo_set; /* Initial flags passed via --libxo */ }; /* Flag operations */ @@ -8170,6 +8172,7 @@ } xo_handle_t *xop = xo_default(NULL); + xop->xo_libxo_set = false; for (save = i = 1; i < argc; i++) { if (argv[i] == NULL @@ -8180,6 +8183,7 @@ continue; } + xop->xo_libxo_set = true; cp = argv[i] + sizeof(libxo_opt) - 1; if (*cp == '\0') { cp = argv[++i]; @@ -8224,6 +8228,17 @@ return save; } +/* + * Let consumers know if --libxo was passed in argv. + */ +bool +xo_libxo_set(void) +{ + xo_handle_t *xop = xo_default(NULL); + + return (xop->xo_libxo_set); +} + /* * Debugging function that dumps the current stack of open libxo constructs, * suitable for calling from the debugger. Index: contrib/libxo/libxo/xo.h =================================================================== --- contrib/libxo/libxo/xo.h +++ contrib/libxo/libxo/xo.h @@ -26,6 +26,7 @@ #include #include #include +#include #ifdef __dead2 #define NORETURN __dead2 @@ -583,6 +584,9 @@ int xo_parse_args (int argc, char **argv); +bool +xo_libxo_set(void); + /** * This is the "magic" number returned by libxo-supporting commands * when passed the equally magic "--libxo-check" option. If you Index: usr.bin/w/w.c =================================================================== --- usr.bin/w/w.c +++ usr.bin/w/w.c @@ -95,7 +95,6 @@ static struct winsize ws; static kvm_t *kd; static time_t now; /* the current time of day */ -static int ttywidth; /* width of tty */ static int fromwidth = 0; /* max width of "from" field */ static int argwidth; /* width of arguments */ static int header = 1; /* true if -h flag: don't print heading */ @@ -381,13 +380,21 @@ } } } - if ((ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws) == -1 && - ioctl(STDERR_FILENO, TIOCGWINSZ, &ws) == -1 && - ioctl(STDIN_FILENO, TIOCGWINSZ, &ws) == -1) || ws.ws_col == 0) - ttywidth = 79; - else - ttywidth = ws.ws_col - 1; - argwidth = ttywidth - WUSED; + /* Don't truncate the argument list if --libxo was specified */ + if (xo_libxo_set()) { + argwidth = ARG_MAX; + } else { + int ttywidth; /* width of tty */ + + if ((ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws) == -1 && + ioctl(STDERR_FILENO, TIOCGWINSZ, &ws) == -1 && + ioctl(STDIN_FILENO, TIOCGWINSZ, &ws) == -1) || + ws.ws_col == 0) + ttywidth = 79; + else + ttywidth = ws.ws_col - 1; + argwidth = ttywidth - WUSED; + } if (argwidth < 4) argwidth = 8; for (ep = ehead; ep != NULL; ep = ep->next) {