X-Git-Url: http://git.tuebingen.mpg.de/?p=adu.git;a=blobdiff_plain;f=adu.c;h=42d1b19bcae5a70fde2a9655ad82dd1c62b55c5a;hp=6eb958456ea292d33cf0bb4eba7b6c050a426866;hb=b01ff57775258c8df4c486b0962fc67cfdfef439;hpb=dd689d6a5f07f03bc0f4ffc518eb8bd3cdcee3ca diff --git a/adu.c b/adu.c index 6eb9584..42d1b19 100644 --- a/adu.c +++ b/adu.c @@ -18,13 +18,6 @@ static int signum; /** Command line and config file options. */ struct gengetopt_args_info conf; -/** Global dir count. */ -uint64_t num_dirs = 0; -/** Global files count. */ -uint64_t num_files = 0; -/** Global bytes count. */ -uint64_t num_bytes = 0; - /** The number of different uids found so far. */ uint32_t num_uids = 0; @@ -60,8 +53,6 @@ struct osl_table *dir_table = NULL; */ struct uid_range *admissible_uids; -/** 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))) /** * Compare the size of two directories @@ -318,7 +309,7 @@ int for_each_admissible_user(int (*func)(struct user_info *, void *), return 1; } -#define PRIME1 0x811c9dc5 +#define PRIME1 0xb11924e1 #define PRIME2 0x01000193 void create_hash_table(unsigned bits) @@ -482,6 +473,12 @@ char *get_uid_list_name(void) return make_message("%s/uid_list", conf.database_dir_arg); } +void sort_hash_table(int (*comp)(const void *, const void *)) +{ + qsort(uid_hash_table, uid_hash_table_size, sizeof(struct user_info), + comp); +} + int open_dir_table(int create) { dir_table_desc.dir = adu_strdup(conf.database_dir_arg); @@ -553,8 +550,10 @@ int main(int argc, char **argv) ret = -E_SYNTAX; if (conf.select_given) ret = com_select(); - else + else if (conf.create_given) ret = com_create(); + else + ret = com_interactive(); if (ret < 0) goto out; out: