This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GNU Mailutils".
http://git.savannah.gnu.org/cgit/mailutils.git/commit/?id=17930dd7cacf60c375408a26154301934a17609e The branch, master has been updated via 17930dd7cacf60c375408a26154301934a17609e (commit) from 131ddb25a51862bb31fe5fd7a1111896fbb20c58 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 17930dd7cacf60c375408a26154301934a17609e Author: Sergey Poznyakoff <g...@gnu.org> Date: Sun May 3 20:48:53 2015 +0300 mail: honor columns/screen variables * mail/util.c (util_command_list): Use util_screen_columns instead of util_getcols. (util_getcols): Don't use COLUMNS. (util_getlines): Don't use LINES. * mail/mail.c: Don't force COLUMNS and LINES (they are normally not exported, so setting them will cause util_getcols and util_getlines to return wrong results). Set variable "columns" from envvar COLUMNS, if set to a numeric value. Set variable "screen" from envvar LINES, if set to a numeric value. * mail/from.c (format_headline): Use util_screen_columns instead of util_getcols. * mail/mailvar.c (mailvar_print,mail_variable): Likewise. * mail/print.c (mail_print_msg): Likewise. ----------------------------------------------------------------------- Summary of changes: mail/from.c | 2 +- mail/mail.c | 21 +++++++++++++-------- mail/mailline.c | 4 ++-- mail/mailvar.c | 4 ++-- mail/print.c | 2 +- mail/util.c | 25 +++++-------------------- 6 files changed, 24 insertions(+), 34 deletions(-) diff --git a/mail/from.c b/mail/from.c index 66ae362..3a0fbd4 100644 --- a/mail/from.c +++ b/mail/from.c @@ -78,7 +78,7 @@ format_pad (size_t n) static void format_headline (struct header_segm *seg, msgset_t *mspec, mu_message_t msg) { - int screen_cols = util_getcols () - 2; + int screen_cols = util_screen_columns () - 2; int out_cols = 0; struct header_call_args args; diff --git a/mail/mail.c b/mail/mail.c index 7784ec4..2d50917 100644 --- a/mail/mail.c +++ b/mail/mail.c @@ -376,10 +376,7 @@ main (int argc, char **argv) /* set up the default environment */ if (!getenv ("HOME")) - { - char *p = util_get_homedir (); - setenv ("HOME", p, 0); - } + setenv ("HOME", util_get_homedir (), 0); /* Set up the default environment */ setenv ("DEAD", util_fullpath ("~/dead.letter"), 0); @@ -390,14 +387,22 @@ main (int argc, char **argv) setenv ("PAGER", "more", 0); setenv ("SHELL", "sh", 0); setenv ("VISUAL", "vi", 0); - setenv ("COLUMNS", "80", 0); - setenv ("LINES", "24", 0); /* set defaults for execution */ for (i = 0; i < sizeof (default_setup)/sizeof (default_setup[0]); i++) util_do_command ("%s", default_setup[i]); - util_do_command ("set screen=%d", util_getlines ()); - util_do_command ("set columns=%d", util_getcols ()); + + p = getenv ("LINES"); + if (p && p[strspn (p, "0123456789")] == 0) + util_do_command ("set screen=%s", p); + else + util_do_command ("set screen=%d", util_getlines ()); + + p = getenv ("COLUMNS"); + if (p && p[strspn (p, "0123456789")] == 0) + util_do_command ("set columns=%s", p); + else + util_do_command ("set columns=%d", util_getcols ()); /* Set the default mailer to sendmail. */ mailvar_set ("sendmail", diff --git a/mail/mailline.c b/mail/mailline.c index 9b1a194..502453c 100644 --- a/mail/mailline.c +++ b/mail/mailline.c @@ -39,8 +39,8 @@ sig_handler (int signo) break; #if defined (SIGWINCH) case SIGWINCH: - util_do_command ("set screen=%d", util_getlines()); - util_do_command ("set columns=%d", util_getcols()); + util_do_command ("set screen=%d", util_getlines ()); + util_do_command ("set columns=%d", util_getcols ()); page_invalidate (1); break; #endif diff --git a/mail/mailvar.c b/mail/mailvar.c index a74e721..3d1b178 100644 --- a/mail/mailvar.c +++ b/mail/mailvar.c @@ -749,7 +749,7 @@ mailvar_print (int set) clos.out = open_pager (count); clos.prettyprint = mailvar_get (NULL, "variable-pretty-print", mailvar_type_boolean, 0) == 0; - clos.width = util_getcols (); + clos.width = util_screen_columns (); mu_list_foreach (varlist, mailvar_printer, &clos); mu_list_destroy (&varlist); @@ -845,7 +845,7 @@ int mail_variable (int argc, char **argv) { int pagelines = util_get_crt (); - int width = util_getcols (); + int width = util_screen_columns (); mu_stream_t out = open_pager (pagelines + 1); if (argc == 1) diff --git a/mail/print.c b/mail/print.c index 5d77515..ad2c7f5 100644 --- a/mail/print.c +++ b/mail/print.c @@ -45,7 +45,7 @@ mail_print_msg (msgset_t *mspec, mu_message_t mesg, void *data) { if (pagelines) { - size_t col = (size_t)util_getcols (); + size_t col = (size_t) util_screen_columns (); if (col) { size_t size = 0; diff --git a/mail/util.c b/mail/util.c index 6c028e8..098deb8 100644 --- a/mail/util.c +++ b/mail/util.c @@ -311,7 +311,7 @@ util_command_list (void *table, size_t nmemb, size_t size) { int i; char *p; - int cols = util_getcols (); + int cols = util_screen_columns (); int pos; for (p = table, i = 0; i < nmemb; i++, p += size) @@ -349,16 +349,9 @@ int util_getcols (void) { struct winsize ws; - ws.ws_col = ws.ws_row = 0; - if ((ioctl(1, TIOCGWINSZ, (char *) &ws) < 0) || ws.ws_row == 0) - { - const char *columns = getenv ("COLUMNS"); - if (columns) - ws.ws_col = strtol (columns, NULL, 10); - } - - /* FIXME: Should we exit()/abort() if col <= 0 ? */ + if ((ioctl(1, TIOCGWINSZ, (char *) &ws) < 0) || ws.ws_col == 0) + return 80; /* FIXME: Should we exit()/abort() if col <= 0 ? */ return ws.ws_col; } @@ -370,17 +363,9 @@ int util_getlines (void) { struct winsize ws; - ws.ws_col = ws.ws_row = 0; - if ((ioctl(1, TIOCGWINSZ, (char *) &ws) < 0) || ws.ws_row == 0) - { - const char *lines = getenv ("LINES"); - if (lines) - ws.ws_row = strtol (lines, NULL, 10); - } - - /* FIXME: Should we exit()/abort() if row <= 0 ? */ - + if ((ioctl(1, TIOCGWINSZ, (char *) &ws) < 0) || ws.ws_row <= 2) + ws.ws_row = 24; /* FIXME: Should we exit()/abort() if row <= 2 ? */ /* Reserve at least 2 line for the prompt. */ return ws.ws_row - 2; } hooks/post-receive -- GNU Mailutils _______________________________________________ Commit-mailutils mailing list Commit-mailutils@gnu.org https://lists.gnu.org/mailman/listinfo/commit-mailutils