#include "error.h"
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. */
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))
return 1;
}
+/**
+ * Open the directory table.
+ *
+ * \param create If non-zero, create the table first.
+ *
+ * \return Standard.
+ */
int open_dir_table(int create)
{
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;
#include "user.h"
#include "select.cmdline.h"
+/** \cond */
/* global list */
#define GLOBAL_LIST_ATOMS \
ATOM(size, SIZE) \
enum user_summary_atoms {USER_SUMMARY_ATOMS};
#undef ATOM
+/** \endcond */
+
struct global_list_info {
uint32_t count;
int ret;
return ret;
}
+/** Default format string for global_list mode. */
#define GLOBAL_LIST_DFLT_FMT "%(size:r:8) %(files:r:8) %(dirname)\n"
+/** Default format string for global_summary mode. */
#define GLOBAL_SUMMARY_DFLT_FMT "#directories: %(dirs), #files: %(files), size: %(size)\n\n"
+/** Default format string for user_list mode. */
#define USER_LIST_DFLT_FMT "%(size:r:5) %(files:r:5) %(dirname)\n"
+/** Default format string for user_summary mode. */
#define USER_SUMMARY_DFLT_FMT "%(pw_name:l:16) %(uid:r:5) %(dirs:r:5) %(files:r:5) %(size:r:5)\n"
static int setup_format_string(char *fmt, struct format_info **fi)