From 955516759cfed29122439938632964fed4f8a347 Mon Sep 17 00:00:00 2001 From: Nicholas Noll Date: Sat, 20 Jun 2020 11:30:56 -0700 Subject: feat: file globbing in shell. added dynamic.mk --- sys/cmd/rc/io.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'sys/cmd/rc/io.c') diff --git a/sys/cmd/rc/io.c b/sys/cmd/rc/io.c index 2fbe57f..e06bfcc 100644 --- a/sys/cmd/rc/io.c +++ b/sys/cmd/rc/io.c @@ -94,8 +94,8 @@ flush(Io **fp) n = f->b - f->buf; if (n && write(f->fd, f->buf, n) < 0) { write(3, "write error\n", 12); - if (ntrap) - dotrap(); + // if (ntrap) + // dotrap(); } f->b = f->buf; f->e = f->buf + bufsize; @@ -153,10 +153,10 @@ void pwrd(Io *f, char *s) { char *t; - for (t = s; *t; t++) - if (!wordchr(*t)) + for(t = s; *t; t++) + if(!wordchr(*t)) break; - if (t == s || *t) + if(t == s || *t) pquo(f, s); else pstr(f, s); @@ -186,10 +186,10 @@ pptr(Io *f, void *v) void pstr(Io *f, char *s) { - if (!s) + if(!s || !s[0]) s = ""; - while (*s) + while(*s) pchr(f, *s++); } @@ -228,8 +228,8 @@ poct(Io *f, uint n) void pval(Io *f, Word *a) { - if (a) { - while (a->link && a->link->word) { + if(a) { + while(a->link && a->link->word) { pwrd(f, a->word); pchr(f, ' '); a = a->link; @@ -416,6 +416,9 @@ vpfmt(Io *f, char *fmt, va_list args) case 'q': pwrd(f, va_arg(args, char*)); break; + case 'r': + pstr(f, strerror(errno)); + break; case 's': pstr(f, va_arg(args, char*)); break; -- cgit v1.2.1