From f5eb58c97162a6ed8ba033b3a2a39c8b4926c793 Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Mon, 24 Feb 2003 10:30:10 +0000 Subject: Removed auto-generated file --- doc/texinfo/mailcap.inc | 102 ++++++++++++++++++++++++++++-------------------- 1 file changed, 59 insertions(+), 43 deletions(-) diff --git a/doc/texinfo/mailcap.inc b/doc/texinfo/mailcap.inc index 117d14e30..4c082839b 100644 --- a/doc/texinfo/mailcap.inc +++ b/doc/texinfo/mailcap.inc @@ -17,57 +17,73 @@ #include #include +#include +#include -int main(int argc, char **argv) +int +main(int argc, char **argv) @{ - stream_t stream = NULL; - int status = 0; + stream_t stream = NULL; + int status = 0; + char *file = argc == 1 ? "/etc/mailcap" : argv[1]; + mu_mailcap_t mailcap = NULL; + + status = file_stream_create (&stream, file, MU_STREAM_READ); + if (status) + @{ + mu_error ("cannot create file stream %s: %s", + file, mu_strerror (status)); + exit (1); + @} - status = file_stream_create (&stream, "/etc/mailcap", MU_STREAM_READ); - if (status == 0) - @{ - status = stream_open (stream); - if (status == 0) - @{ - mu_mailcap_t mailcap = NULL; - status = mu_mailcap_create (&mailcap, stream); - if (status == 0) - @{ - int i; - size_t count = 0; - char buffer[256]; + status = stream_open (stream); + if (status) + @{ + mu_error ("cannot open file stream %s: %s", + file, mu_strerror (status)); + exit (1); + @} - mu_mailcap_entries_count (mailcap, &count); - for (i = 1; i <= count; i++) - @{ - int j; - mu_mailcap_entry_t entry = NULL; - int fields_count = 0; + status = mu_mailcap_create (&mailcap, stream); + if (status == 0) + @{ + int i; + size_t count = 0; + char buffer[256]; - printf ("entry[%d]\n", i); + mu_mailcap_entries_count (mailcap, &count); + for (i = 1; i <= count; i++) + @{ + int j; + mu_mailcap_entry_t entry = NULL; + int fields_count = 0; - mu_mailcap_get_entry (mailcap, i, &entry); + printf ("entry[%d]\n", i); - /* typefield. */ - mu_mailcap_entry_get_typefield (entry, buffer, sizeof (buffer), NULL); - printf ("\ttypefield: %s\n", buffer); + mu_mailcap_get_entry (mailcap, i, &entry); - /* view-command. */ - mu_mailcap_entry_get_viewcommand (entry, buffer, sizeof (buffer), NULL); - printf ("\tview-command: %s\n", buffer); + /* typefield. */ + mu_mailcap_entry_get_typefield (entry, buffer, + sizeof (buffer), NULL); + printf ("\ttypefield: %s\n", buffer); + + /* view-command. */ + mu_mailcap_entry_get_viewcommand (entry, buffer, + sizeof (buffer), NULL); + printf ("\tview-command: %s\n", buffer); - /* fields. */ - mu_mailcap_entry_fields_count (entry, &fields_count); - for (j = 1; j <= fields_count; j++) - @{ - mu_mailcap_entry_get_field (entry, j, buffer, sizeof (buffer), NULL); - printf ("\tfields[%d]: %s\n", j, buffer); - @} - printf ("\n"); - @} - mu_mailcap_destroy (&mailcap); - @} - @} - @} + /* fields. */ + mu_mailcap_entry_fields_count (entry, &fields_count); + for (j = 1; j <= fields_count; j++) + @{ + mu_mailcap_entry_get_field (entry, j, buffer, + sizeof (buffer), NULL); + printf ("\tfields[%d]: %s\n", j, buffer); + @} + printf ("\n"); + @} + mu_mailcap_destroy (&mailcap); + @} + return 0; @} -- cgit v1.2.1