summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--examples/addr.c48
-rw-r--r--examples/mimetest.c202
-rw-r--r--examples/msg-send.c42
-rw-r--r--examples/muemail.c2
-rw-r--r--examples/sfrom.c16
-rw-r--r--examples/url-parse.c40
6 files changed, 175 insertions, 175 deletions
diff --git a/examples/addr.c b/examples/addr.c
index e5a589141..b38533e30 100644
--- a/examples/addr.c
+++ b/examples/addr.c
@@ -58,46 +58,46 @@ parse (const char *str)
printf ("%d ", no);
if (isgroup)
- {
- address_get_personal (address, no, buf, sizeof (buf), &got);
+ {
+ address_get_personal (address, no, buf, sizeof (buf), &got);
- printf ("group <%s>\n", buf);
- }
+ printf ("group <%s>\n", buf);
+ }
else
- {
- address_get_email (address, no, buf, sizeof (buf), 0);
+ {
+ address_get_email (address, no, buf, sizeof (buf), 0);
- printf ("email <%s>\n", buf);
- }
+ printf ("email <%s>\n", buf);
+ }
address_get_personal (address, no, buf, sizeof (buf), &got);
if (got && !isgroup)
- printf (" personal <%s>\n", buf);
+ printf (" personal <%s>\n", buf);
address_get_comments (address, no, buf, sizeof (buf), &got);
if (got)
- printf (" comments <%s>\n", buf);
+ printf (" comments <%s>\n", buf);
address_get_local_part (address, no, buf, sizeof (buf), &got);
if (got)
- {
- printf (" local-part <%s>", buf);
+ {
+ printf (" local-part <%s>", buf);
- address_get_domain (address, no, buf, sizeof (buf), &got);
+ address_get_domain (address, no, buf, sizeof (buf), &got);
- if (got)
- printf (" domain <%s>", buf);
+ if (got)
+ printf (" domain <%s>", buf);
- printf ("\n");
- }
+ printf ("\n");
+ }
address_get_route (address, no, buf, sizeof (buf), &got);
if (got)
- printf (" route <%s>\n", buf);
+ printf (" route <%s>\n", buf);
}
address_destroy (&address);
@@ -132,13 +132,13 @@ main (int argc, const char *argv[])
for (; argv[argc]; argc++)
{
if (strcmp (argv[argc], "-") == 0)
- {
- parseinput ();
- }
+ {
+ parseinput ();
+ }
else
- {
- parse (argv[argc]);
- }
+ {
+ parse (argv[argc]);
+ }
}
return 0;
diff --git a/examples/mimetest.c b/examples/mimetest.c
index fba093ab7..9ff413973 100644
--- a/examples/mimetest.c
+++ b/examples/mimetest.c
@@ -68,13 +68,13 @@ main (int argc, char **argv)
for (i = 1; i < argc; i++)
{
if (strcmp (argv[i], "-d") == 0)
- debug = 1;
+ debug = 1;
else if (strcmp (argv[i], "-p") == 0)
- print_attachments = 1;
+ print_attachments = 1;
else if (strcmp (argv[i], "-i") == 0)
- indent_level = strtoul (argv[++i], NULL, 0);
+ indent_level = strtoul (argv[++i], NULL, 0);
else
- break;
+ break;
}
mailbox_name = argv[i];
@@ -122,32 +122,32 @@ main (int argc, char **argv)
size_t msize;
if ((ret = mailbox_get_message (mbox, i, &msg)) != 0)
- {
- fprintf (stderr, "mailbox_get_message - %s\n", mu_errstring (ret));
- exit (2);
- }
+ {
+ fprintf (stderr, "mailbox_get_message - %s\n", mu_errstring (ret));
+ exit (2);
+ }
if ((ret = message_size (msg, &msize)) != 0)
- {
- fprintf (stderr, "message_size - %s\n", mu_errstring (ret));
- exit (2);
- }
+ {
+ fprintf (stderr, "message_size - %s\n", mu_errstring (ret));
+ exit (2);
+ }
if ((ret = message_get_header (msg, &hdr)) != 0)
- {
- fprintf (stderr, "message_get_header - %s\n", mu_errstring (ret));
- exit (2);
- }
+ {
+ fprintf (stderr, "message_get_header - %s\n", mu_errstring (ret));
+ exit (2);
+ }
header_get_value (hdr, MU_HEADER_FROM, from, sizeof (from), NULL);
header_get_value (hdr, MU_HEADER_SUBJECT, subject, sizeof (subject),
- NULL);
+ NULL);
printf ("Message: %d\n", i);
printf ("From: %s\n", from);
printf ("Subject: %s\n", subject);
if ((ret = message_get_num_parts (msg, &nparts)) != 0)
- {
- fprintf (stderr, "message_get_num_parts - %s\n", mu_errstring (ret));
- exit (2);
- }
+ {
+ fprintf (stderr, "message_get_num_parts - %s\n", mu_errstring (ret));
+ exit (2);
+ }
printf ("Number of parts in message - %d\n", nparts);
printf ("Total message size - %d\n", msize);
message_display_parts (msg, 0);
@@ -186,98 +186,98 @@ message_display_parts (message_t msg, int indent)
for (j = 1; j <= nparts; j++)
{
if ((ret = message_get_part (msg, j, &part)) != 0)
- {
- fprintf (stderr, "mime_get_part - %s\n", mu_errstring (ret));
- exit (2);
- }
+ {
+ fprintf (stderr, "mime_get_part - %s\n", mu_errstring (ret));
+ exit (2);
+ }
if ((ret = message_size (part, &msize)) != 0)
- {
- fprintf (stderr, "message_size - %s\n", mu_errstring (ret));
- exit (2);
- }
+ {
+ fprintf (stderr, "message_size - %s\n", mu_errstring (ret));
+ exit (2);
+ }
if ((ret = message_get_header (part, &hdr)) != 0)
- {
- fprintf (stderr, "message_get_header - %s\n", mu_errstring (ret));
- exit (2);
- }
+ {
+ fprintf (stderr, "message_get_header - %s\n", mu_errstring (ret));
+ exit (2);
+ }
header_get_value (hdr, MU_HEADER_CONTENT_TYPE, type, sizeof (type),
- NULL);
+ NULL);
printf ("%*.*sType of part %d = %s\n", indent, indent, "", j, type);
printf ("%*.*sMessage part size - %d\n", indent, indent, "", msize);
encoding[0] = '\0';
header_get_value (hdr, MU_HEADER_CONTENT_TRANSFER_ENCODING, encoding,
- sizeof (encoding), NULL);
+ sizeof (encoding), NULL);
ismulti = 0;
if ((type[0]
- && strncasecmp (type, "message/rfc822", strlen (type)) == 0)
- || (message_is_multipart (part, &ismulti) == 0 && ismulti))
- {
- if (!ismulti)
- {
- ret = message_unencapsulate (part, &part, NULL);
- if (ret != 0)
- fprintf (stderr, "message_unencapsulate - %s\n",
- mu_errstring (ret));
- break;
- }
- if ((ret = message_get_header (part, &hdr)) != 0)
- {
- fprintf (stderr, "message_get_header - %s\n",
- mu_errstring (ret));
- exit (2);
- }
- header_get_value (hdr, MU_HEADER_FROM, from, sizeof (from), NULL);
- header_get_value (hdr, MU_HEADER_SUBJECT, subject, sizeof (subject),
- NULL);
- printf ("%*.*sEncapsulated message : %s\t%s\n",
- indent, indent, "", from, subject);
- printf ("%*.*sBegin\n", indent, indent, "");
- if ((ret = message_get_num_parts (part, &nsubparts)) != 0)
- {
- fprintf (stderr, "mime_get_num_parts - %s\n",
- mu_errstring (ret));
- exit (2);
- }
- message_display_parts (part, indent+indent_level);
- message_destroy (&part, NULL);
- }
+ && strncasecmp (type, "message/rfc822", strlen (type)) == 0)
+ || (message_is_multipart (part, &ismulti) == 0 && ismulti))
+ {
+ if (!ismulti)
+ {
+ ret = message_unencapsulate (part, &part, NULL);
+ if (ret != 0)
+ fprintf (stderr, "message_unencapsulate - %s\n",
+ mu_errstring (ret));
+ break;
+ }
+ if ((ret = message_get_header (part, &hdr)) != 0)
+ {
+ fprintf (stderr, "message_get_header - %s\n",
+ mu_errstring (ret));
+ exit (2);
+ }
+ header_get_value (hdr, MU_HEADER_FROM, from, sizeof (from), NULL);
+ header_get_value (hdr, MU_HEADER_SUBJECT, subject, sizeof (subject),
+ NULL);
+ printf ("%*.*sEncapsulated message : %s\t%s\n",
+ indent, indent, "", from, subject);
+ printf ("%*.*sBegin\n", indent, indent, "");
+ if ((ret = message_get_num_parts (part, &nsubparts)) != 0)
+ {
+ fprintf (stderr, "mime_get_num_parts - %s\n",
+ mu_errstring (ret));
+ exit (2);
+ }
+ message_display_parts (part, indent+indent_level);
+ message_destroy (&part, NULL);
+ }
else if (type[0] == '\0'
- || (strncasecmp (type, "text/plain", strlen ("text/plain")) ==
- 0)
- || (strncasecmp (type, "text/html", strlen ("text/html")) ==
- 0))
- {
- printf ("%*.*sText Message\n", indent, indent, "");
- printf ("%*.*sBegin\n", indent, indent, "");
- message_get_body (part, &body);
- body_get_stream (body, &str);
- filter_create (&str, str, encoding, 0, 0);
- offset = 0;
- while (stream_readline (str, buf, sizeof (buf), offset, &nbytes) ==
- 0 && nbytes)
- {
- printf ("%*.*s%s", indent, indent, "", buf);
- offset += nbytes;
- }
- stream_destroy (&str, NULL);
- }
+ || (strncasecmp (type, "text/plain", strlen ("text/plain")) ==
+ 0)
+ || (strncasecmp (type, "text/html", strlen ("text/html")) ==
+ 0))
+ {
+ printf ("%*.*sText Message\n", indent, indent, "");
+ printf ("%*.*sBegin\n", indent, indent, "");
+ message_get_body (part, &body);
+ body_get_stream (body, &str);
+ filter_create (&str, str, encoding, 0, 0);
+ offset = 0;
+ while (stream_readline (str, buf, sizeof (buf), offset, &nbytes) ==
+ 0 && nbytes)
+ {
+ printf ("%*.*s%s", indent, indent, "", buf);
+ offset += nbytes;
+ }
+ stream_destroy (&str, NULL);
+ }
else
- {
- /* Save the attachements. */
- char *fname = NULL;
- message_aget_attachment_name (part, &fname);
- if (fname == NULL)
- fname = mu_tempname (NULL);
+ {
+ /* Save the attachements. */
+ char *fname = NULL;
+ message_aget_attachment_name (part, &fname);
+ if (fname == NULL)
+ fname = mu_tempname (NULL);
- printf ("%*.*sAttachment - saving [%s]\n", indent, indent, "",
- fname);
- printf ("%*.*sBegin\n", indent, indent, "");
- /*FIXME: What is the 'data' argument for? */
- message_save_attachment (part, NULL, NULL);
- if (print_attachments)
- print_file (fname, indent);
- free (fname);
- }
+ printf ("%*.*sAttachment - saving [%s]\n", indent, indent, "",
+ fname);
+ printf ("%*.*sBegin\n", indent, indent, "");
+ /*FIXME: What is the 'data' argument for? */
+ message_save_attachment (part, NULL, NULL);
+ if (print_attachments)
+ print_file (fname, indent);
+ free (fname);
+ }
printf ("\n%*.*sEnd\n", indent, indent, "");
}
}
diff --git a/examples/msg-send.c b/examples/msg-send.c
index 92f3e0fe1..c0635f3e7 100644
--- a/examples/msg-send.c
+++ b/examples/msg-send.c
@@ -71,27 +71,27 @@ main (int argc, char *argv[])
while ((opt = getopt (argc, argv, "hdm:f:")) != -1)
{
switch (opt)
- {
- case 'h':
- printf ("%s\n%s", USAGE, HELP);
- return 0;
-
- case 'd':
- optdebug++;
- break;
-
- case 'm':
- optmailer = optarg;
- break;
-
- case 'f':
- optfrom = optarg;
- break;
-
- default:
- fprintf (stderr, "%s\n", USAGE);
- exit (1);
- }
+ {
+ case 'h':
+ printf ("%s\n%s", USAGE, HELP);
+ return 0;
+
+ case 'd':
+ optdebug++;
+ break;
+
+ case 'm':
+ optmailer = optarg;
+ break;
+
+ case 'f':
+ optfrom = optarg;
+ break;
+
+ default:
+ fprintf (stderr, "%s\n", USAGE);
+ exit (1);
+ }
}
/* Register mailers. */
diff --git a/examples/muemail.c b/examples/muemail.c
index 8e1bf2fb9..a7394b586 100644
--- a/examples/muemail.c
+++ b/examples/muemail.c
@@ -38,7 +38,7 @@ main (int argc, char *argv[])
else
{
for (; argv[arg]; arg++)
- printf ("%s -> %s\n", argv[arg], mu_get_user_email (argv[arg]));
+ printf ("%s -> %s\n", argv[arg], mu_get_user_email (argv[arg]));
}
return 0;
diff --git a/examples/sfrom.c b/examples/sfrom.c
index 56795d4b9..f7a7f8494 100644
--- a/examples/sfrom.c
+++ b/examples/sfrom.c
@@ -64,18 +64,18 @@ main (int argc, const char **argv)
header_t hdr;
if ((status = mailbox_get_message (mbox, msgno, &msg)) != 0
- || (status = message_get_header (msg, &hdr)) != 0)
- {
- fprintf (stderr, "Error message: %s\n",
- mu_errstring (status));
- exit (EXIT_FAILURE);
- }
+ || (status = message_get_header (msg, &hdr)) != 0)
+ {
+ fprintf (stderr, "Error message: %s\n",
+ mu_errstring (status));
+ exit (EXIT_FAILURE);
+ }
if (header_aget_value (hdr, MU_HEADER_FROM, &from))
- from = strdup ("(NO FROM)");
+ from = strdup ("(NO FROM)");
if (header_aget_value (hdr, MU_HEADER_SUBJECT, &subject))
- subject = strdup("(NO SUBJECT)");
+ subject = strdup("(NO SUBJECT)");
printf ("%s\t%s\n", from, subject);
free (from);
diff --git a/examples/url-parse.c b/examples/url-parse.c
index 7c6b1c856..528df09ad 100644
--- a/examples/url-parse.c
+++ b/examples/url-parse.c
@@ -33,46 +33,46 @@ main ()
{
int rc;
- str[strlen (str) - 1] = '\0'; /* chop newline */
+ str[strlen (str) - 1] = '\0'; /* chop newline */
if (strspn (str, " \t") == strlen (str))
- continue; /* skip empty lines */
+ continue; /* skip empty lines */
if ((rc = url_create (&u, str)) != 0)
- {
- fprintf (stderr, "url_create %s ERROR: [%d] %s",
- str, rc, mu_errstring (rc));
- exit (1);
- }
+ {
+ fprintf (stderr, "url_create %s ERROR: [%d] %s",
+ str, rc, mu_errstring (rc));
+ exit (1);
+ }
if ((rc = url_parse (u)) != 0)
- {
- printf ("%s => FAILED: [%d] %s\n",
- str, rc, mu_errstring (rc));
- continue;
- }
+ {
+ printf ("%s => FAILED: [%d] %s\n",
+ str, rc, mu_errstring (rc));
+ continue;
+ }
printf ("%s => SUCCESS\n", str);
url_get_scheme (u, buffer, len, NULL);
- printf (" scheme <%s>\n", buffer);
+ printf (" scheme <%s>\n", buffer);
url_get_user (u, buffer, len, NULL);
- printf (" user <%s>\n", buffer);
+ printf (" user <%s>\n", buffer);
url_get_passwd (u, buffer, len, NULL);
- printf (" passwd <%s>\n", buffer);
+ printf (" passwd <%s>\n", buffer);
url_get_auth (u, buffer, len, NULL);
- printf (" auth <%s>\n", buffer);
+ printf (" auth <%s>\n", buffer);
url_get_host (u, buffer, len, NULL);
- printf (" host <%s>\n", buffer);
+ printf (" host <%s>\n", buffer);
url_get_port (u, &port);
- printf (" port %ld\n", port);
+ printf (" port %ld\n", port);
url_get_path (u, buffer, len, NULL);
- printf (" path <%s>\n", buffer);
+ printf (" path <%s>\n", buffer);
url_get_query (u, buffer, len, NULL);
- printf (" query <%s>\n", buffer);
+ printf (" query <%s>\n", buffer);
url_destroy (&u);

Return to:

Send suggestions and report system problems to the System administrator.