/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* hack.topl.c - version 1.0.2 */
xchar tlx
, tly
; /* set by pline; used by addtopl */
} *old_toplines
, *last_redone_topl
;
#define OTLMAX 20 /* max nr of old toplines remembered */
last_redone_topl
= last_redone_topl
->next_topl
;
last_redone_topl
= old_toplines
;
(void) strcpy(toplines
, last_redone_topl
->topl_text
);
if(index(toplines
, '\n')) cl_end();
register struct topl
*tl
;
register int cnt
= OTLMAX
;
!strcmp(toplines
, last_redone_topl
->topl_text
)) return;
!strcmp(toplines
, old_toplines
->topl_text
)) return;
alloc((unsigned)(strlen(toplines
) + sizeof(struct topl
) + 1));
tl
->next_topl
= old_toplines
;
tl
->topl_text
= (char *)(tl
+ 1);
(void) strcpy(tl
->topl_text
, toplines
);
free((char *) tl
->next_topl
);
if(tlx
+ strlen(s
) > CO
) putsym('\n');
char *s
; /* allowed chars besides space/return */
if(tlx
+ 8 > CO
) putsym('\n'), tly
++;
if(flags
.toplin
&& tly
> 1) {
if(tly
> 1) docorner(1, tly
-1);
pline(line
,arg1
,arg2
,arg3
,arg4
,arg5
,arg6
)
register char *line
,*arg1
,*arg2
,*arg3
,*arg4
,*arg5
,*arg6
;
register char *bp
= pbuf
, *tl
;
if(!line
|| !*line
) return;
if(!index(line
, '%')) (void) strcpy(pbuf
,line
); else
(void) sprintf(pbuf
,line
,arg1
,arg2
,arg3
,arg4
,arg5
,arg6
);
if(flags
.toplin
== 1 && !strcmp(pbuf
, toplines
)) return;
/* If there is room on the line, print message on same line */
/* But messages like "You die..." deserve their own line */
if(flags
.toplin
== 1 && tly
== 1 &&
n0
+ strlen(toplines
) + 3 < CO
-8 && /* leave room for --More-- */
strncmp(bp
, "You ", 4)) {
(void) strcat(toplines
, " ");
(void) strcat(toplines
, bp
);
if(flags
.toplin
== 1) more();
/* look for appropriate cut point */
for(n
= 0; n
< CO
; n
++) if(bp
[n
] == ' ')
if(!n0
) for(n
= 0; n
< CO
-1; n
++)
if(!letter(bp
[n
])) n0
= n
;
(void) strncpy((tl
= eos(toplines
)), bp
, n0
);
/* remove trailing spaces, but leave one */
while(n0
> 1 && tl
[n0
-1] == ' ' && tl
[n0
-2] == ' ')
if(n0
&& tl
[0]) (void) strcat(tl
, "\n");
if(cury
> tly
) tly
= cury
;
putsym('\n'); /* 1 <= curx <= CO; avoid CO */
putstr(s
) register char *s
; {