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
f56551c4
...
f56551c48de5e09bf94a70de8e661d9ce6fdb556
authored
2001-06-25 08:20:13 +0000
by
Sergey Poznyakoff
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Split off mail_send0(). It is used by mail_send() and mail_reply().
1 parent
e72ba028
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
18 deletions
mail/send.c
mail/send.c
View file @
f56551c
...
...
@@ -32,6 +32,40 @@ int
mail_send
(
int
argc
,
char
**
argv
)
{
char
*
to
=
NULL
,
*
cc
=
NULL
,
*
bcc
=
NULL
,
*
subj
=
NULL
;
if
(
argc
<
2
)
to
=
readline
(
"To: "
);
else
{
while
(
--
argc
)
{
char
*
p
=
alias_expand
(
*++
argv
);
if
(
to
)
util_strcat
(
&
to
,
","
);
util_strcat
(
&
to
,
p
);
free
(
p
);
}
}
if
((
util_find_env
(
"askcc"
))
->
set
)
cc
=
readline
(
"Cc: "
);
if
((
util_find_env
(
"askbcc"
))
->
set
)
bcc
=
readline
(
"Bcc: "
);
if
((
util_find_env
(
"asksub"
))
->
set
)
subj
=
readline
(
"Subject: "
);
else
subj
=
(
util_find_env
(
"subject"
))
->
value
;
return
mail_send0
(
to
,
cc
,
bcc
,
subj
);
}
/* Shared between mail_send() and mail_reply();
NOTE: arguments should be allocated dynamically. They will be freed
before exit */
int
mail_send0
(
char
*
to
,
char
*
cc
,
char
*
bcc
,
char
*
subj
)
{
char
*
buf
=
NULL
;
size_t
n
=
0
;
int
done
=
0
;
...
...
@@ -40,7 +74,7 @@ mail_send (int argc, char **argv)
FILE
*
file
;
const
char
*
tmpdir
;
/* We have to be extra careful
l
about opening temporary files, since we
/* We have to be extra careful about opening temporary files, since we
may be running with extra privilege i.e setgid(). */
tmpdir
=
(
getenv
(
"TMPDIR"
))
?
getenv
(
"TMPDIR"
)
:
"/tmp"
;
filename
=
alloca
(
strlen
(
tmpdir
)
+
/*'/'*/
1
+
/* "muXXXXXX" */
8
+
1
);
...
...
@@ -62,23 +96,6 @@ mail_send (int argc, char **argv)
file
=
fdopen
(
fd
,
"w"
);
if
(
argc
<
2
)
to
=
readline
(
"To: "
);
else
{
/* figure it out from argv */
}
if
((
util_find_env
(
"askcc"
))
->
set
)
cc
=
readline
(
"Cc: "
);
if
((
util_find_env
(
"askbcc"
))
->
set
)
bcc
=
readline
(
"Bcc: "
);
if
((
util_find_env
(
"asksub"
))
->
set
)
subj
=
readline
(
"Subject: "
);
else
subj
=
(
util_find_env
(
"subject"
))
->
value
;
while
(
getline
(
&
buf
,
&
n
,
stdin
)
>=
0
&&
!
done
)
{
if
(
buf
[
0
]
==
(
util_find_env
(
"escape"
))
->
value
[
0
])
...
...
Please
register
or
sign in
to post a comment