/[mailutils]/mailutils/readmsg/readmsg.c
ViewVC logotype

Diff of /mailutils/readmsg/readmsg.c

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

revision 1.7 by gray, Wed Aug 7 23:07:05 2002 UTC revision 1.8 by gray, Tue Aug 27 10:50:15 2002 UTC
# Line 41  static struct argp_option options[] = Line 41  static struct argp_option options[] =
41    { "folder", 'f', "FOLDER", 0, "Folder to use", 1 },    { "folder", 'f', "FOLDER", 0, "Folder to use", 1 },
42    { "no-header", 'n', 0, 0, "Exclude all headers", 1 },    { "no-header", 'n', 0, 0, "Exclude all headers", 1 },
43    { "form-feeds", 'p', 0, 0, "Output formfeeds between messages", 1 },    { "form-feeds", 'p', 0, 0, "Output formfeeds between messages", 1 },
44    { "show-all-match", 'a', "PATTERN", 0,    { "show-all-match", 'a', NULL, 0,
45      "Print all messages matching PATTERN", 1 },      "Print all messages matching pattern, not just the first", 1 },
46    {0, 0, 0, 0}    {0, 0, 0, 0}
47  };  };
48    
# Line 162  print_header (message_t message, int no_ Line 162  print_header (message_t message, int no_
162    
163        header_get_field_count (header, &count);        header_get_field_count (header, &count);
164    
165        for (i = 1; i < count; i++)        for (i = 1; i <= count; i++)
166          {          {
167            char *name = NULL;            char *name = NULL;
168            char *value = NULL;            char *value = NULL;
169            char *token = strdup (weedlist);            char *weedcopy = strdup (weedlist);
170            char *p = token;            char *token, *s;
171    
172            header_aget_field_name (header, i, &name);            header_aget_field_name (header, i, &name);
173            header_aget_field_value (header, i, &value);            header_aget_field_value (header, i, &value);
174            for (; (token = strtok (token, delim)) != NULL; token = NULL)            for (token = strtok_r (weedcopy, delim, &s); token;
175                   token = strtok_r (NULL, delim, &s))
176              {              {
177                if (string_starts_with (name, token))                if (string_starts_with (name, token))
178                  {                  {
# Line 182  print_header (message_t message, int no_ Line 183  print_header (message_t message, int no_
183              }              }
184            free (value);            free (value);
185            free (name);            free (name);
186            free (p);            free (weedcopy);
187          }          }
188        putchar ('\n');        putchar ('\n');
189      }      }
# Line 253  main (int argc, char **argv) Line 254  main (int argc, char **argv)
254    status = mailbox_open (mbox, MU_STREAM_READ);    status = mailbox_open (mbox, MU_STREAM_READ);
255    if (status != 0)    if (status != 0)
256      {      {
257        fprintf (stderr, "mailbox open - %s\n", mu_errstring(status));        url_t url = NULL;
258    
259          mailbox_get_url (mbox, &url);
260          fprintf (stderr, "can't open mailbox %s: %s\n",
261                   url_to_string (url),
262                   mu_errstring(status));
263        exit (2);        exit (2);
264      }      }
265    
# Line 261  main (int argc, char **argv) Line 267  main (int argc, char **argv)
267      weedlist = "Date To Cc Subject From Apparently-";      weedlist = "Date To Cc Subject From Apparently-";
268    
269    /* Build an array containing the message number.  */    /* Build an array containing the message number.  */
270    argc -= optind;    argc -= index;
271    if (argc > 0)    if (argc > 0)
272      msglist (mbox, show_all, argc, &argv[index], &set, &n);      msglist (mbox, show_all, argc, &argv[index], &set, &n);
273    

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

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