Lines Matching refs:shp

56 static void	chkmail(Shell_t *shp, char*);
88 Shell_t *shp = (Shell_t*)context; in fts_sigcheck() local
91 if(shp->trapnote&SH_SIGSET) in fts_sigcheck()
111 int sh_source(Shell_t *shp, Sfio_t *iop, const char *file) in sh_source() argument
124 shp->st.filename = path_fullname(stakptr(PATH_OFFSET)); in sh_source()
126 exfile(shp, iop, fd); in sh_source()
143 register Shell_t *shp; in sh_main() local
157 shp = sh_init(ac,av,userinit); in sh_main()
162 fts_notify(fts_sigcheck,(void*)shp); in sh_main()
164 if(sigsetjmp(*((sigjmp_buf*)shp->jmpbuffer),0)) in sh_main()
169 shp->fn_depth = shp->dot_depth = 0; in sh_main()
172 shp->pid = getpid(); in sh_main()
173 srand(shp->pid&0x7fff); in sh_main()
174 shp->ppid = getppid(); in sh_main()
185 ((Lex_t*)shp->lex_context)->nonstandard = 0; in sh_main()
186 if(shp->ppid==1) in sh_main()
187 shp->login_sh++; in sh_main()
188 if(shp->login_sh >= 2) in sh_main()
205 for(i=0; i<elementsof(shp->offoptions.v); i++) in sh_main()
206 shp->options.v[i] &= ~shp->offoptions.v[i]; in sh_main()
217 job_init(shp,sh_isoption(SH_LOGIN_SHELL)); in sh_main()
221 sh_source(shp, iop, e_sysprofile); in sh_main()
224 char **files = shp->login_files; in sh_main()
225 while ((name = *files++) && !sh_source(shp, iop, sh_mactry(shp,name))); in sh_main()
238 sh_source(shp, iop, e_bash_sysrc); in sh_main()
240 sh_source(shp, iop, shp->rcfile ? shp->rcfile : sh_mactry(shp,(char*)e_bash_rc)); in sh_main()
245 if(name = sh_mactry(shp,nv_getval(ENVNOD))) in sh_main()
249 sh_source(shp, iop, e_sysrc); in sh_main()
253 sh_source(shp, iop, name); in sh_main()
259 sh_source(shp, iop, e_suidprofile); in sh_main()
261 shp->st.cmdname = error_info.id = command; in sh_main()
266 if(shp->comdiv) in sh_main()
269 iop = sfnew(NIL(Sfio_t*),shp->comdiv,strlen(shp->comdiv),0,SF_STRING|SF_READ); in sh_main()
274 error_info.id = shp->shname; in sh_main()
301 shp->st.dolv[0] = av[0]; in sh_main()
302 fixargs(shp->st.dolv,1); in sh_main()
319 shp->st.filename = path_fullname(name); in sh_main()
332 shp->st.filename = path_fullname(sp); in sh_main()
344 shp->comdiv = (char*)malloc(strlen(name)+7); in sh_main()
345 name = strcopy(shp->comdiv,name); in sh_main()
346 if(shp->st.dolc) in sh_main()
353 shp->readscript = shp->shname; in sh_main()
356 shp->comdiv--; in sh_main()
366 fdin = shp->infd; in sh_main()
367 fixargs(shp->st.dolv,1); in sh_main()
372 exfile(shp,iop,fdin); in sh_main()
373 sh_done(shp,0); in sh_main()
383 static void exfile(register Shell_t *shp, register Sfio_t *iop,register int fno) in exfile() argument
392 nv_putval(SH_PATHNAMENOD, shp->st.filename ,NV_NOFREE); in exfile()
400 shp->fdstatus[r] = shp->fdstatus[fno]; in exfile()
405 shp->fdstatus[fno] |= IOCLEX; in exfile()
406 iop = sh_iostream((void*)shp,fno); in exfile()
413 shp->infd = fno; in exfile()
417 nv_putval(PS1NOD,(shp->euserid?e_stdprompt:e_supprompt),NV_RDONLY); in exfile()
419 if(sh_histinit((void*)shp)) in exfile()
440 sh_iorestore((void*)shp,0,jmpval); in exfile()
441 hist_flush(shp->hist_ptr); in exfile()
442 sfsync(shp->outpool); in exfile()
443 shp->st.execbrk = shp->st.breakcnt = 0; in exfile()
450 …soption(SH_INTERACTIVE) || sh_isstate(SH_FORKED) || (jmpval > SH_JMPERREXIT && job_close(shp) >=0)) in exfile()
466 tcsetpgrp(job.fd,shp->pid); in exfile()
472 shp->st.optindex = 1; in exfile()
474 shp->st.loopcnt = 0; in exfile()
475 shp->trapnote = 0; in exfile()
476 shp->intrap = 0; in exfile()
478 shp->inlineno = 1; in exfile()
479 shp->binscript = 0; in exfile()
485 shp->nextprompt = 1; in exfile()
486 sh_freeup(shp); in exfile()
523 chkmail(shp,mail); in exfile()
527 if(shp->hist_ptr) in exfile()
528 hist_eof(shp->hist_ptr); in exfile()
530 shp->timeout = shp->st.tmout; in exfile()
532 if(shp->timeout <= 0 || shp->timeout > SHOPT_TIMEOUT) in exfile()
533 shp->timeout = SHOPT_TIMEOUT; in exfile()
535 shp->inlineno = 1; in exfile()
537 shp->exitval = 0; in exfile()
538 shp->trapnote = 0; in exfile()
554 !sferror(sfstderr) && (shp->fdstatus[fno]&IOTTY)) in exfile()
560 else if(job_close(shp)<0) in exfile()
572 if(sh_isstate(SH_INTERACTIVE) && shp->hist_ptr) in exfile()
575 hist_eof(shp->hist_ptr); in exfile()
582 t = (Shnode_t*)sh_parse(shp,iop,0); in exfile()
585 shp->readscript = 0; in exfile()
586 if(sh_isstate(SH_INTERACTIVE) && shp->hist_ptr) in exfile()
587 hist_flush(shp->hist_ptr); in exfile()
594 (fno<0 || !(shp->fdstatus[fno]&(IOTTY|IONOSEEK))) in exfile()
599 shp->st.execbrk = 0; in exfile()
601 if(shp->forked) in exfile()
616 job_close(shp); in exfile()
619 siglongjmp(*shp->jmplist,jmpval); in exfile()
621 sh_done(shp,0); in exfile()
624 if(shp->st.filename) in exfile()
625 free((void*)shp->st.filename); in exfile()
626 shp->st.filename = 0; in exfile()
631 static void chkmail(Shell_t *shp, char *files) in chkmail() argument
680 char *save = shp->lastarg; in chkmail()
681 shp->lastarg = cp; in chkmail()
682 errormsg(SH_DICT,0,sh_mactry(shp,qp?qp+1:(char*)e_mailmsg)); in chkmail()
683 shp->lastarg = save; in chkmail()