adu.git
15 years agoAdd missing source code documentation of user.c.
Andre Noll [Mon, 10 Nov 2008 21:00:06 +0000 (22:00 +0100)]
Add missing source code documentation of user.c.

This completes the documentation of user.c.

15 years agoAdd \brief command to file header to make doxygen happy.
Andre Noll [Mon, 10 Nov 2008 00:39:18 +0000 (01:39 +0100)]
Add \brief command to file header to make doxygen happy.

15 years agoRemove sha1.c
Andre Noll [Mon, 10 Nov 2008 00:38:10 +0000 (01:38 +0100)]
Remove sha1.c

This was never needed.

15 years agouser.c: Add some more source code documentation.
Andre Noll [Mon, 10 Nov 2008 00:28:58 +0000 (01:28 +0100)]
user.c: Add some more source code documentation.

15 years agoAdd copyright header and COPYING file.
Andre Noll [Mon, 10 Nov 2008 00:06:13 +0000 (01:06 +0100)]
Add copyright header and COPYING file.

15 years agoCosmetic cleanups.
Andre Noll [Sun, 9 Nov 2008 23:57:02 +0000 (00:57 +0100)]
Cosmetic cleanups.

15 years agoRemove duplicate whitespaces in documentation.
Andre Noll [Sun, 9 Nov 2008 22:20:20 +0000 (23:20 +0100)]
Remove duplicate whitespaces in documentation.

man2html does not like that.

15 years agoImplement pattern matching for select mode.
Andre Noll [Sun, 9 Nov 2008 22:18:40 +0000 (23:18 +0100)]
Implement pattern matching for select mode.

15 years agoMinor documentation updates/fixes/improvements.
Andre Noll [Sun, 9 Nov 2008 19:37:41 +0000 (20:37 +0100)]
Minor documentation updates/fixes/improvements.

15 years agoMake the header line configurable.
Andre Noll [Sun, 9 Nov 2008 19:37:09 +0000 (20:37 +0100)]
Make the header line configurable.

This replaces the --no-header flag by --header string option. The
argument is the header of the summary/list.

This was not a straight-forward task because the headers for the
user lists contain the uid and the user name. So introduce another
set of format string directives to still allow this.

15 years agoformat.c: Return an empty buffer for empty format strings rather than NULL.
Andre Noll [Sun, 9 Nov 2008 19:30:08 +0000 (20:30 +0100)]
format.c: Return an empty buffer for empty format strings rather than NULL.

15 years agoRename short option -L to -l.
Andre Noll [Sun, 9 Nov 2008 15:27:10 +0000 (16:27 +0100)]
Rename short option -L to -l.

Also, add a more descriptive help text.

15 years agoMake --limit work also for the user summary.
Andre Noll [Sun, 9 Nov 2008 15:21:54 +0000 (16:21 +0100)]
Make --limit work also for the user summary.

15 years agocompute_user_summary does not need any private data.
Andre Noll [Sun, 9 Nov 2008 15:13:38 +0000 (16:13 +0100)]
compute_user_summary does not need any private data.

Consequently, pass a NULL pointer rather than a pointer to struct
format_info which is not used anyway.

15 years agoFix sorting of the uid hash table.
Andre Noll [Sun, 9 Nov 2008 14:33:16 +0000 (15:33 +0100)]
Fix sorting of the uid hash table.

We must not blindy sort the whole table because in interactive mode
this table may be modified by later commands and lookup_uid() gets
confused if the entries have been permuted. So introduce
uid_hash_table_sort_idx, an array of indices that describes the current
sorting of the hash table. The order of the entries in the table itsself
never gets changed any more with this patch.

Also, simplify the uid comparators by introducing a wrapper that does
the casts which were previously contained in each comparator.

15 years agoMake the summary comparators non-static.
Andre Noll [Sun, 9 Nov 2008 12:21:04 +0000 (13:21 +0100)]
Make the summary comparators non-static.

