aboutsummaryrefslogtreecommitdiff
path: root/sys/cmd/rc/io.c
diff options
context:
space:
mode:
authorNicholas Noll <nbnoll@eml.cc>2020-06-20 11:30:56 -0700
committerNicholas Noll <nbnoll@eml.cc>2020-06-20 11:30:56 -0700
commit955516759cfed29122439938632964fed4f8a347 (patch)
tree6cc0c6300e2b3d5b4e0c08103ecd9c9e939bc1c8 /sys/cmd/rc/io.c
parent91c673b37782d4cd90e5cf9a8e4491723e6c04bf (diff)
feat: file globbing in shell. added dynamic.mk
Diffstat (limited to 'sys/cmd/rc/io.c')
-rw-r--r--sys/cmd/rc/io.c21
1 files changed, 12 insertions, 9 deletions
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 = "<null>";
- 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;