From de2b58a3ef8a7f1f0629ff8d39fd8aab4e522b1b Mon Sep 17 00:00:00 2001 From: arif Date: Tue, 17 Nov 2009 15:53:11 +0000 Subject: [PATCH] smyrna sscanf -> strtok --- cmd/smyrna/topview.c | 18 +++++++++++++++++- cmd/smyrna/viewport.c | 2 +- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/cmd/smyrna/topview.c b/cmd/smyrna/topview.c index 7addf8cfe..42c92458f 100755 --- a/cmd/smyrna/topview.c +++ b/cmd/smyrna/topview.c @@ -78,11 +78,27 @@ static void init_element_data(element_data * d) static void setpositioninfo(float *x, float *y, float *z, char *buf) { + /*zero all values */ + char* a; + + *x = 0; *y = 0; *z = 0; - sscanf(buf, "%f,%f,%f", x, y, z); + a=strtok(buf,","); + if(a) + *x=atof(a); + a=strtok(NULL,","); + if(a) + *y=atof(a); + a=strtok(NULL,","); + if(a) + *z=atof(a); + + + +// sscanf(buf, "%f,%f,%f", x, y, z); } static void setglCompColor(glCompColor * c, char *colorstr) diff --git a/cmd/smyrna/viewport.c b/cmd/smyrna/viewport.c index 09e7d7334..e11e831bb 100755 --- a/cmd/smyrna/viewport.c +++ b/cmd/smyrna/viewport.c @@ -349,8 +349,8 @@ void init_viewport(ViewInfo * view) { FILE *input_file = NULL; FILE *input_file2 = NULL; - get_data_dir(); static char* path; + get_data_dir(); input_file = fopen(view->template_file, "rb"); if (!input_file) { -- 2.40.0