[net.sources] More fixes to my last version of cpr.

phb@hcr.UUCP (Paul Breslin) (09/28/83)

One of these days we'll get it right!

The function CatchSignalsPlease should really be:
--------------------------------------------------------------------------
CatchSignalsPlease(action)
int	(*action)();
  {
	if( signal(SIGINT,  SIG_IGN) != SIG_IGN ) signal(SIGINT,  action);
	if( signal(SIGQUIT, SIG_IGN) != SIG_IGN ) signal(SIGQUIT, action);
	if( signal(SIGHUP,  SIG_IGN) != SIG_IGN ) signal(SIGHUP,  action);
  }

--------------------------------------------------------------------------
In the function PutLine this case has changed slightly:
    case '\'':
	for( ++l; *l && *l != '\''; ++l )
		if( *l == '\\' && *(l+1) ) ++l;
	break;

--------------------------------------------------------------------------
And finally the functions EndComment and EndString have been slightly
modified:

char *
EndComment(p)
register char	*p;
  {
	register char	c;

	/*
	 * Always return pointer to last non-null char looked at.
	 */
	while( c = *p++ )
		if( c == '*' && *p == '/' )
		  {
			InComment = 0;
			return(p);
		  }
	return(p-2);
  }

char *
EndString(p)
register char	*p;
  {
	register char	c;

	/*
	 * Always return pointer to last non-null char looked at.
	 */
	while( c = *p++ )
		if( c == '\\' && *p )
		  {
			++p;
			continue;
		  }
		else if( c == '"' )
		  {
			InString = 0;
			return(p-1);
		  }
	return(p-2);
  }

--------------------------------------------------------------------------
Thanks to Scott Stevens (inuxa!stevens) for reporting these problems.