adu.git
15 years agoAdd create_argv() to string.c.
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.

15 years agoMake parse_format_string() return int.
Andre Noll [Sat, 18 Oct 2008 21:23:46 +0000 (23:23 +0200)]
Make parse_format_string() return int.

It's much cleaner to let public functions return a negative
error code on failure.

15 years agoMerge commit 'fml/master'
Andre Noll [Sat, 18 Oct 2008 18:50:06 +0000 (20:50 +0200)]
Merge commit 'fml/master'

15 years agoAdd pretty-printing formating functions.
Andre Noll [Sat, 18 Oct 2008 15:20:58 +0000 (17:20 +0200)]
Add pretty-printing formating functions.

This adds a generic format string parser. The new code is compiled
in but not yet used.

15 years agoMerge commit 'fml/master'
Andre Noll [Sun, 12 Oct 2008 22:58:10 +0000 (00:58 +0200)]
Merge commit 'fml/master'

15 years agoHandle select help options properly.
Andre Noll [Wed, 2 Jul 2008 16:19:07 +0000 (18:19 +0200)]
Handle select help options properly.

The old code never printed out the help texts.

15 years agoMerge commit 'fml/master'
Andre Noll [Tue, 1 Jul 2008 19:26:26 +0000 (21:26 +0200)]
Merge commit 'fml/master'

Conflicts:

Makefile

15 years agoImplement --output.
Andre Noll [Mon, 30 Jun 2008 15:53:52 +0000 (17:53 +0200)]
Implement --output.

The option was added long ago, but the implementation was missing..

15 years agoadu-0.0.3. v0.0.3
Andre Noll [Mon, 23 Jun 2008 16:15:07 +0000 (18:15 +0200)]
adu-0.0.3.

15 years agoImplement the interactive "run" command to run the select query.
Andre Noll [Mon, 23 Jun 2008 13:59:14 +0000 (15:59 +0200)]
Implement the interactive "run" command to run the select query.

This was a straight-forward task, given the preparations of the
past few patches.

15 years agoIntroduce run_select_query().
Andre Noll [Mon, 23 Jun 2008 12:47:22 +0000 (14:47 +0200)]
Introduce run_select_query().

This is just the part of com_select() that will be called from
the run command of interactive.c.

15 years agoMake struct admissible uids local.
Andre Noll [Mon, 23 Jun 2008 11:58:38 +0000 (13:58 +0200)]
Make struct admissible uids local.

It is only used in read_uid_file. So pass it as an arg to this
function.

15 years agoUse only one copy of struct select_conf.
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.

15 years agocom_select(): Minor cleanup.
Andre Noll [Mon, 23 Jun 2008 11:48:54 +0000 (13:48 +0200)]
com_select(): Minor cleanup.

Move params struct into the if clause where it is used.

15 years agoMove remaining select options from adu.ggo to select.ggo.
Andre Noll [Fri, 20 Jun 2008 15:30:26 +0000 (17:30 +0200)]
Move remaining select options from adu.ggo to select.ggo.

15 years agoMove --no-user-summary to select.ggo.
Andre Noll [Fri, 20 Jun 2008 15:23:20 +0000 (17:23 +0200)]
Move --no-user-summary to select.ggo.

15 years agoMove --user-summary-sort to select.ggo.
Andre Noll [Fri, 20 Jun 2008 15:21:10 +0000 (17:21 +0200)]
Move --user-summary-sort to select.ggo.

15 years agoMove --size-unit and --count-unit from adu.ggo to select.ggo.
Andre Noll [Fri, 20 Jun 2008 15:18:13 +0000 (17:18 +0200)]
Move --size-unit and --count-unit from adu.ggo to select.ggo.

15 years agoRemove the --limit option from adu.ggo.
Andre Noll [Fri, 20 Jun 2008 13:37:02 +0000 (15:37 +0200)]
Remove the --limit option from adu.ggo.

Use --limit from select.ggo instead.

15 years agoMake --uid take a comma-separated list of uids and move it to select.ggo.
Andre Noll [Fri, 20 Jun 2008 13:27:02 +0000 (15:27 +0200)]
Make --uid take a comma-separated list of uids and move it to select.ggo.

