version 1.1, 2007/03/23 01:47:11 |
version 1.2, 2007/03/23 02:11:00 |
|
|
int |
int |
main(int argc, char *argv[]) |
main(int argc, char *argv[]) |
{ |
{ |
struct stat sb; |
|
FILE *fp; |
|
const char *editor, *tmpdir; |
const char *editor, *tmpdir; |
char *tmppath = NULL; |
char *tmppath = NULL; |
time_t mtime; |
|
int c, fd, ret = 1; |
int c, fd, ret = 1; |
|
struct stat sb; |
|
time_t mtime; |
|
FILE *fp; |
|
|
if ((tmpdir = getenv("TMPDIR")) == NULL || tmpdir[0] == '\0') |
if ((tmpdir = getenv("TMPDIR")) == NULL || tmpdir[0] == '\0') |
tmpdir = _PATH_TMP; |
tmpdir = _PATH_TMP; |
|
|
warn("fork"); |
warn("fork"); |
goto cleanup; |
goto cleanup; |
case 0: |
case 0: |
execlp(editor, editor, tmppath, NULL); |
execlp(editor, editor, tmppath, (void *)NULL); |
err(1, "execlp"); |
err(1, "execlp"); |
default: |
default: |
wait(NULL); |
wait(NULL); |
|
|
} |
} |
close(filedes[0]); |
close(filedes[0]); |
execl("/usr/sbin/sendmail", "sendmail", |
execl("/usr/sbin/sendmail", "sendmail", |
"-oi", "-t", NULL); |
"-oi", "-t", (void *)NULL); |
warn("sendmail error: unsent report in %s", |
warn("sendmail error: unsent report in %s", |
tmppath); |
tmppath); |
return (-1); |
return (-1); |
|
|
int |
int |
send_file(const char *file, int dst) |
send_file(const char *file, int dst) |
{ |
{ |
FILE *fp; |
|
char *buf; |
|
size_t len; |
|
int blank = 0; |
int blank = 0; |
|
size_t len; |
|
char *buf; |
|
FILE *fp; |
|
|
if ((fp = fopen(file, "r")) == NULL) |
if ((fp = fopen(file, "r")) == NULL) |
return (-1); |
return (-1); |