Update diff and emg.

This commit is contained in:
Serge
2022-05-27 02:24:49 -07:00
parent a47779d9d6
commit 9e2d5993f6
13 changed files with 190 additions and 70 deletions

View File

@@ -6,6 +6,6 @@ extern int tgetnum(char *);
extern int tgetflag(char *); extern int tgetflag(char *);
extern char *tgetstr(char *, char **); extern char *tgetstr(char *, char **);
extern char *tgoto(char *, int, int); extern char *tgoto(char *, int, int);
extern int tputs(register char *, int, int (*)()); extern int tputs(register char *, int, int (*)(int));
#endif #endif

View File

@@ -3,10 +3,36 @@
*/ */
#include "diff.h" #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 diff[] = DIFF;
char diffh[] = DIFFH; char diffh[] = DIFFH;
char pr[] = PR; char pr[] = PR;
void noroom(void);
int
main(argc, argv) main(argc, argv)
int argc; int argc;
char **argv; char **argv;
@@ -158,6 +184,7 @@ savestr(cp)
return (dp); return (dp);
} }
int
min(a,b) min(a,b)
int a,b; int a,b;
{ {
@@ -165,6 +192,7 @@ min(a,b)
return (a < b ? a : b); return (a < b ? a : b);
} }
int
max(a,b) max(a,b)
int a,b; int a,b;
{ {
@@ -172,7 +200,8 @@ max(a,b)
return (a > b ? a : b); return (a > b ? a : b);
} }
void done(sig) void
done(sig)
int sig; int sig;
{ {
if (tempfile) if (tempfile)
@@ -185,9 +214,10 @@ talloc(n)
{ {
register char *p; register char *p;
if ((p = malloc((unsigned)n)) != NULL) p = malloc((unsigned)n);
return(p); if (p == NULL)
noroom(); noroom();
return(p);
} }
char * char *
@@ -201,6 +231,7 @@ char *p;
return(q); return(q);
} }
void
noroom() noroom()
{ {
fprintf(stderr, "diff: files too big, try -h\n"); fprintf(stderr, "diff: files too big, try -h\n");

View File

@@ -9,11 +9,13 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/dir.h> #include <sys/dir.h>
#include <signal.h> #include <signal.h>
#include <unistd.h>
#include <fcntl.h>
/* /*
* Output format options * Output format options
*/ */
int opt; extern int opt;
#define D_NORMAL 0 /* Normal output */ #define D_NORMAL 0 /* Normal output */
#define D_EDIT -1 /* Editor script out */ #define D_EDIT -1 /* Editor script out */
@@ -23,49 +25,49 @@ int opt;
#define D_NREVERSE 4 /* Reverse ed script with numbered #define D_NREVERSE 4 /* Reverse ed script with numbered
lines and no trailing . */ lines and no trailing . */
int tflag; /* expand tabs on output */ extern int tflag; /* expand tabs on output */
/* /*
* Algorithm related options * Algorithm related options
*/ */
int hflag; /* -h, use halfhearted DIFFH */ extern int hflag; /* -h, use halfhearted DIFFH */
int bflag; /* ignore blanks in comparisons */ extern int bflag; /* ignore blanks in comparisons */
int wflag; /* totally ignore blanks in comparisons */ extern int wflag; /* totally ignore blanks in comparisons */
int iflag; /* ignore case in comparisons */ extern int iflag; /* ignore case in comparisons */
/* /*
* Options on hierarchical diffs. * Options on hierarchical diffs.
*/ */
int lflag; /* long output format with header */ extern int lflag; /* long output format with header */
int rflag; /* recursively trace directories */ extern int rflag; /* recursively trace directories */
int sflag; /* announce files which are same */ extern int sflag; /* announce files which are same */
char *start; /* do file only if name >= this */ extern char *start; /* do file only if name >= this */
/* /*
* Variables for -I D_IFDEF option. * Variables for -I D_IFDEF option.
*/ */
int wantelses; /* -E */ extern int wantelses; /* -E */
char *ifdef1; /* String for -1 */ extern char *ifdef1; /* String for -1 */
char *ifdef2; /* String for -2 */ extern char *ifdef2; /* String for -2 */
char *endifname; /* What we will print on next #endif */ extern char *endifname; /* What we will print on next #endif */
int inifdef; extern int inifdef;
/* /*
* Variables for -c context option. * 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. * State for exit status.
*/ */
int status; extern int status;
int anychange; extern int anychange;
char *tempfile; /* used when comparing against std input */ extern char *tempfile; /* used when comparing against std input */
/* /*
* Variables for diffdir. * 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. * 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 * and padded with a '/', and then efile0 and efile1 point after
* the '/'. * the '/'.
*/ */
char *file1, *file2, *efile1, *efile2; extern char *file1, *file2, *efile1, *efile2;
struct stat stb1, stb2; extern struct stat stb1, stb2;
char *talloc(), *ralloc(); char *talloc(int n);
char *savestr(), *splice(), *splicen(); char *ralloc(char *p, int n);
char *copytemp(); char *savestr(char *cp);
int min(int a, int b);
int max(int a, int b);
void done(int); void done(int);
void diffdir(char **argv);
void diffreg(void);
extern char diffh[], diff[], pr[]; extern char diffh[], diff[], pr[];

View File

@@ -1,6 +1,7 @@
/* /*
* diff - directory comparison * diff - directory comparison
*/ */
#include <sys/wait.h>
#include "diff.h" #include "diff.h"
#define d_flags d_ino #define d_flags d_ino
@@ -21,6 +22,15 @@ struct dir *setupdir();
int header; int header;
char title[2*BUFSIZ], *etitle; 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) diffdir(argv)
char **argv; char **argv;
{ {
@@ -109,6 +119,7 @@ diffdir(argv)
} }
} }
void
setfile(fpp, epp, file) setfile(fpp, epp, file)
char **fpp, **epp; char **fpp, **epp;
char *file; char *file;
@@ -127,6 +138,7 @@ setfile(fpp, epp, file)
*epp = cp; *epp = cp;
} }
void
scanpr(dp, test, title, file1, efile1, file2, efile2) scanpr(dp, test, title, file1, efile1, file2, efile2)
register struct dir *dp; register struct dir *dp;
int test; int test;
@@ -152,6 +164,7 @@ scanpr(dp, test, title, file1, efile1, file2, efile2)
} }
} }
void
only(dp, which) only(dp, which)
struct dir *dp; struct dir *dp;
int which; int which;
@@ -193,7 +206,7 @@ setupdir(cp)
fprintf(stderr, "diff: ran out of memory\n"); fprintf(stderr, "diff: ran out of memory\n");
done(0); done(0);
} }
while (rp = readdir(dirp)) { while ((rp = readdir(dirp))) {
ep = &dp[nitems++]; ep = &dp[nitems++];
ep->d_reclen = rp->d_reclen; ep->d_reclen = rp->d_reclen;
ep->d_namlen = rp->d_namlen; ep->d_namlen = rp->d_namlen;
@@ -222,12 +235,14 @@ setupdir(cp)
return (dp); return (dp);
} }
int
entcmp(d1, d2) entcmp(d1, d2)
struct dir *d1, *d2; struct dir *d1, *d2;
{ {
return (strcmp(d1->d_entry, d2->d_entry)); return (strcmp(d1->d_entry, d2->d_entry));
} }
void
compare(dp) compare(dp)
register struct dir *dp; register struct dir *dp;
{ {
@@ -320,6 +335,7 @@ closem:
char *prargs[] = { "pr", "-h", 0, "-f", 0, 0 }; char *prargs[] = { "pr", "-h", 0, "-f", 0, 0 };
void
calldiff(wantpr) calldiff(wantpr)
char *wantpr; char *wantpr;
{ {
@@ -379,6 +395,7 @@ calldiff(wantpr)
#include <a.out.h> #include <a.out.h>
int
ascii(f) ascii(f)
int f; int f;
{ {
@@ -404,6 +421,7 @@ ascii(f)
/* /*
* THIS IS CRUDE. * THIS IS CRUDE.
*/ */
int
useless(cp) useless(cp)
register char *cp; register char *cp;
{ {

View File

@@ -1,6 +1,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <ctype.h> #include <ctype.h>
#include <unistd.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
@@ -17,12 +18,22 @@ int bflag;
int debug = 0; int debug = 0;
FILE *file[2]; 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*/ /* return pointer to line n of file f*/
char *getl(f,n) char *getl(f,n)
long n; long n;
{ {
register char *t; register char *t;
register delta, nt; register int delta, nt;
again: again:
delta = n - lineno[f]; delta = n - lineno[f];
nt = ntext[f]; nt = ntext[f];
@@ -39,11 +50,12 @@ again:
t = text[f][nt]; t = text[f][nt];
if(t==0) { if(t==0) {
t = text[f][nt] = malloc(LEN+1); t = text[f][nt] = malloc(LEN+1);
if(t==NULL) if(t==NULL) {
if(hardsynch()) if(hardsynch())
goto again; goto again;
else else
progerr("5"); progerr("5");
}
} }
t = fgets(t,LEN,file[f]); t = fgets(t,LEN,file[f]);
if(t!=NULL) if(t!=NULL)
@@ -52,10 +64,11 @@ again:
} }
/*remove thru line n of file f from storage*/ /*remove thru line n of file f from storage*/
void
clrl(f,n) clrl(f,n)
long n; long n;
{ {
register i,j; register int i,j;
j = n-lineno[f]+1; j = n-lineno[f]+1;
for(i=0;i+j<ntext[f];i++) for(i=0;i+j<ntext[f];i++)
movstr(text[f][i+j],text[f][i]); movstr(text[f][i+j],text[f][i]);
@@ -63,13 +76,15 @@ long n;
ntext[f] -= j; ntext[f] -= j;
} }
void
movstr(s,t) movstr(s,t)
register char *s, *t; register char *s, *t;
{ {
while(*t++= *s++) while ((*t++ = *s++))
continue; continue;
} }
int
main(argc,argv) main(argc,argv)
char **argv; char **argv;
{ {
@@ -112,10 +127,11 @@ char **argv;
} }
/* synch on C successive matches*/ /* synch on C successive matches*/
int
easysynch() easysynch()
{ {
int i,j; int i,j;
register k,m; register int k,m;
char *s0,*s1; char *s0,*s1;
for(i=j=1;i<RANGE&&j<RANGE;i++,j++) { for(i=j=1;i<RANGE&&j<RANGE;i++,j++) {
s0 = getl(0,n0+i); s0 = getl(0,n0+i);
@@ -144,9 +160,10 @@ cont2: ;
return(0); return(0);
} }
int
output(a,b) output(a,b)
{ {
register i; register int i;
char *s; char *s;
if(a<0) if(a<0)
change(n0-1,0,n1,b,"a"); change(n0-1,0,n1,b,"a");
@@ -175,6 +192,7 @@ output(a,b)
return(1); return(1);
} }
void
change(a,b,c,d,s) change(a,b,c,d,s)
long a,c; long a,c;
char *s; char *s;
@@ -185,6 +203,7 @@ char *s;
printf("\n"); printf("\n");
} }
void
range(a,b) range(a,b)
long a; long a;
{ {
@@ -196,6 +215,7 @@ long a;
printf("%ld,%ld",a,a+b); printf("%ld,%ld",a,a+b);
} }
int
cmp(s,t) cmp(s,t)
char *s,*t; char *s,*t;
{ {
@@ -220,20 +240,21 @@ char *f1,*f2;
FILE *f; FILE *f;
char b[100],*bptr,*eptr; char b[100],*bptr,*eptr;
struct stat statbuf; struct stat statbuf;
if(cmp(f1,"-")==0) if (cmp(f1, "-") == 0) {
if(cmp(f2,"-")==0) if(cmp(f2,"-")==0)
error("can't do - -",""); error("can't do - -","");
else else
return(stdin); return(stdin);
}
if(stat(f1,&statbuf)==-1) if(stat(f1,&statbuf)==-1)
error("can't access ",f1); error("can't access ",f1);
if((statbuf.st_mode&S_IFMT)==S_IFDIR) { if((statbuf.st_mode&S_IFMT)==S_IFDIR) {
for(bptr=b;*bptr= *f1++;bptr++) ; for (bptr = b; (*bptr = *f1++); bptr++) ;
*bptr++ = '/'; *bptr++ = '/';
for(eptr=f2;*eptr;eptr++) for(eptr=f2;*eptr;eptr++)
if(*eptr=='/'&&eptr[1]!=0&&eptr[1]!='/') if(*eptr=='/'&&eptr[1]!=0&&eptr[1]!='/')
f2 = eptr+1; f2 = eptr+1;
while(*bptr++= *f2++) ; while ((*bptr++ = *f2++)) ;
f1 = b; f1 = b;
} }
f = fopen(f1,"r"); f = fopen(f1,"r");
@@ -242,13 +263,14 @@ char *f1,*f2;
return(f); return(f);
} }
void
progerr(s) progerr(s)
char *s; char *s;
{ {
error("program error ",s); error("program error ",s);
} }
void
error(s,t) error(s,t)
char *s,*t; char *s,*t;
{ {
@@ -257,6 +279,7 @@ char *s,*t;
} }
/*stub for resychronization beyond limits of text buf*/ /*stub for resychronization beyond limits of text buf*/
int
hardsynch() hardsynch()
{ {
change(n0,INF,n1,INF,"c"); change(n0,INF,n1,INF,"c");

View File

@@ -135,6 +135,28 @@ const char cup2low[256] = {
0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,0xf9,0xfa,0xfb,0xfc,0xfd,0xfe,0xff 0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,0xf9,0xfa,0xfb,0xfc,0xfd,0xfe,0xff
}; };
char *splice(char *dir, char *file);
char *copytemp(void);
int asciifile(FILE *f);
void prepare(int i, FILE *fd);
void prune(void);
void sort(struct line *a, int n);
void equiv(struct line *a, int n, struct line *b, int m, int *c);
void unsort(struct line *f, int l, int *b);
int stone(int *a, int n, int *b, int *c);
void unravel(int p);
void check(void);
void output(void);
int readhash(FILE *f);
int newcand(int x, int y, int pred);
int search(int *c, int k, int y);
int skipline(int f);
void change(int a, int b, int c, int d);
void dump_context_vec(void);
void range(int a, int b, char *separator);
void fetch(long *f, int a, int b, FILE *lb, char *s, int oldfile);
void
diffreg() diffreg()
{ {
register int i, j; register int i, j;
@@ -306,16 +328,17 @@ splice(dir, file)
return (savestr(buf)); return (savestr(buf));
} }
void
prepare(i, fd) prepare(i, fd)
int i; int i;
FILE *fd; FILE *fd;
{ {
register struct line *p; register struct line *p;
register j,h; register int j, h;
fseek(fd, (long)0, 0); fseek(fd, (long)0, 0);
p = (struct line *)talloc(3*sizeof(line)); p = (struct line *)talloc(3*sizeof(line));
for(j=0; h=readhash(fd);) { for (j = 0; (h = readhash(fd)); ) {
p = (struct line *)ralloc((char *)p,(++j+3)*sizeof(line)); p = (struct line *)ralloc((char *)p,(++j+3)*sizeof(line));
p[j].value = h; p[j].value = h;
} }
@@ -323,9 +346,10 @@ prepare(i, fd)
file[i] = p; file[i] = p;
} }
void
prune() prune()
{ {
register i,j; register int i, j;
for(pref=0;pref<len[0]&&pref<len[1]&& for(pref=0;pref<len[0]&&pref<len[1]&&
file[0][pref+1].value==file[1][pref+1].value; file[0][pref+1].value==file[1][pref+1].value;
pref++ ) ; pref++ ) ;
@@ -340,6 +364,7 @@ prune()
} }
} }
void
equiv(a,n,b,m,c) equiv(a,n,b,m,c)
struct line *a, *b; struct line *a, *b;
int *c; int *c;
@@ -368,6 +393,7 @@ int *c;
c[j] = -1; c[j] = -1;
} }
int
stone(a,n,b,c) stone(a,n,b,c)
int *a; int *a;
int *b; int *b;
@@ -409,6 +435,7 @@ register int *c;
return(k); return(k);
} }
int
newcand(x,y,pred) newcand(x,y,pred)
{ {
register struct cand *q; register struct cand *q;
@@ -420,6 +447,7 @@ newcand(x,y,pred)
return(clen-1); return(clen-1);
} }
int
search(c, k, y) search(c, k, y)
int *c; int *c;
{ {
@@ -444,6 +472,7 @@ int *c;
return(l+1); return(l+1);
} }
void
unravel(p) unravel(p)
{ {
register int i; register int i;
@@ -461,6 +490,7 @@ unravel(p)
to confounding by hashing (which result in "jackpot") to confounding by hashing (which result in "jackpot")
2. collect random access indexes to the two files */ 2. collect random access indexes to the two files */
void
check() check()
{ {
register int i, j; register int i, j;
@@ -560,6 +590,7 @@ check()
*/ */
} }
void
sort(a,n) /*shellsort CACM #201*/ sort(a,n) /*shellsort CACM #201*/
struct line *a; struct line *a;
{ {
@@ -595,6 +626,7 @@ struct line *a;
} }
} }
void
unsort(f, l, b) unsort(f, l, b)
struct line *f; struct line *f;
int *b; int *b;
@@ -609,9 +641,10 @@ int *b;
free((char *)a); free((char *)a);
} }
int
skipline(f) skipline(f)
{ {
register i, c; register int i, c;
for(i=1;(c=getc(input[f]))!='\n';i++) for(i=1;(c=getc(input[f]))!='\n';i++)
if (c < 0) if (c < 0)
@@ -619,6 +652,7 @@ skipline(f)
return(i); return(i);
} }
void
output() output()
{ {
int m; int m;
@@ -686,6 +720,7 @@ struct context_vec *context_vec_start,
and this means that there were lines appended (beginning at b). and this means that there were lines appended (beginning at b).
If c is greater than d then there are lines missing from the to file. If c is greater than d then there are lines missing from the to file.
*/ */
void
change(a,b,c,d) change(a,b,c,d)
{ {
int ch; int ch;
@@ -776,6 +811,7 @@ change(a,b,c,d)
} }
} }
void
range(a,b,separator) range(a,b,separator)
char *separator; char *separator;
{ {
@@ -785,6 +821,7 @@ char *separator;
} }
} }
void
fetch(f,a,b,lb,s,oldfile) fetch(f,a,b,lb,s,oldfile)
long *f; long *f;
FILE *lb; FILE *lb;
@@ -864,13 +901,14 @@ char *s;
* arranging line in 7-bit bytes and then * arranging line in 7-bit bytes and then
* summing 1-s complement in 16-bit hunks * summing 1-s complement in 16-bit hunks
*/ */
int
readhash(f) readhash(f)
register FILE *f; register FILE *f;
{ {
register long sum; register long sum;
register unsigned shift; register unsigned shift;
register t; register int t;
register space; register int space;
sum = 1; sum = 1;
space = 0; space = 0;
@@ -931,6 +969,7 @@ register FILE *f;
#include <a.out.h> #include <a.out.h>
int
asciifile(f) asciifile(f)
FILE *f; FILE *f;
{ {
@@ -953,8 +992,8 @@ asciifile(f)
return (1); return (1);
} }
/* dump accumulated "context" diff changes */ /* dump accumulated "context" diff changes */
void
dump_context_vec() dump_context_vec()
{ {
register int a, b, c, d; register int a, b, c, d;
@@ -998,15 +1037,15 @@ dump_context_vec()
ch = (a <= b) ? 'd' : 'a'; ch = (a <= b) ? 'd' : 'a';
if (ch == 'a') if (ch == 'a')
fetch(ixold,lowa,b,input[0]," "); fetch(ixold,lowa,b,input[0]," ", 0);
else { else {
fetch(ixold,lowa,a-1,input[0]," "); fetch(ixold,lowa,a-1,input[0]," ", 0);
fetch(ixold,a,b,input[0],ch == 'c' ? "! " : "- "); fetch(ixold,a,b,input[0],ch == 'c' ? "! " : "- ", 0);
} }
lowa = b + 1; lowa = b + 1;
cvp++; cvp++;
} }
fetch(ixold, b+1, upb, input[0], " "); fetch(ixold, b+1, upb, input[0], " ", 0);
} }
/* output changes to the "new" file */ /* output changes to the "new" file */
@@ -1032,15 +1071,15 @@ dump_context_vec()
ch = (a <= b) ? 'd' : 'a'; ch = (a <= b) ? 'd' : 'a';
if (ch == 'd') if (ch == 'd')
fetch(ixnew,lowc,d,input[1]," "); fetch(ixnew,lowc,d,input[1]," ", 0);
else { else {
fetch(ixnew,lowc,c-1,input[1]," "); fetch(ixnew,lowc,c-1,input[1]," ", 0);
fetch(ixnew,c,d,input[1],ch == 'c' ? "! " : "+ "); fetch(ixnew,c,d,input[1],ch == 'c' ? "! " : "+ ", 0);
} }
lowc = d + 1; lowc = d + 1;
cvp++; cvp++;
} }
fetch(ixnew, d+1, upd, input[1], " "); fetch(ixnew, d+1, upd, input[1], " ", 0);
} }
context_vec_ptr = context_vec_start - 1; context_vec_ptr = context_vec_start - 1;