This means --uid no needs to be a multiple option.
Also, add descriptions to all interactive commands.

15 years agoRe-activate -Wuninitialized.
Andre Noll [Fri, 20 Jun 2008 13:23:14 +0000 (15:23 +0200)]
Re-activate -Wuninitialized.

15 years agoFix prototype of com_create().
Andre Noll [Fri, 20 Jun 2008 08:44:54 +0000 (10:44 +0200)]
Fix prototype of com_create().

15 years agoKill two unused variables.
Andre Noll [Fri, 20 Jun 2008 08:44:40 +0000 (10:44 +0200)]
Kill two unused variables.

15 years agoMove the uid-range parser to string.c.
Andre Noll [Fri, 20 Jun 2008 08:44:16 +0000 (10:44 +0200)]
Move the uid-range parser to string.c.

This code will also be needed by the interactive mode.

15 years agoAdd rudimentary interactive support.
Andre Noll [Fri, 20 Jun 2008 08:40:13 +0000 (10:40 +0200)]
Add rudimentary interactive support.

This needs much more work..

15 years agoFix typo in Makefile.
Andre Noll [Thu, 19 Jun 2008 13:45:11 +0000 (15:45 +0200)]
Fix typo in Makefile.

15 years agoFix typo in Makefile.
Andre Noll [Wed, 18 Jun 2008 18:47:13 +0000 (20:47 +0200)]
Fix typo in Makefile.

15 years agoMerge commit 'fml/master'
Andre Noll [Wed, 18 Jun 2008 18:28:06 +0000 (20:28 +0200)]
Merge commit 'fml/master'

15 years agoAdd large file support.
Andre Noll [Wed, 18 Jun 2008 13:18:06 +0000 (15:18 +0200)]
Add large file support.

This is needed on 32bit systems for files > 2G. Only tested on Linux
so far.

15 years agoReplace value of PRIME1.
Andre Noll [Wed, 18 Jun 2008 12:45:57 +0000 (14:45 +0200)]
Replace value of PRIME1.

It wasn't a prime at all ;)

15 years agoMerge commit 'fml/master'
Andre Noll [Thu, 5 Jun 2008 20:29:59 +0000 (22:29 +0200)]
Merge commit 'fml/master'

15 years agoFix and simplify get_dir_name_by_number() and friends.
Andre Noll [Thu, 5 Jun 2008 16:58:38 +0000 (18:58 +0200)]
Fix and simplify get_dir_name_by_number() and friends.

That was quite buggy. Fortunately, this fixed version is even
simpler than the buggy code we've had before.

15 years agoscan_dir(): Print error reason if lstat() failed.
Andre Noll [Thu, 5 Jun 2008 16:56:58 +0000 (18:56 +0200)]
scan_dir(): Print error reason if lstat() failed.

15 years agoMerge commit 'fml/master'
Andre Noll [Wed, 4 Jun 2008 19:08:22 +0000 (21:08 +0200)]
Merge commit 'fml/master'

15 years agoAdd the --print-base-dir option.
Andre Noll [Tue, 3 Jun 2008 15:52:08 +0000 (17:52 +0200)]
Add the --print-base-dir option.

15 years agoAdd the funny adu logo.
Andre Noll [Mon, 2 Jun 2008 17:57:35 +0000 (19:57 +0200)]
Add the funny adu logo.

15 years agoadu-0.0.2 v0.0.2
Andre Noll [Mon, 2 Jun 2008 08:20:56 +0000 (10:20 +0200)]
adu-0.0.2

15 years agoAdd options for selecting what to print.
Andre Noll [Sun, 1 Jun 2008 22:55:36 +0000 (00:55 +0200)]
Add options for selecting what to print.

15 years agoRename size_unit to size-unit and count_unit to count-unit.
Andre Noll [Sun, 1 Jun 2008 21:29:59 +0000 (23:29 +0200)]
Rename size_unit to size-unit and count_unit to count-unit.

Other multi-word options also use a hyphen rather than an underscore.

