summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2022-05-01 19:17:08 -0400
committerJakob Kaivo <jkk@ung.org>2022-05-01 19:17:08 -0400
commit19b8b863047a2086f42cf47459322f121fae054a (patch)
treec75fb06d68f28bc8fa5bb08f81e0cf635782ab27
parentb94e07106038dfb07ccfc184cd76bbf48aa966d0 (diff)
add prompt with file nameHEADmaster
-rw-r--r--more.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/more.c b/more.c
index 896634a..a50e6e0 100644
--- a/more.c
+++ b/more.c
@@ -102,10 +102,21 @@ static void more_echo(int on)
static void more_status(const char *fmt, ...)
{
+ static char smso[64] = "";
+ static char rmso[64] = "";
+ if (smso[0] == '\0') {
+ more_tput(sizeof(smso), smso, "smso");
+ more_tput(sizeof(rmso), rmso, "rmso");
+ }
+
+ fprintf(stderr, "%s", smso);
+
va_list ap;
va_start(ap, fmt);
- vprintf(fmt, ap);
+ vfprintf(stderr, fmt, ap);
va_end(ap);
+
+ fprintf(stderr, "%s", rmso);
}
static void more_clear(more_clear_action action)
@@ -569,9 +580,14 @@ static int more(struct more_file *mf)
return 0;
}
more_status("%s <EOF>", mf->path);
+ } else {
+ more_status("%s", mf->path);
}
+
int c = fgetc(more_in);
+ fprintf(stderr, "\r%*s\r", 80, " ");
+
switch (c) {
case EOF:
perror("fgetc");