From luoqi@luoqi.watermarkgroup.com  Tue Jan 14 02:52:00 1997
Received: from luoqi.watermarkgroup.com (ppp-3.ts-1.ptn.idt.net [169.132.64.3])
          by freefall.freebsd.org (8.8.4/8.8.4) with ESMTP id CAA05977
          for <FreeBSD-gnats-submit@freebsd.org>; Tue, 14 Jan 1997 02:51:56 -0800 (PST)
Received: (from root@localhost) by luoqi.watermarkgroup.com (8.8.4/8.6.12) id FAA18440; Tue, 14 Jan 1997 05:51:53 -0500 (EST)
Message-Id: <199701141051.FAA18440@luoqi.watermarkgroup.com>
Date: Tue, 14 Jan 1997 05:51:53 -0500 (EST)
From: luoqi@watermarkgroup.com
Reply-To: luoqi@watermarkgroup.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: chat.c fix: still report when report string coincides with an expect string
X-Send-Pr-Version: 3.2

>Number:         2491
>Category:       bin
>Synopsis:       chat won't report is the report string coincides with an expect string
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jan 14 03:00:01 PST 1997
>Closed-Date:    Mon Jun 1 16:55:08 PDT 1998
>Last-Modified:  Mon Jun  1 16:58:19 PDT 1998
>Originator:     Luoqi Chen
>Release:        FreeBSD 2.2-RELEASE i386
>Organization:
>Environment:

	
     $Id: chat.c,v 1.4 1995/10/31 23:28:29 peter Exp $


>Description:

	
	If a report string coincides with one of the expect strings, it will
	not be reported.

>How-To-Repeat:

	
	In the following script file, CONNECT will never be reported. 
	    REPORT CONNECT ABORT BUSY ABORT 'NO CARRIER'
	    TIMEOUT 60 '' ATZ OK ATDT555-1234 CONNECT ''
	    annex: 1 name: ppp word: ppp

>Fix:
	
	
	Attached is a diff.

--- chat.c	Tue Jan 14 05:37:54 1997
+++ chat.c.new	Tue Jan 14 05:37:21 1997
@@ -579,6 +579,8 @@
 	    {
 	    fprintf (report_fp, "Closing \"%s\".\n", report_file);
 	    }
+	if (report_gathering)
+	    fprintf (report_fp, "chat:  %s\n", report_buffer);
 	fclose (report_fp);
 	report_fp = (FILE*) NULL;
         }
@@ -1221,38 +1223,6 @@
 
 	*s++ = c;
 
-	if (s - temp >= len &&
-	    c == string[len - 1] &&
-	    strncmp(s - len, string, len) == 0)
-	    {
-	    if (verbose)
-		{
-		logf(" -- got it\n");
-		}
-
-	    alarm(0);
-	    alarmed = 0;
-	    return (1);
-	    }
-
-	for (n = 0; n < n_aborts; ++n)
-	    {
-	    if (s - temp >= (abort_len = strlen(abort_string[n])) &&
-		strncmp(s - abort_len, abort_string[n], abort_len) == 0)
-	        {
-		if (verbose)
-		    {
-		    logf(" -- failed\n");
-		    }
-		
-		alarm(0);
-		alarmed = 0;
-		exit_code = n + 4;
-		strcpy(fail_reason = fail_buffer, abort_string[n]);
-		return (0);
-	        }
-	    }
-
 	if (!report_gathering)
 	    {
 	    for (n = 0; n < n_reports; ++n)
@@ -1285,6 +1255,38 @@
 	        {
 		report_gathering = 0;
 		fprintf (report_fp, "chat:  %s\n", report_buffer);
+	        }
+	    }
+
+	if (s - temp >= len &&
+	    c == string[len - 1] &&
+	    strncmp(s - len, string, len) == 0)
+	    {
+	    if (verbose)
+		{
+		logf(" -- got it\n");
+		}
+
+	    alarm(0);
+	    alarmed = 0;
+	    return (1);
+	    }
+
+	for (n = 0; n < n_aborts; ++n)
+	    {
+	    if (s - temp >= (abort_len = strlen(abort_string[n])) &&
+		strncmp(s - abort_len, abort_string[n], abort_len) == 0)
+	        {
+		if (verbose)
+		    {
+		    logf(" -- failed\n");
+		    }
+		
+		alarm(0);
+		alarmed = 0;
+		exit_code = n + 4;
+		strcpy(fail_reason = fail_buffer, abort_string[n]);
+		return (0);
 	        }
 	    }
 

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: gnats-admin->freebsd-bugs 
Responsible-Changed-By: gpalmer 
Responsible-Changed-When: Tue Jan 14 03:15:08 PST 1997 
Responsible-Changed-Why:  
Misfiled PR 
State-Changed-From-To: open->closed 
State-Changed-By: steve 
State-Changed-When: Mon Jun 1 16:55:08 PDT 1998 
State-Changed-Why:  
Originator says this was fixed in revision 1.9 with the 
ppp-2.3.1 merge. 
>Unformatted:
