From e108646f26bc4566f7a919e1ef62eded075b316d Mon Sep 17 00:00:00 2001 From: leitner Date: Mon, 28 Oct 2002 19:49:00 +0000 Subject: [PATCH] simplistic support for single-part yenc --- test/uudecode.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/test/uudecode.c b/test/uudecode.c index 0b29945..cb3f93c 100644 --- a/test/uudecode.c +++ b/test/uudecode.c @@ -192,8 +192,9 @@ invalidybegin: continue; } l=filename-line+6; - if (!(filename=strstr(line," part="))) goto invalidybegin; - if (filename[6+scan_ulong(filename+6,&part)] != ' ') goto invalidybegin; + if (!(filename=strstr(line," part="))) { + part=1; + } else if (filename[6+scan_ulong(filename+6,&part)] != ' ') goto invalidybegin; if (part==1) reconstructed=0; if (!(filename=strstr(line," size="))) goto invalidybegin; if (filename[6+scan_ulong(filename+6,&totalsize)] != ' ') goto invalidybegin; @@ -227,9 +228,16 @@ invalidpart: stralloc out; char* tmp=strstr(line," pcrc32="); - if (!tmp) goto invalidpart; - if (!scan_xlong(tmp+8,&wantedcrc)) - goto invalidpart; + if (tmp) { + if (!scan_xlong(tmp+8,&wantedcrc)) + goto invalidpart; + } else if (part==1) { + tmp=strstr(line," crc32="); + if (!tmp) goto invalidpart; + if (!scan_xlong(tmp+7,&wantedcrc)) + goto invalidpart; + endoffset=totalsize; + } else goto invalidpart; stralloc_init(&out); stralloc_0(¥cpart); stralloc_ready(&out,yencpart.len); @@ -258,6 +266,7 @@ invalidpart: buffer_puts(buffer_2,"warning: part "); buffer_putulong(buffer_2,part); buffer_putsflush(buffer_2," corrupt; reconstruction failed.\n"); + buffer_put(&fileout,out.s,out.len); } } stralloc_free(&out);