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 (2 of 5) Message-ID: <612@gara.une.oz> Date: 27 Mar 89 04:27:41 GMT Organization: University of New England, Armidale, Australia Lines: 719 # 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: # comlined.cdif cx.cdif exec.cdif hash.cdif header.hdif hist.cdif echo x - comlined.cdif cat > "comlined.cdif" << '//E*O*F comlined.cdif//' *** org/comlined.c Fri Mar 10 21:34:35 1989 --- st-gcc/comlined.c Sat Mar 11 03:33:21 1989 *************** *** 16,22 **** extern char termcapbuf[]; extern FILE *zin,*zout,*fopen(); ! void mputc(c,f,curs) char c; FILE *f; --- 16,22 ---- extern char termcapbuf[]; extern FILE *zin,*zout,*fopen(); ! #ifndef ATARI_ST void mputc(c,f,curs) char c; FILE *f; *************** *** 33,44 **** --- 33,72 ---- curs[1]++; } } + #else + void mputc(c,f,curs) + int c; + FILE *f; + int curs[]; + { + extern int wid; + char cc = c; + + write(f->_file,&cc,1); + curs[0]++; + if (curs[0]>=wid) + { + write(f->_file,"\n",1); /* goto start of next line */ + curs[0]=curs[0]%wid; /* hopefully gives zero */ + curs[1]++; + } + } + #endif + #ifndef ATARI_ST void oputc(c) char c; { write(zout->_file,&c,1); } + #else + int oputc(c) + int c; + { + char cc = c; + return write(zout->_file,&cc,1); + } + #endif void go(curs,hor,vert) int curs[],hor,vert; *************** *** 144,153 **** --- 172,185 ---- go(curs,horig,vorig); } + #ifdef __STDC__ + void show(char *line, int *curs, bool clearing) + #else void show(line,curs,clearing) char *line; int curs[]; bool clearing; + #endif { extern int lenprompt; int pos=0,horig,vorig; //E*O*F comlined.cdif// echo x - cx.cdif cat > "cx.cdif" << '//E*O*F cx.cdif//' *** org/cx.c Fri Mar 10 21:34:36 1989 --- st-gcc/cx.c Sat Mar 11 05:40:06 1989 *************** *** 16,21 **** --- 16,22 ---- FILE *pswdp,*fopen(); char pwent[256],username[USERNL],restpath[MAXWL]; int i,j,colon=0; + extern char *getlogin(); #ifdef DEBUG fprintf(stderr,"user_path is %s\n",user_path); *************** *** 68,80 **** else { fprintf(stderr,"\n%sBad password entry in %s for %s.\n",beep,PASSWD,username); ! close(pswdp); return(FALSE); } break; } } ! close(pswdp); /* this test is a repeat of the one above but will give a different error message if we can't find a matching username */ if (colon!=5) --- 69,83 ---- else { fprintf(stderr,"\n%sBad password entry in %s for %s.\n",beep,PASSWD,username); ! /* close(pswdp); */ ! fclose(pswdp); return(FALSE); } break; } } ! /* close(pswdp); */ ! fclose(pswdp); /* this test is a repeat of the one above but will give a different error message if we can't find a matching username */ if (colon!=5) //E*O*F cx.cdif// echo x - exec.cdif cat > "exec.cdif" << '//E*O*F exec.cdif//' *** org/exec.c Fri Mar 10 21:34:38 1989 --- st-gcc/exec.c Sat Mar 11 03:03:02 1989 *************** *** 14,20 **** #ifdef MINIX extern int errno; #endif ! extern **environ; void (*builtin_func)(); struct adefn *alias_defn; int stopflg,NoIoctl=0; --- 14,20 ---- #ifdef MINIX extern int errno; #endif ! extern char **environ; void (*builtin_func)(); struct adefn *alias_defn; int stopflg,NoIoctl=0; *************** *** 46,57 **** fprintf(stderr,"set exec\n"); #endif ! termod=(struct sgttyb *) malloc (sizeof(struct sgttyb)); if (ioctl(0,TIOCGETP,termod)) perror("ioctl in setexec"); termod->sg_flags &= (~CBREAK); /* cooked mode */ termod->sg_flags |= ECHO; /* with echo */ if (ioctl(0,TIOCSETN,termod)) perror("ioctl"); ! setsigc=(struct tchars *) malloc (sizeof(struct tchars)); if (ioctl(0,TIOCGETC,setsigc)) perror("ioctl"); setsigc->t_intrc=03; /* interrupt ctrl c */ setsigc->t_quitc=034; /* quit ctrl \ */ --- 46,57 ---- fprintf(stderr,"set exec\n"); #endif ! termod=(struct sgttyb *) malloc ((unsigned)(sizeof(struct sgttyb))); if (ioctl(0,TIOCGETP,termod)) perror("ioctl in setexec"); termod->sg_flags &= (~CBREAK); /* cooked mode */ termod->sg_flags |= ECHO; /* with echo */ if (ioctl(0,TIOCSETN,termod)) perror("ioctl"); ! setsigc=(struct tchars *) malloc ((unsigned)(sizeof(struct tchars))); if (ioctl(0,TIOCGETC,setsigc)) perror("ioctl"); setsigc->t_intrc=03; /* interrupt ctrl c */ setsigc->t_quitc=034; /* quit ctrl \ */ *************** *** 86,92 **** { int sig; ! for(sig=1;sig<21;sig++) signal(sig,SIG_DFL); } --- 86,92 ---- { int sig; ! for(sig=1;sig "hash.cdif" << '//E*O*F hash.cdif//' *** org/hash.c Fri Mar 10 21:34:40 1989 --- st-gcc/hash.c Fri Mar 10 22:04:31 1989 *************** *** 34,40 **** struct stat *buf; char fpn[MAXWL]; ! buf=(struct stat *) malloc (sizeof(struct stat)); if (nojoin) stat(dir,buf); else --- 34,40 ---- struct stat *buf; char fpn[MAXWL]; ! buf=(struct stat *) malloc ((unsigned)(sizeof(struct stat))); if (nojoin) stat(dir,buf); else *************** *** 92,98 **** } } /* Having found a blank position we now malloc some space and copy the values */ ! hasharray[hashval].name=(char *) malloc (strlen(aptr->a_name)+1); strcpy(hasharray[hashval].name,aptr->a_name); hasharray[hashval].exec_ptr.alias_defn=checkalias(aptr->a_name); hasharray[hashval].type=1; --- 92,98 ---- } } /* Having found a blank position we now malloc some space and copy the values */ ! hasharray[hashval].name=(char *) malloc ((unsigned)(strlen(aptr->a_name)+1)); strcpy(hasharray[hashval].name,aptr->a_name); hasharray[hashval].exec_ptr.alias_defn=checkalias(aptr->a_name); hasharray[hashval].type=1; *************** *** 128,134 **** } } /* Having found a blank position we now malloc some space and copy the values */ ! hasharray[hashval].name=(char *) malloc (strlen(builtin_name[i])+1); strcpy(hasharray[hashval].name,builtin_name[i]); hasharray[hashval].exec_ptr.builtin_fn=checkbuiltins(builtin_name[i]); hasharray[hashval].type=2; --- 128,134 ---- } } /* Having found a blank position we now malloc some space and copy the values */ ! hasharray[hashval].name=(char *) malloc ((unsigned)strlen(builtin_name[i])+1); strcpy(hasharray[hashval].name,builtin_name[i]); hasharray[hashval].exec_ptr.builtin_fn=checkbuiltins(builtin_name[i]); hasharray[hashval].type=2; *************** *** 248,256 **** } /* Having found a blank position we now malloc some space and copy the values */ ! hasharray[hashval].name=(char *) malloc (strlen(entry->d_name)+1); strcpy(hasharray[hashval].name,entry->d_name); ! hasharray[hashval].exec_ptr.dir=(char *) malloc (strlen(dir)+1); strcpy(hasharray[hashval].exec_ptr.dir,dir); hasharray[hashval].type=0; } --- 248,256 ---- } /* Having found a blank position we now malloc some space and copy the values */ ! hasharray[hashval].name=(char *) malloc ((unsigned)(strlen(entry->d_name)+1)); strcpy(hasharray[hashval].name,entry->d_name); ! hasharray[hashval].exec_ptr.dir=(char *) malloc ((unsigned)(strlen(dir)+1)); strcpy(hasharray[hashval].exec_ptr.dir,dir); hasharray[hashval].type=0; } //E*O*F hash.cdif// echo x - header.hdif cat > "header.hdif" << '//E*O*F header.hdif//' *** org/header.h Fri Mar 10 21:34:41 1989 --- st-gcc/header.h Sat Mar 11 03:27:07 1989 *************** *** 10,16 **** #else # include # include ! # include # ifdef SUN # include # include --- 10,20 ---- #else # include # include ! # ifndef ATARI_ST ! # include ! #else ! # include ! #endif # ifdef SUN # include # include *************** *** 60,66 **** #define DFLTSH "/bin/sh" /* name of default editor to use for alias creation. */ ! #define DFLTED "/usr/local/bin/vi" /* Sizes of some data structures */ #ifdef MINIX --- 64,70 ---- #define DFLTSH "/bin/sh" /* name of default editor to use for alias creation. */ ! #define DFLTED "/usr/local/bin/mg" /* Sizes of some data structures */ #ifdef MINIX *************** *** 93,99 **** # ifndef MINIX # define NUMSIG 27 # else ! # define NUMSIG 19 # endif #endif --- 97,107 ---- # ifndef MINIX # define NUMSIG 27 # else ! # ifdef ATARI_ST ! # define NUMSIG NSIG /* defined in */ ! # else ! # define NUMSIG 19 ! # endif # endif #endif *************** *** 102,107 **** --- 110,118 ---- #define UNDEF -1 /* Identification for error codes for metacharacter expansion function */ + #ifdef OK /* defined somewhere on minixST */ + #undef OK + #endif #define OK 0 #define SH_ERR -1 #define ST_ERR -2 *************** *** 115,120 **** --- 126,141 ---- #define DL_ERR -10 typedef enum TS {RDRIN,RDROUT,RDRERR,APPND,PIPE,WORD,ENDLN,SEMI,EQ,ADD,BCKGND,DBLPIPE,DBLAMP,ERRER} SYM_T; + + /* some brain damaged people put these in stdio */ + #ifdef FALSE + #undef FALSE + #endif + + #ifdef TRUE + #undef TRUE + #endif + typedef enum bb {FALSE,TRUE} bool; /* These structures are used to store the alias definitions. */ *************** *** 166,168 **** --- 187,310 ---- long lastmod; struct job *next; }; + + #ifdef __STDC__ + #ifndef __NO_PROTO__ + void aliaslist(void); + void savealias(char *, FILE *); + struct adefn *checkalias(char *); + void addalias(char *, struct adefn *); + void makelinealias(char *, char *); + void makealias(char *, FILE *); + void delalias(char *); + + void alias(int, char **, int, int, int, char *, char *, char *, bool, bool); + void logout(int, char **, int, int, int, char *, char *, char *, bool, bool); + void (*checkbuiltins())(char *); + + bool firstword(char *, int); + void complete(char *, int *, int *); + void nameopt(char *, int, int *); + + void mputc(int, FILE *, int *); + int oputc(int); + void go(int *, int, int); + void backward(int *); + void forward(int *); + void clrscrn(void); + void insert(char *, int, int, int *); + void show(char *, int *, bool); + void goend(char *, int *, int *); + void copyback(char *, int, int *); + void delword(char *, int, int *); + void backword(char *, int *, int *); + void forword(char *, int *, int *); + void yanknext(char *, int, char *); + void yankprev(char *, int, char *); + void clrline(char *, int, int *); + void transpose(char *, int, int *); + int strip(char *); + void tardis(char *, int *, int *); + bool getlin(char *, int *, int); + + bool expand_tilde(char *, int *); + void help(char *, int, int *); + + void setexec(void); + void setbgexec(void); + void resetsigdefaults(void); + bool findslash(char *); + void runalias(struct adefn *, int, char **, int, int, int, char *, + char *, char *, bool, bool, bool); + int getpath(char *, char *); + void panic(char *); + int atoo(char *); + void setmask(char *); + void redirect(int, int, int, char *, char *, char *, bool, bool); + int execute(int, char **, int, int, int, char *, char *, char *, bool, + bool, bool, int); + + bool getfileline(char *, FILE *, int); + + bool executable(char *, char *, int); + + void savehist(char *, int, int); + void loadhist(char *, int *, int, int *); + void mprint(char *); + void history(char **); + bool gethist(char *); + char *getnumhist(int); + int matchhist(int); + + void joblist(void); + struct job *findjob(int); + int pidfromjob(int); + void addreport(struct job *); + int addjob(int, char *, int, bool); + void newcurr(void); + void rmjob(int); + int update(int, int); + void checkjobs(void); + int waitfor(int); + void reportjobs(void); + int lengthint(int); + void printime(void); + void prprompt(int); + bool tflagexist(char *, char *); + void terminal(void); + void graceful(int); + void setup(void); + void resetsh(void); + void setdown(void); + void leave_shell(void); + int process(int, char **, char *); + void file(FILE *, int); + void shinit(void); + void interact(void); + void execstring(int, char **, int); + + void getdir(FILE *, char *); + int isanum(char *); + int meta(char *, int); + + bool getword(char *, int *, char *, bool ); + SYM_T retsym(char *, char *, int *, bool ); + SYM_T intercom(char *, int *, int *, int *, bool , int); + + char *vget(char *); + char *vwget(char *, int); + bool export(char *, char *); + void makenvpath(void); + void makenventry(char *); + void makenv(void); + void vset(char *, char *); + void vadd(char *, char *); + void vdel(char *); + void venvdel(char *); + void vprint(void); + void venvprint(void); + void copyenv(char **, char **); + void loadenv(void); + + #endif /* __NO_PROTO__ */ + #endif /* __STDC__ */ //E*O*F header.hdif// echo x - hist.cdif cat > "hist.cdif" << '//E*O*F hist.cdif//' *** org/hist.c Fri Mar 10 21:34:42 1989 --- st-gcc/hist.c Fri Mar 10 22:02:30 1989 *************** *** 27,40 **** for (old=ptr=htop;ptr && ptr->hnum!=histnum;old=ptr,ptr=ptr->next); if (ptr) /* change existing history */ { ! ptr->hline=(char *) realloc (ptr->hline,strlen(line)+1); strcpy(ptr->hline,line); } else if (htop) /* there is a history, isn't there? */ { ! old->next=ptr=(struct histlist *) malloc (sizeof(struct histlist)); ! ptr->hline=(char *) malloc (strlen(line)+1); strcpy(ptr->hline,line); ptr->hnum=histnum; ptr->next=0; --- 27,40 ---- for (old=ptr=htop;ptr && ptr->hnum!=histnum;old=ptr,ptr=ptr->next); if (ptr) /* change existing history */ { ! ptr->hline=(char *) realloc (ptr->hline,(unsigned)(strlen(line)+1)); strcpy(ptr->hline,line); } else if (htop) /* there is a history, isn't there? */ { ! old->next=ptr=(struct histlist *) malloc((unsigned)(sizeof(struct histlist))); ! ptr->hline=(char *) malloc ((unsigned)(strlen(line)+1)); strcpy(ptr->hline,line); ptr->hnum=histnum; ptr->next=0; *************** *** 47,54 **** } else /* no? well, let's make one then. */ { ! htop=(struct histlist *) malloc (sizeof(struct histlist)); ! htop->hline=(char *) malloc (strlen(line)+1); strcpy(htop->hline,line); htop->hnum=histnum; htop->next=0; --- 47,54 ---- } else /* no? well, let's make one then. */ { ! htop=(struct histlist *) malloc ((unsigned)(sizeof(struct histlist))); ! htop->hline=(char *) malloc ((unsigned)(strlen(line)+1)); strcpy(htop->hline,line); htop->hnum=histnum; htop->next=0; //E*O*F hist.cdif// exit 0