15 years agoImplement the new interactive command "source".
Andre Noll [Sun, 9 Nov 2008 12:15:42 +0000 (13:15 +0100)]
Implement the new interactive command "source".

15 years agoFix a typo in interactive.c.
Andre Noll [Sun, 9 Nov 2008 12:15:16 +0000 (13:15 +0100)]
Fix a typo in interactive.c.

15 years agoMake user_summary the default select mode.
Andre Noll [Sun, 9 Nov 2008 00:55:12 +0000 (01:55 +0100)]
Make user_summary the default select mode.

15 years agoDo not close tables on each query.
Andre Noll [Sun, 9 Nov 2008 00:45:42 +0000 (01:45 +0100)]
Do not close tables on each query.

This speeds up interactive mode where many queries may be executed
in a row. User tables are opened on demand (if the uid is admissible)
and only closed on exit. Also the dir table is opened only once per
session rather than on each query.

15 years agoIncrease default loglevel to 4 (WARN).
Andre Noll [Sun, 9 Nov 2008 00:38:32 +0000 (01:38 +0100)]
Increase default loglevel to 4 (WARN).

15 years agoFix segfault in select mode if --uid was given.
Andre Noll [Sat, 8 Nov 2008 23:03:06 +0000 (00:03 +0100)]
Fix segfault in select mode if --uid was given.

We must not close tables for non-admissible users.

15 years agoFix a couple of gengetopt-related memory leaks.
Andre Noll [Sat, 8 Nov 2008 22:54:16 +0000 (23:54 +0100)]
Fix a couple of gengetopt-related memory leaks.

It's still a bit leaky..

15 years agoUser handling improvments.
Andre Noll [Sat, 8 Nov 2008 22:05:54 +0000 (23:05 +0100)]
User handling improvments.

- move global variable num_uids to user.c.
- logging improvements.
- replace search_uid() by create_user_table(). search_uid() had a
  horrible interface.
- in user.c, use FOR_EACH_USER() to loop over all users rather than
  for_each_admissible_user().

15 years agoSimplify user table closing.
Andre Noll [Sat, 8 Nov 2008 17:58:01 +0000 (18:58 +0100)]
Simplify user table closing.

No need for an extra function for freeing the hash table.

15 years agoselect.c: Fix two return values.
Andre Noll [Sat, 8 Nov 2008 17:26:24 +0000 (18:26 +0100)]
select.c: Fix two return values.

ERRNO_TO_ERROR() takes a _positive_ error code.

15 years agoOutput improvements.
Andre Noll [Sat, 8 Nov 2008 17:21:13 +0000 (18:21 +0100)]
Output improvements.

- Implement appending to an output file.
- Do not override the output file by default
- Implement piping the output into a command.

15 years agoMerge commit 'meins/master'
Andre Noll [Fri, 7 Nov 2008 09:31:50 +0000 (10:31 +0100)]
Merge commit 'meins/master'

15 years agoRename error message for E_OUTPUT.
Andre Noll [Fri, 7 Nov 2008 09:31:20 +0000 (10:31 +0100)]
Rename error message for E_OUTPUT.

We might as well get this error without using an output file.

15 years agoAdd new select option to specify users by name.
Andre Noll [Thu, 6 Nov 2008 23:09:50 +0000 (00:09 +0100)]
Add new select option to specify users by name.

This patch renames the short option -u for --uid to -U and introduces
the new --user option (short: -u) to specify admissible users by name.

The new option may be given mutltiple times to allow more than one user.

15 years agoMove user and user ID related functions to separate files.
Andre Noll [Thu, 6 Nov 2008 22:15:21 +0000 (23:15 +0100)]
Move user and user ID related functions to separate files.

15 years agoMove code for setting up the format string to an own function.
Andre Noll [Thu, 6 Nov 2008 20:16:30 +0000 (21:16 +0100)]
Move code for setting up the format string to an own function.

