Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!lll-lcc!lll-winken!uunet!munnari!gwydir!gara!wtoomey From: wtoomey@gara.une.oz (Warren Toomey) Newsgroups: comp.os.minix Subject: Official Patch #1 to Clam (4 of 5) Message-ID: <614@gara.une.oz> Date: 27 Mar 89 04:29:07 GMT Organization: University of New England, Armidale, Australia Lines: 493 # This is a shell archive. Remove anything before this line, then # unpack it by saving it in a file and typing "sh file". (Files # unpacked will be owned by you and have default permissions.) # # This archive contains: # job.cdif login.cdif main.cdif echo x - job.cdif cat > "job.cdif" << '//E*O*F job.cdif//' *** org/job.c Fri Mar 10 21:34:43 1989 --- st-gcc/job.c Sat Mar 11 01:22:03 1989 *************** *** 94,100 **** #endif if (i) { ! old->next=ptr=(struct job *) malloc (sizeof(struct job)); if (ptr==0) { write(2,"Malloc failed. Cannot add report.\n",34); --- 94,100 ---- #endif if (i) { ! old->next=ptr=(struct job *) malloc ((unsigned)(sizeof(struct job))); if (ptr==0) { write(2,"Malloc failed. Cannot add report.\n",34); *************** *** 104,110 **** } else { ! exitop=(struct job *) malloc (sizeof(struct job)); if (exitop==0) { write(2,"Malloc failed. Cannot add report.\n",34); --- 104,110 ---- } else { ! exitop=(struct job *) malloc ((unsigned)(sizeof(struct job))); if (exitop==0) { write(2,"Malloc failed. Cannot add report.\n",34); *************** *** 116,127 **** ptr->jobnumber=newone->jobnumber; ptr->pid=newone->pid; ptr->status.w_status=newone->status.w_status; ! ptr->name=(char *) malloc (strlen(newone->name)+1); if (ptr->name) (void) strcpy(ptr->name,newone->name); else write(2,"Malloc failed in addreport.\n",28); ! ptr->dir=(char *) malloc (strlen(newone->dir)+1); if (ptr->dir) (void) strcpy(ptr->dir,newone->dir); else --- 116,127 ---- ptr->jobnumber=newone->jobnumber; ptr->pid=newone->pid; ptr->status.w_status=newone->status.w_status; ! ptr->name=(char *) malloc ((unsigned)(strlen(newone->name)+1)); if (ptr->name) (void) strcpy(ptr->name,newone->name); else write(2,"Malloc failed in addreport.\n",28); ! ptr->dir=(char *) malloc ((unsigned)(strlen(newone->dir)+1)); if (ptr->dir) (void) strcpy(ptr->dir,newone->dir); else *************** *** 132,141 **** --- 132,145 ---- #endif } + #ifdef __STDC__ + int addjob(int pid, char *name, int outfd, bool bckgnd) + #else int addjob(pid,name,outfd,bckgnd) int pid,outfd; char *name; bool bckgnd;/* this isn't used yet */ + #endif { int jobno,diff=(-1); #ifdef UCB *************** *** 148,154 **** if (diff<0) if (jobno!=1) /* insertion between old and ptr */ { ! new=(struct job *) malloc (sizeof(struct job)); if (new==0) { write(2,"Malloc failed. Cannot add job.\n",31); --- 152,158 ---- if (diff<0) if (jobno!=1) /* insertion between old and ptr */ { ! new=(struct job *) malloc ((unsigned)(sizeof(struct job))); if (new==0) { write(2,"Malloc failed. Cannot add job.\n",31); *************** *** 160,166 **** } else /* insertion before jtop */ { ! old=(struct job *) malloc (sizeof(struct job)); if (old==0) { write(2,"Malloc failed. Cannot add job.\n",31); --- 164,170 ---- } else /* insertion before jtop */ { ! old=(struct job *) malloc ((unsigned)(sizeof(struct job))); if (old==0) { write(2,"Malloc failed. Cannot add job.\n",31); *************** *** 171,177 **** } else /* append at end */ { ! ptr=(struct job *) malloc (sizeof(struct job)); if (ptr==0) { write(2,"Malloc failed. Cannot add job.\n",31); --- 175,181 ---- } else /* append at end */ { ! ptr=(struct job *) malloc ((unsigned)(sizeof(struct job))); if (ptr==0) { write(2,"Malloc failed. Cannot add job.\n",31); *************** *** 182,188 **** } ptr->jobnumber=jobno; ptr->pid=pid; ! ptr->name=(char *) malloc (strlen(name)+1); if (ptr->name) (void) strcpy(ptr->name,name); else --- 186,192 ---- } ptr->jobnumber=jobno; ptr->pid=pid; ! ptr->name=(char *) malloc ((unsigned)(strlen(name)+1)); if (ptr->name) (void) strcpy(ptr->name,name); else *************** *** 190,196 **** ptr->status.w_status=0; if (getwd(execdir)) { ! ptr->dir=(char *) malloc (strlen(execdir)+1); if (ptr->dir) (void) strcpy(ptr->dir,execdir); else --- 194,200 ---- ptr->status.w_status=0; if (getwd(execdir)) { ! ptr->dir=(char *) malloc ((unsigned)(strlen(execdir)+1)); if (ptr->dir) (void) strcpy(ptr->dir,execdir); else //E*O*F job.cdif// echo x - login.cdif cat > "login.cdif" << '//E*O*F login.cdif//' *** login.c.B Thu Oct 19 03:30:24 1988 --- login.c Thu Mar 11 06:06:49 1989 *************** *** 55,61 **** setgid (pwd->pw_gid); setuid (pwd->pw_uid); chdir (pwd->pw_dir); ! strcpy(pwd->pw_dir, home+5); if (pwd->pw_shell) { execle(pwd->pw_shell, "-", (char *) 0, env); } --- 55,62 ---- setgid (pwd->pw_gid); setuid (pwd->pw_uid); chdir (pwd->pw_dir); ! /* strcpy(pwd->pw_dir, home+5); --bug */ ! strcpy(home+5, pwd->pw_dir); /* and fix ++jrb */ if (pwd->pw_shell) { execle(pwd->pw_shell, "-", (char *) 0, env); } //E*O*F login.cdif// echo x - main.cdif cat > "main.cdif" << '//E*O*F main.cdif//' *** org/main.c Fri Mar 10 21:34:44 1989 --- st-gcc/main.c Sat Mar 11 03:13:30 1989 *************** *** 21,27 **** void printime() { ! long clock, *time(); struct tm *t, *localtime(); time(&clock); --- 21,27 ---- void printime() { ! long clock, time(); struct tm *t, *localtime(); time(&clock); *************** *** 270,276 **** /* setup terminal with ioctl calls */ ! termod=(struct sgttyb *) malloc (sizeof(struct sgttyb)); if (ioctl(0,TIOCGETP,termod)) /* get the sgttyb struct */ perror("ioctl in setup"); termod->sg_flags |= CBREAK; /* cbreak mode to get each char */ --- 270,276 ---- /* setup terminal with ioctl calls */ ! termod=(struct sgttyb *) malloc ((unsigned)(sizeof(struct sgttyb))); if (ioctl(0,TIOCGETP,termod)) /* get the sgttyb struct */ perror("ioctl in setup"); termod->sg_flags |= CBREAK; /* cbreak mode to get each char */ *************** *** 277,283 **** termod->sg_flags &= (~ECHO); /* do not echo chars to screen */ if (ioctl(0,TIOCSETP,termod)) /* put it back, modified */ perror("ioctl"); ! setsigc=(struct tchars *) malloc (sizeof(struct tchars)); if (ioctl(0,TIOCGETC,setsigc)) /* get the tchars struct */ perror("ioctl"); setsigc->t_intrc=(UNDEF); /* no interrupt or quitting */ --- 277,283 ---- termod->sg_flags &= (~ECHO); /* do not echo chars to screen */ if (ioctl(0,TIOCSETP,termod)) /* put it back, modified */ perror("ioctl"); ! setsigc=(struct tchars *) malloc ((unsigned)(sizeof(struct tchars))); if (ioctl(0,TIOCGETC,setsigc)) /* get the tchars struct */ perror("ioctl"); setsigc->t_intrc=(UNDEF); /* no interrupt or quitting */ *************** *** 300,306 **** /* now set up signals */ for (i=1;i<=NUMSIG;i++) ! signal(i,SIG_IGN); signal(SIGQUIT,SIG_DFL); /* allow while debugging */ /*signal(SIGQUIT,SIG_IGN);*/ signal(SIGHUP,SIG_DFL); --- 300,309 ---- /* now set up signals */ for (i=1;i<=NUMSIG;i++) ! { ! if ( i != SIGKILL ) /* SIGKILL cannot be caught or ignored */ ! signal(i,SIG_IGN); ! } signal(SIGQUIT,SIG_DFL); /* allow while debugging */ /*signal(SIGQUIT,SIG_IGN);*/ signal(SIGHUP,SIG_DFL); *************** *** 312,319 **** /* This catches all the serious errors from within the shell, ILL -> SYS */ /* If any program uses these, then the programmer should be shot. */ for (i=4;i<=12;i++) ! signal(i,graceful); ! #ifndef MINIX signal(SIGCHLD,checkjobs); #endif --- 315,324 ---- /* This catches all the serious errors from within the shell, ILL -> SYS */ /* If any program uses these, then the programmer should be shot. */ for (i=4;i<=12;i++) ! { ! if (i != SIGKILL) /* SIGKILL cannot be caught or ignored */ ! signal(i,graceful); ! } #ifndef MINIX signal(SIGCHLD,checkjobs); #endif *************** *** 345,351 **** write(2,"Resetting shell\n",16); #endif ! termod=(struct sgttyb *) malloc (sizeof(struct sgttyb)); if (ioctl(0,TIOCGETP,termod)) /* get the sgttyb struct */ perror("ioctl in resetsh"); termod->sg_flags |= CBREAK; /* cbreak mode to get each char */ --- 350,356 ---- write(2,"Resetting shell\n",16); #endif ! termod=(struct sgttyb *) malloc ((unsigned)(sizeof(struct sgttyb))); if (ioctl(0,TIOCGETP,termod)) /* get the sgttyb struct */ perror("ioctl in resetsh"); termod->sg_flags |= CBREAK; /* cbreak mode to get each char */ *************** *** 352,358 **** termod->sg_flags &= (~ECHO); /* do not echo chars to screen */ if (ioctl(0,TIOCSETN,termod)) /* put it back, modified */ perror("ioctl"); ! setsigc=(struct tchars *) malloc (sizeof(struct tchars)); if (ioctl(0,TIOCGETC,setsigc)) /* get the tchars struct */ perror("ioctl"); setsigc->t_intrc=(UNDEF); /* no interrupt or quitting */ --- 357,363 ---- termod->sg_flags &= (~ECHO); /* do not echo chars to screen */ if (ioctl(0,TIOCSETN,termod)) /* put it back, modified */ perror("ioctl"); ! setsigc=(struct tchars *) malloc ((unsigned)(sizeof(struct tchars))); if (ioctl(0,TIOCGETC,setsigc)) /* get the tchars struct */ perror("ioctl"); setsigc->t_intrc=(UNDEF); /* no interrupt or quitting */ *************** *** 401,407 **** fprintf(stderr,"Setdown terminal\n"); #endif ! termod=(struct sgttyb *) malloc (sizeof(struct sgttyb)); if (ioctl(0,TIOCGETP,termod)) /* get the sgttyb struct */ perror("ioctl in setdown"); termod->sg_flags &= (~CBREAK); /* reset cooked mode */ --- 406,412 ---- fprintf(stderr,"Setdown terminal\n"); #endif ! termod=(struct sgttyb *) malloc ((unsigned)(sizeof(struct sgttyb))); if (ioctl(0,TIOCGETP,termod)) /* get the sgttyb struct */ perror("ioctl in setdown"); termod->sg_flags &= (~CBREAK); /* reset cooked mode */ *************** *** 408,414 **** termod->sg_flags |= ECHO; /* echo chars to screen */ if (ioctl(0,TIOCSETP,termod)) /* put it back, modified */ perror("ioctl"); ! setsigc=(struct tchars *) malloc (sizeof(struct tchars)); if (ioctl(0,TIOCGETC,setsigc)) /* get the tchars struct */ perror("ioctl"); setsigc->t_intrc=3; /* set interrupt and quitting */ --- 413,419 ---- termod->sg_flags |= ECHO; /* echo chars to screen */ if (ioctl(0,TIOCSETP,termod)) /* put it back, modified */ perror("ioctl"); ! setsigc=(struct tchars *) malloc ((unsigned)(sizeof(struct tchars))); if (ioctl(0,TIOCGETC,setsigc)) /* get the tchars struct */ perror("ioctl"); setsigc->t_intrc=3; /* set interrupt and quitting */ *************** *** 560,567 **** while (act!=ENDLN && act!=ERRER) { retval=0; ! act=intercom(line,&pos,&pid,FALSE,NULL,1); /* call intercom with fromfile set */ for (i=3;i<=20;i++) if (i!=fileno(finp)) close(i); if (pid && act!=BCKGND) retval=waitfor(pid); if (!disable_auto && act==ERRER) exit(1); /* exit on shell syntax error */ --- 565,585 ---- while (act!=ENDLN && act!=ERRER) { retval=0; ! #if 0 ! /* Was this: appears to be totally wrong */ ! act=intercom(line,&pos,&pid,FALSE,NULL,1); ! #else ! act=intercom(line,&pos,&pid,&i ,FALSE,1); ! /* call intercom with fromfile set -- ?? the big question is do we */ ! /* really ignore the value of outpfd - i dunno., could'nt make out, */ ! /* so i just put in &i, otherwise obviusly this call causes bombs in */ ! /* intercom() */ ! #endif ! #if 0 for (i=3;i<=20;i++) if (i!=fileno(finp)) close(i); + #else + for (i=3;i<=NFILES;i++) if (i!=fileno(finp)) close(i); + #endif if (pid && act!=BCKGND) retval=waitfor(pid); if (!disable_auto && act==ERRER) exit(1); /* exit on shell syntax error */ *************** *** 585,590 **** --- 603,610 ---- void shinit() { extern void loadenv(),vset(),venvprint(); + extern int O_faststart; + #ifndef MINIX extern void hashpath(); extern bool hashed; *************** *** 733,740 **** while (act!=ENDLN && act!=ERRER) { retval=0; ! act=intercom(line,&pos,&pid,FALSE,NULL,0); /* call intercom with fromfile not set */ for (i=3;i<=20;i++) close(i); if (pid && act!=BCKGND) retval=waitfor(pid); #ifndef MINIX --- 753,769 ---- while (act!=ENDLN && act!=ERRER) { retval=0; ! #if 0 ! /* WAS: same intercom problem as in file() here */ ! act=intercom(line,&pos,&pid,FALSE,NULL,0); ! #else ! act=intercom(line,&pos,&pid, &i, FALSE,0); /* call intercom with fromfile not set */ ! #endif ! #if 0 for (i=3;i<=20;i++) close(i); + #else + for (i=3;i<=NFILES;i++) close(i); + #endif if (pid && act!=BCKGND) retval=waitfor(pid); #ifndef MINIX *************** *** 765,771 **** char *argv[]; { extern SYM_T intercom(); ! extern int O_echoexp,meta(); SYM_T act; char line[MAXLL]; int i,pos,retval,pid; --- 794,800 ---- char *argv[]; { extern SYM_T intercom(); ! extern int O_echoexp,O_exiterror,meta(); SYM_T act; char line[MAXLL]; int i,pos,retval,pid; *************** *** 790,797 **** --- 819,835 ---- while (act!=ENDLN && act!=ERRER) { retval=0; + #if 0 + /* WAS: sample problem */ act=intercom(line,&pos,&pid,FALSE,NULL,0); /* call intercom with fromfile not set */ + #else + act=intercom(line,&pos,&pid, &i,FALSE,0); /* call intercom with fromfile not set */ + #endif + #if 0 for (i=3;i<=20;i++) close(i); + #else + for (i=3;i<=NFILES;i++) close(i); + #endif if (pid && act!=BCKGND) retval=waitfor(pid); #ifndef MINIX *************** *** 816,822 **** extern void copyenv(); extern char *invokename,**arguments,**environ,*newenv[]; extern FILE *zin,*zout; ! extern int fromfile,numargs; char filename[MAXFNL]; int argp; --- 854,860 ---- extern void copyenv(); extern char *invokename,**arguments,**environ,*newenv[]; extern FILE *zin,*zout; ! extern int fromfile,numargs, O_execstring; char filename[MAXFNL]; int argp; //E*O*F main.cdif// exit 0