projects
/
uci2wb.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
(parent:
c33a143
)
Fix string options with empty default
author
H.G.Muller
<hgm@hgm-xboard.(none)>
Sat, 24 Dec 2016 18:41:11 +0000 (19:41 +0100)
committer
H.G.Muller
<hgm@hgm-xboard.(none)>
Sat, 24 Dec 2016 18:44:58 +0000 (19:44 +0100)
When sscanf finds nothing after 'default', it does not touch the target
array at all, rather than putting an empty string in it. So the target
is now initialized to an empty string before the sscanf.
UCI2WB.c
patch
|
blob
|
history
diff --git
a/UCI2WB.c
b/UCI2WB.c
index
cbc11f7
..
6b4d19d
100644
(file)
--- a/
UCI2WB.c
+++ b/
UCI2WB.c
@@
-332,7
+332,7
@@
Engine2GUI()
}
\r
else if(!strcmp(command, "option")) { // USI option: extract data fields
\r
char name[80], type[80], buf[1024], val[256], *q;
\r
- int min=0, max=1e9;
\r
+ int min=0, max=1e9; *val = 0;
\r
if(p = strstr(line+6, " type ")) sscanf(p+1, "type %s", type), *p = '\n';
\r
if(p = strstr(line+6, " min ")) sscanf(p+1, "min %d", &min), *p = '\n';
\r
if(p = strstr(line+6, " max ")) sscanf(p+1, "max %d", &max), *p = '\n';
\r