The change to the option processing is almost trivial. We added N: to the list of options processed by getopt() and we added a case statement for the -N option. The only funny thing we do is calculate the number of digits that the number of counters will require. This is done by calling sprintf() to generate a string with the maximum value, and by using the return value as the count of the number of digits. We need to know the size because we'll be using it to match the filenames that come in on the io_open(), and to generate the directory entries.
Finally, we initialize the attributes structure in the option processor (instead of execute_resmgr() as in previous versions) because we need the attributes structures to exist before we call read_file() to read the counter values from the persistent file.