Commit afb2849e afb2849e44068b5a5955c8b89c851d459df0270d by Sergey Poznyakoff

Fixed indentation, adopted for 80-column screen.

1 parent cf5c7550
...@@ -117,7 +117,8 @@ mu_mailcap_entries_count (mu_mailcap_t mailcap, size_t *pcount) ...@@ -117,7 +117,8 @@ mu_mailcap_entries_count (mu_mailcap_t mailcap, size_t *pcount)
117 } 117 }
118 118
119 int 119 int
120 mu_mailcap_get_entry (mu_mailcap_t mailcap, size_t no, mu_mailcap_entry_t *pentry) 120 mu_mailcap_get_entry (mu_mailcap_t mailcap, size_t no,
121 mu_mailcap_entry_t *pentry)
121 { 122 {
122 int status = 0; 123 int status = 0;
123 if (mailcap == NULL || pentry == NULL) 124 if (mailcap == NULL || pentry == NULL)
...@@ -136,7 +137,8 @@ mu_mailcap_get_entry (mu_mailcap_t mailcap, size_t no, mu_mailcap_entry_t *pentr ...@@ -136,7 +137,8 @@ mu_mailcap_get_entry (mu_mailcap_t mailcap, size_t no, mu_mailcap_entry_t *pentr
136 } 137 }
137 138
138 int 139 int
139 mu_mailcap_entry_get_typefield(mu_mailcap_entry_t entry, char *buffer, size_t buflen, size_t *pn) 140 mu_mailcap_entry_get_typefield (mu_mailcap_entry_t entry, char *buffer,
141 size_t buflen, size_t *pn)
140 { 142 {
141 int status = 0; 143 int status = 0;
142 int len = 0; 144 int len = 0;
...@@ -164,7 +166,8 @@ mu_mailcap_entry_get_typefield(mu_mailcap_entry_t entry, char *buffer, size_t bu ...@@ -164,7 +166,8 @@ mu_mailcap_entry_get_typefield(mu_mailcap_entry_t entry, char *buffer, size_t bu
164 } 166 }
165 167
166 int 168 int
167 mu_mailcap_entry_get_viewcommand(mu_mailcap_entry_t entry, char *buffer, size_t buflen, size_t *pn) 169 mu_mailcap_entry_get_viewcommand (mu_mailcap_entry_t entry, char *buffer,
170 size_t buflen, size_t *pn)
168 { 171 {
169 int status = 0; 172 int status = 0;
170 int len = 0; 173 int len = 0;
...@@ -207,7 +210,8 @@ mu_mailcap_entry_fields_count (mu_mailcap_entry_t entry, size_t *pcount) ...@@ -207,7 +210,8 @@ mu_mailcap_entry_fields_count (mu_mailcap_entry_t entry, size_t *pcount)
207 } 210 }
208 211
209 int 212 int
210 mu_mailcap_entry_get_field (mu_mailcap_entry_t entry, size_t no, char *buffer, size_t buflen, size_t *pn) 213 mu_mailcap_entry_get_field (mu_mailcap_entry_t entry, size_t no,
214 char *buffer, size_t buflen, size_t *pn)
211 { 215 {
212 int status = 0; 216 int status = 0;
213 int len = 0; 217 int len = 0;
...@@ -239,43 +243,49 @@ mu_mailcap_entry_get_field (mu_mailcap_entry_t entry, size_t no, char *buffer, s ...@@ -239,43 +243,49 @@ mu_mailcap_entry_get_field (mu_mailcap_entry_t entry, size_t no, char *buffer, s
239 } 243 }
240 244
241 int 245 int
242 mu_mailcap_entry_get_compose(mu_mailcap_entry_t entry, char *buffer, size_t buflen, size_t *pn) 246 mu_mailcap_entry_get_compose (mu_mailcap_entry_t entry,
247 char *buffer, size_t buflen, size_t *pn)
243 { 248 {
244 return mu_mailcap_entry_get_value (entry, "compose", buffer, buflen, pn); 249 return mu_mailcap_entry_get_value (entry, "compose", buffer, buflen, pn);
245 } 250 }
246 251
247 int 252 int
248 mu_mailcap_entry_get_composetyped(mu_mailcap_entry_t entry, char *buffer, size_t buflen, size_t *pn) 253 mu_mailcap_entry_get_composetyped (mu_mailcap_entry_t entry, char *buffer,
254 size_t buflen, size_t *pn)
249 { 255 {
250 return mu_mailcap_entry_get_value (entry, "composetyped", buffer, buflen, pn); 256 return mu_mailcap_entry_get_value (entry, "composetyped", buffer, buflen, pn);
251 } 257 }
252 258
253 int 259 int
254 mu_mailcap_entry_get_edit(mu_mailcap_entry_t entry, char *buffer, size_t buflen, size_t *pn) 260 mu_mailcap_entry_get_edit (mu_mailcap_entry_t entry, char *buffer,
261 size_t buflen, size_t *pn)
255 { 262 {
256 return mu_mailcap_entry_get_value (entry, "edit", buffer, buflen, pn); 263 return mu_mailcap_entry_get_value (entry, "edit", buffer, buflen, pn);
257 } 264 }
258 265
259 int 266 int
260 mu_mailcap_entry_get_test(mu_mailcap_entry_t entry, char *buffer, size_t buflen, size_t *pn) 267 mu_mailcap_entry_get_test (mu_mailcap_entry_t entry,
268 char *buffer, size_t buflen, size_t *pn)
261 { 269 {
262 return mu_mailcap_entry_get_value (entry, "test", buffer, buflen, pn); 270 return mu_mailcap_entry_get_value (entry, "test", buffer, buflen, pn);
263 } 271 }
264 272
265 int 273 int
266 mu_mailcap_entry_get_x11bitmap(mu_mailcap_entry_t entry, char *buffer, size_t buflen, size_t *pn) 274 mu_mailcap_entry_get_x11bitmap (mu_mailcap_entry_t entry,
275 char *buffer, size_t buflen, size_t *pn)
267 { 276 {
268 return mu_mailcap_entry_get_value (entry, "x11-bitmap", buffer, buflen, pn); 277 return mu_mailcap_entry_get_value (entry, "x11-bitmap", buffer, buflen, pn);
269 } 278 }
270 279
271 int 280 int
272 mu_mailcap_entry_get_description(mu_mailcap_entry_t entry, char *buffer, size_t buflen, size_t *pn) 281 mu_mailcap_entry_get_description (mu_mailcap_entry_t entry,
282 char *buffer, size_t buflen, size_t *pn)
273 { 283 {
274 return mu_mailcap_entry_get_value (entry, "description", buffer, buflen, pn); 284 return mu_mailcap_entry_get_value (entry, "description", buffer, buflen, pn);
275 } 285 }
276 286
277 int 287 int
278 mu_mailcap_entry_needsterminal(mu_mailcap_entry_t entry, int *on) 288 mu_mailcap_entry_needsterminal (mu_mailcap_entry_t entry, int *on)
279 { 289 {
280 int status = 0; 290 int status = 0;
281 int found = 0; 291 int found = 0;
...@@ -302,7 +312,7 @@ mu_mailcap_entry_needsterminal(mu_mailcap_entry_t entry, int *on) ...@@ -302,7 +312,7 @@ mu_mailcap_entry_needsterminal(mu_mailcap_entry_t entry, int *on)
302 } 312 }
303 313
304 int 314 int
305 mu_mailcap_entry_coupiousoutput(mu_mailcap_entry_t entry, int *on) 315 mu_mailcap_entry_coupiousoutput (mu_mailcap_entry_t entry, int *on)
306 { 316 {
307 int status = 0; 317 int status = 0;
308 int found = 0; 318 int found = 0;
...@@ -329,7 +339,8 @@ mu_mailcap_entry_coupiousoutput(mu_mailcap_entry_t entry, int *on) ...@@ -329,7 +339,8 @@ mu_mailcap_entry_coupiousoutput(mu_mailcap_entry_t entry, int *on)
329 } 339 }
330 340
331 int 341 int
332 mu_mailcap_entry_get_value (mu_mailcap_entry_t entry, const char *key, char *buffer, size_t buflen, size_t *pn) 342 mu_mailcap_entry_get_value (mu_mailcap_entry_t entry, const char *key,
343 char *buffer, size_t buflen, size_t *pn)
333 { 344 {
334 int len = 0; 345 int len = 0;
335 int status = 0; 346 int status = 0;
...@@ -457,7 +468,8 @@ mu_mailcap_parse_entry (mu_mailcap_entry_t entry, char *buffer) ...@@ -457,7 +468,8 @@ mu_mailcap_parse_entry (mu_mailcap_entry_t entry, char *buffer)
457 char *token = NULL; 468 char *token = NULL;
458 char *s = NULL; 469 char *s = NULL;
459 int i; 470 int i;
460 for (i = 0, token = tokenize (buffer, &s); token != NULL; token = tokenize (NULL, &s), i++) 471 for (i = 0, token = tokenize (buffer, &s);
472 token != NULL; token = tokenize (NULL, &s), i++)
461 { 473 {
462 switch (i) 474 switch (i)
463 { 475 {
...@@ -474,7 +486,9 @@ mu_mailcap_parse_entry (mu_mailcap_entry_t entry, char *buffer) ...@@ -474,7 +486,9 @@ mu_mailcap_parse_entry (mu_mailcap_entry_t entry, char *buffer)
474 /* The rest are the optionnal fields. */ 486 /* The rest are the optionnal fields. */
475 default: 487 default:
476 { 488 {
477 char **fields = realloc (entry->fields, (entry->fields_count + 1) * sizeof (*fields)); 489 char **fields = realloc (entry->fields,
490 (entry->fields_count + 1) *
491 sizeof (*fields));
478 if (fields != NULL) 492 if (fields != NULL)
479 { 493 {
480 entry->fields = fields; 494 entry->fields = fields;
...@@ -523,14 +537,19 @@ mu_mailcap_parse (mu_mailcap_t mailcap, stream_t stream) ...@@ -523,14 +537,19 @@ mu_mailcap_parse (mu_mailcap_t mailcap, stream_t stream)
523 } 537 }
524 538
525 /* 539 /*
526 * We are doing this a little more complexe then expected, because we do not want 540 * We are doing this a little more complex then expected, because we do not
527 * to seek() back in the stream: 541 * want to seek() back in the stream:
528 * - we have to take care of continuation line i.e. line ending with '\' 542 * - we have to take care of continuation line i.e. line ending with '\'
529 * - we have to take to account that the line may be bigger then the buffer and reallocate 543 * - we have to take to account that the line may be bigger then the buffer
544 * and reallocate
530 * - check the return of malloc/realloc 545 * - check the return of malloc/realloc
531 * The old continuation line is save in the "previous" pointer and prepend to the buffer. 546 * The old continuation line is saved in the "previous" pointer and
547 * prepended to the buffer.
532 */ 548 */
533 for (previous = NULL, off = n = 0; (status = stream_readline (stream, buffer, buflen, off, &n)) == 0 && n > 0; off += n) 549 for (previous = NULL, off = n = 0;
550 (status = stream_readline (stream, buffer, buflen, off, &n)) == 0
551 && n > 0;
552 off += n)
534 { 553 {
535 int len; 554 int len;
536 555
...@@ -625,11 +644,14 @@ mu_mailcap_parse (mu_mailcap_t mailcap, stream_t stream) ...@@ -625,11 +644,14 @@ mu_mailcap_parse (mu_mailcap_t mailcap, stream_t stream)
625 if (*line != '#' && *line != '\0') 644 if (*line != '#' && *line != '\0')
626 { 645 {
627 mu_mailcap_entry_t *entries; 646 mu_mailcap_entry_t *entries;
628 entries = realloc (mailcap->entries, (mailcap->entries_count + 1) * sizeof (*entries)); 647 entries = realloc (mailcap->entries,
648 (mailcap->entries_count + 1) *
649 sizeof (*entries));
629 if (entries != NULL) 650 if (entries != NULL)
630 { 651 {
631 mailcap->entries = entries; 652 mailcap->entries = entries;
632 mailcap->entries[mailcap->entries_count] = calloc (1, sizeof(**entries)); 653 mailcap->entries[mailcap->entries_count] = calloc (1,
654 sizeof(**entries));
633 if (mailcap->entries[mailcap->entries_count] != NULL) 655 if (mailcap->entries[mailcap->entries_count] != NULL)
634 { 656 {
635 mu_mailcap_parse_entry (mailcap->entries[mailcap->entries_count], line); 657 mu_mailcap_parse_entry (mailcap->entries[mailcap->entries_count], line);
...@@ -688,22 +710,26 @@ int main() ...@@ -688,22 +710,26 @@ int main()
688 710
689 mu_mailcap_get_entry (mailcap, i, &entry); 711 mu_mailcap_get_entry (mailcap, i, &entry);
690 /* Print typefield. */ 712 /* Print typefield. */
691 mu_mailcap_entry_get_typefield (entry, buffer, sizeof (buffer), NULL); 713 mu_mailcap_entry_get_typefield (entry, buffer,
714 sizeof (buffer), NULL);
692 printf ("\ttypefield: %s\n", buffer); 715 printf ("\ttypefield: %s\n", buffer);
693 716
694 /* Print view-command. */ 717 /* Print view-command. */
695 mu_mailcap_entry_get_viewcommand (entry, buffer, sizeof (buffer), NULL); 718 mu_mailcap_entry_get_viewcommand (entry, buffer,
719 sizeof (buffer), NULL);
696 printf ("\tview-command: %s\n", buffer); 720 printf ("\tview-command: %s\n", buffer);
697 721
698 /* Print fields. */ 722 /* Print fields. */
699 mu_mailcap_entry_fields_count (entry, &fields_count); 723 mu_mailcap_entry_fields_count (entry, &fields_count);
700 for (j = 1; j <= fields_count; j++) 724 for (j = 1; j <= fields_count; j++)
701 { 725 {
702 mu_mailcap_entry_get_field (entry, j, buffer, sizeof (buffer), NULL); 726 mu_mailcap_entry_get_field (entry, j, buffer,
727 sizeof (buffer), NULL);
703 printf("\tfields[%d]: %s\n", j, buffer); 728 printf("\tfields[%d]: %s\n", j, buffer);
704 } 729 }
705 n = 0; 730 n = 0;
706 mu_mailcap_entry_get_compose (entry, buffer, sizeof (buffer), &n); 731 mu_mailcap_entry_get_compose (entry, buffer,
732 sizeof (buffer), &n);
707 if (n > 0) 733 if (n > 0)
708 { 734 {
709 printf("\tcompose[%s]\n", buffer); 735 printf("\tcompose[%s]\n", buffer);
......