1 /* Copyright (c) 1985 Ceriel J.H. Jacobs */
4 static char rcsid
[] = "$Header$";
21 # include "commands.h"
26 STATIC
char * basename();
29 static char *errorgiven
; /* Set to error message, if there is one */
36 while (p
< ep
&& *s
) {
43 * display the prompt and refresh the screen.
50 register struct scr_info
*p
= &scr_info
;
52 register char *pb
= buf
;
54 if (startcomm
) return;
66 pb
= copy(pb
, &buf
[255], basename(currentfile
));
68 pb
= copy(pb
, &buf
[255], ", ");
69 pb
= copy(pb
, &buf
[255], getnum(p
->firstline
));
70 pb
= copy(pb
, &buf
[255], "-");
71 pb
= copy(pb
, &buf
[255], getnum(p
->lastline
));
75 *pb
++ = '\007'; /* Stupid terminal, stupid prompt */
79 * display error message
81 pb
= copy(pb
, &buf
[255], " ");
82 pb
= copy(pb
, &buf
[255], errorgiven
);
84 pb
= copy(pb
, &buf
[255], "\r\n");
88 else if (!stupid
&& (status
|| maxpos
)) {
89 pb
= copy(pb
, &buf
[255], " (");
90 name
= &filenames
[filecount
];
93 * indicate top and/or bottom
97 pb
= copy(pb
, &buf
[255], "Top");
100 pb
= copy(pb
, &buf
[255], "Previous: ");
101 pb
= copy(pb
, &buf
[255], basename(*(name
- 1)));
103 if (status
& EOFILE
) {
104 pb
= copy(pb
, &buf
[255], ", ");
107 if (status
& EOFILE
) {
109 pb
= copy(pb
, &buf
[255], "Bottom");
112 pb
= copy(pb
, &buf
[255], "Next: ");
113 pb
= copy(pb
, &buf
[255], basename(*(name
+ 1)));
117 else { /* display percentage */
118 pb
= copy(pb
, &buf
[255], getnum((100 * getpos(p
->lastline
))/maxpos
));
119 pb
= copy(pb
, &buf
[255], "%");
121 pb
= copy(pb
, &buf
[255], ")");
133 * Remember error message
137 error(str
) char *str
; {
144 basename(fn
) char *fn
; { /* Return name without path */
149 while (*s
++) ; /* Search end of name */
153 * Backwards to first '/'
157 * There is a name after the '/'
161 *s
= 0; /* No name after the '/' */
163 if (s
== fn
) return s
;
170 ret_to_continue() { /* Obvious */
182 putline("[Type anything to continue]");
184 if (is_escape(c
= getch())) {
186 (VOID
) match(buf
, &c
, currmap
->k_mach
);