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
4588f3b3
...
4588f3b378234e4af5a418bb7fe75c7c77a5c362
authored
2000-05-20 01:09:54 +0000
by
Sean 'Shaleh' Perry
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fleshed out mh_open() some more
1 parent
38716599
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
7 deletions
ChangeLog
libmailbox/maildir.c
libmailbox/mh.c
ChangeLog
View file @
4588f3b
2000--5-19 Sean 'Shaleh' Perry <shaleh@debian.org>
* libmailbox/mh.c: fleshed out mh_open() some more
2000-05-18 Sean 'Shaleh' Perry <shaleh@debian.org>
* libmailbox/mh.c: fleshed out mh_open() some more
...
...
libmailbox/maildir.c
View file @
4588f3b
...
...
@@ -49,7 +49,7 @@ maildir_open (mailbox * mbox)
alloced
=
10
;
/* process the new directory */
while
(
(
entry
=
readdir
(
data
->
new
))
&&
(
entry
!=
NULL
))
while
(
entry
=
readdir
(
data
->
new
))
{
/* no dot files */
if
(
entry
->
d_name
[
0
]
!=
'.'
)
...
...
@@ -71,7 +71,7 @@ maildir_open (mailbox * mbox)
}
/* then the cur directory */
while
(
(
entry
=
readdir
(
data
->
cur
))
&&
(
entry
!=
NULL
))
while
(
entry
=
readdir
(
data
->
cur
))
{
if
(
entry
->
d_name
[
0
]
!=
'.'
)
{
...
...
libmailbox/mh.c
View file @
4588f3b
...
...
@@ -28,6 +28,7 @@ int
mh_open
(
mailbox
*
mbox
)
{
int
i
;
unsigned
long
seq_num
=
0
;
struct
dirent
*
entry
;
mh_data
*
data
;
...
...
@@ -42,9 +43,10 @@ mh_open (mailbox * mbox)
/* process directory */
while
(
entry
=
readdir
(
data
->
dir
))
{
unsigned
long
seq_num
;
char
*
foo
=
NULL
;
char
fname
[
PATH_MAX
];
char
line
[
80
];
FILE
*
fp
;
if
(
entry
->
d_name
[
0
]
==
'.'
)
{
if
(
strcmp
(
entry
->
d_name
,
".mh_sequences"
)
==
0
)
...
...
@@ -58,10 +60,26 @@ mh_open (mailbox * mbox)
seq_num
=
strtoul
(
entry
->
d_name
,
&
foo
,
10
);
if
(
*
foo
!=
'\0'
)
/* invalid sequence number */
continue
;
/* TODO: handle this better? */
printf
(
"message: %ld
\r
"
,
seq_num
);
sprintf
(
fname
,
"%s/%ld"
,
mbox
->
name
,
seq_num
);
if
((
fp
=
fopen
(
fname
,
"r"
))
==
NULL
)
continue
;
/* TODO: handle the error */
/* TODO: handle corrupt files */
while
(
fgets
(
line
,
80
,
fp
))
{
if
((
line
[
0
]
==
'\r'
&&
line
[
1
]
==
'\n'
)
||
line
[
0
]
==
'\n'
)
{
/* TODO: handle marking the message body */
;
break
;
}
}
fclose
(
fp
);
/* TODO: create message structure */
mbox
->
messages
++
;
}
/* store next sequence number to use */
data
->
sequence
=
seq_num
+
1
;
mbox
->
_data
=
data
;
#if 0
mbox->_close = mh_close;
...
...
@@ -74,9 +92,6 @@ mh_open (mailbox * mbox)
mbox->_get_body = mh_get_body;
mbox->_get_header = mh_get_header;
#endif
chdir
(
old_dir
);
fprintf
(
stderr
,
"
\r\n
%d messages read
\n
"
,
mbox
->
messages
);
return
0
;
}
...
...
Please
register
or
sign in
to post a comment