/[mailutils]/mailutils/mail/top.c
ViewVC logotype

Diff of /mailutils/mail/top.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.12 by polak, Mon Dec 23 22:01:34 2002 UTC revision 1.13 by gray, Sun Dec 29 13:37:43 2002 UTC
# Line 21  Line 21 
21   * to[p] [msglist]   * to[p] [msglist]
22   */   */
23    
24  int  static int
25  mail_top (int argc, char **argv)  top0 (msgset_t *mspec, message_t msg, void *data)
26  {  {
27    if (argc > 1)    stream_t stream;
28      return util_msglist_command (mail_top, argc, argv, 1);    char buf[512];
29    else    size_t n;
30      {    off_t off;
31        message_t msg;    int lines;
       stream_t stream;  
       char buf[512];  
       size_t n;  
       off_t off;  
       int lines;  
32    
33        if (util_getenv (&lines, "toplines", Mail_env_number, 1)    if (util_getenv (&lines, "toplines", Mail_env_number, 1)
34            || lines < 0)        || lines < 0)
35          return 1;      return 1;
36    
37        if (util_get_message (mbox, cursor, &msg, MSG_NODELETED))    message_get_stream (msg, &stream);
38          return 1;    for (n = 0, off = 0; lines > 0; lines--, off += n)
39        {
40        message_get_stream (msg, &stream);        int status = stream_readline (stream, buf, sizeof (buf), off, &n);
41        for (n = 0, off = 0; lines > 0; lines--, off += n)        if (status != 0 || n == 0)
42          {          break;
43            int status = stream_readline (stream, buf, sizeof (buf), off, &n);        fprintf (ofile, "%s", buf);
           if (status != 0 || n == 0)  
             break;  
           fprintf (ofile, "%s", buf);  
         }  
       return 0;  
44      }      }
45    return 1;    cursor = mspec->msg_part[0];
46      return 0;
47  }  }
48    
49    int
50    mail_top (int argc, char **argv)
51    {
52      return util_foreach_msg (argc, argv, MSG_NODELETED, top0, NULL);
53    }
54    

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.13

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26