diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2016-05-15 19:10:37 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2016-05-15 19:10:37 +0200 |
commit | 7717051e3ce062fbdb8415e4befa5205d25e80bb (patch) | |
tree | 029df0be93da100936c772c5f6a83f0874930cef /sys/src/cmd/rc/unix.c | |
parent | 81f867f4fb3d7fd495be3282a01d2e4a9b1a56fd (diff) |
rc: fix inband globbing bugs, cleanup
add glob information to the word structure so we wont accidently
deglob quoted strings containing the GLOB. we store Globsize(word)
in in word->glob which avoids recalculating that values and the
check if a word should be globbed quick.
globlist() now substitutes the word inplace avoiding the copying
when all words are literals and avoids recursion.
minor cleanups: use list2str() in execeval(), move octal() to
unix.c, remove the (char*) casts to efree().
Diffstat (limited to 'sys/src/cmd/rc/unix.c')
-rw-r--r-- | sys/src/cmd/rc/unix.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/sys/src/cmd/rc/unix.c b/sys/src/cmd/rc/unix.c index 8eaaa09f8..e844bc5cc 100644 --- a/sys/src/cmd/rc/unix.c +++ b/sys/src/cmd/rc/unix.c @@ -277,8 +277,8 @@ register struct word *args, *path; Bad: setstatus(msg); pfmt(err, "%s: %s\n", argv[1], msg); - efree((char *)env); - efree((char *)argv); + efree(env); + efree(argv); } #define NDIR 14 /* should get this from param.h */ Globsize(p) @@ -432,6 +432,14 @@ Isatty(fd){ Abort(){ abort(); } +static int +octal(char *s) +{ + int n = 0; + while(*s==' ' || *s=='\t' || *s=='\n') s++; + while('0'<=*s && *s<='7') n = n*8+*s++-'0'; + return n; +} execumask(){ /* wrong -- should fork before writing */ int m; struct io out[1]; |