| 1412 | staticfn |
| 1413 | #endif |
| 1414 | void |
| 1415 | restore_msghistory(NHFILE *nhfp) |
| 1416 | { |
| 1417 | int msgsize = 0; |
| 1418 | #ifndef SFCTOOL |
| 1419 | int msgcount = 0; |
| 1420 | #endif |
| 1421 | char msg[BUFSZ]; |
| 1422 | |
| 1423 | while (1) { |
| 1424 | Sfi_int(nhfp, &msgsize, "msghistory-length"); |
| 1425 | if (msgsize == -1) |
| 1426 | break; |
| 1427 | if (msgsize > BUFSZ - 1) |
| 1428 | panic("restore_msghistory: msg too big (%d)", msgsize); |
| 1429 | Sfi_char(nhfp, msg, "msghistory-msg", msgsize); |
| 1430 | msg[msgsize] = '\0'; |
| 1431 | #ifndef SFCTOOL |
| 1432 | putmsghistory(msg, TRUE); |
| 1433 | ++msgcount; |
| 1434 | #endif /* !SFCTOOL */ |
| 1435 | } |
| 1436 | #ifndef SFCTOOL |
| 1437 | if (msgcount) |
| 1438 | putmsghistory((char *) 0, TRUE); |
| 1439 | debugpline1("Read %d messages from savefile.", msgcount); |
| 1440 | #endif /* !SFCTOOL */ |
| 1441 | } |
| 1442 | |
| 1443 | #ifndef SFCTOOL |
| 1444 |
no test coverage detected