Subject: bin/4310: Problem with pppd auxiliar tool ``chat''
To: None <gnats-bugs@gnats.netbsd.org>
From: Paulo Alexandre Pinto Pires <pappires@vortex.del.ufrj.br>
List: netbsd-bugs
Date: 10/21/1997 07:43:27
>Number:         4310
>Category:       bin
>Synopsis:       argument line parsing problem
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Oct 21 02:50:03 1997
>Last-Modified:
>Originator:     Paulo Alexandre Pinto Pires
>Organization:
	DEL/UFRJ
>Release:        NetBSD-current as of 14-Oct-97
>Environment:
	i486dx-50 16Mb RAM, NetBSD-current (14-Oct-97)


>Description:
	chat scripting tool used by pppd seems to have a problem in
	parsing parameters from the argument line.  This is specially
	true for switches which take an extra argument like "-t <timeout>".
	The problem seems to happen due to parsing errors only when
	such switches are the first to appear in the command line, and
	it causes chat to abort with a "Connect script failed" message.

>How-To-Repeat:
	pppd /dev/tty03 115200 connect 'chat -t 120 -v "" "ATZ" "OK" "ATDP109"'

>Fix:
	The method used in chat sources for parsing the command line
	referred to as a "micro getopt()" seems not to be setting the
	_O variable correctly.

	A workaround for the above example would be changing the order
	in which -v and -t switches appear in the command line, as below:

	pppd /dev/tty03 115200 connect 'chat -v -t 120 "" "ATZ" "OK" "ATDP109"'
>Audit-Trail:
>Unformatted: