#include <stdio.h>

main (int argc, char *argv[])
{
	char buf[256];
	FILE *infp, *outfp;

	if (argc < 3)
	{
		fprintf(stderr, "Usage: <input> <output>\n");
		exit(0);
	}

	if ((infp = fopen(argv[1], "r+")) == NULL)
	{
		fprintf(stderr, "Unable to open input file %s\n",argv[1]);
		exit(1);
	}

	if ((outfp = fopen(argv[2], "w")) == NULL)
	{
		fprintf(stderr, "Unable to open output file %s\n",argv[2]);
		exit(1);
	}

	while (fgets(buf, 255, infp) != NULL)
	{
		fputs(buf, outfp);
	}

	fseek(infp, 0L, SEEK_SET);
	fputs("DONE", infp);
	fclose(infp);
	fclose(outfp);
	exit(0);
}
