warn about \w no arg

This commit is contained in:
rsc 2007-04-21 22:37:13 +00:00
parent 14b4a4702c
commit d0648192ab

View file

@ -72,8 +72,13 @@ e_w(void)
{ {
Rune *a; Rune *a;
Rune buf[40]; Rune buf[40];
static Rune zero;
a = getqarg(); a = getqarg();
if(a == nil){
warn("no arg for \\w");
a = &zero;
}
runesnprint(buf, sizeof buf, "%ld", runestrlen(a)); runesnprint(buf, sizeof buf, "%ld", runestrlen(a));
pushinputstring(buf); pushinputstring(buf);
nr(L("st"), 0); nr(L("st"), 0);