15 years agoHeader cleanup.
Andre Noll [Sun, 1 Jun 2008 21:22:04 +0000 (23:22 +0200)]
Header cleanup.

No need to include lots of network-related header files.

15 years agoMake user summary sortable by user defined column.
Andre Noll [Sun, 1 Jun 2008 21:21:13 +0000 (23:21 +0200)]
Make user summary sortable by user defined column.

This adds the user-summary-sort option

15 years agoGet rid of global variables num_dirs, num_files, and num_bytes.
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.

15 years agoMove ui_used() and ui_admissible() from adu.h to adu.c.
Andre Noll [Sun, 1 Jun 2008 18:08:32 +0000 (20:08 +0200)]
Move ui_used() and ui_admissible() from adu.h to adu.c.

They are only used there.

15 years agoAdd .gitignore.
Andre Noll [Sun, 1 Jun 2008 17:53:55 +0000 (19:53 +0200)]
Add .gitignore.

Hopefully this makes it less likely to forget to check in important
files.

15 years agoAdd create.c.
Andre Noll [Sun, 1 Jun 2008 17:52:17 +0000 (19:52 +0200)]
Add create.c.

Oops, forgot to check it in..

15 years agoHide the implementation of the uid hash table.
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.

15 years agoImplement --hash-table-bits.
Andre Noll [Sun, 1 Jun 2008 17:08:51 +0000 (19:08 +0200)]
Implement --hash-table-bits.

15 years agoAlso catch SIGPIPE.
Andre Noll [Sun, 1 Jun 2008 16:43:39 +0000 (18:43 +0200)]
Also catch SIGPIPE.

Otherwise, "adu -S | invalid_command" kills the adu process and
we're left with dirty osl tables.

15 years agoLet gengetopt check the given args.
Andre Noll [Sun, 1 Jun 2008 16:33:18 +0000 (18:33 +0200)]
Let gengetopt check the given args.

15 years ago--base-dir must not be a required option.
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.

15 years agoCheck args before initializing signal handlers.
Andre Noll [Sun, 1 Jun 2008 16:31:05 +0000 (18:31 +0200)]
Check args before initializing signal handlers.

15 years agoMove the code for the create command to its own file.
Andre Noll [Sun, 1 Jun 2008 16:16:58 +0000 (18:16 +0200)]
Move the code for the create command to its own file.

15 years agoMove the code for the select command to its own file.
Andre Noll [Sun, 1 Jun 2008 15:50:41 +0000 (17:50 +0200)]
Move the code for the select command to its own file.

15 years agoFix a typo in documentation.
Andre Noll [Sun, 1 Jun 2008 14:51:10 +0000 (16:51 +0200)]
Fix a typo in documentation.

15 years agoImplement username resolution.
Andre Noll [Sun, 1 Jun 2008 14:29:58 +0000 (16:29 +0200)]
Implement username resolution.

15 years agoImplement --one-file-system (-x).
Andre Noll [Sun, 1 Jun 2008 13:18:56 +0000 (15:18 +0200)]
Implement --one-file-system (-x).

15 years agoCosmetics.
Andre Noll [Sun, 1 Jun 2008 12:21:58 +0000 (14:21 +0200)]
Cosmetics.

15 years agoReplace para_ prefix by adu_.
Andre Noll [Sun, 1 Jun 2008 12:20:02 +0000 (14:20 +0200)]
Replace para_ prefix by adu_.

15 years agoKill a bunch of unused cruft.
Andre Noll [Sun, 1 Jun 2008 12:02:09 +0000 (14:02 +0200)]
Kill a bunch of unused cruft.

15 years agoAdd error code for SIGNAL_SIG_ERR.
Andre Noll [Sun, 1 Jun 2008 12:01:02 +0000 (14:01 +0200)]
Add error code for SIGNAL_SIG_ERR.

15 years agoImplement signal handling.
Andre Noll [Sun, 1 Jun 2008 11:25:43 +0000 (13:25 +0200)]
Implement signal handling.

Install a trivial signal handler that sets a global variable
and check the value of this variable from time to time.

This approach is good enough because we only want to cleanly close
the osl table in case we catch SIGINT or SIGTERM.

