diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2022-05-16 19:03:17 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2022-05-16 19:07:20 -0700 |
commit | 46c52e5e2f70749803b2a3906e2da1d6d0b1fdf8 (patch) | |
tree | b146af809eca1e19bee40f50bb23ea088ba97b3c | |
parent | 12151ce51d36ab073f09b54973761c1da735c87b (diff) | |
download | pw-46c52e5e2f70749803b2a3906e2da1d6d0b1fdf8.tar.gz pw-46c52e5e2f70749803b2a3906e2da1d6d0b1fdf8.tar.bz2 pw-46c52e5e2f70749803b2a3906e2da1d6d0b1fdf8.zip |
Change :s to :sa.
-rw-r--r-- | pw.1 | 18 | ||||
-rw-r--r-- | pw.c | 7 |
2 files changed, 21 insertions, 4 deletions
@@ -589,8 +589,20 @@ letters .B a through .R z , -upper or lower case. Currently, no -command has a name more than one letter long. The command may be followed +upper or lower case. Only the first two letters of a command are significant: +for instance, the command +.B :save +is actually +.BR :sa . +Commands which are one letter long may not be written with superfluous +letters, though. For instance, +.B :grep +is not understood as +.B :g +but as the (nonexistent) command +.BR :gr . + +The command may be followed by an argument, which is separated from the command by exactly one space. If the argument does not begin with a lower-case letter, then the space may be omitted. If the command is followed by no characters at all, or @@ -744,7 +756,7 @@ Sets the display parameters, exactly in the manner of the option. Any parameters not specified are reset to their default initial values: zero in the case of character positions, off in the case of flags. -.IP "\fB:s\fP [\fIfilename\fP]" +.IP "\fB:sa\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, such that the resulting file is suitable as an argument to the @@ -55,6 +55,8 @@ #define min(a, b) ((a) < (b) ? (a) : (b)) #define max(a, b) ((a) > (b) ? (a) : (b)) +#define twocc(ch1, ch2) (((int) (ch1)) << 8 | (ch2)) + #ifdef __GNUC__ #define printf_attr(fmtpos, vargpos) __attribute__ ((format (printf, \ fmtpos, vargpos))) @@ -967,7 +969,10 @@ static execode execute(pwstate *pw, char *cmd, char *resbuf, } } break; - case 's': + default: + goto badcmd; + } else if (cmd[0] == ':' && ntok == 1) switch (twocc(cmd[1], cmd[2])) { + case twocc('s', 'a'): { int rflg = 0; FILE *f; |