hack.topl.c (1c7f94e5) hack.topl.c (3c439f43)
1/* $NetBSD: hack.topl.c,v 1.7 2003/04/02 18:36:41 jsm Exp $ */
1/* $NetBSD: hack.topl.c,v 1.8 2008/01/28 06:55:42 dholland Exp $ */
2
3/*
4 * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
5 * Amsterdam
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are

--- 48 unchanged lines hidden (view full) ---

58 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
59 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
60 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
61 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
62 */
63
64#include <sys/cdefs.h>
65#ifndef lint
2
3/*
4 * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
5 * Amsterdam
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are

--- 48 unchanged lines hidden (view full) ---

58 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
59 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
60 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
61 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
62 */
63
64#include <sys/cdefs.h>
65#ifndef lint
66__RCSID("$NetBSD: hack.topl.c,v 1.7 2003/04/02 18:36:41 jsm Exp $");
66__RCSID("$NetBSD: hack.topl.c,v 1.8 2008/01/28 06:55:42 dholland Exp $");
67#endif /* not lint */
68
69#include <stdlib.h>
70#include "hack.h"
71#include "extern.h"
72
73char toplines[BUFSZ];
74xchar tlx, tly; /* set by pline; used by addtopl */

--- 61 unchanged lines hidden (view full) ---

136 }
137}
138
139void
140addtopl(s)
141 const char *s;
142{
143 curs(tlx, tly);
67#endif /* not lint */
68
69#include <stdlib.h>
70#include "hack.h"
71#include "extern.h"
72
73char toplines[BUFSZ];
74xchar tlx, tly; /* set by pline; used by addtopl */

--- 61 unchanged lines hidden (view full) ---

136 }
137}
138
139void
140addtopl(s)
141 const char *s;
142{
143 curs(tlx, tly);
144 if (tlx + strlen(s) > CO)
144 if (tlx + (int)strlen(s) > CO)
145 putsym('\n');
146 putstr(s);
147 tlx = curx;
148 tly = cury;
149 flags.toplin = 1;
150}
151
152void

--- 74 unchanged lines hidden (view full) ---

227 if (flags.toplin == 1 && !strcmp(pbuf, toplines))
228 return;
229 nscr(); /* %% */
230
231 /* If there is room on the line, print message on same line */
232 /* But messages like "You die..." deserve their own line */
233 n0 = strlen(bp);
234 if (flags.toplin == 1 && tly == 1 &&
145 putsym('\n');
146 putstr(s);
147 tlx = curx;
148 tly = cury;
149 flags.toplin = 1;
150}
151
152void

--- 74 unchanged lines hidden (view full) ---

227 if (flags.toplin == 1 && !strcmp(pbuf, toplines))
228 return;
229 nscr(); /* %% */
230
231 /* If there is room on the line, print message on same line */
232 /* But messages like "You die..." deserve their own line */
233 n0 = strlen(bp);
234 if (flags.toplin == 1 && tly == 1 &&
235 n0 + strlen(toplines) + 3 < CO - 8 && /* leave room for
235 n0 + (int)strlen(toplines) + 3 < CO - 8 && /* leave room for
236 * --More-- */
237 strncmp(bp, "You ", 4)) {
238 (void) strcat(toplines, " ");
239 (void) strcat(toplines, bp);
240 tlx += 2;
241 addtopl(bp);
242 return;
243 }

--- 63 unchanged lines hidden ---
236 * --More-- */
237 strncmp(bp, "You ", 4)) {
238 (void) strcat(toplines, " ");
239 (void) strcat(toplines, bp);
240 tlx += 2;
241 addtopl(bp);
242 return;
243 }

--- 63 unchanged lines hidden ---