From: Kevin Day Date: Sun, 18 Jun 2023 14:41:12 +0000 (-0500) Subject: Bugfix: The Unix "ctim" is not "create" time but instead is "change" time. X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=8c1d2a644852158938a9937bafa1f7c9b935410a;p=kevux-tools Bugfix: The Unix "ctim" is not "create" time but instead is "change" time. Rename the parameter options from "create" to "change". It would be great to have a "create" option, but that is not available. --- diff --git a/sources/c/remove/main/common.c b/sources/c/remove/main/common.c index d261045..6d94a55 100644 --- a/sources/c/remove/main/common.c +++ b/sources/c/remove/main/common.c @@ -53,7 +53,7 @@ extern "C" { f_string_dynamics_resize(0, &setting->files); kt_remove_dates_resize(0, &setting->accessed); - kt_remove_dates_resize(0, &setting->created); + kt_remove_dates_resize(0, &setting->changed); kt_remove_dates_resize(0, &setting->updated); kt_remove_modes_resize(0, &setting->modes); @@ -282,25 +282,25 @@ extern "C" { { f_console_parameter_t * const parameters[] = { &main->program.parameters.array[kt_remove_parameter_accessed_e], - &main->program.parameters.array[kt_remove_parameter_created_e], + &main->program.parameters.array[kt_remove_parameter_changed_e], &main->program.parameters.array[kt_remove_parameter_updated_e], }; kt_remove_dates_t * const dates[] = { &main->setting.accessed, - &main->setting.created, + &main->setting.changed, &main->setting.updated, }; const f_string_static_t longs[] = { kt_remove_long_accessed_s, - kt_remove_long_created_s, + kt_remove_long_changed_s, kt_remove_long_updated_s, }; for (uint8_t p = 0; p < 3; ++p) { - // kt_remove_parameter_accessed_e, kt_remove_parameter_created_e, kt_remove_parameter_updated_e, needs additional parameters, ==, <, <=, >, >=, <>. + // kt_remove_parameter_accessed_e, kt_remove_parameter_changed_e, kt_remove_parameter_updated_e, needs additional parameters, ==, <, <=, >, >=, <>. if (parameters[p]->result & f_console_result_found_e) { main->setting.state.status = F_status_set_error(F_parameter); diff --git a/sources/c/remove/main/common/enumeration.h b/sources/c/remove/main/common/enumeration.h index 67e628c..1686a2d 100644 --- a/sources/c/remove/main/common/enumeration.h +++ b/sources/c/remove/main/common/enumeration.h @@ -25,7 +25,7 @@ extern "C" { * - block: Remove by file type: block. * - character: Remove by file type: character. * - copyright: Print copyright. - * - created: Remove by created datetime. + * - changed: Remove by changed datetime. * - different: Remove by user different from caller. * - directory: Remove by file type: directory. * - empty_only: Remove empty directories. @@ -67,7 +67,7 @@ extern "C" { kt_remove_main_flag_block_e = 0x2, kt_remove_main_flag_character_e = 0x4, kt_remove_main_flag_copyright_e = 0x8, - kt_remove_main_flag_created_e = 0x10, + kt_remove_main_flag_changed_e = 0x10, kt_remove_main_flag_different_e = 0x20, kt_remove_main_flag_directory_e = 0x40, kt_remove_main_flag_empty_only_e = 0x80, @@ -236,7 +236,7 @@ extern "C" { kt_remove_parameter_accessed_e, kt_remove_parameter_block_e, kt_remove_parameter_character_e, - kt_remove_parameter_created_e, + kt_remove_parameter_changed_e, kt_remove_parameter_different_e, kt_remove_parameter_directory_e, kt_remove_parameter_empty_e, @@ -268,7 +268,7 @@ extern "C" { 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_character_s, kt_remove_long_character_s, 0, f_console_flag_normal_e), \ - macro_f_console_parameter_t_initialize_3(kt_remove_short_created_s, kt_remove_long_created_s, 2, f_console_flag_normal_e), \ + macro_f_console_parameter_t_initialize_3(kt_remove_short_changed_s, kt_remove_long_changed_s, 2, f_console_flag_normal_e), \ macro_f_console_parameter_t_initialize_3(kt_remove_short_different_s, kt_remove_long_different_s, 0, f_console_flag_normal_e), \ macro_f_console_parameter_t_initialize_3(kt_remove_short_directory_s, kt_remove_long_directory_s, 0, f_console_flag_normal_e), \ macro_f_console_parameter_t_initialize_3(kt_remove_short_empty_s, kt_remove_long_empty_s, 1, f_console_flag_normal_e), \ diff --git a/sources/c/remove/main/common/string.c b/sources/c/remove/main/common/string.c index 2c91d0c..cf192b3 100644 --- a/sources/c/remove/main/common/string.c +++ b/sources/c/remove/main/common/string.c @@ -103,7 +103,7 @@ extern "C" { const f_string_static_t kt_remove_short_accessed_s = macro_f_string_static_t_initialize_1(KT_REMOVE_short_accessed_s, 0, KT_REMOVE_short_accessed_s_length); const f_string_static_t kt_remove_short_block_s = macro_f_string_static_t_initialize_1(KT_REMOVE_short_block_s, 0, KT_REMOVE_short_block_s_length); const f_string_static_t kt_remove_short_character_s = macro_f_string_static_t_initialize_1(KT_REMOVE_short_character_s, 0, KT_REMOVE_short_character_s_length); - const f_string_static_t kt_remove_short_created_s = macro_f_string_static_t_initialize_1(KT_REMOVE_short_created_s, 0, KT_REMOVE_short_created_s_length); + const f_string_static_t kt_remove_short_changed_s = macro_f_string_static_t_initialize_1(KT_REMOVE_short_changed_s, 0, KT_REMOVE_short_changed_s_length); const f_string_static_t kt_remove_short_different_s = macro_f_string_static_t_initialize_1(KT_REMOVE_short_different_s, 0, KT_REMOVE_short_different_s_length); const f_string_static_t kt_remove_short_directory_s = macro_f_string_static_t_initialize_1(KT_REMOVE_short_directory_s, 0, KT_REMOVE_short_directory_s_length); const f_string_static_t kt_remove_short_empty_s = macro_f_string_static_t_initialize_1(KT_REMOVE_short_empty_s, 0, KT_REMOVE_short_empty_s_length); @@ -128,7 +128,7 @@ extern "C" { const f_string_static_t kt_remove_long_accessed_s = macro_f_string_static_t_initialize_1(KT_REMOVE_long_accessed_s, 0, KT_REMOVE_long_accessed_s_length); const f_string_static_t kt_remove_long_block_s = macro_f_string_static_t_initialize_1(KT_REMOVE_long_block_s, 0, KT_REMOVE_long_block_s_length); const f_string_static_t kt_remove_long_character_s = macro_f_string_static_t_initialize_1(KT_REMOVE_long_character_s, 0, KT_REMOVE_long_character_s_length); - const f_string_static_t kt_remove_long_created_s = macro_f_string_static_t_initialize_1(KT_REMOVE_long_created_s, 0, KT_REMOVE_long_created_s_length); + const f_string_static_t kt_remove_long_changed_s = macro_f_string_static_t_initialize_1(KT_REMOVE_long_changed_s, 0, KT_REMOVE_long_changed_s_length); const f_string_static_t kt_remove_long_different_s = macro_f_string_static_t_initialize_1(KT_REMOVE_long_different_s, 0, KT_REMOVE_long_different_s_length); const f_string_static_t kt_remove_long_directory_s = macro_f_string_static_t_initialize_1(KT_REMOVE_long_directory_s, 0, KT_REMOVE_long_directory_s_length); const f_string_static_t kt_remove_long_empty_s = macro_f_string_static_t_initialize_1(KT_REMOVE_long_empty_s, 0, KT_REMOVE_long_empty_s_length); diff --git a/sources/c/remove/main/common/string.h b/sources/c/remove/main/common/string.h index 14e4f4f..57245ab 100644 --- a/sources/c/remove/main/common/string.h +++ b/sources/c/remove/main/common/string.h @@ -366,7 +366,7 @@ extern "C" { #define KT_REMOVE_short_accessed_s "A" #define KT_REMOVE_short_block_s "b" #define KT_REMOVE_short_character_s "c" - #define KT_REMOVE_short_created_s "C" + #define KT_REMOVE_short_changed_s "C" #define KT_REMOVE_short_different_s "O" #define KT_REMOVE_short_directory_s "d" #define KT_REMOVE_short_empty_s "e" @@ -391,7 +391,7 @@ extern "C" { #define KT_REMOVE_long_accessed_s "accessed" #define KT_REMOVE_long_block_s "block" #define KT_REMOVE_long_character_s "character" - #define KT_REMOVE_long_created_s "created" + #define KT_REMOVE_long_changed_s "changed" #define KT_REMOVE_long_different_s "different" #define KT_REMOVE_long_directory_s "directory" #define KT_REMOVE_long_empty_s "empty" @@ -418,7 +418,7 @@ extern "C" { #define KT_REMOVE_short_accessed_s_length 1 #define KT_REMOVE_short_block_s_length 1 #define KT_REMOVE_short_character_s_length 1 - #define KT_REMOVE_short_created_s_length 1 + #define KT_REMOVE_short_changed_s_length 1 #define KT_REMOVE_short_different_s_length 1 #define KT_REMOVE_short_directory_s_length 1 #define KT_REMOVE_short_empty_s_length 1 @@ -443,7 +443,7 @@ extern "C" { #define KT_REMOVE_long_accessed_s_length 8 #define KT_REMOVE_long_block_s_length 6 #define KT_REMOVE_long_character_s_length 9 - #define KT_REMOVE_long_created_s_length 7 + #define KT_REMOVE_long_changed_s_length 7 #define KT_REMOVE_long_different_s_length 9 #define KT_REMOVE_long_directory_s_length 9 #define KT_REMOVE_long_empty_s_length 5 @@ -470,7 +470,7 @@ extern "C" { extern const f_string_static_t kt_remove_short_accessed_s; extern const f_string_static_t kt_remove_short_block_s; extern const f_string_static_t kt_remove_short_character_s; - extern const f_string_static_t kt_remove_short_created_s; + extern const f_string_static_t kt_remove_short_changed_s; extern const f_string_static_t kt_remove_short_different_s; extern const f_string_static_t kt_remove_short_directory_s; extern const f_string_static_t kt_remove_short_empty_s; @@ -495,7 +495,7 @@ extern "C" { extern const f_string_static_t kt_remove_long_accessed_s; extern const f_string_static_t kt_remove_long_block_s; extern const f_string_static_t kt_remove_long_character_s; - extern const f_string_static_t kt_remove_long_created_s; + extern const f_string_static_t kt_remove_long_changed_s; extern const f_string_static_t kt_remove_long_different_s; extern const f_string_static_t kt_remove_long_directory_s; extern const f_string_static_t kt_remove_long_empty_s; diff --git a/sources/c/remove/main/common/type.h b/sources/c/remove/main/common/type.h index fde4a67..dfea6e7 100644 --- a/sources/c/remove/main/common/type.h +++ b/sources/c/remove/main/common/type.h @@ -146,7 +146,7 @@ extern "C" { * files: An array of file names (full paths to the files) to remove. * * accessed: An array of last accessed dates used for comparison. - * created: An array of created on dates used for comparison. + * changed: An array of changed on dates used for comparison. * updated: An array of last updated dates used for comparison. * modes: An array of modes used for comparison. * groups: An array of Group IDs (gid_t) represented via an unsigned 32-bit integer. @@ -167,7 +167,7 @@ extern "C" { f_string_dynamics_t files; kt_remove_dates_t accessed; - kt_remove_dates_t created; + kt_remove_dates_t changed; kt_remove_dates_t updated; kt_remove_modes_t modes; f_uint32s_t groups; diff --git a/sources/c/remove/main/operate.c b/sources/c/remove/main/operate.c index 5e91ef8..ed6ac28 100644 --- a/sources/c/remove/main/operate.c +++ b/sources/c/remove/main/operate.c @@ -206,8 +206,6 @@ extern "C" { // @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 @@ -218,7 +216,6 @@ extern "C" { // - 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); diff --git a/sources/c/remove/main/print/message.c b/sources/c/remove/main/print/message.c index c84e4c2..77cd70e 100644 --- a/sources/c/remove/main/print/message.c +++ b/sources/c/remove/main/print/message.c @@ -28,7 +28,7 @@ extern "C" { fll_program_print_help_option(print, kt_remove_short_accessed_s, kt_remove_long_accessed_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Remove by file last accessed date and time."); fll_program_print_help_option(print, kt_remove_short_block_s, kt_remove_long_block_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Remove by file type of block."); fll_program_print_help_option(print, kt_remove_short_character_s, kt_remove_long_character_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "Remove by file type of character."); - fll_program_print_help_option(print, kt_remove_short_created_s, kt_remove_long_created_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Remove by file created on date and time."); + fll_program_print_help_option(print, kt_remove_short_changed_s, kt_remove_long_changed_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Remove by file changed on date and time."); fll_program_print_help_option(print, kt_remove_short_different_s, kt_remove_long_different_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "Remove by file owner by a user different from the current calling user."); fll_program_print_help_option(print, kt_remove_short_directory_s, kt_remove_long_directory_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "Remove by file type of directory."); fll_program_print_help_option(print, kt_remove_short_empty_s, kt_remove_long_empty_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, " Remove directory by a specific empty or not empty state."); @@ -66,7 +66,7 @@ extern "C" { ); fl_print_format(" The parameters '%[%r%r%]', ", print->to, context.set.notable, f_console_symbol_long_normal_s, kt_remove_long_accessed_s, context.set.notable); - fl_print_format("'%[%r%r%]', ", print->to, context.set.notable, f_console_symbol_long_normal_s, kt_remove_long_created_s, context.set.notable); + fl_print_format("'%[%r%r%]', ", print->to, context.set.notable, f_console_symbol_long_normal_s, kt_remove_long_changed_s, context.set.notable); fl_print_format("'%[%r%r%]', ", print->to, context.set.notable, f_console_symbol_long_normal_s, kt_remove_long_group_s, context.set.notable); fl_print_format("'%[%r%r%]', ", print->to, context.set.notable, f_console_symbol_long_normal_s, kt_remove_long_mode_s, context.set.notable); fl_print_format("'%[%r%r%]', and ", print->to, context.set.notable, f_console_symbol_long_normal_s, kt_remove_long_updated_s, context.set.notable); @@ -116,9 +116,11 @@ extern "C" { fl_print_format(" or '%[u+rwX,g+r%]'.%r%r", print->to, context.set.notable, context.set.notable, f_string_eol_s, f_string_eol_s); fl_print_format(" The date related parameters are: '%[%r%r%]', ", print->to, context.set.notable, f_console_symbol_long_normal_s, kt_remove_long_accessed_s, context.set.notable); - fl_print_format("'%[%r%r%]', and ", print->to, context.set.notable, f_console_symbol_long_normal_s, kt_remove_long_created_s, context.set.notable); + fl_print_format("'%[%r%r%]', and ", print->to, context.set.notable, f_console_symbol_long_normal_s, kt_remove_long_changed_s, context.set.notable); fl_print_format("'%[%r%r%]'.%r%r", print->to, context.set.notable, f_console_symbol_long_normal_s, kt_remove_long_updated_s, context.set.notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" Where '%[updated%]' refers to when the contents of a file have been changed and '%[changed%]' refers to when the filesystem data for that file have been changed.%r%r", print->to, context.set.notable, context.set.notable, context.set.notable, context.set.notable, f_string_eol_s, f_string_eol_s); + fl_print_format(" The first value to the date related parameters must be any of the following comparison operators:%r", print->to, f_string_eol_s); fl_print_format(" - '%[%r%]'", print->to, context.set.notable, kt_remove_date_symbol_equal_s, context.set.notable); fl_print_format(" or '%[%r%]': Date match using an equal to operation.%r", print->to, context.set.notable, kt_remove_date_word_equal_s, context.set.notable, f_string_eol_s); diff --git a/sources/c/remove/main/print/simulate.c b/sources/c/remove/main/print/simulate.c index f2dc0ed..fb700c8 100644 --- a/sources/c/remove/main/print/simulate.c +++ b/sources/c/remove/main/print/simulate.c @@ -210,7 +210,7 @@ extern "C" { { kt_remove_dates_t * const dates[] = { &main->setting.accessed, - &main->setting.created, + &main->setting.changed, &main->setting.updated, }; @@ -222,7 +222,7 @@ extern "C" { const f_string_static_t * const names[] = { &kt_remove_long_accessed_s, - &kt_remove_long_created_s, + &kt_remove_long_changed_s, &kt_remove_long_updated_s, };