Rename command_util.sh -> command_util.bash. It's a bash script which wouldn't run properly under general POSIX shells.
command_util.sh: Remove unnecessary mkdir command. This crept in five years ago (commit 4c034f8d) for no good reason.
command_util: grep source files only once. Currently we grep once for each template member. This patch speeds up the header mode of command_util.sh by a factor of 3.
Make (most) command handlers static. Now that the array of commands for para_server and para_audiod are read from a header file, the command handlers can be made static if they are in the same file that defines the command array. This patch makes all such handlers static and tweaks command_util.sh to recognize also static functions.
command_util: Remove code for generating .c files. Now that the *_command_list.c files are no longer needed we may remove this mode from command_util.sh. This makes quite a few headers of the .cmd files unused, so these can be removed as well.
command_util: Write array definition in header mode. This modifies command_util.sh so that when it is called in header mode, it also defines a macro for the array of all commands. command.c and audiod_command.c are changed to use the new preprocessor macro. This allows to get rid of the *command_list.c files completely. We may hence remove these files from the various lists of errlist objects in configure.ac. and from error.h. A subsequent patch will clean up the parts that have become unused by this commit.
command_util: Output array members with backslashes. This makes sure that the generated code for the definition of the command array has backslashes at the end of each line. Currently this does not matter because make_array_member() is only called when generating C code where new lines don't matter. However, ending each line with a backslash allows to use the same output for a cpp #define which can go into the header file.
command_util: Avoid empty output lines. Additional empty output lines do not matter for the generated C code or the function declarations in the header files. However, a subsequent commit changes command_util.sh to generate a preprocessor macro for the header file, and there we can not afford empty lines unless they end with a backslash to continue the line. This patch makes sure that no superfluous newlines are printed in the output.
command_util: replace dump_xxx() by make_xxx(). This replace dump_array_member(), dump_completion() and dump_proto() by their make_xxx counterpart. This allows to iterate over all commands twice.
command_util: Kill HC and CC header lines. There is no point in pretty-printing the generated files. Nobody reads these files anyway and doxygen ignores them as well.
Teach command_util to print also completions. This adds completion mode to command_util.sh. When exectuted in this mode, it prints array initializers for all supported commands. This will be used to generate the array of completers for para_client and para_audiod.
command_util: Fix quoting in template_loop(). Without this additional quoting, the command usage string is incorrect in case the template contains square brackets. For example, the usage of the lsblob commands was printed as Usage: lspl [-i] [-l] [-r] t rather than the desired Usage: lspl [-i] [-l] [-r] [pattern] because the command "echo [pattern]" prints "t" since there is a subdirectory called "t" in the source tree.
Remove autogenerated doxygen comments for commands. The generated comments become invalid once rc4.h is removed, which happens in a subsequent patch.
command_util: Replace tabs by \t. Probably does not matter much...
Replace split_args() by create_argv(). The latter function is superior as it honors quotes and special characters like '\n'. This allows for example to use whitespace characters in mood methods. Fixup and simplify all callers accordingly. The patch broke the grab command of para_audiod which is deactivated ATM and will be fixed in a subsequent patch.
command_util: Generate properly documented command header files.
Make rc4 encryption/decryption more explicit. The old code used a rather fancy way to (de)activate encryption on a per fd basis: In net.c there was an array of rc4 keys, indexed by fd. This is rather wastful because the array size is determined by the highest fd for which encryption is activated. It's also hard to comprehend and it's easy to get strange results if one forgets to deactivate the encryption after the fd is closed. This patch introduces a new structure, rc4_context, which consists of an fd and the needed rc4 keys. Users explicitly call the new rc4 variants of the receving/sending functions which take a pointer to a struct rc4_context instead of a file descriptor but are otherwise identical. Keep crypt simple!
a/command_util.sh: Convert template members also in the short description.
command_util.sh: Add missing newline.
Replace shebang in bash scripts. NetBSD does not have /bin/bash.