Update help prints to print the configured escape character
This commit is contained in:
parent
38cde1611f
commit
28d342aa42
4 changed files with 35 additions and 7 deletions
|
|
@ -116,11 +116,11 @@ bytenuts_run(int argc, char **argv)
|
|||
if (bytenuts.resume) {
|
||||
load_state();
|
||||
} else {
|
||||
cheerios_insert(
|
||||
cheerios_print(
|
||||
"Welcome to Bytenuts\r\n"
|
||||
"To quit press ctrl-b q\r\n"
|
||||
"To see all commands, press ctrl-b h\r\n",
|
||||
82
|
||||
"To quit press ctrl-%c q\r\n"
|
||||
"To see all commands, press ctrl-%c h\r\n",
|
||||
bytenuts.config.escape, bytenuts.config.escape
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -184,6 +184,29 @@ cheerios_info(const char *line)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
cheerios_print(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
char *buf;
|
||||
size_t len;
|
||||
|
||||
va_start(ap, fmt);
|
||||
len = vsnprintf(NULL, 0, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
buf = calloc(1, len+1);
|
||||
|
||||
va_start(ap, fmt);
|
||||
vsprintf(buf, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
cheerios_insert(buf, len);
|
||||
free(buf);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
cheerios_insert(const char *buf, size_t len)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include <ncurses.h>
|
||||
#include <pthread.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "bytenuts.h"
|
||||
|
|
@ -69,6 +70,10 @@ int cheerios_input(const char *line);
|
|||
* do not terminate with a newline! */
|
||||
int cheerios_info(const char *line);
|
||||
|
||||
/* Like cheerios_insert except using printf formatting */
|
||||
__attribute__((format(printf, 1, 2)))
|
||||
int cheerios_print(const char *fmt, ...);
|
||||
|
||||
/* directly insert a buffer to the output window */
|
||||
int cheerios_insert(const char *buf, size_t len);
|
||||
|
||||
|
|
|
|||
|
|
@ -359,8 +359,8 @@ ingest_thread(void *arg)
|
|||
bytenuts_set_status(STATUS_INGEST, "xmodem1k");
|
||||
break;
|
||||
case 'h':
|
||||
cheerios_insert(
|
||||
"Commands (lead with ctrl-b):\r\n"
|
||||
cheerios_print(
|
||||
"Commands (lead with ctrl-%c):\r\n"
|
||||
" c: print available quick commands\r\n"
|
||||
" 0-9: load the given quick command (0 is 10)\r\n"
|
||||
" p: select a different quick commands page\r\n"
|
||||
|
|
@ -369,7 +369,7 @@ ingest_thread(void *arg)
|
|||
" X: start XModem upload with 1024B payloads\r\n"
|
||||
" h: view this help\r\n"
|
||||
" q: quit Bytenuts\r\n",
|
||||
313
|
||||
ingest.config->escape
|
||||
);
|
||||
bytenuts_set_status(STATUS_INGEST, "normal");
|
||||
should_continue = 1;
|
||||
|
|
|
|||
Loading…
Reference in a new issue