diff options
author | dotdotisdead <dotdotisdead@a3eca27d-f21b-0410-9b4a-6511e771f64e> | 2006-12-10 02:20:48 +0000 |
---|---|---|
committer | dotdotisdead <dotdotisdead@a3eca27d-f21b-0410-9b4a-6511e771f64e> | 2006-12-10 02:20:48 +0000 |
commit | 7fb75616337a50fb98c6c251f8d76825dfca9165 (patch) | |
tree | 5767f0e88ce9fe638d8112d35a4ae65337091415 /xdelta3/xdelta3-main.h | |
parent | ad85653ca73c8126de516b9a4294e8f08577c00d (diff) |
Preliminary WIN32 support.
Diffstat (limited to 'xdelta3/xdelta3-main.h')
-rwxr-xr-x | xdelta3/xdelta3-main.h | 141 |
1 files changed, 73 insertions, 68 deletions
diff --git a/xdelta3/xdelta3-main.h b/xdelta3/xdelta3-main.h index 6261156..79f9617 100755 --- a/xdelta3/xdelta3-main.h +++ b/xdelta3/xdelta3-main.h | |||
@@ -55,19 +55,16 @@ | |||
55 | #ifndef XD3_STDIO | 55 | #ifndef XD3_STDIO |
56 | #define XD3_STDIO 0 | 56 | #define XD3_STDIO 0 |
57 | #endif | 57 | #endif |
58 | #ifndef XD3_WIN32 | ||
59 | #define XD3_WIN32 0 | ||
60 | #endif | ||
61 | 58 | ||
62 | /* XPRINTX (used by main) prefixes an "xdelta3: " to the output. */ | 59 | /* XPRINTX (used by main) prefixes an "xdelta3: " to the output. */ |
63 | #define XPR fprintf | 60 | #define XPR fprintf |
64 | #define NT stderr, "xdelta3: " | 61 | #define NT stderr, "xdelta3: " |
65 | 62 | ||
66 | #define VC fprintf | 63 | #define VC fprintf |
67 | #define OUT vcout, | 64 | #define UT vcout, |
68 | 65 | ||
69 | /* If none are set, default to posix. */ | 66 | /* If none are set, default to posix. */ |
70 | #if (XD3_POSIX + XD3_STDIO + XD3_WIN32) == 0 | 67 | #if (XD3_POSIX + XD3_STDIO) == 0 |
71 | #undef XD3_POSIX | 68 | #undef XD3_POSIX |
72 | #define XD3_POSIX 1 | 69 | #define XD3_POSIX 1 |
73 | #endif | 70 | #endif |
@@ -79,10 +76,6 @@ | |||
79 | 76 | ||
80 | #define PRINTHDR_SPECIAL -4378291 | 77 | #define PRINTHDR_SPECIAL -4378291 |
81 | 78 | ||
82 | #ifndef XDELTA1PATH | ||
83 | #define XDELTA1PATH "xdelta1" | ||
84 | #endif | ||
85 | |||
86 | /* The number of soft-config variables. */ | 79 | /* The number of soft-config variables. */ |
87 | #define XD3_SOFTCFG_VARCNT 1 | 80 | #define XD3_SOFTCFG_VARCNT 1 |
88 | 81 | ||
@@ -91,7 +84,6 @@ | |||
91 | #define XD3_LIB_ERRMSG(stream, ret) "%s: %s\n", xd3_errstring (stream), xd3_strerror (ret) | 84 | #define XD3_LIB_ERRMSG(stream, ret) "%s: %s\n", xd3_errstring (stream), xd3_strerror (ret) |
92 | 85 | ||
93 | #include <stdio.h> /* fprintf */ | 86 | #include <stdio.h> /* fprintf */ |
94 | #include <unistd.h> /* lots */ | ||
95 | 87 | ||
96 | #if XD3_POSIX | 88 | #if XD3_POSIX |
97 | #include <unistd.h> /* close, read, write... */ | 89 | #include <unistd.h> /* close, read, write... */ |
@@ -99,8 +91,12 @@ | |||
99 | #include <fcntl.h> | 91 | #include <fcntl.h> |
100 | #endif | 92 | #endif |
101 | 93 | ||
94 | #ifndef _WIN32 | ||
95 | #include <unistd.h> /* lots */ | ||
102 | #include <sys/time.h> /* gettimeofday() */ | 96 | #include <sys/time.h> /* gettimeofday() */ |
103 | #include <sys/stat.h> /* stat() and fstat() */ | 97 | #include <sys/stat.h> /* stat() and fstat() */ |
98 | #else | ||
99 | #endif | ||
104 | 100 | ||
105 | /****************************************************************************************** | 101 | /****************************************************************************************** |
106 | ENUMS and TYPES | 102 | ENUMS and TYPES |
@@ -120,6 +116,7 @@ typedef enum | |||
120 | { | 116 | { |
121 | RD_FIRST = (1 << 0), | 117 | RD_FIRST = (1 << 0), |
122 | RD_NONEXTERNAL = (1 << 1), | 118 | RD_NONEXTERNAL = (1 << 1), |
119 | RD_EXTERNAL_V1 = (1 << 2), | ||
123 | } xd3_read_flags; | 120 | } xd3_read_flags; |
124 | 121 | ||
125 | /* main_file->mode values */ | 122 | /* main_file->mode values */ |
@@ -175,7 +172,7 @@ struct _main_file | |||
175 | char *filename_copy; /* File name or /dev/stdin, /dev/stdout, /dev/stderr. */ | 172 | char *filename_copy; /* File name or /dev/stdin, /dev/stdout, /dev/stderr. */ |
176 | const char *realname; /* File name or /dev/stdin, /dev/stdout, /dev/stderr. */ | 173 | const char *realname; /* File name or /dev/stdin, /dev/stdout, /dev/stderr. */ |
177 | const main_extcomp *compressor; /* External compression struct. */ | 174 | const main_extcomp *compressor; /* External compression struct. */ |
178 | int flags; /* RD_FIRST or RD_NONEXTERNAL */ | 175 | int flags; /* RD_FIRST, RD_NONEXTERNAL, ... */ |
179 | xoff_t nread; /* for input position */ | 176 | xoff_t nread; /* for input position */ |
180 | xoff_t nwrite; /* for output position */ | 177 | xoff_t nwrite; /* for output position */ |
181 | }; | 178 | }; |
@@ -231,6 +228,7 @@ static char* option_smatch_config = NULL; | |||
231 | static int option_no_compress = 0; | 228 | static int option_no_compress = 0; |
232 | static int option_no_output = 0; /* go through the motions, but do not open or write output */ | 229 | static int option_no_output = 0; /* go through the motions, but do not open or write output */ |
233 | static const char *option_source_filename = NULL; | 230 | static const char *option_source_filename = NULL; |
231 | static const char *option_xdelta1 = "xdelta1"; | ||
234 | 232 | ||
235 | static usize_t option_winsize = XD3_DEFAULT_WINSIZE; | 233 | static usize_t option_winsize = XD3_DEFAULT_WINSIZE; |
236 | static usize_t option_srcwinsz = XD3_DEFAULT_SRCWINSZ; | 234 | static usize_t option_srcwinsz = XD3_DEFAULT_SRCWINSZ; |
@@ -277,9 +275,9 @@ static int allow_fake_source = 0; | |||
277 | * the program knows the mapping of IDENT->NAME. */ | 275 | * the program knows the mapping of IDENT->NAME. */ |
278 | static main_extcomp extcomp_types[] = | 276 | static main_extcomp extcomp_types[] = |
279 | { | 277 | { |
280 | /* The entry for xdelta must be first because the program_name is set here. */ | 278 | /* The entry for xdelta3/1 must be 0/1 because the program_names are set there. */ |
281 | { "xdelta3", "-cfq", "xdelta3", "-dcfq", "X", "\xd6\xc3\xc4", 3, RD_NONEXTERNAL }, | 279 | { "xdelta3", "-cfq", "xdelta3", "-dcfq", "X", "\xd6\xc3\xc4", 3, RD_NONEXTERNAL }, |
282 | { XDELTA1PATH,"delta", XDELTA1PATH, "patch", "1", "%XD", 3, 0 }, | 280 | { "xdelta1", "delta", "xdelta1", "patch", "1", "%XD", 3, RD_EXTERNAL_V1 }, |
283 | { "bzip2", "-cf", "bzip2", "-dcf", "B", "BZh", 3, 0 }, | 281 | { "bzip2", "-cf", "bzip2", "-dcf", "B", "BZh", 3, 0 }, |
284 | { "gzip", "-cf", "gzip", "-dcf", "G", "\037\213", 2, 0 }, | 282 | { "gzip", "-cf", "gzip", "-dcf", "G", "\037\213", 2, 0 }, |
285 | { "compress", "-cf", "uncompress", "-cf", "Z", "\037\235", 2, 0 }, | 283 | { "compress", "-cf", "uncompress", "-cf", "Z", "\037\235", 2, 0 }, |
@@ -783,7 +781,7 @@ main_print_window (xd3_stream* stream, FILE *vcout) | |||
783 | int ret; | 781 | int ret; |
784 | usize_t size = 0; | 782 | usize_t size = 0; |
785 | 783 | ||
786 | VC(OUT " Offset Code Type1 Size1 @Addr1 + Type2 Size2 @Addr2\n"); | 784 | VC(UT " Offset Code Type1 Size1 @Addr1 + Type2 Size2 @Addr2\n"); |
787 | 785 | ||
788 | while (stream->inst_sect.buf < stream->inst_sect.buf_max) | 786 | while (stream->inst_sect.buf < stream->inst_sect.buf_max) |
789 | { | 787 | { |
@@ -791,7 +789,7 @@ main_print_window (xd3_stream* stream, FILE *vcout) | |||
791 | 789 | ||
792 | if ((ret = xd3_decode_instruction (stream))) { return ret; } | 790 | if ((ret = xd3_decode_instruction (stream))) { return ret; } |
793 | 791 | ||
794 | VC(OUT " %06"Q"u %03u %s %3u", stream->dec_winstart + size, code, | 792 | VC(UT " %06"Q"u %03u %s %3u", stream->dec_winstart + size, code, |
795 | xd3_rtype_to_string (stream->dec_current1.type, option_print_cpymode), | 793 | xd3_rtype_to_string (stream->dec_current1.type, option_print_cpymode), |
796 | stream->dec_current1.size); | 794 | stream->dec_current1.size); |
797 | 795 | ||
@@ -800,28 +798,28 @@ main_print_window (xd3_stream* stream, FILE *vcout) | |||
800 | size += stream->dec_current1.size; | 798 | size += stream->dec_current1.size; |
801 | if (stream->dec_current1.type >= XD3_CPY) | 799 | if (stream->dec_current1.type >= XD3_CPY) |
802 | { | 800 | { |
803 | VC(OUT " @%-6u", stream->dec_current1.addr); | 801 | VC(UT " @%-6u", stream->dec_current1.addr); |
804 | } | 802 | } |
805 | else | 803 | else |
806 | { | 804 | { |
807 | VC(OUT " "); | 805 | VC(UT " "); |
808 | } | 806 | } |
809 | } | 807 | } |
810 | 808 | ||
811 | if (stream->dec_current2.type != XD3_NOOP) | 809 | if (stream->dec_current2.type != XD3_NOOP) |
812 | { | 810 | { |
813 | size += stream->dec_current2.size; | 811 | size += stream->dec_current2.size; |
814 | VC(OUT " %s %3u", | 812 | VC(UT " %s %3u", |
815 | xd3_rtype_to_string (stream->dec_current2.type, option_print_cpymode), | 813 | xd3_rtype_to_string (stream->dec_current2.type, option_print_cpymode), |
816 | stream->dec_current2.size); | 814 | stream->dec_current2.size); |
817 | 815 | ||
818 | if (stream->dec_current2.type >= XD3_CPY) | 816 | if (stream->dec_current2.type >= XD3_CPY) |
819 | { | 817 | { |
820 | VC(OUT " @%-6u", stream->dec_current2.addr); | 818 | VC(UT " @%-6u", stream->dec_current2.addr); |
821 | } | 819 | } |
822 | } | 820 | } |
823 | 821 | ||
824 | VC(OUT "\n"); | 822 | VC(UT "\n"); |
825 | } | 823 | } |
826 | 824 | ||
827 | if (stream->dec_tgtlen != size && (stream->flags & XD3_SKIP_WINDOW) == 0) | 825 | if (stream->dec_tgtlen != size && (stream->flags & XD3_SKIP_WINDOW) == 0) |
@@ -842,7 +840,7 @@ main_print_window (xd3_stream* stream, FILE *vcout) | |||
842 | return XD3_INTERNAL; | 840 | return XD3_INTERNAL; |
843 | } | 841 | } |
844 | 842 | ||
845 | IF_DEBUG (VC(OUT "SIZE=%u TGTLEN=%u\n", size, stream->dec_tgtlen)); | 843 | IF_DEBUG (VC(UT "SIZE=%u TGTLEN=%u\n", size, stream->dec_tgtlen)); |
846 | 844 | ||
847 | return 0; | 845 | return 0; |
848 | } | 846 | } |
@@ -850,8 +848,8 @@ main_print_window (xd3_stream* stream, FILE *vcout) | |||
850 | static void | 848 | static void |
851 | main_print_vcdiff_file (main_file *file, const char *type, FILE *vcout) | 849 | main_print_vcdiff_file (main_file *file, const char *type, FILE *vcout) |
852 | { | 850 | { |
853 | if (file->filename) { VC(OUT "XDELTA filename (%s): %s\n", type, file->filename); } | 851 | if (file->filename) { VC(UT "XDELTA filename (%s): %s\n", type, file->filename); } |
854 | if (file->compressor) { VC(OUT "XDELTA ext comp (%s): %s\n", type, file->compressor->recomp_cmdname); } | 852 | if (file->compressor) { VC(UT "XDELTA ext comp (%s): %s\n", type, file->compressor->recomp_cmdname); } |
855 | } | 853 | } |
856 | 854 | ||
857 | /* This function prints a VCDIFF input, mainly for debugging purposes. */ | 855 | /* This function prints a VCDIFF input, mainly for debugging purposes. */ |
@@ -873,18 +871,18 @@ main_print_func (xd3_stream* stream, main_file *xfile) | |||
873 | XD3_ASSERT (vcout); | 871 | XD3_ASSERT (vcout); |
874 | if (stream->dec_winstart == 0) | 872 | if (stream->dec_winstart == 0) |
875 | { | 873 | { |
876 | VC(OUT "VCDIFF version: 0\n"); | 874 | VC(UT "VCDIFF version: 0\n"); |
877 | 875 | ||
878 | VC(OUT "VCDIFF header size: %d\n", stream->dec_hdrsize); | 876 | VC(UT "VCDIFF header size: %d\n", stream->dec_hdrsize); |
879 | VC(OUT "VCDIFF header indicator: "); | 877 | VC(UT "VCDIFF header indicator: "); |
880 | if ((stream->dec_hdr_ind & VCD_SECONDARY) != 0) VC(OUT "VCD_SECONDARY "); | 878 | if ((stream->dec_hdr_ind & VCD_SECONDARY) != 0) VC(UT "VCD_SECONDARY "); |
881 | if ((stream->dec_hdr_ind & VCD_CODETABLE) != 0) VC(OUT "VCD_CODETABLE "); | 879 | if ((stream->dec_hdr_ind & VCD_CODETABLE) != 0) VC(UT "VCD_CODETABLE "); |
882 | if ((stream->dec_hdr_ind & VCD_APPHEADER) != 0) VC(OUT "VCD_APPHEADER "); | 880 | if ((stream->dec_hdr_ind & VCD_APPHEADER) != 0) VC(UT "VCD_APPHEADER "); |
883 | if (stream->dec_hdr_ind == 0) VC(OUT "none"); | 881 | if (stream->dec_hdr_ind == 0) VC(UT "none"); |
884 | VC(OUT "\n"); | 882 | VC(UT "\n"); |
885 | 883 | ||
886 | IF_SEC(VC(OUT "VCDIFF secondary compressor: %s\n", stream->sec_type ? stream->sec_type->name : "none")); | 884 | IF_SEC(VC(UT "VCDIFF secondary compressor: %s\n", stream->sec_type ? stream->sec_type->name : "none")); |
887 | IF_NSEC(VC(OUT "VCDIFF secondary compressor: unsupported\n")); | 885 | IF_NSEC(VC(UT "VCDIFF secondary compressor: unsupported\n")); |
888 | 886 | ||
889 | if (stream->dec_hdr_ind & VCD_APPHEADER) | 887 | if (stream->dec_hdr_ind & VCD_APPHEADER) |
890 | { | 888 | { |
@@ -897,9 +895,9 @@ main_print_func (xd3_stream* stream, main_file *xfile) | |||
897 | int sq = option_quiet; | 895 | int sq = option_quiet; |
898 | main_file i, o, s; | 896 | main_file i, o, s; |
899 | XD3_ASSERT (apphead != NULL); | 897 | XD3_ASSERT (apphead != NULL); |
900 | VC(OUT "VCDIFF application header: "); | 898 | VC(UT "VCDIFF application header: "); |
901 | fwrite (apphead, 1, appheadsz, vcout); | 899 | fwrite (apphead, 1, appheadsz, vcout); |
902 | VC(OUT "\n"); | 900 | VC(UT "\n"); |
903 | 901 | ||
904 | main_file_init (& i); | 902 | main_file_init (& i); |
905 | main_file_init (& o); | 903 | main_file_init (& o); |
@@ -917,49 +915,49 @@ main_print_func (xd3_stream* stream, main_file *xfile) | |||
917 | } | 915 | } |
918 | else | 916 | else |
919 | { | 917 | { |
920 | VC(OUT "\n"); | 918 | VC(UT "\n"); |
921 | } | 919 | } |
922 | 920 | ||
923 | VC(OUT "VCDIFF window number: %"Q"u\n", stream->current_window); | 921 | VC(UT "VCDIFF window number: %"Q"u\n", stream->current_window); |
924 | VC(OUT "VCDIFF window indicator: "); | 922 | VC(UT "VCDIFF window indicator: "); |
925 | if ((stream->dec_win_ind & VCD_SOURCE) != 0) VC(OUT "VCD_SOURCE "); | 923 | if ((stream->dec_win_ind & VCD_SOURCE) != 0) VC(UT "VCD_SOURCE "); |
926 | if ((stream->dec_win_ind & VCD_TARGET) != 0) VC(OUT "VCD_TARGET "); | 924 | if ((stream->dec_win_ind & VCD_TARGET) != 0) VC(UT "VCD_TARGET "); |
927 | if ((stream->dec_win_ind & VCD_ADLER32) != 0) VC(OUT "VCD_ADLER32 "); | 925 | if ((stream->dec_win_ind & VCD_ADLER32) != 0) VC(UT "VCD_ADLER32 "); |
928 | if (stream->dec_win_ind == 0) VC(OUT "none"); | 926 | if (stream->dec_win_ind == 0) VC(UT "none"); |
929 | VC(OUT "\n"); | 927 | VC(UT "\n"); |
930 | 928 | ||
931 | if ((stream->dec_win_ind & VCD_ADLER32) != 0) | 929 | if ((stream->dec_win_ind & VCD_ADLER32) != 0) |
932 | { | 930 | { |
933 | VC(OUT "VCDIFF adler32 checksum: %08X\n", stream->dec_adler32); | 931 | VC(UT "VCDIFF adler32 checksum: %08X\n", stream->dec_adler32); |
934 | } | 932 | } |
935 | 933 | ||
936 | if (stream->dec_del_ind != 0) | 934 | if (stream->dec_del_ind != 0) |
937 | { | 935 | { |
938 | VC(OUT "VCDIFF delta indicator: "); | 936 | VC(UT "VCDIFF delta indicator: "); |
939 | if ((stream->dec_del_ind & VCD_DATACOMP) != 0) VC(OUT "VCD_DATACOMP "); | 937 | if ((stream->dec_del_ind & VCD_DATACOMP) != 0) VC(UT "VCD_DATACOMP "); |
940 | if ((stream->dec_del_ind & VCD_INSTCOMP) != 0) VC(OUT "VCD_INSTCOMP "); | 938 | if ((stream->dec_del_ind & VCD_INSTCOMP) != 0) VC(UT "VCD_INSTCOMP "); |
941 | if ((stream->dec_del_ind & VCD_ADDRCOMP) != 0) VC(OUT "VCD_ADDRCOMP "); | 939 | if ((stream->dec_del_ind & VCD_ADDRCOMP) != 0) VC(UT "VCD_ADDRCOMP "); |
942 | if (stream->dec_del_ind == 0) VC(OUT "none"); | 940 | if (stream->dec_del_ind == 0) VC(UT "none"); |
943 | VC(OUT "\n"); | 941 | VC(UT "\n"); |
944 | } | 942 | } |
945 | 943 | ||
946 | if (stream->dec_winstart != 0) | 944 | if (stream->dec_winstart != 0) |
947 | { | 945 | { |
948 | VC(OUT "VCDIFF window at offset: %"Q"u\n", stream->dec_winstart); | 946 | VC(UT "VCDIFF window at offset: %"Q"u\n", stream->dec_winstart); |
949 | } | 947 | } |
950 | 948 | ||
951 | if (SRCORTGT (stream->dec_win_ind)) | 949 | if (SRCORTGT (stream->dec_win_ind)) |
952 | { | 950 | { |
953 | VC(OUT "VCDIFF copy window length: %u\n", stream->dec_cpylen); | 951 | VC(UT "VCDIFF copy window length: %u\n", stream->dec_cpylen); |
954 | VC(OUT "VCDIFF copy window offset: %"Q"u\n", stream->dec_cpyoff); | 952 | VC(UT "VCDIFF copy window offset: %"Q"u\n", stream->dec_cpyoff); |
955 | } | 953 | } |
956 | 954 | ||
957 | VC(OUT "VCDIFF delta encoding length: %u\n", stream->dec_enclen); | 955 | VC(UT "VCDIFF delta encoding length: %u\n", stream->dec_enclen); |
958 | VC(OUT "VCDIFF target window length: %u\n", stream->dec_tgtlen); | 956 | VC(UT "VCDIFF target window length: %u\n", stream->dec_tgtlen); |
959 | 957 | ||
960 | VC(OUT "VCDIFF data section length: %u\n", stream->data_sect.size); | 958 | VC(UT "VCDIFF data section length: %u\n", stream->data_sect.size); |
961 | VC(OUT "VCDIFF inst section length: %u\n", stream->inst_sect.size); | 959 | VC(UT "VCDIFF inst section length: %u\n", stream->inst_sect.size); |
962 | VC(OUT "VCDIFF addr section length: %u\n", stream->addr_sect.size); | 960 | VC(UT "VCDIFF addr section length: %u\n", stream->addr_sect.size); |
963 | 961 | ||
964 | ret = 0; | 962 | ret = 0; |
965 | if ((stream->flags & XD3_JUST_HDR) != 0) | 963 | if ((stream->flags & XD3_JUST_HDR) != 0) |
@@ -1278,7 +1276,9 @@ main_decompress_input_check (main_file *ifile, | |||
1278 | 1276 | ||
1279 | if (check_nread == XD3_ALLOCSIZE) | 1277 | if (check_nread == XD3_ALLOCSIZE) |
1280 | { | 1278 | { |
1281 | ret = main_file_read (ifile, input_buf + XD3_ALLOCSIZE, input_size - XD3_ALLOCSIZE, nread, "input read failed"); | 1279 | ret = main_file_read (ifile, input_buf + XD3_ALLOCSIZE, |
1280 | input_size - XD3_ALLOCSIZE, nread, | ||
1281 | "input read failed"); | ||
1282 | } | 1282 | } |
1283 | 1283 | ||
1284 | memcpy (input_buf, check_buf, check_nread); | 1284 | memcpy (input_buf, check_buf, check_nread); |
@@ -1878,7 +1878,7 @@ main_set_source (xd3_stream *stream, int cmd, main_file *sfile, xd3_source *sour | |||
1878 | { | 1878 | { |
1879 | XPR(NT "source file too large for external decompression: %s: %"Q"u\n", | 1879 | XPR(NT "source file too large for external decompression: %s: %"Q"u\n", |
1880 | sfile->filename, osize); | 1880 | sfile->filename, osize); |
1881 | return EFBIG; | 1881 | return XD3_INTERNAL; |
1882 | } | 1882 | } |
1883 | 1883 | ||
1884 | if ((ret = main_decompress_source (sfile, source))) | 1884 | if ((ret = main_decompress_source (sfile, source))) |
@@ -2427,6 +2427,14 @@ done: | |||
2427 | main_file_close (ifile); | 2427 | main_file_close (ifile); |
2428 | main_file_close (sfile); | 2428 | main_file_close (sfile); |
2429 | 2429 | ||
2430 | #if EXTERNAL_COMPRESSION | ||
2431 | if ((ret = main_external_compression_finish ())) | ||
2432 | { | ||
2433 | XPR(NT "external compression commands failed\n"); | ||
2434 | return EXIT_FAILURE; | ||
2435 | } | ||
2436 | #endif | ||
2437 | |||
2430 | /* If output file is not open yet because of delayed-open, it means we never encountered | 2438 | /* If output file is not open yet because of delayed-open, it means we never encountered |
2431 | * a window in the delta, but it could have had a VCDIFF header? TODO: solve this | 2439 | * a window in the delta, but it could have had a VCDIFF header? TODO: solve this |
2432 | * elsewhere. For now, it prints "nothing to output" below, but the check doesn't | 2440 | * elsewhere. For now, it prints "nothing to output" below, but the check doesn't |
@@ -2452,10 +2460,6 @@ done: | |||
2452 | return EXIT_FAILURE; | 2460 | return EXIT_FAILURE; |
2453 | } | 2461 | } |
2454 | 2462 | ||
2455 | #if EXTERNAL_COMPRESSION | ||
2456 | if ((ret = main_external_compression_finish ())) { return EXIT_FAILURE; } | ||
2457 | #endif | ||
2458 | |||
2459 | xd3_free_stream (& stream); | 2463 | xd3_free_stream (& stream); |
2460 | 2464 | ||
2461 | if (option_verbose) | 2465 | if (option_verbose) |
@@ -2463,9 +2467,6 @@ done: | |||
2463 | char tm[32]; | 2467 | char tm[32]; |
2464 | long end_time = get_millisecs_now (); | 2468 | long end_time = get_millisecs_now (); |
2465 | XPR(NT "command finished in %s\n", main_format_millis (end_time - start_time, tm)); | 2469 | XPR(NT "command finished in %s\n", main_format_millis (end_time - start_time, tm)); |
2466 | } | ||
2467 | if (option_verbose > 1) | ||
2468 | { | ||
2469 | XPR(NT "input bytes: %"Q"u\n", ifile->nread); | 2470 | XPR(NT "input bytes: %"Q"u\n", ifile->nread); |
2470 | XPR(NT "output bytes: %"Q"u\n", ofile->nwrite); | 2471 | XPR(NT "output bytes: %"Q"u\n", ofile->nwrite); |
2471 | } | 2472 | } |
@@ -2513,7 +2514,7 @@ main (int argc, char **argv) | |||
2513 | main_file ifile; | 2514 | main_file ifile; |
2514 | main_file ofile; | 2515 | main_file ofile; |
2515 | main_file sfile; | 2516 | main_file sfile; |
2516 | static char *flags = "0123456789cdefhnqvDJNRTVs:B:C:E:F:L:O:P:M:W:A::S::"; | 2517 | static char *flags = "0123456789cdefhnqvDJNORTVs:B:C:E:F:L:O:P:M:W:A::S::"; |
2517 | int my_optind; | 2518 | int my_optind; |
2518 | char *my_optarg; | 2519 | char *my_optarg; |
2519 | char *my_optstr; | 2520 | char *my_optstr; |
@@ -2698,6 +2699,7 @@ main (int argc, char **argv) | |||
2698 | case 'T': option_use_altcodetable = 1; break; | 2699 | case 'T': option_use_altcodetable = 1; break; |
2699 | case 'C': option_smatch_config = my_optarg; break; | 2700 | case 'C': option_smatch_config = my_optarg; break; |
2700 | case 'J': option_no_output = 1; break; | 2701 | case 'J': option_no_output = 1; break; |
2702 | case 'O': option_xdelta1 = my_optarg; break; | ||
2701 | case 'S': if (my_optarg == NULL) { option_use_secondary = 0; } | 2703 | case 'S': if (my_optarg == NULL) { option_use_secondary = 0; } |
2702 | else { option_use_secondary = 1; option_secondary = my_optarg; } break; | 2704 | else { option_use_secondary = 1; option_secondary = my_optarg; } break; |
2703 | case 'A': if (my_optarg == NULL) { option_use_appheader = 0; } | 2705 | case 'A': if (my_optarg == NULL) { option_use_appheader = 0; } |
@@ -2772,6 +2774,9 @@ main (int argc, char **argv) | |||
2772 | goto cleanup; | 2774 | goto cleanup; |
2773 | } | 2775 | } |
2774 | 2776 | ||
2777 | extcomp_types[1].recomp_cmdname = option_xdelta1; | ||
2778 | extcomp_types[1].decomp_cmdname = option_xdelta1; | ||
2779 | |||
2775 | if (option_verbose > 1) | 2780 | if (option_verbose > 1) |
2776 | { | 2781 | { |
2777 | int l = 1; | 2782 | int l = 1; |