monolithic patch that seperates the commands' functionality to functions

further try to avoid boilerplate by delegating arguments and regex device matching to functions, make some variables for options global, replace fflush() calls with a single setvbuf() call for stdout, use bool type where appropriate, make enum for commands command_t, and more general fixes
do not use exit() calls, in case of parse_arguments return -1 to indicate exit succesfull
improve error message for invalid non-option arguments
Merge branch 'feature/functions' into develop