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(" 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(" xkey=val: take only val bytes from user keyfile.");
tfc_say(" okey=val: seek the key before reading it (usually a device).");
tfc_say(" xctr=val: specify size in bytes of initial counter prepended or read.");
char *randsource = TFC_DEFAULT_RANDSOURCE;
-tfc_fsize iseek_blocks, iseek, oseek, maxlen = NOFSIZE;
+tfc_fsize iseek_blocks, iseek, oseek, maxlen = NOFSIZE, ftrunc_dfd = NOFSIZE;
tfc_fsize total_processed_src, total_processed_dst;
tfc_fsize delta_processed;
tfc_fsize genrandom_nr_bytes, genzero_nr_bytes;
if (counter_opt == TFC_CTR_HEAD)
maxlen += TF_BLOCK_SIZE;
}
+ else if (!strncmp(s, "ftrunc", 6) && *(s+6) == '=') {
+ s += 7;
+ ftrunc_dfd = tfc_humanfsize(s, &stoi);
+ if (!str_empty(stoi)) {
+ ftrunc_dfd = tfc_fnamesize(s, YES);
+ ftrunc_dfd = tfc_modifysize(ftrunc_dfd, strchr(s, ':'));
+ if (ftrunc_dfd == NOFSIZE) xerror(NO, YES, YES,
+ "%s: invalid ftrunc value", s);
+ }
+ else ftrunc_dfd = tfc_modifysize(ftrunc_dfd, strchr(s, ':'));
+ }
else if (!strncmp(s, "xkey", 4) && *(s+4) == '=') {
s += 5;
maxkeylen = tfc_humanfsize(s, &stoi);
if (do_preserve_time) fcopy_matime(dfd, &s_stat);
xclose(sfd);
+ if (ftrunc_dfd != NOFSIZE) if (ftruncate(dfd, (off_t)ftrunc_dfd) == -1) xerror(YES, NO, YES, "ftruncate(%d)", dfd);
xclose(dfd);
xexit(exitcode);
extern tfc_byte macvrfy[SKEIN_DIGEST_SIZE], macresult[SKEIN_DIGEST_SIZE];
extern tfc_byte tmpdata[TFC_TMPSIZE];
extern char *randsource;
-extern tfc_fsize iseek_blocks, iseek, oseek, maxlen;
+extern tfc_fsize iseek_blocks, iseek, oseek, maxlen, ftrunc_dfd;
extern tfc_fsize total_processed_src, total_processed_dst;
extern tfc_fsize delta_processed;
extern tfc_fsize genrandom_nr_bytes, genzero_nr_bytes;