aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pw.19
-rw-r--r--pw.c20
2 files changed, 23 insertions, 6 deletions
diff --git a/pw.1 b/pw.1
index a43eda4..08c4401 100644
--- a/pw.1
+++ b/pw.1
@@ -669,6 +669,11 @@ the trigger count is reset to zero. Thus when the
command is used to resume capture, the same number of capture events
will have to occur again before the next automatic suspension.
+.IP "\fB:p\fP [\fIinteger\fP[,\fIinteger\fP[,\fIinteger\fP[,\fIinteger\fP[,\fIinteger\fP]]]]]
+Sets the display parameters, exactly in the manner of the
+.B -p
+option.
+
.IP "\fB:s\fP [\fIfilename\fP]"
Save a snapshot of the configuration state to the specified file.
The state is saved as a sequence of colon and trigger commands,
@@ -682,8 +687,8 @@ is started up with
.I filename
as the argument to the
.B -f
-option, the grep stack and trigger state will be stored to exactly
-the same configuration that existed at the time the state was saved.
+option, the grep stack, trigger state and display parameters will be stored to
+exactly the same configuration that existed at the time the state was saved.
.SH OPTIONS
diff --git a/pw.c b/pw.c
index 1e4ce19..174dac4 100644
--- a/pw.c
+++ b/pw.c
@@ -709,17 +709,18 @@ static int decodeparms(pwstate *pw, char *parms,
snprintf(resbuf, size, "bad flags %s: %s\n", flags, err);
return 0;
}
- pw->stat = stat & stat_save;
+ pw->stat &= ~stat_save;
+ pw->stat |= (stat & stat_save);
}
return 1;
}
-static execode execute(pwstate *pw, const char *cmd, char *resbuf,
+static execode execute(pwstate *pw, char *cmd, char *resbuf,
size_t size, int count)
{
execode res = exec_failed;
- const char *arg = cmd + 2 + strspn(cmd + 2, " \t");
+ char *arg = cmd + 2 + strspn(cmd + 2, " \t");
clrline(0);
@@ -874,6 +875,14 @@ static execode execute(pwstate *pw, const char *cmd, char *resbuf,
res = exec_ok;
}
break;
+ case 'p':
+ {
+ if (decodeparms(pw, arg, resbuf, size)) {
+ pw->stat |= stat_force;
+ res = exec_ok;
+ }
+ }
+ break;
case 's':
{
int rflg = 0;
@@ -889,6 +898,9 @@ static execode execute(pwstate *pw, const char *cmd, char *resbuf,
break;
}
+ fprintf(f, ":p%d,%d,%d,%d,%d\n", pw->hpos, pw->vsplit1, pw->vsplit2,
+ pw->vs2pos, (int) pw->stat & stat_save);
+
if (pw->tcount)
fprintf(f, ":f%d\n", pw->tcount);
if (pw->sncount)
@@ -998,7 +1010,7 @@ static execode execute(pwstate *pw, const char *cmd, char *resbuf,
return res;
}
-static execode batchexe(pwstate *pw, const char *cmd, char *resbuf, size_t size)
+static execode batchexe(pwstate *pw, char *cmd, char *resbuf, size_t size)
{
size_t ndigits = strspn(cmd, "0123456789");
int count = 0;