-#include "portable_io.h"
-
-/** Global dir count. */
-static uint64_t num_dirs;
-/** Global files count. */
-static uint64_t num_files;
-/** Global bytes count. */
-static uint64_t num_bytes;
-
-/** The decimal representation of an uint64_t never exceeds that size. */
-#define FORMATED_VALUE_SIZE 25
-
-/* these get filled in by the select command. */
-static char count_unit_buf[4] = "( )", size_unit_buf[4] = "( )";
-
-enum global_stats_flags {
- GSF_PRINT_DIRNAME = 1,
- GSF_PRINT_BYTES = 2,
- GSF_PRINT_FILES = 4,
- GSF_COMPUTE_SUMMARY = 8,
+#include "user.h"
+#include "select.cmdline.h"
+
+/** \cond */
+/* global list */
+#define GLOBAL_LIST_ATOMS \
+ ATOM(size, SIZE) \
+ ATOM(files, COUNT) \
+ ATOM(dirname, STRING) \
+
+#define ATOM(x, y) { .name = #x, .type = AT_ ## y},
+struct atom global_list_atoms[] = {
+ GLOBAL_LIST_ATOMS
+ {.name = NULL}
+};
+#undef ATOM
+#define ATOM(x, y) gla_ ## x,
+enum global_list_atoms {GLOBAL_LIST_ATOMS};
+#undef ATOM
+
+/* global summary */
+#define GLOBAL_SUMMARY_ATOMS \
+ ATOM(dirs, COUNT) \
+ ATOM(files, COUNT) \
+ ATOM(size, SIZE)
+
+#define ATOM(x, y) { .name = #x, .type = AT_ ## y},
+struct atom global_summary_atoms[] = {
+ GLOBAL_SUMMARY_ATOMS
+ {.name = NULL}
+};
+#undef ATOM
+#define ATOM(x, y) gsa_ ## x,
+enum global_summary_atoms {GLOBAL_SUMMARY_ATOMS};
+#undef ATOM
+
+/* user list */
+#define USER_LIST_ATOMS \
+ ATOM(pw_name, STRING) \
+ ATOM(uid, ID) \
+ ATOM(size, SIZE) \
+ ATOM(files, COUNT) \
+ ATOM(dirname, STRING) \
+
+#define ATOM(x, y) { .name = #x, .type = AT_ ## y},
+struct atom user_list_atoms[] = {
+ USER_LIST_ATOMS
+ {.name = NULL}
+};
+#undef ATOM
+#define ATOM(x, y) ula_ ## x,
+enum user_list_atoms {USER_LIST_ATOMS};
+#undef ATOM
+
+/* user list header */
+#define USER_LIST_HEADER_ATOMS \
+ ATOM(pw_name, STRING) \
+ ATOM(uid, ID)
+
+#define ATOM(x, y) { .name = #x, .type = AT_ ## y},
+struct atom user_list_header_atoms[] = {
+ USER_LIST_HEADER_ATOMS
+ {.name = NULL}
+};
+#undef ATOM
+#define ATOM(x, y) ulha_ ## x,
+enum user_list_header_atoms {USER_LIST_HEADER_ATOMS};
+#undef ATOM
+
+/* user summary */
+#define USER_SUMMARY_ATOMS \
+ ATOM(pw_name, STRING) \
+ ATOM(uid, ID) \
+ ATOM(dirs, COUNT) \
+ ATOM(files, COUNT) \
+ ATOM(size, SIZE)
+
+#define ATOM(x, y) { .name = #x, .type = AT_ ## y},
+struct atom user_summary_atoms[] = {
+ USER_SUMMARY_ATOMS
+ {.name = NULL}