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().
This commit is contained in:
cinap_lenrek 2016-05-15 19:10:37 +02:00
parent 81f867f4fb
commit 7717051e3c
11 changed files with 169 additions and 173 deletions

View file

@ -30,19 +30,18 @@ void codefree(code*);
int compile(tree*);
char * list2str(word*);
int count(word*);
void deglob(void*);
char* deglob(char*);
void delwaitpid(int);
void dotrap(void);
void freenodes(void);
void freewords(word*);
void globlist(void);
word* globlist(word*);
int havewaitpid(int);
int idchr(int);
void inttoascii(char*, long);
void kinit(void);
int mapfd(int);
int match(void*, void*, int);
int matchfn(void*, void*);
int match(char*, char*, int);
char** mkargv(word*);
void clearwaitpids(void);
void panic(char*, int);
@ -52,7 +51,7 @@ void popword(void);
void pprompt(void);
void pushlist(void);
void pushredir(int, int, int);
void pushword(char*);
word* pushword(char*);
void readhere(void);
word* searchpath(char*);
void setstatus(char*);