for mail/*
- implemented header - implemented printall - little change on print - little bugs in util.c fix - free(list) after calling util_expand_list(); - Range is now working "2-4" or "2 - 4" or "2 3-5 6" should work. Various little bugs fixes. for the mailbox/*: - little cleanup and buglets fix.
Showing
8 changed files
with
162 additions
and
64 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 Free Software Foundation, Inc. | 2 | Copyright (C) 1999, 2000 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This program is free software; you can redistribute it and/or modify | 4 | This program 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 |
... | @@ -25,9 +25,7 @@ int | ... | @@ -25,9 +25,7 @@ int |
25 | mail_from (int argc, char **argv) | 25 | mail_from (int argc, char **argv) |
26 | { | 26 | { |
27 | if (argc > 1) | 27 | if (argc > 1) |
28 | { | ||
29 | return util_msglist_command (mail_from, argc, argv); | 28 | return util_msglist_command (mail_from, argc, argv); |
30 | } | ||
31 | else | 29 | else |
32 | { | 30 | { |
33 | message_t msg; | 31 | message_t msg; |
... | @@ -41,9 +39,11 @@ mail_from (int argc, char **argv) | ... | @@ -41,9 +39,11 @@ mail_from (int argc, char **argv) |
41 | if (col) | 39 | if (col) |
42 | columns = strtol (col, NULL, 10) - 5; | 40 | columns = strtol (col, NULL, 10) - 5; |
43 | 41 | ||
44 | if (mailbox_get_message (mbox, cursor, &msg) != 0 || | 42 | if (mailbox_get_message (mbox, cursor, &msg) != 0) |
45 | message_get_header (msg, &hdr) != 0) | 43 | { |
44 | fprintf (stderr, "Could not read message %d\n", cursor); | ||
46 | return 1; | 45 | return 1; |
46 | } | ||
47 | 47 | ||
48 | froml = columns / 3; | 48 | froml = columns / 3; |
49 | subjl = columns * 2 / 3; | 49 | subjl = columns * 2 / 3; |
... | @@ -60,6 +60,7 @@ mail_from (int argc, char **argv) | ... | @@ -60,6 +60,7 @@ mail_from (int argc, char **argv) |
60 | return 1; | 60 | return 1; |
61 | } | 61 | } |
62 | 62 | ||
63 | message_get_header (msg, &hdr); | ||
63 | header_get_value (hdr, MU_HEADER_FROM, from, froml, NULL); | 64 | header_get_value (hdr, MU_HEADER_FROM, from, froml, NULL); |
64 | header_get_value (hdr, MU_HEADER_SUBJECT, subj, subjl, NULL); | 65 | header_get_value (hdr, MU_HEADER_SUBJECT, subj, subjl, NULL); |
65 | 66 | ... | ... |
1 | /* GNU mailutils - a suite of utilities for electronic mail | 1 | /* GNU mailutils - a suite of utilities for electronic mail |
2 | Copyright (C) 1999 Free Software Foundation, Inc. | 2 | Copyright (C) 1999, 2000 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This program is free software; you can redistribute it and/or modify | 4 | This program 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 |
... | @@ -24,6 +24,34 @@ | ... | @@ -24,6 +24,34 @@ |
24 | int | 24 | int |
25 | mail_headers (int argc, char **argv) | 25 | mail_headers (int argc, char **argv) |
26 | { | 26 | { |
27 | printf ("Function not implemented in %s line %d\n", __FILE__, __LINE__); | 27 | if (argc > 1) |
28 | return util_msglist_command (mail_headers, argc, argv); | ||
29 | else | ||
30 | { | ||
31 | message_t msg; | ||
32 | header_t hdr; | ||
33 | stream_t is; | ||
34 | char buffer[BUFSIZ]; | ||
35 | off_t off = 0; | ||
36 | size_t n = 0; | ||
37 | |||
38 | if (mailbox_get_message (mbox, cursor, &msg) != 0) | ||
39 | { | ||
40 | printf ("Could not read message %d\n", cursor); | ||
41 | return 1; | ||
42 | } | ||
43 | |||
44 | message_get_header (msg, &hdr); | ||
45 | header_get_stream (hdr, &is); | ||
46 | |||
47 | while (stream_read (is, buffer, sizeof (buffer) - 1, off, &n) == 0 | ||
48 | && n != 0) | ||
49 | { | ||
50 | buffer[n] = '\0'; | ||
51 | printf ("%s", buffer); | ||
52 | off += n; | ||
53 | } | ||
54 | return 0; | ||
55 | } | ||
28 | return 1; | 56 | return 1; |
29 | } | 57 | } | ... | ... |
1 | /* GNU mailutils - a suite of utilities for electronic mail | 1 | /* GNU mailutils - a suite of utilities for electronic mail |
2 | Copyright (C) 1999 Free Software Foundation, Inc. | 2 | Copyright (C) 1999, 2000 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This program is free software; you can redistribute it and/or modify | 4 | This program 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 |
... | @@ -64,12 +64,17 @@ parse_opt (int key, char *arg, struct argp_state *state) | ... | @@ -64,12 +64,17 @@ parse_opt (int key, char *arg, struct argp_state *state) |
64 | args->file = arg; | 64 | args->file = arg; |
65 | else | 65 | else |
66 | { | 66 | { |
67 | int len; | ||
67 | char *home = getenv("HOME"); | 68 | char *home = getenv("HOME"); |
68 | int len = strlen (home) + strlen ("/mbox") + 1; | 69 | if (home == NULL) |
70 | { | ||
71 | fprintf (stderr, "No Home!\n"); | ||
72 | home = (char *)""; | ||
73 | } | ||
74 | len = strlen (home) + strlen ("/mbox") + 1; | ||
69 | args->file = malloc(len * sizeof (char)); | 75 | args->file = malloc(len * sizeof (char)); |
70 | strcpy (args->file, home); | 76 | strcpy (args->file, home); |
71 | strcat (args->file, "/mbox"); | 77 | strcat (args->file, "/mbox"); |
72 | free (home); | ||
73 | } | 78 | } |
74 | break; | 79 | break; |
75 | case 'p': | 80 | case 'p': |
... | @@ -159,7 +164,7 @@ main (int argc, char **argv) | ... | @@ -159,7 +164,7 @@ main (int argc, char **argv) |
159 | 164 | ||
160 | /* mail_from (2, from); */ | 165 | /* mail_from (2, from); */ |
161 | /* FIXME: this is bad form */ | 166 | /* FIXME: this is bad form */ |
162 | for (cursor=1; cursor < total; cursor++) | 167 | for (cursor = 1; cursor <= total; cursor++) |
163 | mail_from (1, from); | 168 | mail_from (1, from); |
164 | cursor = realcursor; | 169 | cursor = realcursor; |
165 | 170 | ||
... | @@ -191,4 +196,3 @@ main (int argc, char **argv) | ... | @@ -191,4 +196,3 @@ main (int argc, char **argv) |
191 | add_history (cmd); | 196 | add_history (cmd); |
192 | } | 197 | } |
193 | } | 198 | } |
194 | ... | ... |
1 | /* GNU mailutils - a suite of utilities for electronic mail | 1 | /* GNU mailutils - a suite of utilities for electronic mail |
2 | Copyright (C) 1999 Free Software Foundation, Inc. | 2 | Copyright (C) 1999, 2000 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This program is free software; you can redistribute it and/or modify | 4 | This program 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 |
... | @@ -25,44 +25,49 @@ | ... | @@ -25,44 +25,49 @@ |
25 | int | 25 | int |
26 | mail_print (int argc, char **argv) | 26 | mail_print (int argc, char **argv) |
27 | { | 27 | { |
28 | |||
29 | if (argc > 1) | ||
30 | return util_msglist_command (mail_print, argc, argv); | ||
31 | else | ||
32 | { | ||
28 | message_t mesg; | 33 | message_t mesg; |
29 | header_t hdr; | 34 | header_t hdr; |
30 | body_t body; | 35 | body_t body; |
31 | stream_t stream; | 36 | stream_t stream; |
37 | char buffer[BUFSIZ]; | ||
38 | off_t off = 0; | ||
39 | size_t n = 0; | ||
32 | 40 | ||
33 | if (argc > 1) | 41 | if (mailbox_get_message (mbox, cursor, &mesg) != 0) |
34 | return util_msglist_command (mail_print, argc, argv); | ||
35 | else if (mailbox_get_message (mbox, cursor, &mesg) != 0) | ||
36 | printf ("Couldn't read message %d\n", cursor); | ||
37 | else if (message_get_header (mesg, &hdr) != 0) | ||
38 | printf ("Couldn't read message header on message %d\n", cursor); | ||
39 | else if (message_get_body (mesg, &body) != 0) | ||
40 | printf ("Couldn't read message body from message %d\n", cursor); | ||
41 | else if (body_get_stream (body, &stream) != 0) | ||
42 | printf ("Couldn't get stream for message %d\n", cursor); | ||
43 | else | ||
44 | { | 42 | { |
45 | char *buf = NULL; | 43 | printf ("Could not read message %d\n", cursor); |
46 | size_t len = 0; | 44 | return 1; |
47 | buf = malloc (80 * sizeof (char)); | 45 | } |
48 | if (header_get_value (hdr, MU_HEADER_FROM, buf, 80, NULL) == 0) | 46 | |
47 | message_get_header (mesg, &hdr); | ||
48 | if (header_get_value (hdr, MU_HEADER_FROM, buffer, sizeof (buffer), | ||
49 | NULL) == 0) | ||
49 | { | 50 | { |
50 | printf ("From: %s\n", buf); | 51 | printf ("From: %s\n", buffer); |
51 | /* free (buf); */ | 52 | /* free (buf); */ |
52 | } | 53 | } |
53 | if (header_get_value (hdr, MU_HEADER_SUBJECT, buf, 80,NULL) == 0) | 54 | if (header_get_value (hdr, MU_HEADER_SUBJECT, buffer, sizeof (buffer), |
55 | NULL) == 0) | ||
54 | { | 56 | { |
55 | printf ("Subject: %s\n", buf); | 57 | printf ("Subject: %s\n", buffer); |
56 | /* free (buf); */ | 58 | /* free (buf); */ |
57 | } | 59 | } |
58 | free (buf); | ||
59 | body_size (body, &len); | ||
60 | buf = malloc ((len+1) * sizeof(char)); | ||
61 | memset (buf, '\0', len+1); | ||
62 | stream_read (stream, buf, len, 0, NULL); | ||
63 | printf ("\n%s\n", buf); | ||
64 | free (buf); | ||
65 | } | ||
66 | 60 | ||
61 | message_get_body (mesg, &body); | ||
62 | body_get_stream (body, &stream); | ||
63 | while (stream_read (stream, buffer, sizeof (buffer) - 1, off, &n) == 0 | ||
64 | && n != 0) | ||
65 | { | ||
66 | buffer[n] = '\0'; | ||
67 | printf ("%s", buffer); | ||
68 | off += n; | ||
69 | } | ||
70 | return 0; | ||
71 | } | ||
67 | return 1; | 72 | return 1; |
68 | } | 73 | } | ... | ... |
1 | /* GNU mailutils - a suite of utilities for electronic mail | 1 | /* GNU mailutils - a suite of utilities for electronic mail |
2 | Copyright (C) 1999 Free Software Foundation, Inc. | 2 | Copyright (C) 1999, 2000 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This program is free software; you can redistribute it and/or modify | 4 | This program 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 |
... | @@ -25,6 +25,29 @@ | ... | @@ -25,6 +25,29 @@ |
25 | int | 25 | int |
26 | mail_printall (int argc, char **argv) | 26 | mail_printall (int argc, char **argv) |
27 | { | 27 | { |
28 | printf ("Function not implemented in %s line %d\n", __FILE__, __LINE__); | 28 | if (argc > 1) |
29 | return util_msglist_command (mail_printall, argc, argv); | ||
30 | else | ||
31 | { | ||
32 | message_t msg; | ||
33 | stream_t is; | ||
34 | char buffer[BUFSIZ]; | ||
35 | off_t off = 0; | ||
36 | size_t n = 0; | ||
37 | |||
38 | if (mailbox_get_message (mbox, cursor, &msg) != 0) | ||
39 | return 1; | ||
40 | |||
41 | message_get_stream (msg, &is); | ||
42 | |||
43 | while (stream_read (is, buffer, sizeof (buffer) - 1, off, &n) == 0 | ||
44 | && n != 0) | ||
45 | { | ||
46 | buffer[n] = '\0'; | ||
47 | printf ("%s", buffer); | ||
48 | off += n; | ||
49 | } | ||
50 | return 0; | ||
51 | } | ||
29 | return 1; | 52 | return 1; |
30 | } | 53 | } | ... | ... |
1 | /* GNU mailutils - a suite of utilities for electronic mail | 1 | /* GNU mailutils - a suite of utilities for electronic mail |
2 | Copyright (C) 1999 Free Software Foundation, Inc. | 2 | Copyright (C) 1999, 2000 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This program is free software; you can redistribute it and/or modify | 4 | This program 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 |
... | @@ -30,6 +30,7 @@ util_expand_msglist (const int argc, char **argv, int **list) | ... | @@ -30,6 +30,7 @@ util_expand_msglist (const int argc, char **argv, int **list) |
30 | { | 30 | { |
31 | int i = 0, lc = 0; | 31 | int i = 0, lc = 0; |
32 | int undelete = 0; | 32 | int undelete = 0; |
33 | int hyphen = 0; | ||
33 | 34 | ||
34 | if (util_command_get (argv[0]) == util_command_get ("undelete")) | 35 | if (util_command_get (argv[0]) == util_command_get ("undelete")) |
35 | undelete = 1; | 36 | undelete = 1; |
... | @@ -43,7 +44,7 @@ util_expand_msglist (const int argc, char **argv, int **list) | ... | @@ -43,7 +44,7 @@ util_expand_msglist (const int argc, char **argv, int **list) |
43 | } | 44 | } |
44 | else if (!strcmp (argv[i], "-")) | 45 | else if (!strcmp (argv[i], "-")) |
45 | { | 46 | { |
46 | *list[lc++] = i; /* FIXME: previous [un]deleted message */ | 47 | hyphen = 1; /* FIXME: previous [un]deleted message */ |
47 | } | 48 | } |
48 | else if (!strcmp (argv[i], ".")) | 49 | else if (!strcmp (argv[i], ".")) |
49 | { | 50 | { |
... | @@ -61,8 +62,8 @@ util_expand_msglist (const int argc, char **argv, int **list) | ... | @@ -61,8 +62,8 @@ util_expand_msglist (const int argc, char **argv, int **list) |
61 | { | 62 | { |
62 | free (*list); | 63 | free (*list); |
63 | *list = malloc (total * sizeof(int)); | 64 | *list = malloc (total * sizeof(int)); |
64 | for (i=0; i < total; i++) | 65 | for (i = 0; i < total; i++) |
65 | *list[i] = i+1; | 66 | *list[i] = i + 1; |
66 | return total; | 67 | return total; |
67 | } | 68 | } |
68 | else if (argv[i][0] == '/') | 69 | else if (argv[i][0] == '/') |
... | @@ -80,19 +81,44 @@ util_expand_msglist (const int argc, char **argv, int **list) | ... | @@ -80,19 +81,44 @@ util_expand_msglist (const int argc, char **argv, int **list) |
80 | } | 81 | } |
81 | else | 82 | else |
82 | { | 83 | { |
83 | int j = 0, hyphen = 0; | 84 | int j; |
84 | int len = strlen (argv[i]); | 85 | int len = strlen (argv[i]); |
85 | 86 | ||
86 | for (j=0; j < len; j++) | 87 | for (j = 0; j < len; j++) |
87 | if (argv[i][j] == '-') | 88 | if (argv[i][j] == '-') |
89 | { | ||
88 | hyphen = 1; | 90 | hyphen = 1; |
89 | 91 | break; | |
90 | if (!hyphen) | 92 | } |
91 | *list[lc++] = atoi (argv[i]); | 93 | if (hyphen) |
92 | else | 94 | { |
95 | if (j != len) /* One argument "x-y". */ | ||
93 | { | 96 | { |
94 | *list[lc++] = i; /* FIXME: range in argv[i] (x-y) */ | 97 | int x, y; |
98 | char *arg = strdup (argv[i]); | ||
99 | arg[j] = '\0'; | ||
100 | x = atoi (arg); | ||
101 | y = atoi (&(arg[j + 1])); | ||
102 | /* In this case, we also have to realloc() the list. */ | ||
103 | *list = realloc (*list, (argc + 2) * sizeof (int)); | ||
104 | for (; x <= y; x++, lc++) | ||
105 | *list[lc] = x; | ||
106 | free (arg); | ||
95 | } | 107 | } |
108 | else if (i == 3) /* 3 arguments "x" "-" "y". */ | ||
109 | { | ||
110 | int x, y; | ||
111 | x = *list[lc - 1]; | ||
112 | y = atoi (argv[i]); | ||
113 | for (; x <= y; x++, lc++) | ||
114 | *list[lc] = x; | ||
115 | } | ||
116 | else /* Badly form. */ | ||
117 | *list[lc++] = atoi (argv[i]); | ||
118 | hyphen = 0; | ||
119 | } | ||
120 | else | ||
121 | *list[lc++] = atoi(argv[i]); | ||
96 | } | 122 | } |
97 | } | 123 | } |
98 | return lc; | 124 | return lc; |
... | @@ -146,17 +172,18 @@ int | ... | @@ -146,17 +172,18 @@ int |
146 | util_msglist_command (int (*func)(int, char**), int argc, char **argv) | 172 | util_msglist_command (int (*func)(int, char**), int argc, char **argv) |
147 | { | 173 | { |
148 | int i; | 174 | int i; |
149 | int *list; | 175 | int *list = NULL; |
150 | int status = 0; | 176 | int status = 0; |
151 | int number = util_expand_msglist (argc, argv, &list); | 177 | int number = util_expand_msglist (argc, argv, &list); |
152 | realcursor = cursor; | 178 | realcursor = cursor; |
153 | 179 | ||
154 | for (i = 0; i <= number; i++) | 180 | for (i = 0; i < number; i++) |
155 | { | 181 | { |
156 | cursor = list[i]; | 182 | cursor = list[i]; |
157 | if (func (1, argv) != 0) | 183 | if (func (1, argv) != 0) |
158 | status = 1; | 184 | status = 1; |
159 | } | 185 | } |
186 | free (list); | ||
160 | 187 | ||
161 | cursor = realcursor; | 188 | cursor = realcursor; |
162 | return status; | 189 | return status; | ... | ... |
... | @@ -657,11 +657,13 @@ pop_get_message (mailbox_t mbox, size_t msgno, message_t *pmsg) | ... | @@ -657,11 +657,13 @@ pop_get_message (mailbox_t mbox, size_t msgno, message_t *pmsg) |
657 | 657 | ||
658 | /* Create the message. */ | 658 | /* Create the message. */ |
659 | { | 659 | { |
660 | message_t msg; | 660 | message_t msg = NULL; |
661 | stream_t is; | 661 | stream_t is = NULL; |
662 | if ((status = message_create (&msg, mpm)) != 0 | 662 | if ((status = message_create (&msg, mpm)) != 0 |
663 | || (status = stream_create (&is, MU_STREAM_READ, mpm)) != 0) | 663 | || (status = stream_create (&is, MU_STREAM_READ, mpm)) != 0) |
664 | { | 664 | { |
665 | message_destroy (&msg, mpm); | ||
666 | stream_destroy (&is, mpm); | ||
665 | free (mpm); | 667 | free (mpm); |
666 | return status; | 668 | return status; |
667 | } | 669 | } |
... | @@ -673,11 +675,13 @@ pop_get_message (mailbox_t mbox, size_t msgno, message_t *pmsg) | ... | @@ -673,11 +675,13 @@ pop_get_message (mailbox_t mbox, size_t msgno, message_t *pmsg) |
673 | 675 | ||
674 | /* Create the header. */ | 676 | /* Create the header. */ |
675 | { | 677 | { |
676 | header_t header; | 678 | header_t header = NULL; |
677 | stream_t stream; | 679 | stream_t stream = NULL; |
678 | if ((status = header_create (&header, NULL, 0, mpm)) != 0 | 680 | if ((status = header_create (&header, NULL, 0, mpm)) != 0 |
679 | || (status = stream_create (&stream, MU_STREAM_READ, mpm)) != 0) | 681 | || (status = stream_create (&stream, MU_STREAM_READ, mpm)) != 0) |
680 | { | 682 | { |
683 | header_destroy (&header, mpm); | ||
684 | stream_destroy (&stream, mpm); | ||
681 | message_destroy (&(mpm->message), mpm); | 685 | message_destroy (&(mpm->message), mpm); |
682 | free (mpm); | 686 | free (mpm); |
683 | return status; | 687 | return status; |
... | @@ -706,11 +710,13 @@ pop_get_message (mailbox_t mbox, size_t msgno, message_t *pmsg) | ... | @@ -706,11 +710,13 @@ pop_get_message (mailbox_t mbox, size_t msgno, message_t *pmsg) |
706 | 710 | ||
707 | /* Create the body and its stream. */ | 711 | /* Create the body and its stream. */ |
708 | { | 712 | { |
709 | stream_t stream; | 713 | body_t body = NULL; |
710 | body_t body; | 714 | stream_t stream = NULL; |
711 | if ((status = body_create (&body, mpm)) != 0 | 715 | if ((status = body_create (&body, mpm)) != 0 |
712 | || (status = stream_create (&stream, MU_STREAM_READ, mpm)) != 0) | 716 | || (status = stream_create (&stream, MU_STREAM_READ, mpm)) != 0) |
713 | { | 717 | { |
718 | body_destroy (&body, mpm); | ||
719 | stream_destroy (&stream, mpm); | ||
714 | message_destroy (&(mpm->message), mpm); | 720 | message_destroy (&(mpm->message), mpm); |
715 | free (mpm); | 721 | free (mpm); |
716 | return status; | 722 | return status; | ... | ... |
... | @@ -1090,11 +1090,13 @@ unix_get_message (mailbox_t mbox, size_t msgno, message_t *pmsg) | ... | @@ -1090,11 +1090,13 @@ unix_get_message (mailbox_t mbox, size_t msgno, message_t *pmsg) |
1090 | 1090 | ||
1091 | /* Set the header. */ | 1091 | /* Set the header. */ |
1092 | { | 1092 | { |
1093 | header_t header; | 1093 | header_t header = NULL; |
1094 | stream_t stream; | 1094 | stream_t stream = NULL; |
1095 | if ((status = header_create (&header, NULL, 0, mum)) != 0 | 1095 | if ((status = header_create (&header, NULL, 0, mum)) != 0 |
1096 | || (status = stream_create (&stream, MU_STREAM_READ, mum)) != 0) | 1096 | || (status = stream_create (&stream, MU_STREAM_READ, mum)) != 0) |
1097 | { | 1097 | { |
1098 | stream_destroy (&stream, mum); | ||
1099 | header_destroy (&header, mum); | ||
1098 | message_destroy (&msg, mum); | 1100 | message_destroy (&msg, mum); |
1099 | return status; | 1101 | return status; |
1100 | } | 1102 | } |
... | @@ -1125,12 +1127,14 @@ unix_get_message (mailbox_t mbox, size_t msgno, message_t *pmsg) | ... | @@ -1125,12 +1127,14 @@ unix_get_message (mailbox_t mbox, size_t msgno, message_t *pmsg) |
1125 | 1127 | ||
1126 | /* Prepare the body. */ | 1128 | /* Prepare the body. */ |
1127 | { | 1129 | { |
1128 | body_t body; | 1130 | body_t body = NULL; |
1129 | stream_t stream; | 1131 | stream_t stream = NULL; |
1130 | int flags = MU_STREAM_READ; | 1132 | int flags = MU_STREAM_READ; |
1131 | if ((status = body_create (&body, mum)) != 0 | 1133 | if ((status = body_create (&body, mum)) != 0 |
1132 | || (status = stream_create (&stream, flags, mum)) != 0) | 1134 | || (status = stream_create (&stream, flags, mum)) != 0) |
1133 | { | 1135 | { |
1136 | body_destroy (&body, mum); | ||
1137 | stream_destroy (&stream, mum); | ||
1134 | message_destroy (&msg, mum); | 1138 | message_destroy (&msg, mum); |
1135 | return status; | 1139 | return status; |
1136 | } | 1140 | } | ... | ... |
-
Please register or sign in to post a comment