/[mailutils]/mailutils/mh/anno.c
ViewVC logotype

Diff of /mailutils/mh/anno.c

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

revision 1.1 by gray, Mon Feb 10 01:02:12 2003 UTC revision 1.2 by gray, Mon Feb 10 12:00:01 2003 UTC
# Line 50  struct mh_option mh_option[] = { Line 50  struct mh_option mh_option[] = {
50    { NULL }    { NULL }
51  };  };
52    
 static char datebuf[80];  
53  static int inplace;       /* Annotate the message in place */  static int inplace;       /* Annotate the message in place */
54  static char *anno_date;   /* Annotation date */  static int anno_date = 1; /* Add date to the annotation */
55  static char *component;   /* header field */  static char *component;   /* header field */
56  static char *anno_text;   /* header field value */  static char *anno_text;   /* header field value */
57    
# Line 75  opt_handler (int key, char *arg, void *u Line 74  opt_handler (int key, char *arg, void *u
74        break;        break;
75    
76      case ARG_DATE:      case ARG_DATE:
77        anno_date = datebuf;        anno_date = is_true (arg);
78        break;        break;
79    
80      case ARG_NODATE:      case ARG_NODATE:
81        anno_date = NULL;        anno_date = 0;
82        break;        break;
83    
84      case ARG_COMPONENT:      case ARG_COMPONENT:
# Line 99  opt_handler (int key, char *arg, void *u Line 98  opt_handler (int key, char *arg, void *u
98  void  void
99  anno (mailbox_t mbox, message_t msg, size_t num, void *data)  anno (mailbox_t mbox, message_t msg, size_t num, void *data)
100  {  {
101    header_t hdr;    mh_annotate (msg, component, anno_text, anno_date);
   attribute_t attr;  
     
   if (message_get_header (msg, &hdr))  
     return;  
   
   if (anno_date)  
     header_set_value (hdr, component, anno_date, 0);  
   header_set_value (hdr, component, anno_text, 0);  
   
   message_get_attribute (msg, &attr);  
   attribute_set_modified (attr);  
102  }  }
103    
104  int  int
# Line 120  main (int argc, char **argv) Line 108  main (int argc, char **argv)
108    int index;    int index;
109    mailbox_t mbox;    mailbox_t mbox;
110    mh_msgset_t msgset;    mh_msgset_t msgset;
   time_t t;  
   struct tm *tm;  
111        
112    mu_init_nls ();    mu_init_nls ();
113    
   t = time (NULL);  
   tm = localtime (&t);  
   strftime (datebuf, sizeof datebuf, "%a, %d %b %Y %H:%M:%S %Z", tm);  
     
114    mh_argp_parse (argc, argv, options, mh_option, args_doc, doc,    mh_argp_parse (argc, argv, options, mh_option, args_doc, doc,
115                   opt_handler, NULL, &index);                   opt_handler, NULL, &index);
116    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

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