diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2004-01-13 15:47:25 +0000 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2004-01-13 15:47:25 +0000 |
commit | b951d4cb74d4389e157872ab4087a3820ba125c8 (patch) | |
tree | 8f632e64655436e35a3755cd13c2e664999d3808 /frm | |
parent | ad9f2c68385eeb7a12f42ce3b2913ffaf9fda2db (diff) | |
download | mailutils-b951d4cb74d4389e157872ab4087a3820ba125c8.tar.gz mailutils-b951d4cb74d4389e157872ab4087a3820ba125c8.tar.bz2 |
Fixed comments
Diffstat (limited to 'frm')
-rw-r--r-- | frm/frm.c | 28 |
1 files changed, 15 insertions, 13 deletions
@@ -40,12 +40,13 @@ #include <mailutils/stream.h> #include <mailutils/url.h> #include <mailutils/nls.h> #include <mailutils/tls.h> #include <mailutils/error.h> #include <mailutils/mutil.h> +#include <mailutils/mime.h> static char* show_field; static int show_to; static int show_from = 1; static int show_subject = 1; static int show_number; @@ -96,13 +97,13 @@ N_("Select messages with the specific attribute. STATUS is one \ of the following: new, unread, old (same as unread) or read. Any unambiguous \ abbreviation of those is also accepted."); /* Attribute table handling */ -/* Prepares the table for use: computes minimum abbreviation lengths */ +/* Prepares the table for use. Computes minimum abbreviation lengths. */ static void prepare_attrs (void) { struct attr_tab *p, *q; for (p = attr_tab; p->name; p++) @@ -202,13 +203,13 @@ parse_opt (int key, char *arg, struct argp_state *state) show_number = 1; break; case 'Q': /* Very silent. */ be_quiet += 2; - if (freopen("/dev/null", "w", stdout) == NULL) + if (freopen ("/dev/null", "w", stdout) == NULL) { perror (_("Can not be very quiet")); exit (3); } break; @@ -323,13 +324,13 @@ get_personal (header_t hdr, const char *field, char *personal, size_t buflen) if (len == 0) strncpy (personal, hfield, buflen)[buflen - 1] = '\0'; } return status; } -/* Observable Action this is being call at every message discover. */ +/* Observable action is being called on discovery of each message. */ /* FIXME: The format of the display is poorly done, please correct. */ static int action (observer_t o, size_t type) { static int counter; int status; @@ -348,14 +349,14 @@ action (observer_t o, size_t type) mailbox_get_message (mbox, counter, &msg); message_get_attribute (msg, &attr); message_get_header (msg, &hdr); if (((select_attribute & IS_READ) && (!attribute_is_read (attr))) - || (select_attribute & IS_NEW) && (!attribute_is_recent (attr)) - || (select_attribute & IS_OLD) && (!attribute_is_seen (attr))) + || ((select_attribute & IS_NEW) && (!attribute_is_recent (attr))) + || ((select_attribute & IS_OLD) && (!attribute_is_seen (attr)))) break; if (attribute_is_recent (attr)) have_new_mail = 1; if (select_attribute) @@ -416,17 +417,17 @@ action (observer_t o, size_t type) break; } return 0; } /* This is a clone of the elm program call "frm". It is a good example on - how to use the observable(callback) of libmailutils. "frm" has to + how to use the observable(callback) of libmailbox. "frm" has to be very interactive, it is not possible to call mailbox_messages_count() and wait for the scanning to finish before displaying. As soon as the scan - find a new message we want to know about it, this is done by registering - an observable type MU_MAILBOX_MSG_ADD. The rest is formating code. */ + finds a new message we want to know about it. This is done by registering + an observable type MU_MAILBOX_MSG_ADD. The rest is formatting code. */ int main (int argc, char **argv) { char *mailbox_name = NULL; size_t total = 0; @@ -521,29 +522,30 @@ cleanup: url_to_string (url), mu_strerror (status)); return -1; } mailbox_destroy (&mbox); - if(status != 0) + if (status != 0) return 3; } cleanup1: if (show_summary) printf (ngettext ("You have %d message.\n", "You have %d messages.\n", total), total); if (show_query && have_new_mail) printf (_("You have new mail.\n")); - /* 0 - selected messages discover. - 1 - have messages. - 2 - no message. - */ + /* EXIT STATUS + Frm returns a zero status ("true") if messages matching `status' are + present. Frm returns 1 if no messages matching `status' are present, + but there are some messages, returns 2 if there are no messages at + all, or returns 3 if an error occurred. */ if (selected) status = 0; else if (total > 0) status = 1; else |