Add incomplete copyright printing.
Remove or disable the /proc relating "isolate" functions.
I will think later on if and how I want to support that.
It may be usefully to have a "--proc=/proc" style long parameter if this is decided to be kept.
Add some needed changes that I missed in the previous commit regarding updating to FLL 0.7.x/0.8.x.
Generalize some of the functions a bit more than previously done.
Add more comments about plans to make the future work easier.
It took me a bit of time to remember where I left off and these comments should now help me in the future.
}
if (main->program.parameters.array[kt_remove_parameter_copyright_e].result & f_console_result_found_e) {
+ main->setting.flag |= kt_remove_main_flag_copyright_e;
+ }
+
+ if (main->program.parameters.array[kt_remove_parameter_block_e].result & f_console_result_found_e) {
main->setting.flag |= kt_remove_main_flag_block_e;
main->setting.flag |= kt_remove_main_flag_option_used_e;
}
}
// kt_remove_parameter_isolate_e, needs additional parameters (all, ignore, or root).
- if (main->program.parameters.array[kt_remove_parameter_isolate_e].result & f_console_result_found_e) {
- main->setting.state.status = F_status_set_error(F_parameter);
-
- kt_remove_print_error_parameter_missing_value_requires_amount(&main->program.error, f_console_symbol_long_normal_s, kt_remove_long_isolate_s, 1);
-
- return;
- }
-
- if (main->program.parameters.array[kt_remove_parameter_isolate_e].result & f_console_result_value_e) {
- total_arguments = main->program.parameters.array[kt_remove_parameter_isolate_e].values.used;
-
- if (main->program.parameters.array[kt_remove_parameter_isolate_e].locations.used != total_arguments) {
- main->setting.state.status = F_status_set_error(F_parameter);
-
- kt_remove_print_error_parameter_missing_value_requires_amount(&main->program.error, f_console_symbol_long_normal_s, kt_remove_long_isolate_s, 1);
-
- return;
- }
-
- index = main->program.parameters.array[kt_remove_parameter_isolate_e].values.array[total_arguments - 1];
-
- if (fl_string_dynamic_compare(kt_remove_all_s, main->program.parameters.arguments.array[index]) == F_equal_to) {
- main->setting.flag |= kt_remove_main_flag_isolate_all_e;
-
- if (main->setting.flag & kt_remove_main_flag_isolate_ignore_e) {
- main->setting.flag -= kt_remove_main_flag_isolate_ignore_e;
- }
-
- if (main->setting.flag & kt_remove_main_flag_isolate_root_e) {
- main->setting.flag -= kt_remove_main_flag_isolate_root_e;
- }
- }
- else if (fl_string_dynamic_compare(kt_remove_ignore_s, main->program.parameters.arguments.array[index]) == F_equal_to) {
- main->setting.flag |= kt_remove_main_flag_isolate_ignore_e;
-
- if (main->setting.flag & kt_remove_main_flag_isolate_all_e) {
- main->setting.flag -= kt_remove_main_flag_isolate_all_e;
- }
-
- if (main->setting.flag & kt_remove_main_flag_isolate_root_e) {
- main->setting.flag -= kt_remove_main_flag_isolate_root_e;
- }
- }
- else if (fl_string_dynamic_compare(kt_remove_root_s, main->program.parameters.arguments.array[index]) == F_equal_to) {
- main->setting.flag |= kt_remove_main_flag_isolate_root_e;
-
- if (main->setting.flag & kt_remove_main_flag_isolate_all_e) {
- main->setting.flag -= kt_remove_main_flag_isolate_all_e;
- }
-
- if (main->setting.flag & kt_remove_main_flag_isolate_ignore_e) {
- main->setting.flag -= kt_remove_main_flag_isolate_ignore_e;
- }
- }
- else {
- main->setting.state.status = F_status_set_error(F_parameter);
-
- kt_remove_print_error_parameter_unknown_value(&main->program.error, f_console_symbol_long_normal_s, kt_remove_long_isolate_s, main->program.parameters.arguments.array[index]);
-
- return;
- }
- }
+ // Currently not supported, requires /proc support.
+ //if (main->program.parameters.array[kt_remove_parameter_isolate_e].result & f_console_result_found_e) {
+ // main->setting.state.status = F_status_set_error(F_parameter);
+ //
+ // kt_remove_print_error_parameter_missing_value_requires_amount(&main->program.error, f_console_symbol_long_normal_s, kt_remove_long_isolate_s, 1);
+ //
+ // return;
+ //}
+ //
+ //if (main->program.parameters.array[kt_remove_parameter_isolate_e].result & f_console_result_value_e) {
+ // total_arguments = main->program.parameters.array[kt_remove_parameter_isolate_e].values.used;
+ //
+ // if (main->program.parameters.array[kt_remove_parameter_isolate_e].locations.used != total_arguments) {
+ // main->setting.state.status = F_status_set_error(F_parameter);
+ //
+ // kt_remove_print_error_parameter_missing_value_requires_amount(&main->program.error, f_console_symbol_long_normal_s, kt_remove_long_isolate_s, 1);
+ //
+ // return;
+ // }
+ //
+ // index = main->program.parameters.array[kt_remove_parameter_isolate_e].values.array[total_arguments - 1];
+ //
+ // if (fl_string_dynamic_compare(kt_remove_all_s, main->program.parameters.arguments.array[index]) == F_equal_to) {
+ // main->setting.flag |= kt_remove_main_flag_isolate_all_e;
+ //
+ // if (main->setting.flag & kt_remove_main_flag_isolate_ignore_e) {
+ // main->setting.flag -= kt_remove_main_flag_isolate_ignore_e;
+ // }
+ //
+ // if (main->setting.flag & kt_remove_main_flag_isolate_root_e) {
+ // main->setting.flag -= kt_remove_main_flag_isolate_root_e;
+ // }
+ // }
+ // else if (fl_string_dynamic_compare(kt_remove_ignore_s, main->program.parameters.arguments.array[index]) == F_equal_to) {
+ // main->setting.flag |= kt_remove_main_flag_isolate_ignore_e;
+ //
+ // if (main->setting.flag & kt_remove_main_flag_isolate_all_e) {
+ // main->setting.flag -= kt_remove_main_flag_isolate_all_e;
+ // }
+ //
+ // if (main->setting.flag & kt_remove_main_flag_isolate_root_e) {
+ // main->setting.flag -= kt_remove_main_flag_isolate_root_e;
+ // }
+ // }
+ // else if (fl_string_dynamic_compare(kt_remove_root_s, main->program.parameters.arguments.array[index]) == F_equal_to) {
+ // main->setting.flag |= kt_remove_main_flag_isolate_root_e;
+ //
+ // if (main->setting.flag & kt_remove_main_flag_isolate_all_e) {
+ // main->setting.flag -= kt_remove_main_flag_isolate_all_e;
+ // }
+ //
+ // if (main->setting.flag & kt_remove_main_flag_isolate_ignore_e) {
+ // main->setting.flag -= kt_remove_main_flag_isolate_ignore_e;
+ // }
+ // }
+ // else {
+ // main->setting.state.status = F_status_set_error(F_parameter);
+ //
+ // kt_remove_print_error_parameter_unknown_value(&main->program.error, f_console_symbol_long_normal_s, kt_remove_long_isolate_s, main->program.parameters.arguments.array[index]);
+ //
+ // return;
+ // }
+ //}
// kt_remove_parameter_mode_e, needs additional parameters (modes, match parameters).
if (main->program.parameters.array[kt_remove_parameter_mode_e].result & f_console_result_found_e) {
*
* kt_remove_main_flag_*_e:
* - none: No flags set.
- * - accessed: @todo
+ * - accessed: Remove by last accessed datetime.
* - block: Remove by file type: block.
* - character: Remove by file type: character.
* - copyright: Print copyright.
- * - created: @todo
+ * - created: Remove by created datetime.
* - different: Remove by user different from caller.
* - directory: Remove by file type: directory.
* - empty_only: Remove empty directories.
* - force: Forcibly delete.
* - group: Remove by GID.
* - help: Print help.
- * - isolate_all: Isolate to a single file system, error on all outside file system files (@todo requires /proc support).
- * - isolate_ignore: Ignore rather than fail for anything on a different file system (@todo requires /proc support).
- * - isolate_root: Isolate to a single file system, error on remove on '/' (@todo requires /proc support).
+ * - isolate_all: Isolate to a single file system, error on all outside file system files (not implemented, requires /proc support).
+ * - isolate_ignore: Ignore rather than fail for anything on a different file system (not implemented, requires /proc support).
+ * - isolate_root: Isolate to a single file system, error on remove on '/' (not implemented, requires /proc support).
* - link: Remove by file type: link.
* - mode: Remove by mode.
* - option_used: This gets set when when certain options are specified to toggle the default match detection boolean during removal of each file.
* - simulate: Do not actually perform deletes, instead print messages (when silent, should still return 0 or 1).
* - socket: Remove by file type: socket.
* - tree: Remove directory tree (parent directories) (remove a/b/c, removes a/b/c, then a/b/, then a).
+ * - updated: Remove by last updated datetime.
* - user: Remove by UID.
* - utc: Process dates in UTC mode.
* - version: Print version.
#endif // _di_kt_remove_flag_convert_e_
/**
- * Flags associated with a date.
+ * Flags associated with a datetime.
*
* kt_remove_flag_date_*_e:
* - none: No flags set.
#endif // _di_kt_remove_flag_mode_e_
/**
+ * Flags associated with performing an operation on a file.
+ *
+ * kt_remove_flag_file_operate_*_e:
+ * - none: No flags set.
+ * - directory: Is a directory.
+ * - recurse: Perform recursively (only on directories).
+ * - remove: Perform remove.
+ */
+#ifndef _di_kt_remove_flag_file_operate_e_
+ enum {
+ kt_remove_flag_file_operate_none_e = 0x0,
+ kt_remove_flag_file_operate_directory_e = 0x1,
+ kt_remove_flag_file_operate_recurse_e = 0x2,
+ kt_remove_flag_file_operate_remove_e = 0x4,
+ }; // enum
+#endif // _di_kt_remove_flag_file_operate_e_
+
+/**
* The main program parameters.
*/
#ifndef _di_kt_remove_parameter_e_
kt_remove_parameter_follow_e,
kt_remove_parameter_force_e,
kt_remove_parameter_group_e,
- kt_remove_parameter_isolate_e,
+ //kt_remove_parameter_isolate_e, // Not implemented.
kt_remove_parameter_link_e,
kt_remove_parameter_local_e,
kt_remove_parameter_mode_e,
#define kt_remove_console_parameter_t_initialize \
{ \
- macro_f_console_parameter_t_initialize_3(f_console_standard_short_help_s, f_console_standard_long_help_s, 0, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_3(f_console_standard_short_copyright_s, f_console_standard_long_copyright_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_3(f_console_standard_short_light_s, f_console_standard_long_light_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_3(f_console_standard_short_dark_s, f_console_standard_long_dark_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_3(f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_3(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_3(f_console_standard_short_error_s, f_console_standard_long_error_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_3(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_3(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_3(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_3(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_first_no_s, f_console_standard_long_line_first_no_s, 0, f_console_flag_inverse_e), \
- macro_f_console_parameter_t_initialize_3(f_console_standard_short_line_last_no_s, f_console_standard_long_line_last_no_s, 0, f_console_flag_inverse_e), \
+ macro_fll_program_console_parameter_standard_initialize, \
\
macro_f_console_parameter_t_initialize_3(kt_remove_short_accessed_s, kt_remove_long_accessed_s, 2, f_console_flag_normal_e), \
macro_f_console_parameter_t_initialize_3(kt_remove_short_block_s, kt_remove_long_block_s, 0, f_console_flag_normal_e), \
macro_f_console_parameter_t_initialize_3(kt_remove_short_follow_s, kt_remove_long_follow_s, 0, f_console_flag_normal_e), \
macro_f_console_parameter_t_initialize_3(kt_remove_short_force_s, kt_remove_long_force_s, 0, f_console_flag_normal_e), \
macro_f_console_parameter_t_initialize_3(kt_remove_short_group_s, kt_remove_long_group_s, 1, f_console_flag_normal_e), \
- macro_f_console_parameter_t_initialize_3(kt_remove_short_isolate_s, kt_remove_long_isolate_s, 1, f_console_flag_normal_e), \
macro_f_console_parameter_t_initialize_3(kt_remove_short_link_s, kt_remove_long_link_s, 0, f_console_flag_normal_e), \
macro_f_console_parameter_t_initialize_5( kt_remove_long_local_s, 0, f_console_flag_normal_e), \
macro_f_console_parameter_t_initialize_3(kt_remove_short_mode_s, kt_remove_long_mode_s, 2, f_console_flag_normal_e), \
macro_f_console_parameter_t_initialize_5( kt_remove_long_utc_s, 0, f_console_flag_normal_e), \
}
- #define kt_remove_total_parameters_d 39
+ #define kt_remove_total_parameters_d 38
#endif // _di_kt_remove_parameter_e_
/**
const f_string_static_t kt_remove_once_s = macro_f_string_static_t_initialize(KT_REMOVE_once_s, 0, KT_REMOVE_once_s_length);
const f_string_static_t kt_remove_only_s = macro_f_string_static_t_initialize(KT_REMOVE_only_s, 0, KT_REMOVE_only_s_length);
const f_string_static_t kt_remove_only_fail_s = macro_f_string_static_t_initialize(KT_REMOVE_only_fail_s, 0, KT_REMOVE_only_fail_s_length);
+ const f_string_static_t kt_remove_recurse_s = macro_f_string_static_t_initialize(KT_REMOVE_recurse_s, 0, KT_REMOVE_recurse_s_length);
const f_string_static_t kt_remove_remove_s = macro_f_string_static_t_initialize(KT_REMOVE_remove_s, 0, KT_REMOVE_remove_s_length);
const f_string_static_t kt_remove_root_s = macro_f_string_static_t_initialize(KT_REMOVE_root_s, 0, KT_REMOVE_root_s_length);
const f_string_static_t kt_remove_today_s = macro_f_string_static_t_initialize(KT_REMOVE_today_s, 0, KT_REMOVE_today_s_length);
#define KT_REMOVE_once_s "once"
#define KT_REMOVE_only_s "only"
#define KT_REMOVE_only_fail_s "only_fail"
+ #define KT_REMOVE_recurse_s "recurse"
#define KT_REMOVE_remove_s "remove"
#define KT_REMOVE_root_s "root"
#define KT_REMOVE_today_s "today"
#define KT_REMOVE_once_s_length 4
#define KT_REMOVE_only_s_length 4
#define KT_REMOVE_only_fail_s_length 9
+ #define KT_REMOVE_recurse_s_length 7
#define KT_REMOVE_remove_s_length 6
#define KT_REMOVE_root_s_length 4
#define KT_REMOVE_today_s_length 5
extern const f_string_static_t kt_remove_once_s;
extern const f_string_static_t kt_remove_only_s;
extern const f_string_static_t kt_remove_only_fail_s;
+ extern const f_string_static_t kt_remove_recurse_s;
extern const f_string_static_t kt_remove_remove_s;
extern const f_string_static_t kt_remove_root_s;
extern const f_string_static_t kt_remove_today_s;
* groups: An array of Group IDs (gid_t) represented via an unsigned 32-bit integer.
* users: An array of Group IDs (uid_t) represented via an unsigned 32-bit integer.
*
- * process_help: Process help (generally printing help).
- * process_normal: Process normally (data from parameters and files).
+ * process_help: Process help (generally printing help).
+ * process_normal: Process normally (data from parameters and files).
+ * process_operate_file: Process an individual file, returning F_done to designate handled, and F_none for letting parent continue handling.
*/
#ifndef _di_kt_remove_setting_t_
typedef struct {
f_status_t (*process_help)(void * const main);
void (*process_normal)(void * const main);
+ void (*process_operate_file)(void * const main, const f_string_static_t path, const struct stat statistics, uint8_t * const flag);
} kt_remove_setting_t;
#define kt_remove_setting_t_initialize \
0, \
0, \
0, \
+ 0, \
}
#endif // _di_kt_remove_setting_t_
}
if (main->setting.state.status == F_false) {
- kt_remove_print_simulate_operate_remove(&main->program.output, F_false, F_false);
+ kt_remove_print_simulate_operate_boolean(&main->program.output, kt_remove_remove_s, F_false);
return;
}
if (main->program.signal_received) return;
f_array_length_t i = 0;
- f_status_t remove = (main->setting.flag & kt_remove_main_flag_option_used_e) ? F_false : F_true;
+ uint8_t flag = (main->setting.flag & kt_remove_main_flag_option_used_e) ? 0 : kt_remove_flag_file_operate_remove_e;
struct stat statistics;
if (main->setting.flag & kt_remove_main_flag_block_e) {
if (macro_f_file_type_get(statistics.st_mode) == F_file_type_block_d) {
- remove = F_true;
+ flag |= kt_remove_flag_file_operate_remove_e;
}
}
if (main->setting.flag & kt_remove_main_flag_character_e) {
if (macro_f_file_type_get(statistics.st_mode) == F_file_type_character_d) {
- remove = F_true;
+ flag |= kt_remove_flag_file_operate_remove_e;
}
}
- if (main->setting.flag & kt_remove_main_flag_directory_e) {
- if (macro_f_file_type_get(statistics.st_mode) == F_file_type_directory_d) {
- remove = F_true;
+ if (macro_f_file_type_get(statistics.st_mode) == F_file_type_directory_d) {
+ flag |= kt_remove_flag_file_operate_directory_e;
+
+ if (main->setting.flag & kt_remove_main_flag_directory_e) {
+ flag |= kt_remove_flag_file_operate_remove_e;
}
}
if (main->setting.flag & kt_remove_main_flag_fifo_e) {
if (macro_f_file_type_get(statistics.st_mode) == F_file_type_fifo_d) {
- remove = F_true;
+ flag |= kt_remove_flag_file_operate_remove_e;
}
}
if (main->setting.flag & kt_remove_main_flag_link_e) {
if (macro_f_file_type_get(statistics.st_mode) == F_file_type_link_d) {
- remove = F_true;
+ flag |= kt_remove_flag_file_operate_remove_e;
}
}
if (main->setting.flag & kt_remove_main_flag_regular_e) {
if (macro_f_file_type_get(statistics.st_mode) == F_file_type_regular_d) {
- remove = F_true;
+ flag |= kt_remove_flag_file_operate_remove_e;
}
}
if (main->setting.flag & kt_remove_main_flag_socket_e) {
if (macro_f_file_type_get(statistics.st_mode) == F_file_type_socket_d) {
- remove = F_true;
+ flag |= kt_remove_flag_file_operate_remove_e;
}
}
- if (main->program.signal_received) return;
-
if (main->setting.flag & kt_remove_main_flag_user_e) {
for (i = 0; i < main->setting.users.used; ++i) {
+
+ if (main->program.signal_received) return;
if (statistics.st_uid == (uid_t) main->setting.users.array[i]) break;
} // for
if (i < main->setting.users.used) {
- remove = F_true;
+ flag |= kt_remove_flag_file_operate_remove_e;
}
}
if (main->setting.flag & kt_remove_main_flag_same_e) {
if (statistics.st_uid != geteuid()) {
- remove = F_true;
+ flag |= kt_remove_flag_file_operate_remove_e;
}
}
if (main->setting.flag & kt_remove_main_flag_different_e) {
if (statistics.st_uid == geteuid()) {
- remove = F_true;
+ flag |= kt_remove_flag_file_operate_remove_e;
}
}
if (main->setting.flag & kt_remove_main_flag_group_e) {
for (i = 0; i < main->setting.groups.used; ++i) {
+
+ if (main->program.signal_received) return;
if (statistics.st_gid == (gid_t) main->setting.groups.array[i]) break;
} // for
if (i < main->setting.groups.used) {
- remove = F_true;
+ flag |= kt_remove_flag_file_operate_remove_e;
}
}
for (i = 0; i < main->setting.modes.used; ++i) {
+ if (main->program.signal_received) return;
+
if (main->setting.modes.array[i].type == kt_remove_flag_mode_different_e) {
if (main->setting.modes.array[i].mode & ~mode) break;
}
} // for
if (i < main->setting.modes.used) {
- remove = F_true;
+ flag |= kt_remove_flag_file_operate_remove_e;
}
- }
- if (main->program.signal_received) return;
+ if (main->setting.flag & kt_remove_main_flag_recurse_e) {
+ flag |= kt_remove_flag_file_operate_recurse_e;
+ }
- main->setting.state.status = F_none;
+ if (main->setting.flag & kt_remove_main_flag_force_e) {
+ flag |= kt_remove_flag_file_operate_remove_e;
+ }
- if (main->setting.flag & kt_remove_main_flag_force_e) {
- remove = F_true;
+ // Trigger the callback to make any modifications before simulating or performing the removal.
+ if (main->setting.process_operate_file) {
+ main->setting.state.status = F_none;
- kt_remove_print_simulate_operate_remove(&main->program.output, remove, F_true);
+ main->setting.process_operate_file((void *) main, path, statistics, &flag);
+ if (F_status_is_error(main->setting.state.status)) return;
+
+ if (main->setting.state.status == F_done) {
+ main->setting.state.status = F_none;
+
+ return;
+ }
+ }
+
+ main->setting.state.status = F_none;
}
- // @todo add check here to see if file is a directory, apply any appropriate restrictions (such as not removing non-empty directories without force or recursive).
+ if (main->setting.flag & kt_remove_main_flag_force_e) {
+ kt_remove_print_simulate_operate_boolean(&main->program.output, kt_remove_force_s, F_true);
+ }
- // @todo
+ if (flag & kt_remove_flag_file_operate_directory_e) {
+ kt_remove_print_simulate_operate_boolean(&main->program.output, kt_remove_recurse_s, flag & kt_remove_flag_file_operate_recurse_e);
+ }
- kt_remove_print_simulate_operate_remove(&main->program.output, remove, F_false);
+ // @todo add check here to see if file is a directory, apply any appropriate restrictions (such as not removing non-empty directories without force or recursive).
+ // @todo be sure too handle all of the remaining flags, such as tree, force, recurse, etc...:
+ // - kt_remove_main_flag_accessed_e
+ // - kt_remove_main_flag_created_e
+ // - kt_remove_main_flag_empty_only_e
+ // - kt_remove_main_flag_empty_only_fail_e
+ // - kt_remove_main_flag_empty_not_e
+ // - kt_remove_main_flag_empty_not_fail_e
+ // - kt_remove_main_flag_prompt_all_e
+ // - kt_remove_main_flag_prompt_follow_e
+ // - kt_remove_main_flag_prompt_never_e
+ // - kt_remove_main_flag_prompt_once_e
+ // - kt_remove_main_flag_recurse_e
+ // - kt_remove_main_flag_tree_e
+ // - kt_remove_main_flag_updated_e
+
+ kt_remove_print_simulate_operate_boolean(&main->program.output, kt_remove_remove_s, flag & kt_remove_flag_file_operate_remove_e);
// @todo do actual removal.
- // @todo be sure too handle all of the remaining flags, such as tree, force, recurse, etc...
}
#endif // _di_kt_remove_operate_file_
fll_program_print_help_option(print, kt_remove_short_follow_s, kt_remove_long_follow_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Remove the file being pointed to rather than the symbolic link itself.");
fll_program_print_help_option(print, kt_remove_short_force_s, kt_remove_long_force_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Forcibly perform remove.");
fll_program_print_help_option(print, kt_remove_short_group_s, kt_remove_long_group_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Remove by file group ID or name.");
- fll_program_print_help_option(print, kt_remove_short_isolate_s, kt_remove_long_isolate_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Isolate remove based on filesystem.");
+ //fll_program_print_help_option(print, kt_remove_short_isolate_s, kt_remove_long_isolate_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Isolate remove based on filesystem."); // Not implemented.
fll_program_print_help_option(print, kt_remove_short_link_s, kt_remove_long_link_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Remove by file type of link.");
fll_program_print_help_option(print, kt_remove_short_mode_s, kt_remove_long_mode_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Remove by file mode.");
fll_program_print_help_option(print, kt_remove_short_prompt_s, kt_remove_long_prompt_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Prompt before removing.");
fl_print_format(" - '%[%r%]': Remove directories that are empty.%r", print->to, context.set.notable, kt_remove_only_s, context.set.notable, f_string_eol_s);
fl_print_format(" - '%[%r%]': Fail when removing directoies that are empty.%r%r", print->to, context.set.notable, kt_remove_only_fail_s, context.set.notable, f_string_eol_s, f_string_eol_s);
- fl_print_format(" The parameter '%[%r%r%]' supports the following values:%r", print->to, context.set.notable, f_console_symbol_long_normal_s, kt_remove_long_isolate_s, context.set.notable, f_string_eol_s);
- fl_print_format(" - '%[%r%]': Isolate to a single file system, error on all files outside of the file system.%r", print->to, context.set.notable, kt_remove_all_s, context.set.notable, f_string_eol_s);
- fl_print_format(" - '%[%r%]': Ignore rather than erroring on problems outside the file system.%r", print->to, context.set.notable, kt_remove_ignore_s, context.set.notable, f_string_eol_s);
- fl_print_format(" - '%[%r%]': Isolate to a single file system, error on '/'.%r%r", print->to, context.set.notable, kt_remove_root_s, context.set.notable, f_string_eol_s, f_string_eol_s);
-
- // @todo "isolate" needs to optionally pass, ignoring when /proc is not available or fail when /proc is not available.
- // @todo "/proc" needs to be configurable define macro and use that string here.
+ // Not being implemented currently, but may be in the future so the basic setup code is remaining.
+ //fl_print_format(" The parameter '%[%r%r%]' supports the following values:%r", print->to, context.set.notable, f_console_symbol_long_normal_s, kt_remove_long_isolate_s, context.set.notable, f_string_eol_s);
+ //fl_print_format(" - '%[%r%]': Isolate to a single file system, error on all files outside of the file system.%r", print->to, context.set.notable, kt_remove_all_s, context.set.notable, f_string_eol_s);
+ //fl_print_format(" - '%[%r%]': Ignore rather than erroring on problems outside the file system.%r", print->to, context.set.notable, kt_remove_ignore_s, context.set.notable, f_string_eol_s);
+ //fl_print_format(" - '%[%r%]': Isolate to a single file system, error on '/'.%r%r", print->to, context.set.notable, kt_remove_root_s, context.set.notable, f_string_eol_s, f_string_eol_s);
fl_print_format(" The parameter '%[%r%r%]' supports the following values:%r", print->to, context.set.notable, f_console_symbol_long_normal_s, kt_remove_long_prompt_s, context.set.notable, f_string_eol_s);
fl_print_format(" - '%[%r%]': Operate in interactive mode, prompting for every file.%r", print->to, context.set.notable, kt_remove_all_s, context.set.notable, f_string_eol_s);
f_file_stream_lock(print->to);
- fl_print_format("%r%[Files to Remove%]:%r", print->to, f_string_eol_s, print->set->title, print->set->title, f_string_eol_s);
+ fl_print_format("%[Files to Remove%]:%r", print->to, print->set->title, print->set->title, f_string_eol_s);
for (f_array_length_t i = 0; i < main->setting.files.used; ++i) {
fl_print_format(" %Q%r", print->to, main->setting.files.array[i], f_string_eol_s);
}
#endif // _di_kt_remove_print_simulate_operate_file_stat_
-#ifndef _di_kt_remove_print_simulate_operate_remove_
- void kt_remove_print_simulate_operate_remove(fl_print_t * const print, const bool yes, const bool force) {
+#ifndef _di_kt_remove_print_simulate_operate_boolean_
+ void kt_remove_print_simulate_operate_boolean(fl_print_t * const print, const f_string_static_t name, const bool yes) {
if (!print || !print->custom) return;
if (!(main->setting.flag & kt_remove_main_flag_simulate_e)) return;
- fll_print_format(" %r %r%r", main->program.output.to, force ? kt_remove_force_s : kt_remove_remove_s, yes ? kt_remove_yes_s : kt_remove_no_s, f_string_eol_s);
+ fll_print_format(" %r %r%r", main->program.output.to, name, yes ? kt_remove_yes_s : kt_remove_no_s, f_string_eol_s);
}
-#endif // _di_kt_remove_print_simulate_operate_remove_
+#endif // _di_kt_remove_print_simulate_operate_boolean_
#ifdef __cplusplus
} // extern "C"
#endif // _di_kt_remove_print_simulate_operate_file_stat_
/**
- * Simulate operate on a single file, designate that file is to be removed or not removed (forcibly or otherwise).
+ * Print a boolean message for some named parameter regarding the simulation.
*
* This does nothing if the simulate flag (kt_remove_flag_simulate_e) is not set.
*
* This locks, uses, and unlocks the file stream.
*
* This does not alter print.custom.setting.state.status.
+ * @param name
+ * The name printed to be assocaited with the boolean value.
* @param yes
- * If TRUE, then this is to be removed.
- * If FALSE, then this is not to be removed.
- * @param force
- * If TRUE, then this prints a message about being forced.
- * If FALSE, then this prints a message about being removed.
+ * If TRUE, then print "yes".
+ * If FALSE, then print "no".
*/
-#ifndef _di_kt_remove_print_simulate_operate_remove_
- extern void kt_remove_print_simulate_operate_remove(fl_print_t * const print, const bool yes, const bool force);
-#endif // _di_kt_remove_print_simulate_operate_remove_
+#ifndef _di_kt_remove_print_simulate_operate_boolean_
+ extern void kt_remove_print_simulate_operate_boolean(fl_print_t * const print, const f_string_static_t name, const bool yes);
+#endif // _di_kt_remove_print_simulate_operate_boolean_
#ifdef __cplusplus
} // extern "C"