15 years agoFix two memory leaks.
Andre Noll [Sat, 31 May 2008 21:33:18 +0000 (23:33 +0200)]
Fix two memory leaks.

15 years agoMuch nicer output.
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

15 years agoDo not use "B" suffix for quantities that are not bytes.
Andre Noll [Sat, 31 May 2008 18:47:15 +0000 (20:47 +0200)]
Do not use "B" suffix for quantities that are not bytes.

15 years agoDo not print non-admissible uids in user summary.
Andre Noll [Sat, 31 May 2008 18:42:25 +0000 (20:42 +0200)]
Do not print non-admissible uids in user summary.

15 years agoFix the uid parser.
Andre Noll [Sat, 31 May 2008 18:40:33 +0000 (20:40 +0200)]
Fix the uid parser.

Using e.g. --uid 42 caused parse_uid_range() to pass a NULL pointer
to check_uid_arg().

15 years agoSwitch to the new osl_rbtree_loop() semantics.
Andre Noll [Sat, 31 May 2008 17:22:46 +0000 (19:22 +0200)]
Switch to the new osl_rbtree_loop() semantics.

This fixes the --limit option that broke by introducing the osl()
wrapper.

15 years agoRemove debugging message in error.h.
Andre Noll [Sat, 31 May 2008 15:54:35 +0000 (17:54 +0200)]
Remove debugging message in error.h.

15 years agoRemove trailing slashes from base-dir arg.
Andre Noll [Sat, 31 May 2008 15:48:00 +0000 (17:48 +0200)]
Remove trailing slashes from base-dir arg.

15 years agoIntroduce the osl() wrapper and rename error_txt() to adu_strerror().
Andre Noll [Sat, 31 May 2008 14:21:42 +0000 (16:21 +0200)]
Introduce the osl() wrapper and rename error_txt() to adu_strerror().

This gets rid of the copy of the error codes from libosl.

Also, remove para_fgets() as it is unused.

15 years agoRemove and unused variable.
Andre Noll [Fri, 30 May 2008 20:59:00 +0000 (22:59 +0200)]
Remove and unused variable.

15 years agoadd_directory(): Fix log message.
Andre Noll [Fri, 30 May 2008 20:58:48 +0000 (22:58 +0200)]
add_directory(): Fix log message.

15 years agoMerge commit 'fml/master'
Andre Noll [Fri, 30 May 2008 20:56:50 +0000 (22:56 +0200)]
Merge commit 'fml/master'

15 years agoOnly store the number of the parent dir, not the dir itsself.
Andre Noll [Fri, 30 May 2008 16:11:32 +0000 (18:11 +0200)]
Only store the number of the parent dir, not the dir itsself.

This should reduce the size of the database considerably while
also improving performance.

15 years agoCheck the return value of print_statistics().
Andre Noll [Fri, 30 May 2008 16:09:13 +0000 (18:09 +0200)]
Check the return value of print_statistics().

It may fail.

15 years agoGet rid of the rbtree for the name column.
Andre Noll [Fri, 30 May 2008 16:08:34 +0000 (18:08 +0200)]
Get rid of the rbtree for the name column.

We never sort by or loopup the dir name.

15 years agoBe more verbose if the uid file could not be mapped.
Andre Noll [Fri, 30 May 2008 13:26:15 +0000 (15:26 +0200)]
Be more verbose if the uid file could not be mapped.

15 years agoInplement the --uid option.
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.

15 years agoFix funny typo in docu to double_hash().
Andre Noll [Fri, 30 May 2008 13:11:44 +0000 (15:11 +0200)]
Fix funny typo in docu to double_hash().

15 years agoFix uid counting.
Andre Noll [Fri, 30 May 2008 13:10:51 +0000 (15:10 +0200)]
Fix uid counting.

It was only correct in create mode.

15 years agoRemove osl.h and osl_core.h.
Andre Noll [Thu, 29 May 2008 20:40:51 +0000 (22:40 +0200)]
Remove osl.h and osl_core.h.

They are contained in the osl package.

