summaryrefslogtreecommitdiff
path: root/examples/addr.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2007-06-24 12:23:57 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2007-06-24 12:23:57 +0000
commit81dca07b3d80f65dbb635a908f51020942265e73 (patch)
tree1edb0c0449b608806faa6f08a0daf4122d275c9c /examples/addr.c
parentc42264867705eb9672d715768de85ced889e2f42 (diff)
downloadmailutils-81dca07b3d80f65dbb635a908f51020942265e73.tar.gz
mailutils-81dca07b3d80f65dbb635a908f51020942265e73.tar.bz2
Use mu_address_sget functions, where possible.
Diffstat (limited to 'examples/addr.c')
-rw-r--r--examples/addr.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/examples/addr.c b/examples/addr.c
index 48525c6f9..fd53475b6 100644
--- a/examples/addr.c
+++ b/examples/addr.c
@@ -1,5 +1,6 @@
/* GNU Mailutils -- a suite of utilities for electronic mail
- Copyright (C) 1999, 2000, 2001, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2001, 2004, 2005,
+ 2007 Free Software Foundation, Inc.
GNU Mailutils is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -32,7 +33,7 @@ parse (const char *str)
size_t no = 0;
size_t pcount = 0;
int status;
- char buf[BUFSIZ];
+ const char *buf;
mu_address_t address = NULL;
mu_set_user_email_domain ("localhost");
@@ -59,37 +60,32 @@ parse (const char *str)
if (isgroup)
{
- mu_address_get_personal (address, no, buf, sizeof (buf), &got);
+ mu_address_sget_personal (address, no, &buf);
printf ("group <%s>\n", buf);
}
else
{
- mu_address_get_email (address, no, buf, sizeof (buf), 0);
+ mu_address_sget_email (address, no, &buf);
printf ("email <%s>\n", buf);
}
- mu_address_get_personal (address, no, buf, sizeof (buf), &got);
- if (got && !isgroup)
+ if (mu_address_sget_personal (address, no, &buf) == 0 && buf && !isgroup)
printf (" personal <%s>\n", buf);
- mu_address_get_comments (address, no, buf, sizeof (buf), &got);
- if (got)
+ if (mu_address_sget_comments (address, no, &buf) == 0 && buf)
printf (" comments <%s>\n", buf);
- mu_address_get_local_part (address, no, buf, sizeof (buf), &got);
- if (got)
+ if (mu_address_sget_local_part (address, no, &buf) == 0 && buf)
{
printf (" local-part <%s>", buf);
- mu_address_get_domain (address, no, buf, sizeof (buf), &got);
- if (got)
+ if (mu_address_sget_domain (address, no, &buf) == 0 && buf)
printf (" domain <%s>", buf);
printf ("\n");
}
- mu_address_get_route (address, no, buf, sizeof (buf), &got);
- if (got)
+ if (mu_address_sget_route (address, no, &buf) == 0 && buf)
printf (" route <%s>\n", buf);
}
mu_address_destroy (&address);

Return to:

Send suggestions and report system problems to the System administrator.