#!/usr/bin/env python


# Skeleton code for assignment 5. Copies the input file to
# the output file 

import getopt, sys, os, string, math, random 



def usage():
        print """
Usage: summarize
        -i, --input Input file -o --output Output file -p --prefix prefix 
"""


def main():
    
    try:
        opts, args = getopt.getopt(sys.argv[1:], "i:o:p:",
                                   ["input","output","prefix"])
    except getopt.GetoptError:
        usage()
        return 2
    
    ifname = "data.txt"
    ofname = "output.txt"
    prefix = ""

    for (o,a) in opts:
        if o in ("-i", "--input"):
            ifname = a
        if o in ("-o", "--output"):
            ofname = a
        if o in ("-p", "--prefix"):
	    prefix = a
	
    try:
        ifp = open(ifname,"r")
        ofp = open(ofname, "w")
    except IOError,(errno, strerror):
        print "I/O Error(%s): %s" % (errno, strerror)
        print "Tried input filename: %s" % ifname
        print "Tried output filename: %s" % ifname 
        return 2

    ilines = ifp.readlines()

    # your code goes here



    
    ofp.writelines(ilines)    
    print "Copied %s" % ifname
    print " into %s"    % ofname


if __name__ == "__main__":
        sys.exit(main())