15 years agoAdd missing functions to fd.c.
Andre Noll [Mon, 26 May 2008 23:25:52 +0000 (01:25 +0200)]
Add missing functions to fd.c.

These were previously exported by osl but don't really belong there.

15 years agoImplement human-readable output and honor the unit command line options.
Andre Noll [Mon, 26 May 2008 16:06:45 +0000 (18:06 +0200)]
Implement human-readable output and honor the unit command line options.

15 years agoHonor the --limit option.
Andre Noll [Mon, 26 May 2008 11:55:32 +0000 (13:55 +0200)]
Honor the --limit option.

15 years agoHonor the --database_dir option.
Andre Noll [Mon, 26 May 2008 09:38:47 +0000 (11:38 +0200)]
Honor the --database_dir option.

15 years agoMerge commit 'meins/master'
Andre Noll [Mon, 26 May 2008 09:24:34 +0000 (11:24 +0200)]
Merge commit 'meins/master'

Conflicts:

Makefile
adu.c

15 years agoGet rid of the osl code.
Andre Noll [Mon, 26 May 2008 09:00:56 +0000 (11:00 +0200)]
Get rid of the osl code.

Use libosl instead.

15 years agoAdd documentation for double_hash().
Andre Noll [Mon, 26 May 2008 00:04:40 +0000 (02:04 +0200)]
Add documentation for double_hash().

15 years agoMake --loglevel and --S work.
Andre Noll [Sun, 25 May 2008 23:35:53 +0000 (01:35 +0200)]
Make --loglevel and --S work.

15 years agoAdd gengetopt support.
Andre Noll [Sun, 25 May 2008 23:29:30 +0000 (01:29 +0200)]
Add gengetopt support.

First draft of planned options. None is actually implemented so far..

15 years agoImplement the select command.
Andre Noll [Sun, 25 May 2008 21:00:30 +0000 (23:00 +0200)]
Implement the select command.

This seperates the creation of the osl tables and the pretty-printing
of the statistics.

To do this, it is necessary to close the tables properly on exit. This
change also fixed some memory leaks.

For the select command the new code reads the uid file and recomputes
the gloabal and the user stats from the osl tables.

15 years agoWrite the list of all uids to a file.
Andre Noll [Sun, 25 May 2008 16:35:41 +0000 (18:35 +0200)]
Write the list of all uids to a file.

The select command will need this.

15 years agoAdd #define for database dir.
Andre Noll [Sun, 25 May 2008 16:11:18 +0000 (18:11 +0200)]
Add #define for database dir.

Of course, this should be configurabe intstead..

15 years agoReplace id table by hash table.
Andre Noll [Sun, 25 May 2008 16:08:27 +0000 (18:08 +0200)]
Replace id table by hash table.

This should make uid lookups much faster. We use a power of two for
the hash table size and open addressing with double hashing to handle
hash collisions.

15 years agoremove memory leak in scan_dir()
Sebastian Stark [Tue, 20 May 2008 15:22:00 +0000 (17:22 +0200)]
remove memory leak in scan_dir()

the tmp pointer is used only for directory entries. However, it was allocated
unconditionally and was not freed in case of regular files.

15 years agoMerge commit 'stark/master'
Andre Noll [Tue, 20 May 2008 09:24:54 +0000 (11:24 +0200)]
Merge commit 'stark/master'

15 years agoInsert missing tab in stat output.
Andre Noll [Mon, 19 May 2008 19:46:34 +0000 (21:46 +0200)]
Insert missing tab in stat output.

15 years agoReplace dir hash by dir num.
Andre Noll [Mon, 19 May 2008 19:46:12 +0000 (21:46 +0200)]
Replace dir hash by dir num.

This should work equally well, eats less memory and cpu, and doesn't
require openssl.

15 years agoput tab between number of files and number of bytes in dir_stats
Sebastian Stark [Mon, 19 May 2008 16:21:30 +0000 (18:21 +0200)]
put tab between number of files and number of bytes in dir_stats

15 years agolink against libcrypto instead of libssl
Sebastian Stark [Mon, 19 May 2008 16:03:10 +0000 (18:03 +0200)]
link against libcrypto instead of libssl