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
e7562048
...
e75620481f3cb5d2a77b6f3d75fdbea2902a0410
authored
1999-10-01 08:22:06 +0000
by
Sean 'Shaleh' Perry
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
added examples dir and an example
1 parent
7a2b08e6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
1 deletions
ChangeLog
examples/from.c
ChangeLog
View file @
e756204
Fri Oct 1 01:00:00 1999 Sean 'Shaleh' Perry <shaleh@debian.org>
* added and examples directory and the first example, from.c
Fri Oct 1 03:17:28 1999 Jakob 'sparky' Kaivo <jkaivo@gnu.org>
* libmailbox/*.[ch]: added cleanup patches from Shaleh while he works
...
...
@@ -93,4 +97,4 @@ Fri Oct 1 03:17:28 1999 Jakob 'sparky' Kaivo <jkaivo@gnu.org>
\ No newline at end of file
...
...
examples/from.c
0 → 100644
View file @
e756204
/**
* Code in the public domain, Sean 'Shaleh' Perry <shaleh@debian.org>, 1999
*
* Created as an example of using libmailbox
*
**/
#include <mailbox.h>
#include <paths.h>
#include <stdio.h>
int
main
(
int
argc
,
char
*
argv
[])
{
mailbox
*
mail
;
unsigned
int
i
;
char
*
header
,
*
from
,
*
date
;
char
*
user
;
char
mailpath
[
256
];
user
=
getenv
(
"USER"
);
if
(
user
==
NULL
)
{
fprintf
(
stderr
,
"who am I?
\n
"
);
exit
(
-
1
);
}
snprintf
(
mailpath
,
256
,
"%s/%s"
,
_PATH_MAILDIR
,
user
);
mail
=
mbox_open
(
mailpath
);
if
(
mail
==
NULL
)
{
perror
(
"mbox_open: "
);
exit
(
-
1
);
}
for
(
i
=
0
;
i
<
mail
->
messages
;
++
i
)
{
header
=
mbox_get_header
(
mail
,
i
);
if
(
header
==
NULL
)
{
perror
(
"mbox_get_header: "
);
exit
(
-
1
);
}
from
=
mbox_header_line
(
mail
,
i
,
"From"
);
if
(
from
==
NULL
)
{
perror
(
"mbox_header_line: "
);
exit
(
-
1
);
}
date
=
mbox_header_line
(
mail
,
i
,
"Date"
);
if
(
date
==
NULL
)
{
perror
(
"mbox_header_line: "
);
exit
(
-
1
);
}
printf
(
"%s %s
\n
"
,
from
,
date
);
free
(
header
);
free
(
from
);
free
(
date
);
}
mbox_close
(
mail
);
exit
(
0
);
}
Please
register
or
sign in
to post a comment