Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
mailutils
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
d52743d3
...
d52743d3f4fddafd69cb92757b3e01553f8a8c3e
authored
2001-04-10 05:17:26 +0000
by
Alain Magloire
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
New example from Sam Roberts.
1 parent
bc3a57b1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
42 deletions
examples/Makefile
examples/addr.c
examples/Makefile
View file @
d52743d
...
...
@@ -2,11 +2,11 @@ CFLAGS = -Wall -pedantic -g
INCLUDES
=
-I../libmailbox
LIBS
=
../libmailbox/.libs/libmailbox.al
from
:
from.c $(LIBS)
gcc
$(CFLAGS)
$(INCLUDES)
-o from from.c
$(LIBS)
showmail
:
showmail.c $(LIBS)
gcc
$(CFLAGS)
$(INCLUDES)
-o showmail showmail.c
$(LIBS)
$(CC)
$(CFLAGS)
$(INCLUDES)
-o showmail showmail.c
$(LIBS)
addr
:
addr.c $(LIBS)
$(CC)
$(CFLAGS)
$(INCLUDES)
-o addr addr.c
$(LIBS)
clean
:
rm -f
from
showmail
rm -f
addr
showmail
...
...
examples/addr.c
View file @
d52743d
#include <stdio.h>
#include <mailutils/address.h>
static
int
use_zero
=
1
;
static
int
parse
(
const
char
*
str
)
{
size_t
no
=
0
;
size_t
pcount
;
char
buf
[
BUFSIZ
];
char
buf
[
BUFSIZ
];
address_t
address
=
NULL
;
address_t
address
=
NULL
;
if
(
use_zero
)
address_create0
(
&
address
,
str
);
else
address_create
(
&
address
,
str
);
address_create
(
&
address
,
str
);
address_get_count
(
address
,
&
pcount
);
address_get_count
(
address
,
&
pcount
);
printf
(
"%s=> pcount %d
\n
"
,
str
,
pcount
);
printf
(
"%s=> pcount %d
\n
"
,
str
,
pcount
);
for
(
no
=
1
;
no
<=
pcount
;
no
++
)
{
size_t
got
=
0
;
printf
(
"%d "
,
no
);
for
(
no
=
1
;
no
<=
pcount
;
no
++
)
{
size_t
got
=
0
;
printf
(
"%d "
,
no
);
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
);
address_get_personal
(
address
,
no
,
buf
,
sizeof
(
buf
),
&
got
);
if
(
got
)
printf
(
" personal <%s>
\n
"
,
buf
);
if
(
got
)
printf
(
" personal <%s>
\n
"
,
buf
);
address_get_comments
(
address
,
no
,
buf
,
sizeof
(
buf
),
&
got
);
address_get_comments
(
address
,
no
,
buf
,
sizeof
(
buf
),
&
got
);
if
(
got
)
printf
(
" comments <%s>
\n
"
,
buf
);
if
(
got
)
printf
(
" comments <%s>
\n
"
,
buf
);
address_get_local_part
(
address
,
no
,
buf
,
sizeof
(
buf
),
&
got
);
address_get_local_part
(
address
,
no
,
buf
,
sizeof
(
buf
),
&
got
);
if
(
got
)
printf
(
" local-part <%s>"
,
buf
);
if
(
got
)
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>
\n
"
,
buf
);
if
(
got
)
printf
(
" domain <%s>
\n
"
,
buf
);
address_get_route
(
address
,
no
,
buf
,
sizeof
(
buf
),
&
got
);
address_get_route
(
address
,
no
,
buf
,
sizeof
(
buf
),
&
got
);
if
(
got
)
printf
(
" route <%s>
\n
"
,
buf
);
}
address_destroy
(
&
address
);
if
(
got
)
printf
(
" route <%s>
\n
"
,
buf
);
}
address_destroy
(
&
address
);
printf
(
"
\n
"
);
printf
(
"
\n
"
);
return
0
;
return
0
;
}
static
int
parseinput
(
void
)
...
...
@@ -72,14 +67,6 @@ int main(int argc, const char *argv[])
{
argc
=
1
;
if
(
argv
[
argc
]
&&
strcmp
(
argv
[
argc
],
"-1"
)
==
0
)
{
use_zero
=
0
;
argc
++
;
}
if
(
argv
[
argc
]
&&
strcmp
(
argv
[
argc
],
"-0"
)
==
0
)
{
use_zero
=
1
;
argc
++
;
}
if
(
!
argv
[
argc
])
{
return
parseinput
();
}
...
...
Please
register
or
sign in
to post a comment