implement $KSH_MATCH and, to make it usable, ${foo@/bar/baz};

add a real-life example (for slagtc’s programmable tab completion)
to the manpage
This commit is contained in:
tg
2016-08-01 21:38:07 +00:00
parent 8f135b3904
commit 757e25fb21
8 changed files with 197 additions and 34 deletions

14
var.c
View File

@ -28,7 +28,7 @@
#include <sys/sysctl.h>
#endif
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.206 2016/07/25 21:02:13 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.207 2016/08/01 21:38:07 tg Exp $");
/*-
* Variables
@ -1739,3 +1739,15 @@ rndpush(const void *s)
BAFHUpdateOctet_reg(h, 0);
qh_state = h;
}
/* record last glob match */
void
record_match(const char *istr)
{
struct tbl *vp;
vp = local("KSH_MATCH", false);
unset(vp, 1);
vp->flag = DEFINED | RDONLY;
setstr(vp, istr, 0x4);
}