diff --git a/include/term.h b/include/term.h index bc1865e..868f642 100644 --- a/include/term.h +++ b/include/term.h @@ -6,6 +6,6 @@ extern int tgetnum(char *); extern int tgetflag(char *); extern char *tgetstr(char *, char **); extern char *tgoto(char *, int, int); -extern int tputs(register char *, int, int (*)()); +extern int tputs(register char *, int, int (*)(int)); #endif diff --git a/src/cmd/diff/diff.c b/src/cmd/diff/diff.c index 7bb8dea..ca55deb 100644 --- a/src/cmd/diff/diff.c +++ b/src/cmd/diff/diff.c @@ -3,10 +3,36 @@ */ #include "diff.h" +int opt; +int tflag; /* expand tabs on output */ +int hflag; /* -h, use halfhearted DIFFH */ +int bflag; /* ignore blanks in comparisons */ +int wflag; /* totally ignore blanks in comparisons */ +int iflag; /* ignore case in comparisons */ +int lflag; /* long output format with header */ +int rflag; /* recursively trace directories */ +int sflag; /* announce files which are same */ +char *start; /* do file only if name >= this */ +int wantelses; /* -E */ +char *ifdef1; /* String for -1 */ +char *ifdef2; /* String for -2 */ +char *endifname; /* What we will print on next #endif */ +int inifdef; +int context; /* lines of context to be printed */ +int status; +int anychange; +char *tempfile; /* used when comparing against std input */ +char **diffargv; /* option list to pass to recursive diffs */ +char *file1, *file2, *efile1, *efile2; +struct stat stb1, stb2; + char diff[] = DIFF; char diffh[] = DIFFH; char pr[] = PR; +void noroom(void); + +int main(argc, argv) int argc; char **argv; @@ -158,6 +184,7 @@ savestr(cp) return (dp); } +int min(a,b) int a,b; { @@ -165,6 +192,7 @@ min(a,b) return (a < b ? a : b); } +int max(a,b) int a,b; { @@ -172,7 +200,8 @@ max(a,b) return (a > b ? a : b); } -void done(sig) +void +done(sig) int sig; { if (tempfile) @@ -185,9 +214,10 @@ talloc(n) { register char *p; - if ((p = malloc((unsigned)n)) != NULL) - return(p); - noroom(); + p = malloc((unsigned)n); + if (p == NULL) + noroom(); + return(p); } char * @@ -201,6 +231,7 @@ char *p; return(q); } +void noroom() { fprintf(stderr, "diff: files too big, try -h\n"); diff --git a/src/cmd/diff/diff.h b/src/cmd/diff/diff.h index b9cdf36..aeb8894 100644 --- a/src/cmd/diff/diff.h +++ b/src/cmd/diff/diff.h @@ -9,11 +9,13 @@ #include #include #include +#include +#include /* * Output format options */ -int opt; +extern int opt; #define D_NORMAL 0 /* Normal output */ #define D_EDIT -1 /* Editor script out */ @@ -23,49 +25,49 @@ int opt; #define D_NREVERSE 4 /* Reverse ed script with numbered lines and no trailing . */ -int tflag; /* expand tabs on output */ +extern int tflag; /* expand tabs on output */ /* * Algorithm related options */ -int hflag; /* -h, use halfhearted DIFFH */ -int bflag; /* ignore blanks in comparisons */ -int wflag; /* totally ignore blanks in comparisons */ -int iflag; /* ignore case in comparisons */ +extern int hflag; /* -h, use halfhearted DIFFH */ +extern int bflag; /* ignore blanks in comparisons */ +extern int wflag; /* totally ignore blanks in comparisons */ +extern int iflag; /* ignore case in comparisons */ /* * Options on hierarchical diffs. */ -int lflag; /* long output format with header */ -int rflag; /* recursively trace directories */ -int sflag; /* announce files which are same */ -char *start; /* do file only if name >= this */ +extern int lflag; /* long output format with header */ +extern int rflag; /* recursively trace directories */ +extern int sflag; /* announce files which are same */ +extern char *start; /* do file only if name >= this */ /* * Variables for -I D_IFDEF option. */ -int wantelses; /* -E */ -char *ifdef1; /* String for -1 */ -char *ifdef2; /* String for -2 */ -char *endifname; /* What we will print on next #endif */ -int inifdef; +extern int wantelses; /* -E */ +extern char *ifdef1; /* String for -1 */ +extern char *ifdef2; /* String for -2 */ +extern char *endifname; /* What we will print on next #endif */ +extern int inifdef; /* * Variables for -c context option. */ -int context; /* lines of context to be printed */ +extern int context; /* lines of context to be printed */ /* * State for exit status. */ -int status; -int anychange; -char *tempfile; /* used when comparing against std input */ +extern int status; +extern int anychange; +extern char *tempfile; /* used when comparing against std input */ /* * Variables for diffdir. */ -char **diffargv; /* option list to pass to recursive diffs */ +extern char **diffargv; /* option list to pass to recursive diffs */ /* * Input file names. @@ -73,12 +75,16 @@ char **diffargv; /* option list to pass to recursive diffs */ * and padded with a '/', and then efile0 and efile1 point after * the '/'. */ -char *file1, *file2, *efile1, *efile2; -struct stat stb1, stb2; +extern char *file1, *file2, *efile1, *efile2; +extern struct stat stb1, stb2; -char *talloc(), *ralloc(); -char *savestr(), *splice(), *splicen(); -char *copytemp(); +char *talloc(int n); +char *ralloc(char *p, int n); +char *savestr(char *cp); +int min(int a, int b); +int max(int a, int b); void done(int); +void diffdir(char **argv); +void diffreg(void); extern char diffh[], diff[], pr[]; diff --git a/src/cmd/diff/diffdir.c b/src/cmd/diff/diffdir.c index e49b308..8284635 100644 --- a/src/cmd/diff/diffdir.c +++ b/src/cmd/diff/diffdir.c @@ -1,6 +1,7 @@ /* * diff - directory comparison */ +#include #include "diff.h" #define d_flags d_ino @@ -21,6 +22,15 @@ struct dir *setupdir(); int header; char title[2*BUFSIZ], *etitle; +void setfile(char **fpp, char **epp, char *file); +int useless(char *cp); +void only(struct dir *dp, int which); +void compare(struct dir *dp); +void scanpr(struct dir *dp, int test, char *title, char *file1, char *efile1, char *file2, char *efile2); +void calldiff(char *wantpr); +int ascii(int f); + +void diffdir(argv) char **argv; { @@ -109,6 +119,7 @@ diffdir(argv) } } +void setfile(fpp, epp, file) char **fpp, **epp; char *file; @@ -127,6 +138,7 @@ setfile(fpp, epp, file) *epp = cp; } +void scanpr(dp, test, title, file1, efile1, file2, efile2) register struct dir *dp; int test; @@ -152,6 +164,7 @@ scanpr(dp, test, title, file1, efile1, file2, efile2) } } +void only(dp, which) struct dir *dp; int which; @@ -193,7 +206,7 @@ setupdir(cp) fprintf(stderr, "diff: ran out of memory\n"); done(0); } - while (rp = readdir(dirp)) { + while ((rp = readdir(dirp))) { ep = &dp[nitems++]; ep->d_reclen = rp->d_reclen; ep->d_namlen = rp->d_namlen; @@ -222,12 +235,14 @@ setupdir(cp) return (dp); } +int entcmp(d1, d2) struct dir *d1, *d2; { return (strcmp(d1->d_entry, d2->d_entry)); } +void compare(dp) register struct dir *dp; { @@ -320,6 +335,7 @@ closem: char *prargs[] = { "pr", "-h", 0, "-f", 0, 0 }; +void calldiff(wantpr) char *wantpr; { @@ -379,6 +395,7 @@ calldiff(wantpr) #include +int ascii(f) int f; { @@ -404,6 +421,7 @@ ascii(f) /* * THIS IS CRUDE. */ +int useless(cp) register char *cp; { diff --git a/src/cmd/diff/diffh.c b/src/cmd/diff/diffh.c index 5431e2d..75af9bc 100644 --- a/src/cmd/diff/diffh.c +++ b/src/cmd/diff/diffh.c @@ -1,6 +1,7 @@ #include #include #include +#include #include #include @@ -17,12 +18,22 @@ int bflag; int debug = 0; FILE *file[2]; +void progerr(char *s); +int hardsynch(void); +void movstr(char *s, char *t); +void error(char *s, char *t); +int cmp(char *s, char *t); +int easysynch(void); +int output(int a, int b); +void change(long a, int b, long c, int d, char *s); +void range(long a, int b); + /* return pointer to line n of file f*/ char *getl(f,n) long n; { register char *t; - register delta, nt; + register int delta, nt; again: delta = n - lineno[f]; nt = ntext[f]; @@ -39,11 +50,12 @@ again: t = text[f][nt]; if(t==0) { t = text[f][nt] = malloc(LEN+1); - if(t==NULL) + if(t==NULL) { if(hardsynch()) goto again; else progerr("5"); + } } t = fgets(t,LEN,file[f]); if(t!=NULL) @@ -52,10 +64,11 @@ again: } /*remove thru line n of file f from storage*/ +void clrl(f,n) long n; { - register i,j; + register int i,j; j = n-lineno[f]+1; for(i=0;i+j +int asciifile(f) FILE *f; { @@ -953,8 +992,8 @@ asciifile(f) return (1); } - /* dump accumulated "context" diff changes */ +void dump_context_vec() { register int a, b, c, d; @@ -998,15 +1037,15 @@ dump_context_vec() ch = (a <= b) ? 'd' : 'a'; if (ch == 'a') - fetch(ixold,lowa,b,input[0]," "); + fetch(ixold,lowa,b,input[0]," ", 0); else { - fetch(ixold,lowa,a-1,input[0]," "); - fetch(ixold,a,b,input[0],ch == 'c' ? "! " : "- "); + fetch(ixold,lowa,a-1,input[0]," ", 0); + fetch(ixold,a,b,input[0],ch == 'c' ? "! " : "- ", 0); } lowa = b + 1; cvp++; } - fetch(ixold, b+1, upb, input[0], " "); + fetch(ixold, b+1, upb, input[0], " ", 0); } /* output changes to the "new" file */ @@ -1032,15 +1071,15 @@ dump_context_vec() ch = (a <= b) ? 'd' : 'a'; if (ch == 'd') - fetch(ixnew,lowc,d,input[1]," "); + fetch(ixnew,lowc,d,input[1]," ", 0); else { - fetch(ixnew,lowc,c-1,input[1]," "); - fetch(ixnew,c,d,input[1],ch == 'c' ? "! " : "+ "); + fetch(ixnew,lowc,c-1,input[1]," ", 0); + fetch(ixnew,c,d,input[1],ch == 'c' ? "! " : "+ ", 0); } lowc = d + 1; cvp++; } - fetch(ixnew, d+1, upd, input[1], " "); + fetch(ixnew, d+1, upd, input[1], " ", 0); } context_vec_ptr = context_vec_start - 1; diff --git a/src/cmd/emg/Makefile b/src/cmd/emg/Makefile index 616dad8..6b10281 100644 --- a/src/cmd/emg/Makefile +++ b/src/cmd/emg/Makefile @@ -11,10 +11,10 @@ CFLAGS = -Os -Wall -Werror CFLAGS += -ffunction-sections -fdata-sections # This reduces code size significantly. -CFLAGS += -mips16 +#CFLAGS += -mips16 # with CFLAGS+= -ffunction-sections -fdata-sections -LDFLAGS += -Wl,--gc-sections +#LDFLAGS += -Wl,--gc-sections LIBS = -ltermcap -lc diff --git a/src/cmd/emg/estruct.h b/src/cmd/emg/estruct.h index 7ed45fc..21d8674 100644 --- a/src/cmd/emg/estruct.h +++ b/src/cmd/emg/estruct.h @@ -139,7 +139,7 @@ typedef struct void (*t_open) (); /* Open terminal at the start */ void (*t_close) (); /* Close terminal at end */ int (*t_getchar) (); /* Get character from keyboard */ - void (*t_putchar) (); /* Put character to display */ + int (*t_putchar) (); /* Put character to display */ void (*t_flush) (); /* Flush output buffers */ void (*t_move) (); /* Move the cursor, origin 0 */ void (*t_eeol) (); /* Erase to end of line */ diff --git a/src/cmd/emg/tcap.c b/src/cmd/emg/tcap.c index cc451a7..078790b 100644 --- a/src/cmd/emg/tcap.c +++ b/src/cmd/emg/tcap.c @@ -8,16 +8,12 @@ #include "edef.h" #undef CTRL /* Needs to be done here. */ #include - -extern int tgetent(); -extern char *tgetstr(); -extern char *tgoto(); -extern void tputs(); +#include extern char *getenv(); extern void ttopen(); extern int ttgetc(); -extern void ttputc(); +extern int ttputc(int); extern void ttflush(); extern void ttclose(); @@ -39,6 +35,11 @@ void tcapbeep(void); char tcapbuf[TCAPSLEN]; /* capabilities actually used */ char *CM, *CE, *CL, *SO, *SE; +char *UP; /* required by libtermcap */ +char *BC; +char PC = '\0'; +short ospeed = 0; + TERM term = { 0, 0, MARGIN, SCRSIZ, tcapopen, ttclose, ttgetc, ttputc, ttflush, tcapmove, tcapeeol, tcapeeop, tcapbeep, tcaprev diff --git a/src/cmd/picoc/Makefile b/src/cmd/picoc/Makefile index c1c2031..d5abdcc 100644 --- a/src/cmd/picoc/Makefile +++ b/src/cmd/picoc/Makefile @@ -4,7 +4,8 @@ include $(TOPSRC)/target.mk #CC=gcc CFLAGS += -g -DUNIX_HOST -DVER='"1.0"' -DFILENAME_MAX=64 \ -DL_tmpnam=30 -DCLOCKS_PER_SEC=80000000 -DPATH_MAX=200 \ - -DNO_FP -Os -Werror -mips16 + -DNO_FP -Os -Werror +#CFLAGS += -mips16 LIBS = -lm -lc TARGET = picoc diff --git a/src/cmd/smlrc/Makefile b/src/cmd/smlrc/Makefile index 15f81dd..6cc837b 100644 --- a/src/cmd/smlrc/Makefile +++ b/src/cmd/smlrc/Makefile @@ -5,6 +5,7 @@ CFLAGS = -Os -Wall -DMIPS -DNO_ANNOTATIONS -DNO_PREPROCESSOR \ -DNO_PPACK -D_RETROBSD -D__SMALLER_C_SCHAR__ \ -D__SMALLER_C__ -D__SMALLER_C_32__ -DSTATIC \ -DNO_EXTRA_WARNS -DSYNTAX_STACK_MAX=3200 +#CFLAGS += -mips16 # For cross compile #include $(TOPSRC)/cross.mk @@ -33,4 +34,4 @@ clean: rm -f *.o smlrc smlrc.dis smlrc.elf ### smlrc.o: smlrc.c fp.c cgmips.c - ${CC} ${CFLAGS} -mips16 smlrc.c -c -o $@ + ${CC} ${CFLAGS} smlrc.c -c -o $@ diff --git a/src/cmd/uucp/Makefile b/src/cmd/uucp/Makefile index b6064bf..3e5364b 100644 --- a/src/cmd/uucp/Makefile +++ b/src/cmd/uucp/Makefile @@ -17,8 +17,8 @@ LIBOBJ = logent.o ulockf.o uucpdefs.o subdir.o gename.o assert.o expfile.o \ mailst.o systat.o cntrl.o imsg.o gio.o sysacct.o pk0.o pk1.o \ conn.o condevs.o chksum.o setline.o gnsys.o -CC = $(GCCPREFIX)gcc -mips16 -EL -msoft-float -nostdinc -fshort-double -I$(TOPSRC)/include $(INCLUDES) - +CC = $(GCCPREFIX)gcc -EL -msoft-float -nostdinc -fshort-double -I$(TOPSRC)/include $(INCLUDES) +#CC += -mips16 OWNER= uucp diff --git a/src/libtermlib/tputs.c b/src/libtermlib/tputs.c index 7fc9340..7495a03 100644 --- a/src/libtermlib/tputs.c +++ b/src/libtermlib/tputs.c @@ -28,7 +28,7 @@ void tputs(cp, affcnt, outc) register char *cp; int affcnt; - int (*outc)(); + int (*outc)(int); { register int i = 0; register int mspc10;