/* Program:			DUMPMAIL											*/
/* Author:			Brian Dorricott										*/
/* Date:			11th January 1996									*/
/* Copyright:		(C)opyright 1996, Internet Shopper Ltd				*/


#include <stdio.h>
#include <winsock.h>
#include <windows.h>


#define MAX_LINE			16384

main(int argc, char *argv[])
{
    FILE *f;
	char line[MAX_LINE];
	int  done = FALSE;

	if (argc == 2)
	{
		f = fopen(argv[1], "w");

		while (!done)
		{
			fgets(line, MAX_LINE, stdin);
			while (*(line+strlen(line)-1) == '\r' || *(line+strlen(line)-1) == '\n')
				*(line+strlen(line)-1) = '\0';

			if (strcmp(line, ".") == 0)
				done = TRUE;
			if (f != NULL && !done)
				fprintf(f, "%s\n", line);
		}
		if (f != NULL)
			fclose(f);
	}
	    
    return 0;
}
