Rewritten in accordance with POSIX specs: do not mbox deleted and saved messages.
Showing
1 changed file
with
22 additions
and
4 deletions
1 | /* GNU Mailutils -- a suite of utilities for electronic mail | 1 | /* GNU Mailutils -- a suite of utilities for electronic mail |
2 | Copyright (C) 1999, 2001 Free Software Foundation, Inc. | 2 | Copyright (C) 1999, 2001, 2005 Free Software Foundation, Inc. |
3 | 3 | ||
4 | GNU Mailutils is free software; you can redistribute it and/or modify | 4 | GNU Mailutils is free software; you can redistribute it and/or modify |
5 | it under the terms of the GNU General Public License as published by | 5 | it under the terms of the GNU General Public License as published by |
... | @@ -17,12 +17,30 @@ | ... | @@ -17,12 +17,30 @@ |
17 | 17 | ||
18 | #include "mail.h" | 18 | #include "mail.h" |
19 | 19 | ||
20 | /* | 20 | /* tou[ch] [msglist] |
21 | * tou[ch] [msglist] | 21 | |
22 | */ | 22 | Touch the specified messages. If any message in msglist is not |
23 | specifically deleted nor saved in a file, it shall be placed in the | ||
24 | mbox upon normal termination. */ | ||
25 | |||
26 | static int | ||
27 | touch0 (msgset_t *mspec, message_t msg, void *data) | ||
28 | { | ||
29 | attribute_t attr = NULL; | ||
30 | |||
31 | message_get_attribute (msg, &attr); | ||
32 | if (!attribute_is_userflag (attr, MAIL_ATTRIBUTE_SAVED)) | ||
33 | { | ||
34 | attribute_set_userflag (attr, MAIL_ATTRIBUTE_MBOXED); | ||
35 | util_mark_read (msg); | ||
36 | } | ||
37 | |||
38 | cursor = mspec->msg_part[0]; | ||
39 | } | ||
23 | 40 | ||
24 | int | 41 | int |
25 | mail_touch (int argc, char **argv) | 42 | mail_touch (int argc, char **argv) |
26 | { | 43 | { |
44 | return util_foreach_msg (argc, argv, MSG_NODELETED, touch0, NULL); | ||
27 | return mail_mbox (argc, argv); | 45 | return mail_mbox (argc, argv); |
28 | } | 46 | } | ... | ... |
-
Please register or sign in to post a comment