/* Process directory listing program options. */
#include "option-handler.h"
/* Initialize the program options. */
Option_Handler::Option_Handler (void)
/* Prints program usage to standard error stream, then exits. */
Option_Handler::usage (void)
fprintf (stderr
, "usage: %s [-ahl] [directory]\n", program_name
);
/* Sets the program options. */
Option_Handler::operator () (int argc
, char *argv
[])
GetOpt
getopt (argc
, argv
, "ahl");
while ((option_char
= getopt ()) != EOF
)
case 'a': /* Print out hidden files (those starting with '.'). */
case 'h': /* Print help message and exit. */
/* Change the working directory if default is not ".". This saves
time during the directory entry decoding phase. */
chdir (argv
[getopt
.optind
]);
/* TRUE if OPTION enable, else FALSE. */
Option_Handler::operator[] (option_type option
)
return option_word
& option
;