Article View: comp.soft-sys.khoros
Article #1003cantata expression bug (fix) on Omron/NeXT(MACH)...
From: Mark Young
Date: Sat, 21 Nov 1992 18:04
Date: Sat, 21 Nov 1992 18:04
112 lines
5258 bytes
5258 bytes
Hi,
This next bug is also complements of Jon Hale of Omron Corporation.
The bug is that cantata's expression parser does not work on certain
machines. It gives bogus results and thus executes processes with
incorrect command line arguments. The problem will show up on Omron
and NeXT machines, but probably all machines running mach. It has to
do with mach's interpetation of scanf(). In traditional UNIX scanf()
routines, when the first token of the input command is not matched the
operation is aborted, but in mach the scanf() routine continues match-
ing it's arguments. Therefore when we were checking the text line with
the string scan routine for the input i*25:
sscanf(string,"%f%s",&floatval,leftover)
mach's sscanf() will return 1 matched token, storing "i*25" in the
leftover string array, thus skipping the initial "%f" input command
token. Following is th fix that should be applied at the toplevel
of $KHOROS_HOME using patch -c < patchfile. Then the xvforms library
and cantata will need to be recompiled and installed.
Mark
-----------------------------------------------------------------------------
Mark Young young@chama.eece.unm.edu
Khoros Group (505) 277-6563 (work)
University of New Mexico Albuquerque, NM 87131
-----------------------------------------------------------------------------
Humor is something that is plentyful if you are willing to laugh at yourself.
*** src/xvroutines/Lib/xvforms/form_util.c Wed Jul 22 13:33:13 1992
--- src/xvroutines/Lib/xvforms/form_util.c Wed Nov 18 09:48:23 1992
***************
*** 960,966 ****
xvf_parse_int_line(db[sel->index],&line_info);
if ((line_info.optional == true) && (line_info.opt_sel == false))
break;
! if (sscanf(line_info.literal,"%d%s", &ivalue, leftover) != 1)
{
if (!(xve_eval_int(id, line_info.literal, &ivalue, error)))
{
--- 951,959 ----
xvf_parse_int_line(db[sel->index],&line_info);
if ((line_info.optional == true) && (line_info.opt_sel == false))
break;
! leftover[0] = '\0';
! if (sscanf(line_info.literal,"%d%s", &ivalue, leftover) != 1 ||
! leftover[0] != '\0')
{
if (!(xve_eval_int(id, line_info.literal, &ivalue, error)))
{
***************
*** 985,991 ****
xvf_parse_float_line(db[sel->index],&line_info);
if ((line_info.optional == true) && (line_info.opt_sel == false))
break;
! if (sscanf(line_info.literal,"%f%s", &fvalue, leftover) != 1)
{
if (!(xve_eval_float(id, line_info.literal, &fvalue, error)))
{
--- 978,986 ----
xvf_parse_float_line(db[sel->index],&line_info);
if ((line_info.optional == true) && (line_info.opt_sel == false))
break;
! leftover[0] = '\0';
! if (sscanf(line_info.literal,"%f%s", &fvalue, leftover) != 1 ||
! leftover[0] != '\0')
{
if (!(xve_eval_float(id, line_info.literal, &fvalue, error)))
{
*** src/xvroutines/Lib/xvforms/collect.c Wed Mar 11 20:07:00 1992
--- src/xvroutines/Lib/xvforms/collect.c Wed Nov 18 09:47:59 1992
***************
*** 197,203 ****
xvf_parse_int_line(database[current->index], &line_info);
/* see if it's not a regular integer (ie, an expression) */
! if (sscanf(current->buffer,"%d%s",&tmp_int,leftover) != 1)
{
/* can't scan it normally - try to evaluate expression */
id = (long) formptr; /* this is the id for this form */
--- 197,205 ----
xvf_parse_int_line(database[current->index], &line_info);
/* see if it's not a regular integer (ie, an expression) */
! leftover[0] = '\0';
! if (sscanf(current->buffer,"%d%s",&tmp_int,leftover) != 1 ||
! leftover[0] != '\0')
{
/* can't scan it normally - try to evaluate expression */
id = (long) formptr; /* this is the id for this form */
***************
*** 340,346 ****
xvf_parse_float_line(database[current->index], &line_info);
/* see if it's not a regular float (ie, could be an expression) */
! if (sscanf(current->buffer,"%f%s",&tmp_float,leftover) != 1)
{
/* can't scan it normally - try to evaluate expression */
id = (long) formptr; /* this is the id for this form */
--- 342,350 ----
xvf_parse_float_line(database[current->index], &line_info);
/* see if it's not a regular float (ie, could be an expression) */
! leftover[0] = '\0';
! if (sscanf(current->buffer,"%f%s",&tmp_float,leftover) != 1 ||
! leftover[0] != '\0')
{
/* can't scan it normally - try to evaluate expression */
id = (long) formptr; /* this is the id for this form */
Technical Details
Message-ID:
<41777@pprg.eece.unm.edu.pprg.unm.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!elroy.jpl.nasa.gov!swrinde!zaphod.mps.ohio-state.edu!uwm.edu!ogicse!mimbres.cs.unm.edu!pprg.unm.edu!daemonShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!elroy.jpl.nasa.gov!swrinde!zaphod.mps.ohio-state.edu!uwm.edu!ogicse!mimbres.cs.unm.edu!pprg.unm.edu!daemon From: young@chama.eece.unm.edu (Mark Young) Newsgroups: comp.soft-sys.khoros Subject: cantata expression bug (fix) on Omron/NeXT(MACH)... Message-ID: <41777@pprg.eece.unm.edu.pprg.unm.edu> Date: 21 Nov 92 18:04:38 GMT Article-I.D.: pprg.41777 Sender: daemon@pprg.unm.edu Lines: 112