aboutsummaryrefslogtreecommitdiffstats
path: root/pw.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2022-05-16 19:03:17 -0700
committerKaz Kylheku <kaz@kylheku.com>2022-05-16 19:07:20 -0700
commit46c52e5e2f70749803b2a3906e2da1d6d0b1fdf8 (patch)
treeb146af809eca1e19bee40f50bb23ea088ba97b3c /pw.c
parent12151ce51d36ab073f09b54973761c1da735c87b (diff)
downloadpw-46c52e5e2f70749803b2a3906e2da1d6d0b1fdf8.tar.gz
pw-46c52e5e2f70749803b2a3906e2da1d6d0b1fdf8.tar.bz2
pw-46c52e5e2f70749803b2a3906e2da1d6d0b1fdf8.zip
Change :s to :sa.
Diffstat (limited to 'pw.c')
-rw-r--r--pw.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/pw.c b/pw.c
index 681fd6d..b675a4d 100644
--- a/pw.c
+++ b/pw.c
@@ -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;