Mercurial > otakunoraifu
comparison scn2k/scn2k_cmd.cc @ 62:3b1593186f12
fix pointers used to get strchr result
author | Thibaut GIRKA <thib@sitedethib.com> |
---|---|
date | Sat, 06 Feb 2010 17:03:47 +0100 |
parents | d7cde171a1de |
children | 4b9ffe15a87d |
comparison
equal
deleted
inserted
replaced
61:bdd8a5ff8f46 | 62:3b1593186f12 |
---|---|
264 if (strncmp(save, "V<",2) == 0) { | 264 if (strncmp(save, "V<",2) == 0) { |
265 if (strncmp(save, "V<C>[",5) == 0) { // string | 265 if (strncmp(save, "V<C>[",5) == 0) { // string |
266 char buf[1024]; | 266 char buf[1024]; |
267 int n; | 267 int n; |
268 if (sscanf(save, "V<C>[%04d]=",&n) == 1) { | 268 if (sscanf(save, "V<C>[%04d]=",&n) == 1) { |
269 char* s = strchr(save, '='); | 269 const char* s = strchr(save, '='); |
270 s++; | 270 s++; |
271 char* send = strchr(s, '\n'); | 271 const char* send = strchr(s, '\n'); |
272 int slen = send - s; | 272 int slen = send - s; |
273 strncpy(buf, s, slen); | 273 strncpy(buf, s, slen); |
274 buf[slen] = 0; | 274 buf[slen] = 0; |
275 if (n >= 0 && n < 2000) str[n] = buf; | 275 if (n >= 0 && n < 2000) str[n] = buf; |
276 } | 276 } |
333 if (strncmp(save, "V<",2) == 0) { | 333 if (strncmp(save, "V<",2) == 0) { |
334 if (strncmp(save, "V<M>[",5) == 0) { // string | 334 if (strncmp(save, "V<M>[",5) == 0) { // string |
335 char buf[1024]; | 335 char buf[1024]; |
336 int n; | 336 int n; |
337 if (sscanf(save, "V<M>[%04d]=",&n) == 1) { | 337 if (sscanf(save, "V<M>[%04d]=",&n) == 1) { |
338 char* s = strchr(save, '='); | 338 const char* s = strchr(save, '='); |
339 s++; | 339 s++; |
340 char* send = strchr(s, '\n'); | 340 const char* send = strchr(s, '\n'); |
341 int slen = send - s; | 341 int slen = send - s; |
342 strncpy(buf, s, slen); | 342 strncpy(buf, s, slen); |
343 buf[slen] = 0; | 343 buf[slen] = 0; |
344 if (n >= 0 && n < 2000) sys_str[n] = buf; | 344 if (n >= 0 && n < 2000) sys_str[n] = buf; |
345 } | 345 } |