aboutsummaryrefslogtreecommitdiff
path: root/sys/cmd/rc/simple.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/cmd/rc/simple.c')
-rw-r--r--sys/cmd/rc/simple.c67
1 files changed, 35 insertions, 32 deletions
diff --git a/sys/cmd/rc/simple.c b/sys/cmd/rc/simple.c
index d587227..465fe43 100644
--- a/sys/cmd/rc/simple.c
+++ b/sys/cmd/rc/simple.c
@@ -11,18 +11,21 @@
*/
int
exitnext(void){
- union code *c=&runq->code[runq->pc];
- while(c->f==Xpopredir) c++;
- return c->f==Xexit;
+ union Code *c=&runq->code[runq->pc];
+
+ while(c->f==Xpopredir)
+ c++;
+
+ return c->f==Xexit;
}
void
Xsimple(void)
{
- word *a;
- thread *p = runq;
- var *v;
- struct builtin *bp;
+ Word *a;
+ Thread *p = runq;
+ Var *v;
+ struct Builtin *bp;
int pid;
globlist();
a = runq->argv->words;
@@ -46,7 +49,7 @@ Xsimple(void)
a = a->next;
popword();
}
- for(bp = Builtin;bp->name;bp++)
+ for(bp = builtin;bp->name;bp++)
if(strcmp(a->word, bp->name)==0){
(*bp->fnc)();
return;
@@ -72,10 +75,10 @@ Xsimple(void)
}
}
}
-struct word nullpath = { "", 0};
+struct Word nullpath = { "", 0};
void
-doredir(redir *rp)
+doredir(Redir *rp)
{
if(rp){
doredir(rp->next);
@@ -96,10 +99,10 @@ doredir(redir *rp)
}
}
-word*
+Word*
searchpath(char *w)
{
- word *path;
+ Word *path;
if(strncmp(w, "/", 1)==0
/* || strncmp(w, "#", 1)==0 */
|| strncmp(w, "./", 2)==0
@@ -123,9 +126,9 @@ execexec(void)
}
void
-execfunc(var *func)
+execfunc(Var *func)
{
- word *starval;
+ Word *starval;
popword();
starval = runq->argv->words;
runq->argv->words = 0;
@@ -154,8 +157,8 @@ dochdir(char *word)
void
execcd(void)
{
- word *a = runq->argv->words;
- word *cdpath;
+ Word *a = runq->argv->words;
+ Word *cdpath;
char dir[512];
setstatus("can't cd");
cdpath = vlook("cdpath")->val;
@@ -213,8 +216,8 @@ void
execshift(void)
{
int n;
- word *a;
- var *star;
+ Word *a;
+ Var *star;
switch(count(runq->argv->words)){
default:
pfmt(err, "Usage: shift [n]\n");
@@ -252,7 +255,7 @@ octal(char *s)
int
mapfd(int fd)
{
- redir *rp;
+ Redir *rp;
for(rp = runq->redir;rp;rp = rp->next){
switch(rp->type){
case RCLOSE:
@@ -268,10 +271,10 @@ mapfd(int fd)
}
return fd;
}
-union code rdcmds[4];
+union Code rdcmds[4];
void
-execcmds(io *f)
+execcmds(Io *f)
{
static int first = 1;
if(first){
@@ -290,7 +293,7 @@ execeval(void)
{
char *cmdline, *s, *t;
int len = 0;
- word *ap;
+ Word *ap;
if(count(runq->argv->words)<=1){
Xerror1("Usage: eval cmd ...");
return;
@@ -309,19 +312,19 @@ execeval(void)
execcmds(opencore(cmdline, len));
efree(cmdline);
}
-union code dotcmds[14];
+union Code dotcmds[14];
void
execdot(void)
{
int iflag = 0;
int fd;
- list *av;
- thread *p = runq;
+ Words *av;
+ Thread *p = runq;
char *zero;
static int first = 1;
char file[512];
- word *path;
+ Word *path;
if(first){
dotcmds[0].i = 1;
dotcmds[1].f = Xmark;
@@ -372,7 +375,7 @@ execdot(void)
return;
}
/* set up for a new command loop */
- start(dotcmds, 1, (struct var *)0);
+ start(dotcmds, 1, (struct Var *)0);
pushredir(RCLOSE, fd, 0);
runq->cmdfile = zero;
runq->cmdfd = openfd(fd);
@@ -421,11 +424,11 @@ execflag(void)
void
execwhatis(void){ /* mildly wrong -- should fork before writing */
- word *a, *b, *path;
- var *v;
- struct builtin *bp;
+ Word *a, *b, *path;
+ Var *v;
+ struct Builtin *bp;
char file[512];
- struct io out[1];
+ struct Io out[1];
int found, sep;
a = runq->argv->words->next;
if(a==0){
@@ -459,7 +462,7 @@ execwhatis(void){ /* mildly wrong -- should fork before writing */
if(v->fn)
pfmt(out, "fn %s %s\n", v->name, v->fn[v->pc-1].s);
else{
- for(bp = Builtin;bp->name;bp++)
+ for(bp = builtin;bp->name;bp++)
if(strcmp(a->word, bp->name)==0){
pfmt(out, "builtin %s\n", a->word);
break;