C/C++ Arena

Step 6 of 6

Challenge: a real command-line tool

Command-line tools follow conventions that scripts and other programs rely on:

Your turn: write lines FILE..., a tool that prints COUNT NAME for each file and a final COUNT total line. A file that can't be opened prints lines: cannot open NAME to stderr, is skipped, and makes the program exit with code 1 at the end (after the total). With no arguments at all, print usage: lines FILE... to stderr and exit with code 2.

Previous: Command-line arguments