1: #include "remind.h" 2: 3: deliver() /* Never returns */ 4: { register int i,j, ntts; 5: char ttlist[10][10]; 6: int fd[2]; 7: 8: if (m.dirsize) 9: { pipe(fd); 10: if (spawn()) 11: { /* Parent - write commands to shell */ 12: write (fd[1],"chdir ",6); 13: write (fd[1],&exdir[1], (m.dirsize&0377)-1); 14: write (fd[1], msg, m.msgbytes); 15: close (fd[1]); 16: close (fd[0]); 17: } 18: else 19: { /* Child - exec a shell */ 20: close (0); 21: dup (fd[0]); 22: close (fd[0]); 23: close (1); /* Dummy output files */ 24: open (dummy, 2); 25: close (2); 26: dup (1); 27: close (fd[1]); 28: if(Uid != -1) 29: setuid(Uid); 30: execl(shell," remindsh",0); 31: exit(1); 32: } 33: } 34: 35: for (i = m.nrcvrs; i--; ) 36: { if(( ntts = nametty( 0,ttlist,rcvrlist[i])) && ( !lflag )) 37: { /* logged on the ntts ttys in ttlist */ 38: for (j = 0; j < ntts; j++) 39: { if (trysend(rcvrlist[i], ttlist[j])) 40: continue; 41: else /* Spawn a proc to try every so often */ 42: { if (spawn() != 0) continue; 43: while(!trysend(rcvrlist[i],ttlist[j])) 44: sleep(30); 45: exit(0); 46: } 47: } 48: } 49: else /* original did not include this else statement -- pag 2/7/78 */ 50: sendmail(rcvrlist[i]); /* If not logged in */ 51: } 52: exit(0); 53: }