diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2022-04-29 02:31:30 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2022-04-29 02:31:30 -0700 |
commit | bcab803191a240e87414d58fdb6112e9299cb72e (patch) | |
tree | 84810b10bd14671f91a13e73d425949935c99004 | |
parent | 918dafb4a35bdb2b06d2d8c1bbe667ecface63ed (diff) | |
download | pw-bcab803191a240e87414d58fdb6112e9299cb72e.tar.gz pw-bcab803191a240e87414d58fdb6112e9299cb72e.tar.bz2 pw-bcab803191a240e87414d58fdb6112e9299cb72e.zip |
New :i and :l commands to adjust intervals.
-rw-r--r-- | pw.1 | 18 | ||||
-rw-r--r-- | pw.c | 15 |
2 files changed, 31 insertions, 2 deletions
@@ -298,7 +298,23 @@ status line disappears. If the optional modifier is included in the command, then it pops the entire stack, forgetting all the patterns and disabling grep mode. +.IP "\fB:i\fP \fIreal\fP" +Set the poll interval to the number of seconds specified by +.IR real . +See the description of the +.B -i +command line option for the argument format and semantics. + +.IP "\fB:l\fP \fIreal\fP" +Set the long interval to the number of seconds specified by +.IR real . +See the description of the +.B -i +command option for the argument format and the +.B -l +option for the semantics. .PP + Any other command results in a brief error message. .SH OPTIONS @@ -380,8 +396,6 @@ The program uses hard-coded ANSI sequences, so it doesn't support interesting old terminals. On the other hand, it carries no dependency on any terminal abstraction library/data. -The intervals cannot be dynamically adjusted. - There is no support for unwrapping long lines, which would be useful for copy and paste. However, the features like .B :w @@ -474,6 +474,21 @@ static void execute(char *cmd, unsigned *pstat) if (ngrep == 0) *pstat &= ~stat_grep; break; + case 'i': case 'l': + { + char *err = 0; + int interval = getms(arg, &err); + + if (interval < 0) + snprintf(cmd, cmdsize, "%s", err); + else if (cmd[1] == 'i') + poll_interval = interval; + else + long_interval = interval; + + dsdrop(err); + } + break; default: sprintf(cmd, "bad command"); break; |