diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2007-06-28 08:03:29 +0000 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2007-06-28 08:03:29 +0000 |
commit | ff639efd3ee44de0e4904c2d8bb7d0de31b932a1 (patch) | |
tree | a7ca36ee1be7e91379823c7a0ba649fb7a89c10d /mailbox | |
parent | f532b7b3bea1231bdd53039d05746fc7083ab96e (diff) | |
download | mailutils-ff639efd3ee44de0e4904c2d8bb7d0de31b932a1.tar.gz mailutils-ff639efd3ee44de0e4904c2d8bb7d0de31b932a1.tar.bz2 |
(mu_header_append,mu_header_prepend): New function
Diffstat (limited to 'mailbox')
-rw-r--r-- | mailbox/header.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/mailbox/header.c b/mailbox/header.c index 3d9f2fa7b..98ed8fd17 100644 --- a/mailbox/header.c +++ b/mailbox/header.c @@ -584,6 +584,48 @@ mu_header_remove (mu_header_t header, const char *fn, int n) } int +mu_header_append (mu_header_t header, const char *fn, const char *fv) +{ + int status; + struct mu_hdrent *ent; + + if (header == NULL || fn == NULL || fv == NULL) + return EINVAL; + + status = mu_header_fill (header); + if (status) + return status; + + ent = mu_hdrent_create (header, NULL, fn, strlen (fn), fv, strlen (fv)); + if (!ent) + return ENOMEM; + mu_hdrent_append (header, ent); + HEADER_SET_MODIFIED (header); + return 0; +} + +int +mu_header_prepend (mu_header_t header, const char *fn, const char *fv) +{ + int status; + struct mu_hdrent *ent; + + if (header == NULL || fn == NULL || fv == NULL) + return EINVAL; + + status = mu_header_fill (header); + if (status) + return status; + + ent = mu_hdrent_create (header, NULL, fn, strlen (fn), fv, strlen (fv)); + if (!ent) + return ENOMEM; + mu_hdrent_prepend (header, ent); + HEADER_SET_MODIFIED (header); + return 0; +} + +int mu_header_insert (mu_header_t header, const char *fn, const char *fv, const char *ref, int n, int flags) @@ -1189,3 +1231,4 @@ mu_header_clear_modified (mu_header_t header) return 0; } + |