uudeview directly from slrnpull spool

Rocco Caputo <[email protected]>
Newsgroups gmane.network.slrn.user
Message-ID <[email protected]>
I've run into a problem using uudeview directly on a slrnpull spool.   
The fetched bodies retain the beginning-of-line .. escape, breaking  
yenc decoding.  Here's a patch to slrnpull that converts "\n.." back  
to "\n." and brings its output closer to slrn's.



-- 
Rocco Caputo - [email protected]

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
slrnpull.patch (application/octet-stream, 2.8 KB)
*** slrnpull.c.orig	2008-03-08 21:50:30.000000000 -0500
--- slrnpull.c	2008-03-09 01:58:12.000000000 -0500
***************
*** 1135,1141 ****
  	return -1;
       }
  
!    if ((EOF == fputc ('\n', fp)) ||
         (EOF == fputs (body, fp)))
       {
  	log_error (_("Error writing to %s."), file);
--- 1135,1161 ----
  	return -1;
       }
  
! 	// de-escape leading \x2e\x2e to \x2e
! 	char *from = body;
! 	char *to = body;
! 
! 	while (*from) {
! 		if (*from == '\n' && *(from+1) == '.' && *(from+2) == '.') {
! 			*to++ = '\n';
! 			*to++ = '.';
! 			from += 3;
! 			continue;
! 		}
! 		if (from == to) {
! 			from++;
! 			to++;
! 			continue;
! 		}
! 		*to++ = *from++;
! 	}
! 	*to = '\0';
! 
!    if ( //(EOF == fputc ('\n', fp)) ||
         (EOF == fputs (body, fp)))
       {
  	log_error (_("Error writing to %s."), file);
***************
*** 1189,1197 ****
  	return -1;
       }
     
     if ((EOF == fputs (head, fp)) ||
!        ((body!=NULL) && ((EOF == fputc ('\n', fp)) ||
! 			 (EOF == fputs (body, fp)))))
       {
  	log_error (_("Error writing to %s."), file);
  	fclose (fp);
--- 1209,1237 ----
  	return -1;
       }
     
+ 	// de-escape leading \x2e\x2e to \x2e
+ 	char *from = body;
+ 	char *to = body;
+ 
+ 	while (*from) {
+ 		if (*from == '\n' && *(from+1) == '.' && *(from+2) == '.') {
+ 			*to++ = '\n';
+ 			*to++ = '.';
+ 			from += 3;
+ 			continue;
+ 		}
+ 		if (from == to) {
+ 			from++;
+ 			to++;
+ 			continue;
+ 		}
+ 		*to++ = *from++;
+ 	}
+ 	*to = '\0';
+ 
     if ((EOF == fputs (head, fp)) ||
! //       ((body!=NULL) && ((EOF == fputc ('\n', fp)) ||
! 			 (EOF == fputs (body, fp))) // ))
       {
  	log_error (_("Error writing to %s."), file);
  	fclose (fp);
***************
*** 3274,3280 ****
  	
  	if (NULL != (vline = vgets (vp, &vlen)))
  	  {
! 	     vline[vlen] = 0; /* make sure line is NULL terminated */
  	     group->headers = slrn_ranges_from_newsrc_line (vline);
  	  }
  	
--- 3314,3323 ----
  	
  	if (NULL != (vline = vgets (vp, &vlen)))
  	  {
! 	     if (vline[vlen-1] == '\n')
! 	       vline[vlen-1] = 0; /* make sure line is NULL terminated */
! 	     else
! 	       vline[vlen] = 0;
  	     group->headers = slrn_ranges_from_newsrc_line (vline);
  	  }
  	
***************
*** 3383,3389 ****
  	     if (NULL == (group = find_group_type (vline)))
  	       continue;
  	     
! 	     vline[vlen-1] = 0;	       /* kill \n and NULL terminate */
  	     
  	     r = slrn_ranges_from_newsrc_line (p+1);
  	     group->requests = slrn_ranges_merge (group->requests, r);
--- 3426,3435 ----
  	     if (NULL == (group = find_group_type (vline)))
  	       continue;
  	     
! 	     if (vline[vlen-1] == '\n')
! 	       vline[vlen-1] = 0;
! 	     else
! 	       vline[vlen] = 0;
  	     
  	     r = slrn_ranges_from_newsrc_line (p+1);
  	     group->requests = slrn_ranges_merge (group->requests, r);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.