find out if there are command line arguments if no: do stdin to cout if yes: parse them and set appropriate vars if use_files is set: then files will begin with the first argument on the command line that does not begin with a dash else: print from stdin to whatever other (if any) opts indicate ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ N.B. The code doesn't look much like this anymore; but I'm not sure with such a small project it's at all worth while updating this. find out if there are command-line arguments if yes: find out if any of them are filenames if yes: set input_type to file record how many files there are, and what their names are if not: set input_type to stdin record such appropriate option values as the others (which will be flags) indicate if no: set input_type to stdin look at input type: if stdin: process stdin for printing if file: print each file (seperated by cntrl-D's unless specified otherwise)