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