[comp.os.minix] Update to unshar.c

frankb@ruuinf.cs.ruu.nl (Frank Breure) (03/19/90)

Hello,

while I was trying to upgrade to 1.5.5 I encountered a problem with
"unshar".
The 1.5.5 postings had a shell commands like:
sed 's/^X//' > 'IBM_00.uue' << '+ END-OF-FILE ''IBM_00.uue'

The old unshar was not able to recognize the end marker
'+ END-OF-FILE IBM_00.uue', because this end marker is specified as a
concatenation of two strings.

The following cdiff will make unshar recongizing this kind of shar-files:
---------------------- cut here  ------------------------
*** unshar.c~	Fri Mar 16 21:30:29 1990
--- unshar.c	Fri Mar 16 21:52:31 1990
***************
*** 97,108 ****
    switch (*buf) {		/* Now check first char */
        case '\'':
  	buf++;
! 	while (*buf != '\'') *temp++ = *buf++;
  	*temp = 0;
  	return(out);
        case '\"':
  	buf++;
! 	while (*buf != '\"') *temp++ = *buf++;
  	*temp = 0;
  	return(out);
        case 0:
--- 97,112 ----
    switch (*buf) {		/* Now check first char */
        case '\'':
  	buf++;
! 	/* this assumes 'aa''bb' being the same as 'aabb' */
! 	while (*buf != '\'' || (*buf ++ == '\'' && *buf ++ == '\''))
! 	    *temp++ = *buf++;
  	*temp = 0;
  	return(out);
        case '\"':
  	buf++;
! 	/* this assumes "aa""bb" being the same as "aabb" */
! 	while (*buf != '\"' || (*buf ++ == '\"' && *buf ++ == '\"')) 
! 	    *temp++ = *buf++;
  	*temp = 0;
  	return(out);
        case 0:
------------------- cut here ---------------------


-- 
"My opinions may be subject of change without notice."
Frank Breure (Student at Haagse Hogeschool, The Hague)
workplace at: Dept. of Computer Science, Utrecht University
UUCP: ...!uunet!mcsun!hp4nl!ruuinf!frankb   Email: frankb@cs.ruu.nl