[DGD]Sending emails through DGD?
Erwin Harte
harte at xs4all.nl
Tue May 1 03:52:09 CEST 2001
On Mon, Apr 30, 2001 at 07:38:45PM -0500, Lord Lerkista wrote:
> > * Write a kfun that does it. Ick.
> >
>
> i put this in dgd/src/kfun/extra.c
>
> ----------CUT HERE-------
>
> # ifdef FUNCDEF
> FUNCDEF("sendmail", kf_sendmail, pt_sendmail)
> # else
> char pt_sendmail[] = { C_TYPECHECKED | C_STATIC, T_VOID, 3, T_STRING,
> T_STRING, T_STRING };
>
> int kf_sendmail(f)
> register frame *f;
> {
> FILE *fd;
> char *command;
> command = malloc(128);
> sprintf(command,"mail -s \"%s\" %s <%s",
If you MUST, please use snprintf() instead:
# define COMMAND_SIZE 128
command = malloc(COMMAND_SIZE);
if (snprintf(command, COMMAND_SIZE, "...", ...) == -1) {
... buffer wasn't big enough, deal with that ...
}
>
> f->sp[2].u.string->text,f->sp[1].u.string->text,f->sp[0].u.string->text);
> system(command);
> str_del((f->sp++)->u.string);
> str_del((f->sp++)->u.string);
> free(command);
> return 0;
> }
> #endif
Erwin.
--
Erwin Harte
harte at xs4all.nl
List config page: http://list.imaginary.com/mailman/listinfo/dgd
More information about the DGD
mailing list