Andre Noll [Sat, 1 Nov 2008 22:45:47 +0000 (23:45 +0100)]
Improve interactive feeling, kill dump command.
It's no good to spam the user with syntax errors on empty lines.
In popular shells, the set command prints the current environment
if called without arguments. So do the same and kill the dump command.
Andre Noll [Sat, 1 Nov 2008 21:06:16 +0000 (22:06 +0100)]
Make it easier to print the help for select options.
It was always a bit awkward to print the help for the select options
because one had to specify a valid mode (-C -S or -I) and the required
-d option just to make gengetopt not bail out early.
Fix this flaw by not using gengetopt's internal help.
Andre Noll [Sat, 1 Nov 2008 19:21:18 +0000 (20:21 +0100)]
Add format string doku, simplify format string handling.
As adu now only prints one list/summary at a time, there's only need
for one format string. So replace the four format-string related
option by a single --format option and add a detailed description
on how adu format strings may be used.
Andre Noll [Sat, 1 Nov 2008 13:30:28 +0000 (14:30 +0100)]
Introduce select-mode and use pretty formating for the global lists.
This patch introduces the new --select-mode option which is used
to specify which of the four possible output formats should be used.
Only this table is being printed.
The other change to select.c is that the global list also uses the
functions from format.c to pretty-print the output. The new
--global-list-format option may be used to customize the output.
Andre Noll [Sun, 26 Oct 2008 13:13:01 +0000 (14:13 +0100)]
Add create_argv() to string.c.
A problem with gengetopt's string parser is that it can not handle
whitespace within parameters. It's therefore necessary to roll our
own line splitting code.
Andre Noll [Mon, 23 Jun 2008 11:53:57 +0000 (13:53 +0200)]
Use only one copy of struct select_conf.
Previously, we had one copy in select.c and another copy in
interactive.c. Define a single copy in adu.c instead and use
it from both interactive.c and select.c.
Andre Noll [Sun, 1 Jun 2008 18:29:16 +0000 (20:29 +0200)]
Get rid of global variables num_dirs, num_files, and num_bytes.
These were defined in adu.c but not used there at all.
In fact, create.c only used num_dirs in scan_dir() as a counter for
the directory currently being processed while the other two were not
really used at all. Make num_dirs local to scan_dir(), rename it to
current_dir_num and remove the other two.
The only "real" users of these variables are all in select.c, so move
them there and make them static.
Andre Noll [Sun, 1 Jun 2008 17:50:16 +0000 (19:50 +0200)]
Hide the implementation of the uid hash table.
The commands should not know anything about the details.
So replace the FOR_EACH_USER macro by for_each_admissible_user()
which takes a function pointer and calls the given function for
each admissible user, passing a pointer to the user_info struct
of that user.
This allows to un-export uid_hash_table_size and uid_hash_table.
Andre Noll [Sun, 1 Jun 2008 16:32:49 +0000 (18:32 +0200)]
--base-dir must not be a required option.
Otherwise, gengetopt would complain if it is not given even in
--select mode. Make it optional and check manually whether it
is given in --create mode.
Andre Noll [Sat, 31 May 2008 21:21:23 +0000 (23:21 +0200)]
Much nicer output.
- only print units if not human-readable was selected
- print sizes/counts before the dirname
- nice identation
- human-readable output for global summary
Andre Noll [Fri, 30 May 2008 13:25:23 +0000 (15:25 +0200)]
Inplement the --uid option.
This adds a parser for the --uid argument that fills in the array
of admissible intervals.
In select mode the tables for non-admissible uids are no longer opened.
Therefore we can no longer use the ->table pointer of struct user_info
to find out whether a slot in the hash table is already used. Introduce
the new field ->flags to struct user_info that contains a bit indicating
whether the slot in the hash table is used and another bit that tells
us whether the uid associated with that slot is admissible.