-O ioseek=: apply iseek and oseek at same time.
authorAndrey Rys <rys@lynxlynx.ru>
Sun, 28 Nov 2021 17:05:51 +0000 (18:05 +0100)
committerAndrey Rys <rys@lynxlynx.ru>
Sun, 28 Nov 2021 17:07:26 +0000 (18:07 +0100)
VERSION
tfc_error.c
tfcrypt.c

diff --git a/VERSION b/VERSION
index e1617e842ad9a038ec2d8332c6084300a43cb09d..8c61d23e125b800e69cb950b09e23c06f728fff9 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-57
+58
index bb477c4883020ddbc3874d330dd418e48640b4d1..4d64afde69f5c3be13151e53a4e12ed6e98aecb0 100644 (file)
@@ -164,6 +164,8 @@ void usage(void)
                tfc_say("    iobs=val: set IO block size value. Must not exceed %u bytes.", TFC_U(TFC_BLKSIZE));
                tfc_say("    iseek=val: seek source file/device by these val bytes.");
                tfc_say("    oseek=val: seek destination file/device by these val bytes.");
+               tfc_say("    ioseek=val: seek both source and destination.");
+               tfc_say("    ioseek is equal to iseek and oseek.");
                tfc_say("    count=val: process only these val bytes, both input and output.");
                tfc_say("    ftrunc=val: truncate output file to these val bytes before closing it.");
                tfc_say("    ftrunc=tail: truncate output's tail, leaving only processed data.");
@@ -350,6 +352,8 @@ void usage(void)
        tfc_say("    ixctr=val: Increment initial counter by this val bytes.");
        tfc_say("    Internally this number is translated into number of %u byte blocks.", TFC_U(TF_BLOCK_SIZE));
        tfc_say("    oseek=val: seek destination file/device by these val bytes.");
+       tfc_say("    ioseek=val: seek both source and destination.");
+       tfc_say("    ioseek is equal to iseek and oseek.");
        tfc_say("    count=val: process only these val bytes, both input and output.");
        tfc_say("    ftrunc=val: truncate output file to these val bytes before closing it.");
        tfc_say("    ftrunc=tail: truncate output's tail, leaving only processed data.");
index e6d422dbe25277dbf231633021e4f318fac14ee4..7da9e99e550623fdce783b84d4ee420161d2383c 100644 (file)
--- a/tfcrypt.c
+++ b/tfcrypt.c
@@ -456,6 +456,33 @@ _baddfname:
                                                }
                                                else oseek = tfc_modifysize(oseek, strchr(s, ':'));
                                        }
+                                       else if (!strncmp(s, "ioseek", 6) && *(s+6) == '=') {
+                                               s += 7;
+
+                                               iseek = tfc_humanfsize(s, &stoi);
+                                               if (!str_empty(stoi)) {
+                                                       iseek = tfc_fnamesize(s, YES);
+                                                       iseek = tfc_modifysize(iseek, strchr(s, ':'));
+                                                       if (iseek == NOFSIZE) xerror(NO, YES, YES,
+                                                       "%s: invalid iseek value", s);
+                                               }
+                                               else iseek = tfc_modifysize(iseek, strchr(s, ':'));
+                                               if (ctr_mode != TFC_MODE_PLAIN && iseek % TF_BLOCK_SIZE)
+                                                       xerror(NO, YES, YES,
+                                                               "%s: not round to TF block size "
+                                                               "of %u bytes",
+                                                               s, TFC_U(TF_BLOCK_SIZE));
+                                               iseek_blocks = iseek / TF_BLOCK_SIZE;
+
+                                               oseek = tfc_humanfsize(s, &stoi);
+                                               if (!str_empty(stoi)) {
+                                                       oseek = tfc_fnamesize(s, YES);
+                                                       oseek = tfc_modifysize(oseek, strchr(s, ':'));
+                                                       if (oseek == NOFSIZE) xerror(NO, YES, YES,
+                                                       "%s: invalid oseek value", s);
+                                               }
+                                               else oseek = tfc_modifysize(oseek, strchr(s, ':'));
+                                       }
                                        else if (!strncmp(s, "count", 5) && *(s+5) == '=') {
                                                s += 6;
                                                maxlen = tfc_humanfsize(s, &stoi);