Rev 10 | Rev 3843 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 10 | Rev 3718 | ||
---|---|---|---|
Line 14... | Line 14... | ||
14 | * along with this program; if not, write to the Free Software |
14 | * along with this program; if not, write to the Free Software |
15 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
15 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
16 | */ |
16 | */ |
17 | 17 | ||
18 | /* Common routines in interfaces */ |
18 | /* Common routines in interfaces */ |
- | 19 | #include "../Lib/basicstr.c" |
|
19 | 20 | ||
20 | #define ch_root "bin/ch..root" |
21 | #define ch_root "bin/ch..root" |
21 | 22 | ||
22 | int mypid; |
23 | int mypid; |
23 | int must_chroot=0; |
24 | int must_chroot=0; |
Line 228... | Line 229... | ||
228 | char buf[MAX_LINELEN+1], pidbuf[32], *p; |
229 | char buf[MAX_LINELEN+1], pidbuf[32], *p; |
229 | snprintf(pidbuf,sizeof(pidbuf),"%u",pid); |
230 | snprintf(pidbuf,sizeof(pidbuf),"%u",pid); |
230 | accessfile(buf,"r",pidfname); |
231 | accessfile(buf,"r",pidfname); |
231 | p=wordchr(buf,pidbuf); |
232 | p=wordchr(buf,pidbuf); |
232 | if(p!=NULL) { |
233 | if(p!=NULL) { |
233 |
|
234 | ovlstrcpy(p,find_word_start(find_word_end(p))); |
234 | accessfile(buf,"w",pidfname); |
235 | accessfile(buf,"w",pidfname); |
235 | } |
236 | } |
236 | } |
237 | } |
237 | 238 | ||
238 | int execredirected(char *cmdf, char *inf, char *outf, char *errf, |
239 | int execredirected(char *cmdf, char *inf, char *outf, char *errf, |
Line 349... | Line 350... | ||
349 | } |
350 | } |
350 | 351 | ||
351 | if(*(p2-1)=='.' && p2<numend) p2++; |
352 | if(*(p2-1)=='.' && p2<numend) p2++; |
352 | 353 | ||
353 | if(p2<numend) { |
354 | if(p2<numend) { |
354 |
|
355 | ovlstrcpy(p2,numend);numend=p2; |
355 | } |
356 | } |
356 | pp=numend-1; |
357 | pp=numend-1; |
357 | } |
358 | } |
358 | } |
359 | } |
359 | 360 | ||
Line 460... | Line 461... | ||
460 | aboutbuf[0]=0; ff=fopen(outputfname,"r"); |
461 | aboutbuf[0]=0; ff=fopen(outputfname,"r"); |
461 | if(ff!=NULL) { |
462 | if(ff!=NULL) { |
462 | fseek(ff,0,SEEK_END); l=ftell(ff); fseek(ff,0,SEEK_SET); |
463 | fseek(ff,0,SEEK_END); l=ftell(ff); fseek(ff,0,SEEK_SET); |
463 | l=fread(aboutbuf,1,aboutlen-10,ff); fclose(ff); |
464 | l=fread(aboutbuf,1,aboutlen-10,ff); fclose(ff); |
464 | if(l>0 && l<aboutlen) aboutbuf[l]=0; else aboutbuf[0]=0; |
465 | if(l>0 && l<aboutlen) aboutbuf[l]=0; else aboutbuf[0]=0; |
465 | p=find_word_start(aboutbuf); if(p>aboutbuf) |
466 | p=find_word_start(aboutbuf); if(p>aboutbuf) ovlstrcpy(aboutbuf,p); |
466 | } |
467 | } |
467 | return strlen(aboutbuf); |
468 | return strlen(aboutbuf); |
468 | } |
469 | } |
469 | 470 | ||
470 | /* read result of execution */ |
471 | /* read result of execution */ |
Line 541... | Line 542... | ||
541 | lp+=l; *lp=0; |
542 | lp+=l; *lp=0; |
542 | if(active==0) { |
543 | if(active==0) { |
543 | char *pp; |
544 | char *pp; |
544 | pp=strstr(lbuf,startstring); |
545 | pp=strstr(lbuf,startstring); |
545 | if(pp!=NULL) { |
546 | if(pp!=NULL) { |
546 | active=1; |
547 | active=1; ovlstrcpy(lbuf,pp); lp=lbuf+strlen(lbuf); |
547 | } |
548 | } |
548 | } |
549 | } |
549 | if(active!=0 && strstr(lbuf,linebyline)!=NULL) { |
550 | if(active!=0 && strstr(lbuf,linebyline)!=NULL) { |
550 | fprintf(ff,"%s",lbuf); lp=lbuf; |
551 | fprintf(ff,"%s",lbuf); lp=lbuf; |
551 | if(strstr(lbuf,endstring)!=NULL) {lbuf[0]=0; active=-1; break;} |
552 | if(strstr(lbuf,endstring)!=NULL) {lbuf[0]=0; active=-1; break;} |