X-Git-Url: http://git.tuebingen.mpg.de/?p=adu.git;a=blobdiff_plain;f=adu.c;h=b8c7b68f905b2448aa069eb2d6820e029ca42baf;hp=dda9fd24ccd33fa1875d0a8f2e8a33d02ba2d723;hb=66f28f8d1a9562cdba6f1611a06f23f13ee15469;hpb=3bb9b0ca535be1eb28b64972bdf0e205e6afc93e diff --git a/adu.c b/adu.c index dda9fd2..b8c7b68 100644 --- a/adu.c +++ b/adu.c @@ -5,6 +5,17 @@ */ /** \file adu.c \brief The main functions used by all modes of operation. */ + +/** + * \mainpage adu API reference + * + * - Modes of operation: \ref select.c, \ref create.c, \ref interactive.c + * - User handling: \ref user.c + * - Error handling: \ref error.h + * - Library-type functions: \ref fd.c, \ref format.c, \ref string.c, \ref portable_io.h + * - Generated files: \ref cmdline.h, \ref select.cmdline.h + */ + #include "adu.h" #include /* readdir() */ #include @@ -17,7 +28,14 @@ #include "string.h" #include "error.h" +/** Define the array of error descriptions. */ DEFINE_ERRLIST; + +/** + * The error code of the last osl library function. + * + * \sa osl(). + */ int osl_errno; /** In case a signal is received, its number is stored here. */ @@ -120,7 +138,7 @@ static void close_dir_table(void) dir_table = NULL; } -void close_all_tables(void) +static void close_all_tables(void) { close_dir_table(); close_user_tables(); @@ -131,6 +149,12 @@ static void signal_handler(int s) signum = s; } +/** + * Check whether to terminate adu. + * + * Check whether a signal was caught that should terminate the + * adu process. If yes, close all osl tables and exit gracefully. + */ void check_signals(void) { if (likely(!signum)) @@ -151,6 +175,13 @@ static int init_signals(void) return 1; } +/** + * Open the directory table. + * + * \param create If non-zero, create the table first. + * + * \return Standard. + */ int open_dir_table(int create) { @@ -221,6 +252,17 @@ static int print_complete_help_and_die(void) exit(EXIT_FAILURE); } +/** + * The main function of adu. + * + * \param argc Usual argument count. + * \param argv Usual argument vector. + * + * Check command line options, init the signal handlers and + * call the main function of the selected mode. + * + * \return \p EXIT_SUCCESS on success, \p EXIT_FAILURE otherwise. + */ int main(int argc, char **argv) { int ret;