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

Diff of /mailutils/mail/retain.c

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

revision 1.5 by polak, Sun Feb 9 12:33:01 2003 UTC revision 1.6 by gray, Thu Sep 25 14:06:02 2003 UTC
# Line 19  Line 19 
19    
20  static list_t retained_headers = NULL;  static list_t retained_headers = NULL;
21  static list_t ignored_headers = NULL;  static list_t ignored_headers = NULL;
22    static list_t unfolded_headers = NULL;
23    
24  /*  static int
25   * ret[ain] [heder-field...]  process_list (int argc, char **argv,
26   */                list_t *list,
27                  void (*fun) (list_t *, char *),
28  int                char *msg)
 mail_retain (int argc, char **argv)  
29  {  {
30    if (argc == 1)    if (argc == 1)
31      {      {
32        if (!retained_headers)        if (list_is_empty (*list))
33          fprintf (ofile, _("No fields are currently being retained\n"));          fprintf (ofile, _(msg));
34        else        else
35          util_slist_print (retained_headers, 1);          util_slist_print (*list, 1);
36        return 0;        return 0;
37      }      }
38    
39    while (--argc)    while (--argc)
40      util_slist_add (&retained_headers, *++argv);      fun (list, *++argv);
41    return 0;    return 0;
42  }  }
43    
44  /*  /*
45     * ret[ain] [heder-field...]
46     */
47    
48    int
49    mail_retain (int argc, char **argv)
50    {
51      return process_list (argc, argv, &retained_headers,
52                           util_slist_add,
53                           N_("No fields are currently being retained\n"));
54    }
55    
56    /*
57   * di[scard] [header-field...]   * di[scard] [header-field...]
58   * ig[nore] [header-field...]   * ig[nore] [header-field...]
59   */   */
# Line 49  mail_retain (int argc, char **argv) Line 61  mail_retain (int argc, char **argv)
61  int  int
62  mail_discard (int argc, char **argv)  mail_discard (int argc, char **argv)
63  {  {
64    if (argc == 1)    return process_list (argc, argv, &ignored_headers,
65      {                         util_slist_add,
66        if (!ignored_headers)                         N_("No fields are currently being ignored\n"));
         fprintf (ofile, _("No fields are currently being ignored\n"));  
       else  
         util_slist_print (ignored_headers, 1);  
       return 0;  
     }  
   
   while (--argc)  
     util_slist_add (&ignored_headers, *++argv);  
67    return 0;    return 0;
68  }  }
69    
70    /*
71     * unfold [header-field...]
72     */
73    
74    int
75    mail_unfold (int argc, char **argv)
76    {
77      return process_list (argc, argv, &unfolded_headers,
78                           util_slist_add,
79                           N_("No fields are currently being unfolded\n"));
80    }
81    
82    /*
83     * nounfold [header-field...]
84     */
85    
86    int
87    mail_nounfold (int argc, char **argv)
88    {
89      return process_list (argc, argv, &unfolded_headers,
90                           util_slist_remove,
91                           N_("No fields are currently being unfolded\n"));
92    }
93    
94    int
95    mail_header_is_unfoldable (char *str)
96    {
97      return util_slist_lookup (unfolded_headers, str);
98    }
99    
100  int  int
101  mail_header_is_visible (char *str)  mail_header_is_visible (char *str)

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

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