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
6c0e046b
...
6c0e046b7b988a285d623e9e776fdc683f1e9736
authored
2002-02-07 07:58:22 +0000
by
Sergey Poznyakoff
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
(main): Fixed 'No mail for...' reporting.
1 parent
633db76d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
16 deletions
mail/mail.c
mail/mail.c
View file @
6c0e046
...
...
@@ -171,7 +171,8 @@ main (int argc, char **argv)
struct
mail_env_entry
*
mode
=
NULL
,
*
prompt
=
NULL
;
size_t
modelen
=
0
;
struct
arguments
args
;
int
rc
;
ofile
=
stdout
;
cursor
=
1
;
realcursor
=
cursor
;
...
...
@@ -353,29 +354,42 @@ main (int argc, char **argv)
mu_debug_set_level
(
debug
,
MU_DEBUG_TRACE
|
MU_DEBUG_PROT
);
}
if
(
mailbox_open
(
mbox
,
MU_STREAM_RDWR
)
!=
0
)
if
(
(
rc
=
mailbox_open
(
mbox
,
MU_STREAM_RDWR
))
!=
0
&&
rc
!=
ENOENT
)
{
util_error
(
"Can not open mailbox"
);
url_t
url
=
NULL
;
mailbox_get_url
(
mbox
,
&
url
);
util_error
(
"Can not open mailbox %s: %s"
,
url_to_string
(
url
),
strerror
(
rc
));
exit
(
EXIT_FAILURE
);
}
if
(
mailbox_scan
(
mbox
,
1
,
&
total
)
!=
0
)
if
(
rc
)
total
=
0
;
else
{
util_error
(
"Can not read mailbox"
);
exit
(
EXIT_FAILURE
);
}
if
(
strlen
(
"exist"
)
==
modelen
&&
!
strcmp
(
"exist"
,
mode
->
value
))
return
(
total
<
1
)
?
1
:
0
;
else
if
(
strlen
(
"print"
)
==
modelen
&&
!
strcmp
(
"print"
,
mode
->
value
))
return
util_do_command
(
"print *"
);
else
if
(
strlen
(
"headers"
)
==
modelen
&&
!
strcmp
(
"headers"
,
mode
->
value
))
return
util_do_command
(
"from *"
);
if
(
mailbox_scan
(
mbox
,
1
,
&
total
)
!=
0
)
{
util_error
(
"Can not read mailbox"
);
exit
(
EXIT_FAILURE
);
}
if
(
strlen
(
"exist"
)
==
modelen
&&
!
strcmp
(
"exist"
,
mode
->
value
))
return
(
total
<
1
)
?
1
:
0
;
else
if
(
strlen
(
"print"
)
==
modelen
&&
!
strcmp
(
"print"
,
mode
->
value
))
return
util_do_command
(
"print *"
);
else
if
(
strlen
(
"headers"
)
==
modelen
&&
!
strcmp
(
"headers"
,
mode
->
value
))
return
util_do_command
(
"from *"
);
}
if
(
total
==
0
)
{
fprintf
(
ofile
,
"No mail for %s
\n
"
,
mail_whoami
());
if
(
args
.
file
)
fprintf
(
ofile
,
"%s: 0 messages
\n
"
,
args
.
file
);
else
fprintf
(
ofile
,
"No mail for %s
\n
"
,
args
.
user
?
args
.
user
:
mail_whoami
());
return
1
;
}
...
...
Please
register
or
sign in
to post a comment