Lines Matching refs:shp
67 register Shell_t *shp = context->shp;
69 long timeout = 1000*shp->st.tmout;
111 if((fd = shp->cpipe[0])<=0)
131 if(sh_inuse(shp,fd))
147 if(!((r=shp->fdstatus[fd])&IOREAD) || !(r&(IOSEEK|IONOSEEK)))
148 r = sh_iocheckfd(shp,fd);
168 shp->prompt = default_prompt;
169 if(r && (shp->prompt=(char*)sfreserve(sfstderr,r,SF_LOCKR)))
171 memcpy(shp->prompt,name,r);
172 sfwrite(sfstderr,shp->prompt,r-1);
174 shp->timeout = 0;
175 save_prompt = shp->nextprompt;
176 shp->nextprompt = 0;
177 r=sh_readline(shp,argv,fd,flags,len,timeout);
178 shp->nextprompt = save_prompt;
179 if(r==0 && (r=(sfeof(shp->sftable[fd])||sferror(shp->sftable[fd]))))
181 if(fd == shp->cpipe[0] && errno!=EINTR)
182 sh_pclose(shp->cpipe);
204 int sh_readline(register Shell_t *shp,char **names, volatile int fd, int flags,ssize_t size,long timeout)
229 Edit_t *ep = (struct edit*)shp->gd->ed_context;
230 if(!(iop=shp->sftable[fd]) && !(iop=sh_iostream(shp,fd)))
240 np = nv_open(name,shp->var_tree,oflags);
243 if((flags&V_FLAG) && shp->gd->ed_context)
244 ((struct edit*)shp->gd->ed_context)->e_default = np;
274 if(dtvnext(shp->var_tree) || shp->namespace)
275 np = nv_open(nv_name(REPLYNOD),shp->var_tree,0);
282 if((shp->fdstatus[fd]&IOTTY) && !keytrap)
297 ifs = nv_getval(mp=sh_scoped(shp,IFSNOD));
298 if((flags&R_FLAG) && shp->ifstable['\\']==S_ESC)
299 shp->ifstable['\\'] = 0;
300 else if(!(flags&R_FLAG) && shp->ifstable['\\']==0)
301 shp->ifstable['\\'] = S_ESC;
303 shp->ifstable[delim] = S_NL;
306 shp->ifstable['\n'] = 0;
309 shp->ifstable[0] = S_EOF;
312 shp->ifstable['"'] = S_QUOTE;
313 shp->ifstable['\r'] = S_ERR;
321 Namval_t *mp = nv_open(name,shp->var_tree,oflags|NV_NOREF);
333 was_share = (sfset(iop,SF_SHARE,shp->redir0!=2)&SF_SHARE)!=0;
334 if(timeout || (shp->fdstatus[fd]&(IOTTY|IONOSEEK)))
336 sh_pushcontext(shp,&buff,1);
494 if((flags&S_FLAG) && !shp->gd->hist_ptr)
496 sh_histinit((void*)shp);
497 if(!shp->gd->hist_ptr)
510 sfwrite(shp->gd->hist_ptr->histfp,(char*)cp,c);
511 c = shp->ifstable[*cp++];
517 c = shp->ifstable[*cp++];
523 while((c=shp->ifstable[*--cpmax])==S_DELIM || c==S_SPACE);
541 shp->nextprompt = 2;
568 c = shp->ifstable[*cp++];
579 if((c = shp->ifstable[*cp++]) == S_NL)
608 c = shp->ifstable[*cp++];
623 sfwrite(shp->gd->hist_ptr->histfp,(char*)cp,c);
625 c = shp->ifstable[*cp++];
637 while((c=shp->ifstable[*cp++])==S_SPACE);
663 while((c=shp->ifstable[*cp++])==S_SPACE);
678 while((c=shp->ifstable[*cp++])==0)
685 if(shp->ifstable[*cp]==S_QUOTE)
741 while(shp->ifstable[*--vp]==S_SPACE);
747 while(shp->ifstable[*--vp]==S_SPACE);
777 sh_envput(shp->env,np);
782 np = nv_open(name,shp->var_tree,NV_NOASSIGN|NV_VARNAME);
801 if(timeout || (shp->fdstatus[fd]&(IOTTY|IONOSEEK)))
802 sh_popcontext(shp,&buff);
808 if((shp->fdstatus[fd]&IOTTY) && !keytrap)
811 hist_flush(shp->gd->hist_ptr);
813 siglongjmp(*shp->jmplist,jmpval);