View File

@@ -11,10 +11,10 @@ CFLAGS = -Os -Wall -Werror
CFLAGS += -ffunction-sections -fdata-sections CFLAGS += -ffunction-sections -fdata-sections
# This reduces code size significantly. # This reduces code size significantly.
CFLAGS += -mips16 #CFLAGS += -mips16
# with CFLAGS+= -ffunction-sections -fdata-sections # with CFLAGS+= -ffunction-sections -fdata-sections
LDFLAGS += -Wl,--gc-sections #LDFLAGS += -Wl,--gc-sections
LIBS = -ltermcap -lc LIBS = -ltermcap -lc

View File

@@ -139,7 +139,7 @@ typedef struct
void (*t_open) (); /* Open terminal at the start */ void (*t_open) (); /* Open terminal at the start */
void (*t_close) (); /* Close terminal at end */ void (*t_close) (); /* Close terminal at end */
int (*t_getchar) (); /* Get character from keyboard */ 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_flush) (); /* Flush output buffers */
void (*t_move) (); /* Move the cursor, origin 0 */ void (*t_move) (); /* Move the cursor, origin 0 */
void (*t_eeol) (); /* Erase to end of line */ void (*t_eeol) (); /* Erase to end of line */

View File

@@ -8,16 +8,12 @@
#include "edef.h" #include "edef.h"
#undef CTRL /* Needs to be done here. */ #undef CTRL /* Needs to be done here. */
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <term.h>
extern int tgetent();
extern char *tgetstr();
extern char *tgoto();
extern void tputs();
extern char *getenv(); extern char *getenv();
extern void ttopen(); extern void ttopen();
extern int ttgetc(); extern int ttgetc();
extern void ttputc(); extern int ttputc(int);
extern void ttflush(); extern void ttflush();
extern void ttclose(); extern void ttclose();
@@ -39,6 +35,11 @@ void tcapbeep(void);
char tcapbuf[TCAPSLEN]; /* capabilities actually used */ char tcapbuf[TCAPSLEN]; /* capabilities actually used */
char *CM, *CE, *CL, *SO, *SE; char *CM, *CE, *CL, *SO, *SE;
char *UP; /* required by libtermcap */
char *BC;
char PC = '\0';
short ospeed = 0;
TERM term = { TERM term = {
0, 0, MARGIN, SCRSIZ, tcapopen, ttclose, ttgetc, ttputc, 0, 0, MARGIN, SCRSIZ, tcapopen, ttclose, ttgetc, ttputc,
ttflush, tcapmove, tcapeeol, tcapeeop, tcapbeep, tcaprev ttflush, tcapmove, tcapeeol, tcapeeop, tcapbeep, tcaprev

View File

@@ -4,7 +4,8 @@ include $(TOPSRC)/target.mk
#CC=gcc #CC=gcc
CFLAGS += -g -DUNIX_HOST -DVER='"1.0"' -DFILENAME_MAX=64 \ CFLAGS += -g -DUNIX_HOST -DVER='"1.0"' -DFILENAME_MAX=64 \
-DL_tmpnam=30 -DCLOCKS_PER_SEC=80000000 -DPATH_MAX=200 \ -DL_tmpnam=30 -DCLOCKS_PER_SEC=80000000 -DPATH_MAX=200 \
-DNO_FP -Os -Werror -mips16 -DNO_FP -Os -Werror
#CFLAGS += -mips16
LIBS = -lm -lc LIBS = -lm -lc
TARGET = picoc TARGET = picoc

View File

@@ -5,6 +5,7 @@ CFLAGS = -Os -Wall -DMIPS -DNO_ANNOTATIONS -DNO_PREPROCESSOR \
-DNO_PPACK -D_RETROBSD -D__SMALLER_C_SCHAR__ \ -DNO_PPACK -D_RETROBSD -D__SMALLER_C_SCHAR__ \
-D__SMALLER_C__ -D__SMALLER_C_32__ -DSTATIC \ -D__SMALLER_C__ -D__SMALLER_C_32__ -DSTATIC \
-DNO_EXTRA_WARNS -DSYNTAX_STACK_MAX=3200 -DNO_EXTRA_WARNS -DSYNTAX_STACK_MAX=3200
#CFLAGS += -mips16
# For cross compile # For cross compile
#include $(TOPSRC)/cross.mk #include $(TOPSRC)/cross.mk
@@ -33,4 +34,4 @@ clean:
rm -f *.o smlrc smlrc.dis smlrc.elf rm -f *.o smlrc smlrc.dis smlrc.elf
### ###
smlrc.o: smlrc.c fp.c cgmips.c smlrc.o: smlrc.c fp.c cgmips.c
${CC} ${CFLAGS} -mips16 smlrc.c -c -o $@ ${CC} ${CFLAGS} smlrc.c -c -o $@

View File

@@ -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 \ 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 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 OWNER= uucp

View File

@@ -28,7 +28,7 @@ void
tputs(cp, affcnt, outc) tputs(cp, affcnt, outc)
register char *cp; register char *cp;
int affcnt; int affcnt;
int (*outc)(); int (*outc)(int);
{ {
register int i = 0; register int i = 0;
register int mspc10; register int mspc10;