15 years agoFix return codes for loop functions.
Andre Noll [Wed, 5 Nov 2008 17:30:28 +0000 (18:30 +0100)]
Fix return codes for loop functions.

The four different loop functions must set the return value in
their private struct because these functions are called from
within the osl library which will replace any negative return value
by -E_OSL_LOOP.

15 years agoadu-0.0.4. v0.0.4
Andre Noll [Sun, 2 Nov 2008 21:41:12 +0000 (22:41 +0100)]
adu-0.0.4.

15 years agoAdd the latex and html directories to .gitignore.
Andre Noll [Sun, 2 Nov 2008 21:39:22 +0000 (22:39 +0100)]
Add the latex and html directories to .gitignore.

These are created by doxygen.

15 years agoAdd more source code documentation.
Andre Noll [Sun, 2 Nov 2008 21:38:31 +0000 (22:38 +0100)]
Add more source code documentation.

15 years agoAdd more derived files to .gitignore.
Andre Noll [Sun, 2 Nov 2008 19:56:33 +0000 (20:56 +0100)]
Add more derived files to .gitignore.

15 years agomake clean: Remove more derived files.
Andre Noll [Sun, 2 Nov 2008 19:53:38 +0000 (20:53 +0100)]
make clean: Remove more derived files.

15 years agoAdd targets %.ppm and %.png.
Andre Noll [Sun, 2 Nov 2008 19:53:24 +0000 (20:53 +0100)]
Add targets %.ppm and %.png.

15 years agoAdd man page, README, INSTALL, generate index.html.
Andre Noll [Sun, 2 Nov 2008 19:48:17 +0000 (20:48 +0100)]
Add man page, README, INSTALL, generate index.html.

Change the layout of the help text so that both the man page and
the index.html look nice.

15 years agoFix quoting of \n and \t in detailed select help.
Andre Noll [Sun, 2 Nov 2008 15:54:59 +0000 (16:54 +0100)]
Fix quoting of \n and \t in detailed select help.

15 years agoAllow comments in interactive input.
Andre Noll [Sun, 2 Nov 2008 15:45:34 +0000 (16:45 +0100)]
Allow comments in interactive input.

This allows to put comments into adu scripts.

15 years agoFix interactive reset command.
Andre Noll [Sun, 2 Nov 2008 15:41:31 +0000 (16:41 +0100)]
Fix interactive reset command.

We have to invalidate both the format info and the array of
admissible urls.

15 years agoMake sure we never use a stale format info pointer in interactive mode.
Andre Noll [Sat, 1 Nov 2008 23:35:29 +0000 (00:35 +0100)]
Make sure we never use a stale format info pointer in interactive mode.

15 years agoparse_format_string(): Explicitly set the result pointer to NULL on errors.
Andre Noll [Sat, 1 Nov 2008 23:33:33 +0000 (00:33 +0100)]
parse_format_string(): Explicitly set the result pointer to NULL on errors.

15 years agoformat_items(): Check for NULL pointers.
Andre Noll [Sat, 1 Nov 2008 23:31:38 +0000 (00:31 +0100)]
format_items(): Check for NULL pointers.

And return NULL in this case, just as for an empty item list.

15 years agoFix a memory lead in interactive mode.
Andre Noll [Sat, 1 Nov 2008 22:56:46 +0000 (23:56 +0100)]
Fix a memory lead in interactive mode.

15 years agoInit the format info struct in interactive mode.
Andre Noll [Sat, 1 Nov 2008 22:47:03 +0000 (23:47 +0100)]
Init the format info struct in interactive mode.

Another bug which causes adu to segfault if used in interactive mode
and without setting any options.

15 years agoImprove interactive feeling, kill dump command.
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.

15 years agoparse_select_options(): Check directly for NULL strings.
Andre Noll [Sat, 1 Nov 2008 21:57:15 +0000 (22:57 +0100)]
parse_select_options(): Check directly for NULL strings.

