Commit 8cc9f7db 8cc9f7dba5d4f6bc4c68f057c59d7268f93c1ca8 by Alain Magloire

* mail/header.c: We were looping forever in here. The loop

 is not need it, header only prints one page that includes
 the message specified i.e. the header command only takes
 a message number as an argument that will serve as a reference
 to display a screen full.

 * mail/help.c: Use the pager code, the help is long.
1 parent fd292738
......@@ -10,10 +10,10 @@
util_outfolder_name().
util_save_outgoing()
* mail/z.c: removed z_lines() in favor of util_screen_lines().
* mail/headers.c: use util_screen_lines().
* mail/headers.c: use util_screen_lines().
* mail/touch.c: Initial implementation. Simply calls mail_mbox.
Maybe the table.c entry should point to mail_mbox instead?
* mail/write.c: use util_fullpath().
* mail/write.c: use util_fullpath().
* mail/send.c: call util_save_outgoing() to preserve sent message.
Set umask 077 before calling mkstemp().
* mail/folders.c: Use $LISTER.
......@@ -24,6 +24,16 @@
2001-06-25 Alain Magloire
* mail/header.c: We were looping forever in here. The loop
is not need it, header only prints one page that includes
the message specified i.e. the header command only takes
a message number as an argument that will serve as a reference
to display a screen full.
* mail/help.c: Use the pager code, the help is long.
2001-06-25 Alain Magloire
* doc/Makefile.am: add {c-api,framework,programs}.texi EXTRA_DIST
* imap4d/imap4d.c (imap4d_usage): Cut and paste typo.
* pop3d/pop3d.c (pop3d_usage): Cut and paste typo.
......
......@@ -29,30 +29,27 @@
int
mail_headers (int argc, char **argv)
{
int low = 1, high = total, *list = NULL, i = 0;
int low = 1, high = total, *list = NULL;
int lines = util_screen_lines ();
int num = util_expand_msglist (argc, argv, &list);
lines = (lines / num) - 2;
for (i = 0; i < num; i++)
if (lines < total)
{
if (lines < total)
low = list[0] - (lines / 2);
if (low < 1)
low = 1;
high = low + lines;
if (high > total)
{
low = list[i] - (lines / 2);
if (low < 1)
low = 1;
high = low + lines;
if (high > total)
{
high = total;
low = high - lines;
}
high = total;
low = high - lines;
}
util_do_command ("from %d-%d", low, high);
}
util_do_command ("from %d-%d", low, high);
free (list);
return 0;
}
......
......@@ -28,13 +28,23 @@ mail_help (int argc, char **argv)
if (argc < 2)
{
int i = 0;
FILE *out = ofile;
if ((util_find_env("crt"))->set)
out = popen (getenv("PAGER"), "w");
while (mail_command_table[i].synopsis != 0)
fprintf (ofile, "%s\n", mail_command_table[i++].synopsis);
fprintf (out, "%s\n", mail_command_table[i++].synopsis);
if (out != ofile)
pclose (out);
return 0;
}
else
{
int status = 0, cmd = 0;
while (++cmd < argc)
{
struct mail_command_entry entry = util_find_entry (argv[cmd]);
......