Specifically this effects ^G, help and order.
While here also document the 'h' character.
Initial inspiration and diff from Anindya Mukherjee (anindya49 <at> hotmail
<dot> com)
OK bluhm@
-/* $OpenBSD: engine.c,v 1.27 2021/02/06 06:19:28 tb Exp $ */
+/* $OpenBSD: engine.c,v 1.28 2021/06/02 08:32:22 martijn Exp $ */
/*
* Copyright (c) 2001, 2007 Can Erkin Acar <canacar@openbsd.org>
*
int cmd_len = -1;
struct command *curr_cmd = NULL;
char *curr_message = NULL;
+enum message_mode message_mode = MESSAGE_NONE;
+int message_cont = 1;
void print_cmdline(void);
return prev;
}
+void
+message_toggle(enum message_mode mode)
+{
+ message_mode = message_mode != mode ? mode : MESSAGE_NONE;
+ need_update = 1;
+ message_cont = 1;
+}
+
const char *
-message_set(const char *msg) {
- char *prev = curr_message;
- if (msg)
+message_set(const char *msg)
+{
+ free(curr_message);
+
+ if (msg) {
curr_message = strdup(msg);
- else
+ message_cont = 0;
+ } else {
curr_message = NULL;
- free(prev);
+ message_cont = 1;
+ }
return NULL;
}
if (!averageonly ||
(averageonly && count == countmax - 1))
disp_update();
+ if (message_cont) {
+ switch (message_mode) {
+ case MESSAGE_NONE:
+ message_set(NULL);
+ break;
+ case MESSAGE_HELP:
+ show_help();
+ break;
+ case MESSAGE_VIEW:
+ show_view();
+ break;
+ case MESSAGE_ORDER:
+ show_order();
+ break;
+ }
+ }
end_page();
need_update = 0;
if (countmax && ++count >= countmax)
-/* $OpenBSD: engine.h,v 1.12 2020/01/12 20:51:08 martijn Exp $ */
+/* $OpenBSD: engine.h,v 1.13 2021/06/02 08:32:22 martijn Exp $ */
/*
* Copyright (c) 2001, 2007 Can Erkin Acar <canacar@openbsd.org>
*
void ( *exec)(const char *);
};
+enum message_mode {
+ MESSAGE_NONE,
+ MESSAGE_HELP,
+ MESSAGE_VIEW,
+ MESSAGE_ORDER
+};
void tb_start(void);
int foreach_order(void (*callback)(order_type *));
void set_order(const char *opt);
void next_order(void);
+void show_help(void);
+void show_view(void);
+void show_order(void);
void setup_term(int maxpr);
int check_termcap(void);
void engine_loop(int countmax);
struct command *command_set(struct command *cmd, const char *init);
+void message_toggle(enum message_mode);
const char *message_set(const char *msg);
void foreach_view(void (*callback)(field_view *));
-/* $OpenBSD: main.c,v 1.73 2021/01/30 08:44:42 martijn Exp $ */
+/* $OpenBSD: main.c,v 1.74 2021/06/02 08:32:22 martijn Exp $ */
/*
* Copyright (c) 2001, 2007 Can Erkin Acar
* Copyright (c) 2001 Daniel Hartmeier
const char *s;
if (strcasecmp(buf, "help") == 0) {
- show_help();
- need_update = 1;
+ message_toggle(MESSAGE_HELP);
return;
}
if (strcasecmp(buf, "quit") == 0 || strcasecmp(buf, "q") == 0) {
return;
}
if (strncasecmp(buf, "order", 5) == 0) {
- show_order();
- need_update = 1;
+ message_toggle(MESSAGE_ORDER);
return;
}
if (strncasecmp(buf, "human", 5) == 0) {
case '?':
/* FALLTHROUGH */
case 'h':
- show_help();
- need_update = 1;
+ message_toggle(MESSAGE_HELP);
break;
case CTRL_G:
- show_view();
- need_update = 1;
+ message_toggle(MESSAGE_VIEW);
break;
case 'l':
command_set(&cm_count, NULL);
-.\" $OpenBSD: systat.1,v 1.119 2020/06/22 13:17:54 kn Exp $
+.\" $OpenBSD: systat.1,v 1.120 2021/06/02 08:32:22 martijn Exp $
.\" $NetBSD: systat.1,v 1.6 1996/05/10 23:16:39 thorpej Exp $
.\"
.\" Copyright (c) 1985, 1990, 1993
.\"
.\" @(#)systat.1 8.2 (Berkeley) 12/30/93
.\"
-.Dd $Mdocdate: June 22 2020 $
+.Dd $Mdocdate: June 2 2021 $
.Dt SYSTAT 1
.Os
.Sh NAME
While entering a command the
current character erase, word erase, and line kill characters
may be used.
+.It Ic h
+Toggle printing the names of the available views on the command line.
.It Ic o
Select the next ordering which sorts the rows according to a
combination of columns.
.It Ic ^F | Aq Ic left arrow
Select the next view.
.It Ic ^G
-Print the name of the current
+Toggle printing the name of the current
view being shown and the refresh interval.
.It Ic ^L
Refresh the screen.
command interpreter.
.Bl -tag -width Ds
.It Ic help
-Print the names of the available views on the command line.
+Toggle printing the names of the available views on the command line.
.It Ic human
Toggle human readable mode, where applicable.
.It Ic order
-Print the names of the available orderings on the command line.
+Toggle printing the names of the available orderings on the command line.
.It Ic quit
Quit
.Nm .