This is equivalent to checking whether a select option was given
in select mode, but it makes a difference in interactive mode.

15 years agoMake free_format_info() cope with NULL pointers.
Andre Noll [Sat, 1 Nov 2008 21:55:38 +0000 (22:55 +0100)]
Make free_format_info() cope with NULL pointers.

Be liberal with what you take, just as the usual free() function.

15 years agoprint_statistics(): Fix return value.
Andre Noll [Sat, 1 Nov 2008 21:42:33 +0000 (22:42 +0100)]
print_statistics(): Fix return value.

gengeopt should protect us from ever executing this code path,
but anyway.

15 years agoparse_select_options(): Add missing break statements.
Andre Noll [Sat, 1 Nov 2008 21:41:01 +0000 (22:41 +0100)]
parse_select_options(): Add missing break statements.

Doooh. This bug caused that we always used the user_summary_atoms.

15 years agoFix a bug in exec_interactive_command().
Andre Noll [Sat, 1 Nov 2008 21:18:58 +0000 (22:18 +0100)]
Fix a bug in exec_interactive_command().

In case a command iwthout further options was given, p pointed one
byte after the malloced string, and this pointer is passed to the
command handler..

15 years agoMinor documentation improvments.
Andre Noll [Sat, 1 Nov 2008 21:07:23 +0000 (22:07 +0100)]
Minor documentation improvments.

15 years agoMake it easier to print the help for select options.
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.

15 years agoFix parse_uid_arg().
Andre Noll [Sat, 1 Nov 2008 19:22:09 +0000 (20:22 +0100)]
Fix parse_uid_arg().

The old code could segfault if an invalid --user argument was given.

15 years agoAdd format string doku, simplify format string handling.
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.

This further simplifies the select code a bit.

15 years agoMake the array of summary comparators local.
Andre Noll [Sat, 1 Nov 2008 17:02:07 +0000 (18:02 +0100)]
Make the array of summary comparators local.

15 years agoConvert the user-lists to pretty-formating.
Andre Noll [Sat, 1 Nov 2008 16:55:22 +0000 (17:55 +0100)]
Convert the user-lists to pretty-formating.

This allows to get rid of the old formating code and makes a couple
of select options unnecessary. Remove them.

15 years agoFix the user summary.
Andre Noll [Sat, 1 Nov 2008 15:21:30 +0000 (16:21 +0100)]
Fix the user summary.

This broke recently.

Also, rename --sort to --list-sort because there's also the
--user-summary-sort option.

15 years agoFix the global summary.
Andre Noll [Sat, 1 Nov 2008 14:26:57 +0000 (15:26 +0100)]
Fix the global summary.

This broke by the previous patch.

15 years agoIntroduce select-mode and use pretty formating for the global lists.
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.

15 years agoadu.c: Add a comment describing the user table.
Andre Noll [Tue, 28 Oct 2008 07:01:25 +0000 (08:01 +0100)]
adu.c: Add a comment describing the user table.

15 years agoMakefile: Remove also the gengetop source files on make clean.
Andre Noll [Sun, 26 Oct 2008 21:30:34 +0000 (22:30 +0100)]
Makefile: Remove also the gengetop source files on make clean.

15 years agoRemove unused --format select option.
Andre Noll [Sun, 26 Oct 2008 15:41:36 +0000 (16:41 +0100)]
Remove unused --format select option.

15 years agoIntroduce --global-summary-format.
Andre Noll [Sun, 26 Oct 2008 15:06:03 +0000 (16:06 +0100)]
Introduce --global-summary-format.

This allows to pretty-format also the global summary. This patch also
closes some memory leaks.

15 years agoUse the new formating code to print the user summary.
Andre Noll [Sun, 26 Oct 2008 13:19:27 +0000 (14:19 +0100)]
Use the new formating code to print the user summary.

We don't need gengetopt's string parser any more, so don't create the
code for it.

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.