
/*
 * Replace this with your own version or a real sendmail if
 * available
 *
 * This program will be called as \'ups-sendmail <parameters>\'
 * and it will get the mail from stdin.
 */

#include <stdio.h>
#include <stdlib.h>

#ifndef BUFSIZ
#define BUFSIZ 256
#endif

int main(int argc, char *argv[])
{
    char buf[BUFSIZ];
    FILE *out;
    int l;

    if(argc < 2)
	exit(1);
    out = fopen("con:10/10/600/200/UPS-Sendmail/AUTO/WAIT/CLOSE/INACTIVE", "w");
    if(!out)
	exit(1);

    fprintf(out, "Mail arrived (");
    for(l=1; l<argc; l++)
	fprintf(out, "%s ", argv[l]);
    fprintf(out,")\n\n");

    while(l = fread(buf, sizeof(char), BUFSIZ, stdin))
    {
	fwrite(buf, sizeof(char), l, out);
    }
    fclose(out);

    
}
