+
+/** Evaluates to 1 if x < y, to -1 if x > y and to 0 if x == y. */
+#define NUM_COMPARE(x, y) ((int)((x) < (y)) - (int)((x) > (y)))
+
+/** The columns of the directory table. */
+enum dir_table_columns {
+ /** The name of the directory. */
+ DT_NAME,
+ /** The dir count number. */
+ DT_NUM,
+ /** The number of the parent directory. */
+ DT_PARENT_NUM,
+ /** The number of bytes of all regular files. */
+ DT_BYTES,
+ /** The number of all regular files. */
+ DT_FILES,
+ /** Number of columns in this table. */
+ NUM_DT_COLUMNS
+};
+
+/** The columns of the id table. */
+enum user_table_columns {
+ /** The numer of the directory. */
+ UT_DIR_NUM,
+ /** The number of bytes of all regular files in this dir owned by this id. */
+ UT_BYTES,
+ /** The number of files in this dir owned by this id. */
+ UT_FILES,
+ /** Number of columns in this table. */
+ NUM_UT_COLUMNS
+};
+
+/** Flags for the user hash table. */
+enum uid_info_flags {
+ /** Whether this slot of the hash table is used. */
+ UI_FL_SLOT_USED = 1,
+ /** Whether this uid should be taken into account. */
+ UI_FL_ADMISSIBLE = 2,
+};
+
+/** Information about one admissible user. */
+struct user_info {
+ /** User ID. */
+ uint32_t uid;
+ /** \sa enum uid_info_flags. */
+ uint32_t flags;
+ /** The user name. */
+ char *pw_name;
+ /** The user table of this user.*/
+ struct osl_table *table;
+ /** Total number of files owned by this user. */
+ uint64_t files;
+ /** Total number of bytes owned by this user. */
+ uint64_t bytes;
+ /** Total number of directories that contain at least one file */
+ uint64_t dirs;
+ /** The description of the user table. */
+ struct osl_table_description *desc;
+};
+
+/**
+ * Describes one range of admissible user IDs.
+ *
+ * adu converts the admissible user ids given at the command line
+ * into an array of such structs.
+ */
+struct uid_range {
+ /** Lowest admissible user ID. */
+ uint32_t low;
+ /** Greatest admissible user ID. */
+ uint32_t high;
+};
+
+enum search_uid_flags {
+ OPEN_USER_TABLE = 1,
+ CREATE_USER_TABLE = 2,
+};
+
+#define FOR_EACH_UID_RANGE(ur, urs) for (ur = urs; ur->low <= ur->high; ur++)
+
+extern uint32_t num_uids;
+extern struct osl_table *dir_table;
+
+/** The adu command line options. */
+extern struct gengetopt_args_info conf;
+
+/**
+ * The select command line options.
+ *
+ * Either given at the command line, or via the \a set command
+ * in interactive mode.
+ */
+extern struct select_args_info select_conf;
+
+/* adu.c */
+__printf_2_3 void __log(int, const char*, ...);
+int open_dir_table(int create);
+void check_signals(void);
+void close_all_tables(void);
+char *get_uid_list_name(void);
+void create_hash_table(unsigned bits);
+int search_uid(uint32_t uid, struct uid_range *urs,
+ enum search_uid_flags flags, struct user_info **ui_ptr);
+int for_each_admissible_user(int (*func)(struct user_info *, void *),
+ void *data);
+void sort_hash_table(int (*comp)(const void *, const void *));
+
+/* create.c */
+int com_create(void);
+
+/* interactive.c */
+void print_interactive_help(void);
+int com_interactive(void);