(str)
| 1619 | /************************* mar_add_message *******************************/ |
| 1620 | |
| 1621 | void |
| 1622 | mar_add_message(str) |
| 1623 | const char *str; |
| 1624 | { |
| 1625 | int i, mesg_hist = mar_get_msg_history(); |
| 1626 | char *tmp, *rest, buf[TBUFSZ]; |
| 1627 | |
| 1628 | if (WIN_MESSAGE == WIN_ERR) |
| 1629 | return; |
| 1630 | |
| 1631 | if (!mar_message_pause) { |
| 1632 | mar_message_pause = TRUE; |
| 1633 | messages_pro_zug = 0; |
| 1634 | msg_pos = msg_max; |
| 1635 | } |
| 1636 | |
| 1637 | if (msg_max > mesg_hist - 2) { |
| 1638 | msg_max = mesg_hist - 2; |
| 1639 | msg_pos--; |
| 1640 | if (msg_pos < 0) |
| 1641 | msg_pos = 0; |
| 1642 | tmp = message_line[0]; |
| 1643 | for (i = 0; i < mesg_hist - 1; i++) { |
| 1644 | message_line[i] = message_line[i + 1]; |
| 1645 | message_age[i] = message_age[i + 1]; |
| 1646 | } |
| 1647 | message_line[mesg_hist - 1] = tmp; |
| 1648 | } |
| 1649 | strcpy(gt.toplines, str); |
| 1650 | messages_pro_zug++; |
| 1651 | msg_max++; |
| 1652 | |
| 1653 | if ((int) strlen(gt.toplines) >= msg_width) { |
| 1654 | int pos = msg_width; |
| 1655 | tmp = gt.toplines + msg_width; |
| 1656 | while (*tmp != ' ' && pos >= 0) { |
| 1657 | tmp--; |
| 1658 | pos--; |
| 1659 | } |
| 1660 | if (pos <= 0) |
| 1661 | pos = msg_width; /* Mar -- Oops, what a word :-) */ |
| 1662 | message_age[msg_max] = TRUE; |
| 1663 | strncpy(message_line[msg_max], gt.toplines, pos); |
| 1664 | message_line[msg_max][pos] = 0; |
| 1665 | rest = strcpy(buf, gt.toplines + pos); |
| 1666 | } else { |
| 1667 | message_age[msg_max] = TRUE; |
| 1668 | strncpy(message_line[msg_max], gt.toplines, msg_width); |
| 1669 | rest = 0; |
| 1670 | } |
| 1671 | |
| 1672 | Gem_nhwindow[WIN_MESSAGE].gw_dirty = TRUE; |
| 1673 | if (messages_pro_zug |
| 1674 | >= mesg_hist) { /* MAR -- Greater then should never happen */ |
| 1675 | messages_pro_zug = mesg_hist; |
| 1676 | mar_display_nhwindow(WIN_MESSAGE); |
| 1677 | } |
| 1678 |
no test coverage detected