Remove *.cmd and command_util.bash. The four *.cmd files are no longer needed and can be removed, along with the script which transformed these files into C code. The directory for the generated files, $(build_dir)/cmdlist, can go away as well. With command_util.bash gone, the Makefile can also be cleaned up considerably. In particular, the ugly TOUPPER make function can be removed because it was only used by the command_util recipe. Moreover, The dependencies for the *.command_list.* files are no longer needed. Finally, the sed command which fixed up the dependencies in the *.d files can be simplified.
server: Convert com_ls() to lopsub. This is the final server command to be converted to the lopsub API. Besides the conversion to lopsub, the patch changes the semantics of the ls command in two ways: The deprecated -p option is removed, and the -F option is made the default so that full paths are printed if -b is not given. Regarding the conversion, the patch removes enum ls_flags which used to contain the various flags of the ls command. This information can now be extracted in the callback from the deserialized parse result. Also write_score() is kind of pointless and is replaced by inlining it. Note that make_status_items() is also affected by this patch because it makes use of the infrastructure of the ls command. This function is called from the event handler of the audio file table for events of type AFSI_CHANGE and AFHI_CHANGE. Since no more non-lopsub server commands are left after this patch, several cleanups are possible. These are dealt with in subsequent patches.
server: Convert blob commands to lopsub. This converts all blob commands (ls, cat rm, mv) in one go to lopsub, making the patch rather large. The addblob commands are special in that we must pass not only the blob name given at the command line to the callback but also the blob data which was read from stdin. The command handler does not serialize the parse result like most other commands do, but constructs a query object containing name and data for the callback. Therefore the command handler does not call send_lls_callback_request() but send_callback_request(). We continue to follow this scheme. blob.c contains a few macros which expand to a set of functions, one for each type of bloc (mood, playlist, image, lyrics). These macros have to be adjusted to take another argument because we need the prefixes (e.g., lyr for lyrics) in both upper and lower case and there is no preprocessor toupper().
server: Convert com_addatt() to lopsub. Another simple command without options which is easy to convert. The only thing worth noting is that we now fail the command early if more than 64 arguments are given when previously we only checked that at least one argument is given.
server: Convert com_touch() to lopsub. Another open-coded option parser bites the dust. This also gets rid of struct com_touch_options, along with the ugly convention of passing -1 to the action handler to indicate that the option was not given. The documentation was enhanced slightly and now explains in the [description] section the general concept of the touch command.
server: Convert com_select() to lopsub. Pretty straight-forward conversion since the command does not have any arguments. In the callback handler, we we can't return directly any more since we need to free the serialized parse result.
server: Convert com_rm() to lopsub. This gets rid of the open-coded command line parser in com_rm() and of enum rm_flags. Patterns are now passed to for_each_matching_row() and from there to the action handler remove_audio_file() via ->lpr of struct pattern_match_data.
server: Convert com_rmatt() to lopsub. No change to the action handler, remove_attribute(), necessary.
server: Convert com_cpsi() to lopsub. Allows to get rid of enum cpsi_flags as we pass the flags via the serialized parse result to the callback and the action handler (copy_selector_info()). Also the open-coded command line parser in com_cpsi() can be removed.
server: Convert com_check() to lopsub. Gets rid of enum com_check_flags and the open-coded option parser of com_check(). Also streamlines the help text of the options a bit.
server: Convert com_mvatt() to lopsub. We need to cast the obj->data pointer to a non-constant type because the osl library functions expect void *, which results in a warning without the cast.
server: Convert com_setatt() to lopsub. Introduces ->input_skip for struct pattern_match data. The setatt command uses this to strip the attribute modifies off the unnamed arguments in the lopsub parse result. The remaining arguments are the patterns which are to be matched against each file in the audio file table.
server: Convert com_lsatt() to lopsub. This is the first afs subcommand which needs to pass a pattern list to its callback. The new send_lls_callback_request() provides this functionality. It serializes the parse result into a buffer and passes this buffer to the callback. Since there are non-lopsub commands which also pass a pattern list, action_if_pattern_matches() is patched to receive the pattern list either from the serialized parse result or in the old way via pmd->data. To achieve this, a parse result pointer is added to struct pattern_match_data. If this pointer is not NULL, we are dealing with a subcommand that has been converted. Since the ls subcommand has not been converted yet, lopsub will regard "ls" as a uniqe abbreviation of the lsatt command, which breaks t0004. To work around this, we deactivate prefix matching by only accepting exact matches in run_command(). This workaround can be removed after com_ls() has been converted.
server: Convert com_init() to lopsub. No change necessary for the callback as the init command does not have any options. The only information that must travel from the command handler to the callback is the set of tables to create. The corresponding bitmask is passed without serializing the parse result.
server: Convert com_add() to lopsub. In the callback structure for the add command, replace the flags field by the serialized callback result. This way the callback has access to the full parse result structure.
server: Deprecate ls -p. In v0.6.0 the -p option will have the same meaning as for the rm and touch commands: perform pathname match. Also the default for the ls command will be changed to list full paths while the new -b option must be given to print only the basename (i.e., the current behaviour if -p is not given). This commit is a preparation for these incompatible changes which does not break existing scripts. It does the following * The -p option is deprecated in favor of its synonym, the new -F option (for full path). * The new -b option instructs the command to perform basename matching and print only the basename of the matching files. It is currently a no-op. With the patch applied, scripts are supposed to specify either -b or -F as appropriate. In v0.6.0 the semantics of -p will be changed as described above, the default will be changed to print the full path, and -F will be deprecated because it is a no-op then.
Merge branch 'refs/heads/t/command_handler_cleanups' Cooking for about two months. * refs/heads/t/command_handler_cleanups: (39 commits) com_addatt(): Return negative on errors com_rm(): In force mode, don't complain if no paths matched. aft: Unify handling of hash and path duplicates. afs: Provide pbout para_buffer for each callback. afs: Make afs callbacks more flexible. afs: Rename callback_function to afs_callback. com_check(): Add attribute checking. Let afs_event() return int. playlist_check_callback(): Return negative on errors mood_check_callback(): Return negative on errors com_mvblob(): Return negative on errors com_addblob(): Return negative on errors com_rmblob(): Return negative on errors, cleanup com_catblob(): Return negative on errors com_lsblob(): Return negative on errors rmatt: Cleanup callback. com_rmatt(): Return negative on errors com_mvatt(): Return negative on errors com_lsatt(): Return negative on errors com_init(): Return negative on errors ...
Merge branch 'refs/heads/t/com_ls_compat' A single commit which adds support for the new syntax for the -l and -s options of the ls command. These options should now be specified as -l=v rather than -lv, for example. The old syntax still works, but support will be dropped in v0.6.0. * fdb039 Introduce new syntax for com_ls().
Fix help text of mvblob commands. No references to @member@ are allowed here since there is only one help text for all four mvblob commands. This bug was introduced one year ago in commit aa4b3935 (Overhaul help texts of server and afs commands).
Introduce new syntax for com_ls(). The ls command is the only command that takes one-letter arguments which immediately follow the option. For example, -lv activates verbose listing mode. If we ever want to support short option combining (like in rm -rf) for paraslash commands, the one-letter arguments are problematic because, in the above example, -lv can also be interpreted as -l -v. This commit encourages a different syntax for the -l and -s options of the ls command while keeping the one-letter options working for backwards compatibility. The new official way to enable verbose listing mode is -l=v. This is analogous to how the "stat" and "touch" commands expect their arguments. The ls completer and the documentation are also updated according to the new syntax.