In the showwal command-line tool, for unix builds, if the
auxiliary argument is of
the form "Ntruncate" where "N" is a frame number, then truncate the WAL
file after the N-th frame.
FossilOrigin-Name: 90015df30655d884ecf7ae61e588824696954252dc6b1a5f78cf2de8cb236104
diff --git a/tool/showwal.c b/tool/showwal.c
index 33cc218..b214a28 100644
--- a/tool/showwal.c
+++ b/tool/showwal.c
@@ -12,6 +12,7 @@
#if !defined(_MSC_VER)
#include <unistd.h>
+#include <sys/types.h>
#else
#include <io.h>
#endif
@@ -579,6 +580,14 @@
decode_btree_page(a, iStart, hdrSize, zLeft+1);
free(a);
continue;
+#if !defined(_MSC_VER)
+ }else if( zLeft && strcmp(zLeft,"truncate")==0 ){
+ /* Frame number followed by "truncate" truncates the WAL file
+ ** after that frame */
+ off_t newSize = 32 + iStart*(pagesize+24);
+ truncate(argv[1], newSize);
+ continue;
+#endif
}else{
iEnd = iStart;
}