import java.io.*;

/**
 * This class takes a parameter on the command line, and prints the file
 * given to standard out.  If con is taken as the parameter, it duplicates
 * standard input.
 * This also demonstrates the use of BufferedReaders and System.in
 * Press Ctl-Z to send it the end of file marker and terminate the program.
 **/

public class cat2 {

    public static void main(String[] args) {

	// read from the standard input stream, System.in

	if (args[0].equals("con")) {

	    BufferedReader reader;
	    reader = new BufferedReader(new InputStreamReader(System.in));

	    String line = null;

	    try {

			while ((line = reader.readLine())!= null) {
			    System.out.println(line);
			}

	    } catch (IOException ioe) { ioe.printStackTrace(); }
	}

	else {
	    System.out.println("Usage: java cat2 con");
	    System.exit(0);
	}

    }
}

