-O finished: prepend "finished: " marker when tfcrypt done (useful for logs).
authorAndrey Rys <rys@lynxlynx.ru>
Sun, 28 Nov 2021 13:15:49 +0000 (14:15 +0100)
committerAndrey Rys <rys@lynxlynx.ru>
Sun, 28 Nov 2021 13:15:49 +0000 (14:15 +0100)
VERSION
tfc_error.c
tfc_signal.c
tfc_vars.c
tfcrypt.c
tfcrypt.h

diff --git a/VERSION b/VERSION
index abac1ea7b759d8258c9ad9e5b450f782aaa33374..21e72e8ac3d7e23bd6532b5f1f4a6bdf8362e6cf 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-47
+48
index d74fd567c7cbe241d04395f7582376f22695cc3a..d95f420f2f13d33dc00716a31d58a70964eab560 100644 (file)
@@ -316,6 +316,7 @@ void usage(void)
        tfc_say("    statless: emit less information in status line (only processed data).");
        tfc_say("    norepeat: do not ask for any possible password confirmations.");
        tfc_say("    showsecrets: show passwords in plaintext instead of masking them.");
+       tfc_say("    finished: add \"finished\" word before status line when work is finished.");
        tfc_say("    prompt=str: set main password prompts to this string.");
        tfc_say("    macprompt=str: set MAC password prompts to this string.");
        tfc_say("    shorthex: with -H, do not print printable characters, dump only hex string.");
index 4c918193f9f44ebfc1493e80a6a3e7ee7d31292e..b0d6e482f1bb7fabb82ae0f5df6b7bad60848fe0 100644 (file)
@@ -95,28 +95,28 @@ void print_crypt_status(int signal)
        else inplace = "";
 
        if (do_less_stats == YES) {
-               tfc_nfsay(stderr, "%s%s:"
+               tfc_nfsay(stderr, "%s%s%s:"
                        " %s %.2f%s,"
                        " %.2f%s B/s @%s",
-                       inplace, progname,
+                       inplace, (last && show_when_done) ? "finished: " : "", progname,
                        oper_mode,
                        human_totalproc_dst, tfc_getscale(dst_scale_idx),
                        human_wr_speed, tfc_getscale(wr_speed_scale), tfc_format_time(total_time));
        }
        else {
-               if (ctr_mode <= TFC_MODE_PLAIN) tfc_nfsay(stderr, "%s%s: read: %llu (%.2f%s),"
+               if (ctr_mode <= TFC_MODE_PLAIN) tfc_nfsay(stderr, "%s%s%s: read: %llu (%.2f%s),"
                        " %s %llu (%.2f%s) bytes,"
                        " (%llu (%.2f%s) B/s), time %s",
-                       inplace, progname,
+                       inplace, (last && show_when_done) ? "finished: " : "", progname,
                        total_processed_src, human_totalproc_src, tfc_getscale(src_scale_idx),
                        oper_mode,
                        total_processed_dst, human_totalproc_dst, tfc_getscale(dst_scale_idx),
                        wr_speed, human_wr_speed, tfc_getscale(wr_speed_scale), tfc_format_time(total_time));
-               else tfc_nfsay(stderr, "%s%s: read: %llu (%.2f%s),"
+               else tfc_nfsay(stderr, "%s%s%s: read: %llu (%.2f%s),"
                        " %s %s %llu (%.2f%s) bytes,"
                        " written %llu (%.2f%s) bytes,"
                        " (%llu (%.2f%s) B/s), time %s",
-                       inplace, progname,
+                       inplace, (last && show_when_done) ? "finished: " : "", progname,
                        total_processed_src, human_totalproc_src, tfc_getscale(src_scale_idx),
                        tfc_modename(ctr_mode), oper_mode,
                        total_processed_dst, human_totalproc_dst, tfc_getscale(dst_scale_idx),
index 359c7e1e1860a13e924a25f6447408502ac7916c..0148f771dd94505bb96506ac6cb0f0536a6e53e7 100644 (file)
@@ -64,7 +64,7 @@ int counter_opt, mackey_opt, do_mac, do_outfmt = TFC_OUTFMT_B64, rawkey;
 int idx, write_flags;
 tfc_yesno catch_all_errors, ignore_seek_errors, password, overwrite_source, do_fsync, do_pad, do_ftrunc = TFC_NO_FTRUNC;
 tfc_yesno do_preserve_time, do_stats_in_gibs, do_statline_dynamic = YES, do_less_stats;
-tfc_yesno no_repeat, do_full_hexdump = YES, verbose, statline_was_shown, show_secrets;
+tfc_yesno no_repeat, do_full_hexdump = YES, verbose, statline_was_shown, show_secrets, show_when_done;
 char *srcfname = TFC_STDIN_NAME, *dstfname = TFC_STDOUT_NAME, *do_mac_file, *counter_file, *sksum_hashlist_file;
 char *saltf, *genkeyf, *mackeyf, *tweakf;
 char *pw_prompt, *mac_pw_prompt;
index 6b9055f346b7def9984a34863a86cc15cff6f577..aa7db33eacba393d5f52be7495bdd184ac2a919b 100644 (file)
--- a/tfcrypt.c
+++ b/tfcrypt.c
@@ -332,6 +332,8 @@ _baddfname:
                                                do_full_key = YES;
                                        else if (!strcmp(s, "showsecrets"))
                                                show_secrets = YES;
+                                       else if (!strcmp(s, "finished"))
+                                               show_when_done = YES;
                                        else if (!strncmp(s, "logfile", 7) && *(s+7) == '=')
                                                open_log(s+8);
                                        else if (!strncmp(s, "iobs", 4) && *(s+4) == '=') {
index 67b4956cf83d8952289afdb3a4682d1161559d93..1b5f8116faf7977db863e3c0ecc55dbe4c724853 100644 (file)
--- a/tfcrypt.h
+++ b/tfcrypt.h
@@ -158,7 +158,7 @@ extern int counter_opt, mackey_opt, do_mac, do_outfmt, rawkey;
 extern int idx, write_flags;
 extern tfc_yesno catch_all_errors, ignore_seek_errors, password, overwrite_source, do_fsync, do_pad, do_ftrunc;
 extern tfc_yesno do_preserve_time, do_stats_in_gibs, do_statline_dynamic, do_less_stats;
-extern tfc_yesno no_repeat, do_full_hexdump, verbose, statline_was_shown, show_secrets;
+extern tfc_yesno no_repeat, do_full_hexdump, verbose, statline_was_shown, show_secrets, show_when_done;
 extern char *srcfname, *dstfname, *do_mac_file, *counter_file, *sksum_hashlist_file;
 extern char *saltf, *genkeyf, *mackeyf, *tweakf;
 extern char *pw_prompt, *mac_pw_prompt;