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
93ee46dd
...
93ee46dd389d2b1f2a1f32a6914efce1e0f20416
authored
2001-10-19 20:20:22 +0000
by
Sergey Poznyakoff
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
New functions mh_audit_open(), mh_audit_close().
1 parent
6f3ab756
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
0 deletions
mh/mh_init.c
mh/mh_init.c
View file @
93ee46d
...
...
@@ -321,3 +321,54 @@ mh_getyn (const char *fmt, ...)
}
return
0
;
/* to pacify gcc */
}
FILE
*
mh_audit_open
(
char
*
name
,
mailbox_t
mbox
)
{
FILE
*
fp
;
char
date
[
64
];
time_t
t
;
struct
tm
*
tm
;
url_t
url
;
char
*
namep
;
namep
=
mu_tilde_expansion
(
name
,
"/"
,
NULL
);
if
(
strchr
(
namep
,
'/'
)
==
NULL
)
{
char
*
p
=
NULL
;
asprintf
(
&
p
,
"%s/Mail/%s"
,
mu_get_homedir
(),
namep
);
if
(
!
p
)
{
mh_error
(
"low memory"
);
exit
(
1
);
}
free
(
namep
);
namep
=
p
;
}
fp
=
fopen
(
namep
,
"a"
);
if
(
!
fp
)
{
mh_error
(
"Can't open audit file %s: %s"
,
namep
,
strerror
(
errno
));
free
(
namep
);
return
NULL
;
}
free
(
namep
);
time
(
&
t
);
tm
=
localtime
(
&
t
);
strftime
(
date
,
sizeof
date
,
"%a, %d %b %Y %H:%M:%S %Z"
,
tm
);
mailbox_get_url
(
mbox
,
&
url
);
fprintf
(
fp
,
"<<%s>> %s %s
\n
"
,
program_invocation_short_name
,
date
,
url_to_string
(
url
));
return
fp
;
}
void
mh_audit_close
(
FILE
*
fp
)
{
fclose
(
fp
);
}
...
...
Please
register
or
sign in
to post a comment