/* $Header:cat.c 12.0$ */
/* $ACIS:cat.c 12.0$ */
/* $Source: /ibm/acis/usr/sys/standca/RCS/cat.c,v $ */

#ifndef lint
static char *rcsid = "$Header:cat.c 12.0$";
#endif

/*
 * 5799-WZQ (C) COPYRIGHT IBM CORPORATION 1986,1988
 * LICENSED MATERIALS - PROPERTY OF IBM
 * REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083
 */

/*		cat.c	6.1	83/07/29		*/

main()
{
	int i;
	char buf[50];

	for (;;)
	{
		printf("File: ");
		gets(buf);
		if (buf[0] == 0)
			break;
		i = open(buf, 0);
		if (i < 0)
			perror("cat");
		else
			{
			docat(i);
			close(i);
			}
	}

}

docat(i)
{
	register int c;
	while ((c = getc(i)) > 0)
		putchar(c);
}
