Reorg
This commit is contained in:
parent
2df2758496
commit
522b0689c3
180 changed files with 245 additions and 6144 deletions
|
|
@ -1,7 +0,0 @@
|
|||
CC=gcc
|
||||
CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -I. -I$(PREFIX)/include
|
||||
O=o
|
||||
AR=ar
|
||||
ARFLAGS=rvc
|
||||
NAN=nan64.$O # default, can be overriden by Make.$(SYSNAME)
|
||||
NAN=nan64.$O
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
CC=cc
|
||||
CFLAGS=-O -c -Ae -I.
|
||||
O=o
|
||||
AR=ar
|
||||
ARFLAGS=rvc
|
||||
NAN=nan64.$O
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
CC=gcc
|
||||
CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -I.
|
||||
O=o
|
||||
AR=ar
|
||||
ARFLAGS=rvc
|
||||
NAN=nan64.$O # default, can be overriden by Make.$(SYSNAME)
|
||||
NAN=nan64.$O
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
CC=cc
|
||||
CFLAGS+=-g -c -I.
|
||||
O=o
|
||||
AR=ar
|
||||
ARFLAGS=rvc
|
||||
NAN=nan64.$O
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
include Make.SunOS-sun4u-$(CC)
|
||||
NAN=nan64.$O
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
CC=cc
|
||||
CFLAGS+=-g -c -I. -O
|
||||
O=o
|
||||
AR=ar
|
||||
ARFLAGS=rvc
|
||||
NAN=nan64.$O
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
CC=gcc
|
||||
CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c
|
||||
O=o
|
||||
AR=ar
|
||||
ARFLAGS=rvc
|
||||
NAN=nan64.$O
|
||||
|
|
@ -1,27 +1,7 @@
|
|||
|
||||
# this works in gnu make
|
||||
SYSNAME:=${shell uname}
|
||||
OBJTYPE:=${shell uname -m | sed 's;i.86;386;; s;/.*;;; s; ;;g'}
|
||||
|
||||
# this works in bsd make
|
||||
SYSNAME!=uname
|
||||
OBJTYPE!=uname -m | sed 's;i.86;386;; s;/.*;;; s; ;;g'
|
||||
|
||||
# the gnu rules will mess up bsd but not vice versa,
|
||||
# hence the gnu rules come first.
|
||||
|
||||
include Make.$(SYSNAME)-$(OBJTYPE)
|
||||
|
||||
PREFIX=/usr/local
|
||||
|
||||
NUKEFILES=
|
||||
|
||||
TGZFILES=
|
||||
9SRC=..
|
||||
include $(9SRC)/Makehdr
|
||||
|
||||
TARG=mk
|
||||
VERSION=2.0
|
||||
PORTPLACE=devel/mk
|
||||
NAME=mk
|
||||
|
||||
OFILES=\
|
||||
arc.$O\
|
||||
|
|
@ -51,67 +31,7 @@ HFILES=\
|
|||
mk.h\
|
||||
fns.h\
|
||||
|
||||
all: $(TARG)
|
||||
LDFLAGS+=-lregexp9 -lbio -lfmt -lutf
|
||||
|
||||
TGZFILES+=mk.pdf
|
||||
include $(9SRC)/Makeone
|
||||
|
||||
install: $(LIB)
|
||||
test -d $(PREFIX)/man/man1 || mkdir $(PREFIX)/man/man1
|
||||
test -d $(PREFIX)/doc || mkdir $(PREFIX)/doc
|
||||
install -m 0755 mk $(PREFIX)/bin/mk
|
||||
cat mk.1 | sed 's;DOCPREFIX;$(PREFIX);g' >mk.1a
|
||||
install -m 0644 mk.1a $(PREFIX)/man/man1/mk.1
|
||||
install -m 0644 mk.pdf $(PREFIX)/doc/mk.pdf
|
||||
|
||||
|
||||
$(TARG): $(OFILES)
|
||||
$(CC) -o $(TARG) $(OFILES) -L$(PREFIX)/lib -lregexp9 -lbio -lfmt -lutf
|
||||
|
||||
|
||||
.c.$O:
|
||||
$(CC) $(CFLAGS) -I$(PREFIX)/include $*.c
|
||||
|
||||
%.$O: %.c
|
||||
$(CC) $(CFLAGS) -I$(PREFIX)/include $*.c
|
||||
|
||||
|
||||
$(OFILES): $(HFILES)
|
||||
|
||||
tgz:
|
||||
rm -rf $(NAME)-$(VERSION)
|
||||
mkdir $(NAME)-$(VERSION)
|
||||
cp Makefile Make.* README LICENSE NOTICE *.[ch137] rpm.spec bundle.ports $(TGZFILES) $(NAME)-$(VERSION)
|
||||
tar cf - $(NAME)-$(VERSION) | gzip >$(NAME)-$(VERSION).tgz
|
||||
rm -rf $(NAME)-$(VERSION)
|
||||
|
||||
clean:
|
||||
rm -f $(OFILES) $(LIB)
|
||||
|
||||
nuke:
|
||||
rm -f $(OFILES) *.tgz *.rpm $(NUKEFILES)
|
||||
|
||||
rpm:
|
||||
make tgz
|
||||
cp $(NAME)-$(VERSION).tgz /usr/src/RPM/SOURCES
|
||||
rpm -ba rpm.spec
|
||||
cp /usr/src/RPM/SRPMS/$(NAME)-$(VERSION)-1.src.rpm .
|
||||
cp /usr/src/RPM/RPMS/i586/$(NAME)-$(VERSION)-1.i586.rpm .
|
||||
scp *.rpm rsc@amsterdam.lcs.mit.edu:public_html/software
|
||||
|
||||
PORTDIR=/usr/ports/$(PORTPLACE)
|
||||
|
||||
ports:
|
||||
make tgz
|
||||
rm -rf $(PORTDIR)
|
||||
mkdir $(PORTDIR)
|
||||
cp $(NAME)-$(VERSION).tgz /usr/ports/distfiles
|
||||
cat bundle.ports | (cd $(PORTDIR) && awk '$$1=="---" && $$3=="---" { ofile=$$2; next} {if(ofile) print >ofile}')
|
||||
(cd $(PORTDIR); make makesum)
|
||||
(cd $(PORTDIR); make)
|
||||
(cd $(PORTDIR); /usr/local/bin/portlint)
|
||||
rm -rf $(PORTDIR)/work
|
||||
shar `find $(PORTDIR)` > ports.shar
|
||||
(cd $(PORTDIR); tar cf - *) | gzip >$(NAME)-$(VERSION)-ports.tgz
|
||||
scp *.tgz rsc@amsterdam.lcs.mit.edu:public_html/software
|
||||
|
||||
.phony: all clean nuke install tgz rpm ports
|
||||
|
|
|
|||
|
|
@ -1,45 +0,0 @@
|
|||
TARG=mk
|
||||
VERSION=2.0
|
||||
PORTPLACE=devel/mk
|
||||
NAME=mk
|
||||
|
||||
OFILES=\
|
||||
arc.$O\
|
||||
archive.$O\
|
||||
bufblock.$O\
|
||||
env.$O\
|
||||
file.$O\
|
||||
graph.$O\
|
||||
job.$O\
|
||||
lex.$O\
|
||||
main.$O\
|
||||
match.$O\
|
||||
mk.$O\
|
||||
parse.$O\
|
||||
recipe.$O\
|
||||
rule.$O\
|
||||
run.$O\
|
||||
sh.$O\
|
||||
shprint.$O\
|
||||
symtab.$O\
|
||||
var.$O\
|
||||
varsub.$O\
|
||||
word.$O\
|
||||
unix.$O\
|
||||
|
||||
HFILES=\
|
||||
mk.h\
|
||||
fns.h\
|
||||
|
||||
all: $(TARG)
|
||||
|
||||
TGZFILES+=mk.pdf
|
||||
|
||||
install: $(LIB)
|
||||
test -d $(PREFIX)/man/man1 || mkdir $(PREFIX)/man/man1
|
||||
test -d $(PREFIX)/doc || mkdir $(PREFIX)/doc
|
||||
install -m 0755 mk $(PREFIX)/bin/mk
|
||||
cat mk.1 | sed 's;DOCPREFIX;$(PREFIX);g' >mk.1a
|
||||
install -m 0644 mk.1a $(PREFIX)/man/man1/mk.1
|
||||
install -m 0644 mk.pdf $(PREFIX)/doc/mk.pdf
|
||||
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
--- Makefile ---
|
||||
# New ports collection makefile for: mk
|
||||
# Date Created: 11 Feb 2003
|
||||
# Whom: rsc
|
||||
#
|
||||
# THIS LINE NEEDS REPLACING. IT'S HERE TO GET BY PORTLINT
|
||||
# $FreeBSD: ports/devel/mk/Makefile,v 1.1 2003/02/12 00:51:22 rsc Exp $
|
||||
|
||||
PORTNAME= mk
|
||||
PORTVERSION= 2.0
|
||||
CATEGORIES= devel
|
||||
MASTER_SITES= http://pdos.lcs.mit.edu/~rsc/software/
|
||||
EXTRACT_SUFX= .tgz
|
||||
|
||||
MAINTAINER= rsc@post.harvard.edu
|
||||
|
||||
DEPENDS= ${PORTSDIR}/devel/libutf \
|
||||
${PORTSDIR}/devel/libfmt \
|
||||
${PORTSDIR}/devel/libbio \
|
||||
${PORTSDIR}/devel/libregexp9
|
||||
|
||||
MAN1= mk.1
|
||||
USE_REINPLACE= yes
|
||||
|
||||
.include <bsd.port.pre.mk>
|
||||
|
||||
post-patch:
|
||||
${REINPLACE_CMD} -e 's,$$(PREFIX),${PREFIX},g' ${WRKSRC}/Makefile
|
||||
|
||||
.include <bsd.port.post.mk>
|
||||
--- pkg-comment ---
|
||||
Streamlined replacement for make
|
||||
--- pkg-descr ---
|
||||
Mk is a streamlined replacement for make, written for
|
||||
Tenth Edition Research Unix by Andrew Hume.
|
||||
|
||||
WWW: http://pdos.lcs.mit.edu/~rsc/software/#mk
|
||||
|
||||
Russ Cox
|
||||
rsc@post.harvard.edu
|
||||
--- pkg-plist ---
|
||||
bin/mk
|
||||
doc/mk.pdf
|
||||
--- /dev/null ---
|
||||
This is just a way to make sure blank lines don't
|
||||
creep into pkg-plist.
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
all:V: Makefile Make.FreeBSD-386 Make.Linux-386 Make.HP-UX-9000 Make.OSF1-alpha \
|
||||
Make.SunOS-sun4u Make.SunOS-sun4u-cc Make.SunOS-sun4u-gcc \
|
||||
Make.NetBSD-386 Make.Darwin-PowerMacintosh
|
||||
|
||||
Makefile:D: ../libutf/Makefile.TOP Makefile.MID ../libutf/Makefile.CMD ../libutf/Makefile.BOT
|
||||
cat $prereq >$target
|
||||
|
||||
Make.%: ../libutf/Make.%
|
||||
cp $prereq $target
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
Summary: Streamlined replacement for make
|
||||
Name: mk
|
||||
Version: 2.0
|
||||
Release: 1
|
||||
Group: Development/Utils
|
||||
Copyright: Public Domain
|
||||
Packager: Russ Cox <rsc@post.harvard.edu>
|
||||
Source: http://pdos.lcs.mit.edu/~rsc/software/mk-2.0.tgz
|
||||
URL: http://pdos.lcs.mit.edu/~rsc/software/#mk
|
||||
Requires: libfmt libbio libregexp9 libutf
|
||||
|
||||
%description
|
||||
Mk is a streamlined replacement for make, written for
|
||||
Tenth Edition Research Unix by Andrew Hume.
|
||||
|
||||
http://plan9.bell-labs.com/sys/doc/mk.pdf
|
||||
%prep
|
||||
%setup
|
||||
|
||||
%build
|
||||
make
|
||||
|
||||
%install
|
||||
make install
|
||||
|
||||
%files
|
||||
/usr/local/doc/mk.pdf
|
||||
/usr/local/man/man1/mk.1
|
||||
/usr/local/bin/mk
|
||||
|
|
@ -1,18 +1,34 @@
|
|||
H=errors.h mesg.h parse.h plumb.h sam.h
|
||||
SRC= address.c buff.c cmd.c disk.c error.c file.c io.c\
|
||||
list.c mesg.c moveto.c multi.c unix.c rasp.c regexp.c\
|
||||
sam.c shell.c string.c sys.c util.c xec.c plumb.c
|
||||
9SRC=..
|
||||
include $(9SRC)/Makehdr
|
||||
|
||||
CC=gcc
|
||||
PREFIX=$(HOME)
|
||||
#PREFIX=/usr/local
|
||||
CFLAGS=-I. -I$(PREFIX)/include -O -g
|
||||
LDFLAGS=-L$(PREFIX)/lib
|
||||
LDLIBS=-l9 -lfmt -lutf
|
||||
TARG=sam
|
||||
OFILES=sam.$O\
|
||||
address.$O\
|
||||
buff.$O\
|
||||
cmd.$O\
|
||||
disk.$O\
|
||||
error.$O\
|
||||
file.$O\
|
||||
io.$O\
|
||||
list.$O\
|
||||
mesg.$O\
|
||||
moveto.$O\
|
||||
multi.$O\
|
||||
plumb.$O\
|
||||
rasp.$O\
|
||||
regexp.$O\
|
||||
shell.$O\
|
||||
string.$O\
|
||||
sys.$O\
|
||||
unix.$O\
|
||||
util.$O\
|
||||
xec.$O\
|
||||
|
||||
HFILES=sam.h\
|
||||
errors.h\
|
||||
mesg.h\
|
||||
|
||||
LDFLAGS+=-l9 -lfmt -lutf
|
||||
|
||||
include $(9SRC)/Makeone
|
||||
|
||||
all: sam
|
||||
sam: $(SRC) $(H)
|
||||
$(CC) -o $@ $(CFLAGS) $(SRC) $(LDFLAGS) $(LDLIBS)
|
||||
clean:
|
||||
rm -f *.o *~
|
||||
rm -f sam
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ address(Addr *ap, Address a, int sign)
|
|||
break;
|
||||
|
||||
case '$':
|
||||
a.r.p1 = a.r.p2 = f->_.nc;
|
||||
a.r.p1 = a.r.p2 = f->b.nc;
|
||||
break;
|
||||
|
||||
case '\'':
|
||||
|
|
@ -52,7 +52,7 @@ address(Addr *ap, Address a, int sign)
|
|||
break;
|
||||
|
||||
case '*':
|
||||
a.r.p1 = 0, a.r.p2 = f->_.nc;
|
||||
a.r.p1 = 0, a.r.p2 = f->b.nc;
|
||||
return a;
|
||||
|
||||
case ',':
|
||||
|
|
@ -69,7 +69,7 @@ address(Addr *ap, Address a, int sign)
|
|||
if(ap->next)
|
||||
a2 = address(ap->next, a, 0);
|
||||
else
|
||||
a2.f = a.f, a2.r.p1 = a2.r.p2 = f->_.nc;
|
||||
a2.f = a.f, a2.r.p1 = a2.r.p2 = f->b.nc;
|
||||
if(a1.f != a2.f)
|
||||
error(Eorder);
|
||||
a.f = a1.f, a.r.p1 = a1.r.p1, a.r.p2 = a2.r.p2;
|
||||
|
|
@ -101,7 +101,7 @@ nextmatch(File *f, String *r, Posn p, int sign)
|
|||
if(!execute(f, p, INFINITY))
|
||||
error(Esearch);
|
||||
if(sel.p[0].p1==sel.p[0].p2 && sel.p[0].p1==p){
|
||||
if(++p>f->_.nc)
|
||||
if(++p>f->b.nc)
|
||||
p = 0;
|
||||
if(!execute(f, p, INFINITY))
|
||||
panic("address");
|
||||
|
|
@ -111,7 +111,7 @@ nextmatch(File *f, String *r, Posn p, int sign)
|
|||
error(Esearch);
|
||||
if(sel.p[0].p1==sel.p[0].p2 && sel.p[0].p2==p){
|
||||
if(--p<0)
|
||||
p = f->_.nc;
|
||||
p = f->b.nc;
|
||||
if(!bexecute(f, p))
|
||||
panic("address");
|
||||
}
|
||||
|
|
@ -156,10 +156,10 @@ filematch(File *f, String *r)
|
|||
/* A little dirty... */
|
||||
if(menu == 0)
|
||||
menu = fileopen();
|
||||
bufreset(menu);
|
||||
bufinsert(menu, 0, genstr.s, genstr.n);
|
||||
bufreset(&menu->b);
|
||||
bufinsert(&menu->b, 0, genstr.s, genstr.n);
|
||||
compile(r);
|
||||
return execute(menu, 0, menu->_.nc);
|
||||
return execute(menu, 0, menu->b.nc);
|
||||
}
|
||||
|
||||
Address
|
||||
|
|
@ -171,7 +171,7 @@ charaddr(Posn l, Address addr, int sign)
|
|||
addr.r.p2 = addr.r.p1-=l;
|
||||
else if(sign > 0)
|
||||
addr.r.p1 = addr.r.p2+=l;
|
||||
if(addr.r.p1<0 || addr.r.p2>addr.f->_.nc)
|
||||
if(addr.r.p1<0 || addr.r.p2>addr.f->b.nc)
|
||||
error(Erange);
|
||||
return addr;
|
||||
}
|
||||
|
|
@ -203,14 +203,14 @@ lineaddr(Posn l, Address addr, int sign)
|
|||
n = filereadc(f, p++)=='\n';
|
||||
}
|
||||
while(n < l){
|
||||
if(p >= f->_.nc)
|
||||
if(p >= f->b.nc)
|
||||
error(Erange);
|
||||
if(filereadc(f, p++) == '\n')
|
||||
n++;
|
||||
}
|
||||
a.r.p1 = p;
|
||||
}
|
||||
while(p < f->_.nc && filereadc(f, p++)!='\n')
|
||||
while(p < f->b.nc && filereadc(f, p++)!='\n')
|
||||
;
|
||||
a.r.p2 = p;
|
||||
}else{
|
||||
|
|
|
|||
|
|
@ -91,8 +91,8 @@ setcache(Buffer *b, uint q0)
|
|||
i = b->cbi;
|
||||
}
|
||||
blp = &b->bl[i];
|
||||
while(q+(*blp)->_.n <= q0 && q+(*blp)->_.n < b->nc){
|
||||
q += (*blp)->_.n;
|
||||
while(q+(*blp)->u.n <= q0 && q+(*blp)->u.n < b->nc){
|
||||
q += (*blp)->u.n;
|
||||
i++;
|
||||
blp++;
|
||||
if(i >= b->nbl)
|
||||
|
|
@ -102,8 +102,8 @@ setcache(Buffer *b, uint q0)
|
|||
/* remember position */
|
||||
b->cbi = i;
|
||||
b->cq = q;
|
||||
sizecache(b, bl->_.n);
|
||||
b->cnc = bl->_.n;
|
||||
sizecache(b, bl->u.n);
|
||||
b->cnc = bl->u.n;
|
||||
/*read block*/
|
||||
diskread(disk, bl, b->c, b->cnc);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -185,14 +185,14 @@ termcommand(void)
|
|||
{
|
||||
Posn p;
|
||||
|
||||
for(p=cmdpt; p<cmd->_.nc; p++){
|
||||
for(p=cmdpt; p<cmd->b.nc; p++){
|
||||
if(terminp >= &termline[BLOCKSIZE]){
|
||||
cmdpt = cmd->_.nc;
|
||||
cmdpt = cmd->b.nc;
|
||||
error(Etoolong);
|
||||
}
|
||||
*terminp++ = filereadc(cmd, p);
|
||||
}
|
||||
cmdpt = cmd->_.nc;
|
||||
cmdpt = cmd->b.nc;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -64,20 +64,20 @@ disknewblock(Disk *d, uint n)
|
|||
size = ntosize(n, &i);
|
||||
b = d->free[i];
|
||||
if(b)
|
||||
d->free[i] = b->_.next;
|
||||
d->free[i] = b->u.next;
|
||||
else{
|
||||
/* allocate in chunks to reduce malloc overhead */
|
||||
if(blist == nil){
|
||||
blist = emalloc(100*sizeof(Block));
|
||||
for(j=0; j<100-1; j++)
|
||||
blist[j]._.next = &blist[j+1];
|
||||
blist[j].u.next = &blist[j+1];
|
||||
}
|
||||
b = blist;
|
||||
blist = b->_.next;
|
||||
blist = b->u.next;
|
||||
b->addr = d->addr;
|
||||
d->addr += size;
|
||||
}
|
||||
b->_.n = n;
|
||||
b->u.n = n;
|
||||
return b;
|
||||
}
|
||||
|
||||
|
|
@ -86,8 +86,8 @@ diskrelease(Disk *d, Block *b)
|
|||
{
|
||||
uint i;
|
||||
|
||||
ntosize(b->_.n, &i);
|
||||
b->_.next = d->free[i];
|
||||
ntosize(b->u.n, &i);
|
||||
b->u.next = d->free[i];
|
||||
d->free[i] = b;
|
||||
}
|
||||
|
||||
|
|
@ -98,7 +98,7 @@ diskwrite(Disk *d, Block **bp, Rune *r, uint n)
|
|||
Block *b;
|
||||
|
||||
b = *bp;
|
||||
size = ntosize(b->_.n, nil);
|
||||
size = ntosize(b->u.n, nil);
|
||||
nsize = ntosize(n, nil);
|
||||
if(size != nsize){
|
||||
diskrelease(d, b);
|
||||
|
|
@ -107,16 +107,16 @@ diskwrite(Disk *d, Block **bp, Rune *r, uint n)
|
|||
}
|
||||
if(pwrite(d->fd, r, n*sizeof(Rune), b->addr) != n*sizeof(Rune))
|
||||
panic("write error to temp file");
|
||||
b->_.n = n;
|
||||
b->u.n = n;
|
||||
}
|
||||
|
||||
void
|
||||
diskread(Disk *d, Block *b, Rune *r, uint n)
|
||||
{
|
||||
if(n > b->_.n)
|
||||
if(n > b->u.n)
|
||||
panic("internal error: diskread");
|
||||
|
||||
ntosize(b->_.n, nil); /* called only for sanity check on Maxblock */
|
||||
ntosize(b->u.n, nil); /* called only for sanity check on Maxblock */
|
||||
if(pread(d->fd, r, n*sizeof(Rune), b->addr) != n*sizeof(Rune))
|
||||
panic("read error from temp file");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ mergeextend(File *f, uint p0)
|
|||
|
||||
mp0n = merge.p0+merge.n;
|
||||
if(mp0n != p0){
|
||||
bufread(f, mp0n, merge.buf+merge.nbuf, p0-mp0n);
|
||||
bufread(&f->b, mp0n, merge.buf+merge.nbuf, p0-mp0n);
|
||||
merge.nbuf += p0-mp0n;
|
||||
merge.n = p0-merge.p0;
|
||||
}
|
||||
|
|
@ -268,11 +268,11 @@ filedeltext(File *f, Text *t)
|
|||
void
|
||||
fileinsert(File *f, uint p0, Rune *s, uint ns)
|
||||
{
|
||||
if(p0 > f->_.nc)
|
||||
if(p0 > f->b.nc)
|
||||
panic("internal error: fileinsert");
|
||||
if(f->seq > 0)
|
||||
fileuninsert(f, &f->delta, p0, ns);
|
||||
bufinsert(f, p0, s, ns);
|
||||
bufinsert(&f->b, p0, s, ns);
|
||||
if(ns)
|
||||
f->mod = TRUE;
|
||||
}
|
||||
|
|
@ -294,11 +294,11 @@ fileuninsert(File *f, Buffer *delta, uint p0, uint ns)
|
|||
void
|
||||
filedelete(File *f, uint p0, uint p1)
|
||||
{
|
||||
if(!(p0<=p1 && p0<=f->_.nc && p1<=f->_.nc))
|
||||
if(!(p0<=p1 && p0<=f->b.nc && p1<=f->b.nc))
|
||||
panic("internal error: filedelete");
|
||||
if(f->seq > 0)
|
||||
fileundelete(f, &f->delta, p0, p1);
|
||||
bufdelete(f, p0, p1);
|
||||
bufdelete(&f->b, p0, p1);
|
||||
if(p1 > p0)
|
||||
f->mod = TRUE;
|
||||
}
|
||||
|
|
@ -321,7 +321,7 @@ fileundelete(File *f, Buffer *delta, uint p0, uint p1)
|
|||
n = p1 - i;
|
||||
if(n > RBUFSIZE)
|
||||
n = RBUFSIZE;
|
||||
bufread(f, i, buf, n);
|
||||
bufread(&f->b, i, buf, n);
|
||||
bufinsert(delta, delta->nc, buf, n);
|
||||
}
|
||||
fbuffree(buf);
|
||||
|
|
@ -334,9 +334,9 @@ filereadc(File *f, uint q)
|
|||
{
|
||||
Rune r;
|
||||
|
||||
if(q >= f->_.nc)
|
||||
if(q >= f->b.nc)
|
||||
return -1;
|
||||
bufread(f, q, &r, 1);
|
||||
bufread(&f->b, q, &r, 1);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
|
@ -402,7 +402,7 @@ fileload(File *f, uint p0, int fd, int *nulls)
|
|||
{
|
||||
if(f->seq > 0)
|
||||
panic("undo in file.load unimplemented");
|
||||
return bufload(f, p0, fd, nulls);
|
||||
return bufload(&f->b, p0, fd, nulls);
|
||||
}
|
||||
|
||||
int
|
||||
|
|
@ -525,7 +525,7 @@ fileundo(File *f, int isundo, int canredo, uint *q0p, uint *q1p, int flag)
|
|||
if(canredo)
|
||||
fileundelete(f, epsilon, u.p0, u.p0+u.n);
|
||||
f->mod = u.mod;
|
||||
bufdelete(f, u.p0, u.p0+u.n);
|
||||
bufdelete(&f->b, u.p0, u.p0+u.n);
|
||||
raspdelete(f, u.p0, u.p0+u.n, flag);
|
||||
*q0p = u.p0;
|
||||
*q1p = u.p0;
|
||||
|
|
@ -543,7 +543,7 @@ fileundo(File *f, int isundo, int canredo, uint *q0p, uint *q1p, int flag)
|
|||
if(n > RBUFSIZE)
|
||||
n = RBUFSIZE;
|
||||
bufread(delta, up+i, buf, n);
|
||||
bufinsert(f, u.p0+i, buf, n);
|
||||
bufinsert(&f->b, u.p0+i, buf, n);
|
||||
raspinsert(f, u.p0+i, buf, n, flag);
|
||||
}
|
||||
fbuffree(buf);
|
||||
|
|
@ -601,7 +601,7 @@ void
|
|||
fileclose(File *f)
|
||||
{
|
||||
Strclose(&f->name);
|
||||
bufclose(f);
|
||||
bufclose(&f->b);
|
||||
bufclose(&f->delta);
|
||||
bufclose(&f->epsilon);
|
||||
if(f->rasp)
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ writef(File *f)
|
|||
error(Eappend);
|
||||
n = writeio(f);
|
||||
if(f->name.s[0]==0 || samename){
|
||||
if(addr.r.p1==0 && addr.r.p2==f->_.nc)
|
||||
if(addr.r.p1==0 && addr.r.p2==f->b.nc)
|
||||
f->cleanseq = f->seq;
|
||||
state(f, f->cleanseq==f->seq? Clean : Dirty);
|
||||
}
|
||||
|
|
@ -87,7 +87,7 @@ readio(File *f, int *nulls, int setdate, int toterm)
|
|||
*nulls = FALSE;
|
||||
b = 0;
|
||||
if(f->unread){
|
||||
nt = bufload(f, 0, io, nulls);
|
||||
nt = bufload(&f->b, 0, io, nulls);
|
||||
if(toterm)
|
||||
raspload(f);
|
||||
}else
|
||||
|
|
@ -149,7 +149,7 @@ writeio(File *f)
|
|||
n = BLOCKSIZE;
|
||||
else
|
||||
n = addr.r.p2-p;
|
||||
bufread(f, p, genbuf, n);
|
||||
bufread(&f->b, p, genbuf, n);
|
||||
c = Strtoc(tmprstr(genbuf, n));
|
||||
m = strlen(c);
|
||||
if(Write(io, c, m) != m){
|
||||
|
|
@ -188,8 +188,7 @@ bootterm(char *machine, char **argv, char **end)
|
|||
argv[0] = "samterm";
|
||||
*end = 0;
|
||||
exec(samterm, argv);
|
||||
fprint(2, "can't exec: ");
|
||||
perror(samterm);
|
||||
fprint(2, "can't exec %s: %r\n", samterm);
|
||||
_exits("damn");
|
||||
}
|
||||
if(pipe(ph2t)==-1 || pipe(pt2h)==-1)
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ journaln(int out, long n)
|
|||
int
|
||||
rcvchar(void){
|
||||
static uchar buf[64];
|
||||
static i, nleft = 0;
|
||||
static int i, nleft = 0;
|
||||
|
||||
if(nleft <= 0){
|
||||
nleft = read(0, (char *)buf, sizeof buf);
|
||||
|
|
@ -116,9 +116,9 @@ rcvchar(void){
|
|||
int
|
||||
rcv(void){
|
||||
int c;
|
||||
static state = 0;
|
||||
static count = 0;
|
||||
static i = 0;
|
||||
static int state = 0;
|
||||
static int count = 0;
|
||||
static int i = 0;
|
||||
|
||||
while((c=rcvchar()) != -1)
|
||||
switch(state){
|
||||
|
|
@ -235,17 +235,17 @@ inmesg(Tmesg type)
|
|||
journaln(0, p1-p0);
|
||||
if(f->unread)
|
||||
panic("Trequest: unread");
|
||||
if(p1>f->_.nc)
|
||||
p1 = f->_.nc;
|
||||
if(p0>f->_.nc) /* can happen e.g. scrolling during command */
|
||||
p0 = f->_.nc;
|
||||
if(p1>f->b.nc)
|
||||
p1 = f->b.nc;
|
||||
if(p0>f->b.nc) /* can happen e.g. scrolling during command */
|
||||
p0 = f->b.nc;
|
||||
if(p0 == p1){
|
||||
i = 0;
|
||||
r.p1 = r.p2 = p0;
|
||||
}else{
|
||||
r = rdata(f->rasp, p0, p1-p0);
|
||||
i = r.p2-r.p1;
|
||||
bufread(f, r.p1, buf, i);
|
||||
bufread(&f->b, r.p1, buf, i);
|
||||
}
|
||||
buf[i]=0;
|
||||
outTslS(Hdata, f->tag, r.p1, tmprstr(buf, i+1));
|
||||
|
|
@ -271,9 +271,9 @@ inmesg(Tmesg type)
|
|||
if(f->unread)
|
||||
load(f);
|
||||
else{
|
||||
if(f->_.nc>0){
|
||||
rgrow(f->rasp, 0L, f->_.nc);
|
||||
outTsll(Hgrow, f->tag, 0L, f->_.nc);
|
||||
if(f->b.nc>0){
|
||||
rgrow(f->rasp, 0L, f->b.nc);
|
||||
outTsll(Hgrow, f->tag, 0L, f->b.nc);
|
||||
}
|
||||
outTs(Hcheck0, f->tag);
|
||||
moveto(f, f->dot.r);
|
||||
|
|
@ -302,7 +302,7 @@ inmesg(Tmesg type)
|
|||
loginsert(f, p0, str->s, str->n);
|
||||
if(fileupdate(f, FALSE, FALSE))
|
||||
seq++;
|
||||
if(f==cmd && p0==f->_.nc-i && i>0 && str->s[i-1]=='\n'){
|
||||
if(f==cmd && p0==f->b.nc-i && i>0 && str->s[i-1]=='\n'){
|
||||
freetmpstr(str);
|
||||
termlocked++;
|
||||
termcommand();
|
||||
|
|
@ -370,7 +370,7 @@ inmesg(Tmesg type)
|
|||
journaln(0, i);
|
||||
f = whichfile(i);
|
||||
addr.r.p1 = 0;
|
||||
addr.r.p2 = f->_.nc;
|
||||
addr.r.p2 = f->b.nc;
|
||||
if(f->name.s[0] == 0)
|
||||
error(Enoname);
|
||||
Strduplstr(&genstr, &f->name);
|
||||
|
|
@ -427,9 +427,9 @@ inmesg(Tmesg type)
|
|||
outTl(Hsnarflen, genstr.n);
|
||||
if(genstr.s[genstr.n-1] != '\n')
|
||||
Straddc(&genstr, '\n');
|
||||
loginsert(cmd, cmd->_.nc, genstr.s, genstr.n);
|
||||
loginsert(cmd, cmd->b.nc, genstr.s, genstr.n);
|
||||
fileupdate(cmd, FALSE, TRUE);
|
||||
cmd->dot.r.p1 = cmd->dot.r.p2 = cmd->_.nc;
|
||||
cmd->dot.r.p1 = cmd->dot.r.p2 = cmd->b.nc;
|
||||
telldot(cmd);
|
||||
termcommand();
|
||||
break;
|
||||
|
|
@ -522,7 +522,7 @@ inmesg(Tmesg type)
|
|||
p = p0;
|
||||
while(p0>0 && (i=filereadc(f, p0 - 1))!=' ' && i!='\t' && i!='\n')
|
||||
p0--;
|
||||
while(p1<f->_.nc && (i=filereadc(f, p1))!=' ' && i!='\t' && i!='\n')
|
||||
while(p1<f->b.nc && (i=filereadc(f, p1))!=' ' && i!='\t' && i!='\n')
|
||||
p1++;
|
||||
sprint(cbuf, "click=%ld", p-p0);
|
||||
pm->attr = plumbunpackattr(cbuf);
|
||||
|
|
@ -559,13 +559,13 @@ snarf(File *f, Posn p1, Posn p2, Buffer *buf, int emptyok)
|
|||
return;
|
||||
bufreset(buf);
|
||||
/* Stage through genbuf to avoid compaction problems (vestigial) */
|
||||
if(p2 > f->_.nc){
|
||||
fprint(2, "bad snarf addr p1=%ld p2=%ld f->_.nc=%d\n", p1, p2, f->_.nc); /*ZZZ should never happen, can remove */
|
||||
p2 = f->_.nc;
|
||||
if(p2 > f->b.nc){
|
||||
fprint(2, "bad snarf addr p1=%ld p2=%ld f->b.nc=%d\n", p1, p2, f->b.nc); /*ZZZ should never happen, can remove */
|
||||
p2 = f->b.nc;
|
||||
}
|
||||
for(l=p1; l<p2; l+=i){
|
||||
i = p2-l>BLOCKSIZE? BLOCKSIZE : p2-l;
|
||||
bufread(f, l, genbuf, i);
|
||||
bufread(&f->b, l, genbuf, i);
|
||||
bufinsert(buf, buf->nc, tmprstr(genbuf, i)->s, i);
|
||||
}
|
||||
}
|
||||
|
|
@ -609,7 +609,7 @@ setgenstr(File *f, Posn p0, Posn p1)
|
|||
if(p1-p0 >= TBLOCKSIZE)
|
||||
error(Etoolong);
|
||||
Strinsure(&genstr, p1-p0);
|
||||
bufread(f, p0, genbuf, p1-p0);
|
||||
bufread(&f->b, p0, genbuf, p1-p0);
|
||||
memmove(genstr.s, genbuf, RUNESIZE*(p1-p0));
|
||||
genstr.n = p1-p0;
|
||||
}else{
|
||||
|
|
|
|||
|
|
@ -1,40 +0,0 @@
|
|||
</$objtype/mkfile
|
||||
|
||||
TARG=sam
|
||||
OFILES=sam.$O\
|
||||
address.$O\
|
||||
buff.$O\
|
||||
cmd.$O\
|
||||
disk.$O\
|
||||
error.$O\
|
||||
file.$O\
|
||||
io.$O\
|
||||
list.$O\
|
||||
mesg.$O\
|
||||
moveto.$O\
|
||||
multi.$O\
|
||||
plan9.$O\
|
||||
rasp.$O\
|
||||
regexp.$O\
|
||||
shell.$O\
|
||||
string.$O\
|
||||
sys.$O\
|
||||
util.$O\
|
||||
xec.$O\
|
||||
|
||||
HFILES=sam.h\
|
||||
errors.h\
|
||||
mesg.h\
|
||||
|
||||
BIN=/$objtype/bin
|
||||
</sys/src/cmd/mkone
|
||||
|
||||
address.$O cmd.$O parse.$O xec.$O unix.$O: parse.h
|
||||
|
||||
safeinstall: $O.out
|
||||
mv $BIN/$TARG $BIN/o$TARG
|
||||
cp $prereq $BIN/$TARG
|
||||
|
||||
safeinstallall:V:
|
||||
for (objtype in $CPUS)
|
||||
mk safeinstall
|
||||
|
|
@ -39,8 +39,8 @@ lookorigin(File *f, Posn p0, Posn ls)
|
|||
int nl, nc, c;
|
||||
Posn p, oldp0;
|
||||
|
||||
if(p0 > f->_.nc)
|
||||
p0 = f->_.nc;
|
||||
if(p0 > f->b.nc)
|
||||
p0 = f->b.nc;
|
||||
oldp0 = p0;
|
||||
p = p0;
|
||||
for(nl=nc=c=0; c!=-1 && nl<ls && nc<ls*CHARSHIFT; nc++)
|
||||
|
|
@ -85,7 +85,7 @@ clickmatch(File *f, int cl, int cr, int dir, Posn *p)
|
|||
|
||||
for(;;){
|
||||
if(dir > 0){
|
||||
if(*p >= f->_.nc)
|
||||
if(*p >= f->b.nc)
|
||||
break;
|
||||
c = filereadc(f, (*p)++);
|
||||
}else{
|
||||
|
|
@ -126,7 +126,7 @@ doubleclick(File *f, Posn p1)
|
|||
Rune *r, *l;
|
||||
Posn p;
|
||||
|
||||
if(p1 > f->_.nc)
|
||||
if(p1 > f->b.nc)
|
||||
return;
|
||||
f->dot.r.p1 = f->dot.r.p2 = p1;
|
||||
for(i=0; left[i]; i++){
|
||||
|
|
@ -147,7 +147,7 @@ doubleclick(File *f, Posn p1)
|
|||
}
|
||||
/* try right match */
|
||||
p = p1;
|
||||
if(p1 == f->_.nc)
|
||||
if(p1 == f->b.nc)
|
||||
c = '\n';
|
||||
else
|
||||
c = filereadc(f, p);
|
||||
|
|
@ -156,14 +156,14 @@ doubleclick(File *f, Posn p1)
|
|||
f->dot.r.p1 = p;
|
||||
if(c!='\n' || p!=0 || filereadc(f, 0)=='\n')
|
||||
f->dot.r.p1++;
|
||||
f->dot.r.p2 = p1+(p1<f->_.nc && c=='\n');
|
||||
f->dot.r.p2 = p1+(p1<f->b.nc && c=='\n');
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
/* try filling out word to right */
|
||||
p = p1;
|
||||
while(p < f->_.nc && alnum(filereadc(f, p++)))
|
||||
while(p < f->b.nc && alnum(filereadc(f, p++)))
|
||||
f->dot.r.p2++;
|
||||
/* try filling out word to left */
|
||||
p = p1;
|
||||
|
|
|
|||
|
|
@ -35,10 +35,10 @@ raspload(File *f)
|
|||
{
|
||||
if(f->rasp == nil)
|
||||
return;
|
||||
grown = f->_.nc;
|
||||
grown = f->b.nc;
|
||||
growpos = 0;
|
||||
if(f->_.nc)
|
||||
rgrow(f->rasp, 0, f->_.nc);
|
||||
if(f->b.nc)
|
||||
rgrow(f->rasp, 0, f->b.nc);
|
||||
raspdone(f, 1);
|
||||
}
|
||||
|
||||
|
|
@ -55,14 +55,14 @@ raspstart(File *f)
|
|||
void
|
||||
raspdone(File *f, int toterm)
|
||||
{
|
||||
if(f->dot.r.p1 > f->_.nc)
|
||||
f->dot.r.p1 = f->_.nc;
|
||||
if(f->dot.r.p2 > f->_.nc)
|
||||
f->dot.r.p2 = f->_.nc;
|
||||
if(f->mark.p1 > f->_.nc)
|
||||
f->mark.p1 = f->_.nc;
|
||||
if(f->mark.p2 > f->_.nc)
|
||||
f->mark.p2 = f->_.nc;
|
||||
if(f->dot.r.p1 > f->b.nc)
|
||||
f->dot.r.p1 = f->b.nc;
|
||||
if(f->dot.r.p2 > f->b.nc)
|
||||
f->dot.r.p2 = f->b.nc;
|
||||
if(f->mark.p1 > f->b.nc)
|
||||
f->mark.p1 = f->b.nc;
|
||||
if(f->mark.p2 > f->b.nc)
|
||||
f->mark.p2 = f->b.nc;
|
||||
if(f->rasp == nil)
|
||||
return;
|
||||
if(grown)
|
||||
|
|
|
|||
|
|
@ -700,7 +700,7 @@ bexecute(File *f, Posn startp)
|
|||
case 3:
|
||||
goto Return;
|
||||
list[0][0].inst = list[1][0].inst = 0;
|
||||
p = f->_.nc;
|
||||
p = f->b.nc;
|
||||
goto doloop;
|
||||
default:
|
||||
goto Return;
|
||||
|
|
@ -758,7 +758,7 @@ bexecute(File *f, Posn startp)
|
|||
}
|
||||
break;
|
||||
case EOL:
|
||||
if(p==f->_.nc || filereadc(f, p)=='\n')
|
||||
if(p==f->b.nc || filereadc(f, p)=='\n')
|
||||
goto Step;
|
||||
break;
|
||||
case CCLASS:
|
||||
|
|
|
|||
BIN
src/cmd/sam/sam
BIN
src/cmd/sam/sam
Binary file not shown.
|
|
@ -148,7 +148,7 @@ rescue(void)
|
|||
io = -1;
|
||||
for(i=0; i<file.nused; i++){
|
||||
f = file.filepptr[i];
|
||||
if(f==cmd || f->_.nc==0 || !fileisdirty(f))
|
||||
if(f==cmd || f->b.nc==0 || !fileisdirty(f))
|
||||
continue;
|
||||
if(io == -1){
|
||||
sprint(buf, "%s/sam.save", home);
|
||||
|
|
@ -164,7 +164,7 @@ rescue(void)
|
|||
}else
|
||||
sprint(buf, "nameless.%d", nblank++);
|
||||
fprint(io, "#!%s '%s' $* <<'---%s'\n", SAMSAVECMD, buf, buf);
|
||||
addr.r.p1 = 0, addr.r.p2 = f->_.nc;
|
||||
addr.r.p1 = 0, addr.r.p2 = f->b.nc;
|
||||
writeio(f);
|
||||
fprint(io, "\n---%s\n", (char *)buf);
|
||||
}
|
||||
|
|
@ -299,7 +299,7 @@ cmdupdate(void)
|
|||
{
|
||||
if(cmd && cmd->seq!=0){
|
||||
fileupdate(cmd, FALSE, downloaded);
|
||||
cmd->dot.r.p1 = cmd->dot.r.p2 = cmd->_.nc;
|
||||
cmd->dot.r.p1 = cmd->dot.r.p2 = cmd->b.nc;
|
||||
telldot(cmd);
|
||||
}
|
||||
}
|
||||
|
|
@ -354,9 +354,9 @@ edit(File *f, int cmd)
|
|||
if(cmd == 'r')
|
||||
logdelete(f, addr.r.p1, addr.r.p2);
|
||||
if(cmd=='e' || cmd=='I'){
|
||||
logdelete(f, (Posn)0, f->_.nc);
|
||||
addr.r.p2 = f->_.nc;
|
||||
}else if(f->_.nc!=0 || (f->name.s[0] && Strcmp(&genstr, &f->name)!=0))
|
||||
logdelete(f, (Posn)0, f->b.nc);
|
||||
addr.r.p2 = f->b.nc;
|
||||
}else if(f->b.nc!=0 || (f->name.s[0] && Strcmp(&genstr, &f->name)!=0))
|
||||
empty = FALSE;
|
||||
if((io = open(genc, OREAD))<0) {
|
||||
if (curfile && curfile->unread)
|
||||
|
|
@ -485,17 +485,17 @@ readcmd(String *s)
|
|||
fileclose(flist);
|
||||
flist = fileopen();
|
||||
|
||||
addr.r.p1 = 0, addr.r.p2 = flist->_.nc;
|
||||
addr.r.p1 = 0, addr.r.p2 = flist->b.nc;
|
||||
retcode = plan9(flist, '<', s, FALSE);
|
||||
fileupdate(flist, FALSE, FALSE);
|
||||
flist->seq = 0;
|
||||
if (flist->_.nc > BLOCKSIZE)
|
||||
if (flist->b.nc > BLOCKSIZE)
|
||||
error(Etoolong);
|
||||
Strzero(&genstr);
|
||||
Strinsure(&genstr, flist->_.nc);
|
||||
bufread(flist, (Posn)0, genbuf, flist->_.nc);
|
||||
memmove(genstr.s, genbuf, flist->_.nc*RUNESIZE);
|
||||
genstr.n = flist->_.nc;
|
||||
Strinsure(&genstr, flist->b.nc);
|
||||
bufread(&flist->b, (Posn)0, genbuf, flist->b.nc);
|
||||
memmove(genstr.s, genbuf, flist->b.nc*RUNESIZE);
|
||||
genstr.n = flist->b.nc;
|
||||
Straddc(&genstr, '\0');
|
||||
return retcode;
|
||||
}
|
||||
|
|
@ -673,7 +673,7 @@ copy(File *f, Address addr2)
|
|||
ni = addr.r.p2-p;
|
||||
if(ni > BLOCKSIZE)
|
||||
ni = BLOCKSIZE;
|
||||
bufread(f, p, genbuf, ni);
|
||||
bufread(&f->b, p, genbuf, ni);
|
||||
loginsert(addr2.f, addr2.r.p2, tmprstr(genbuf, ni)->s, ni);
|
||||
}
|
||||
addr2.f->ndot.r.p2 = addr2.r.p2+(f->dot.r.p2-f->dot.r.p1);
|
||||
|
|
|
|||
|
|
@ -110,11 +110,10 @@ enum
|
|||
struct Block
|
||||
{
|
||||
uint addr; /* disk address in bytes */
|
||||
union
|
||||
{
|
||||
union {
|
||||
uint n; /* number of used runes in block */
|
||||
Block *next; /* pointer to next in free list */
|
||||
} _;
|
||||
} u;
|
||||
};
|
||||
|
||||
struct Disk
|
||||
|
|
@ -151,7 +150,7 @@ void bufreset(Buffer*);
|
|||
|
||||
struct File
|
||||
{
|
||||
Buffer _; /* the data */
|
||||
Buffer b; /* the data */
|
||||
Buffer delta; /* transcript of changes */
|
||||
Buffer epsilon; /* inversion of delta for redo */
|
||||
String name; /* name of associated file */
|
||||
|
|
|
|||
|
|
@ -231,7 +231,7 @@ s_cmd(File *f, Cmd *cp)
|
|||
j = c-'0';
|
||||
if(sel.p[j].p2-sel.p[j].p1>BLOCKSIZE)
|
||||
error(Elongtag);
|
||||
bufread(f, sel.p[j].p1, genbuf, sel.p[j].p2-sel.p[j].p1);
|
||||
bufread(&f->b, sel.p[j].p1, genbuf, sel.p[j].p2-sel.p[j].p1);
|
||||
Strinsert(&genstr, tmprstr(genbuf, (sel.p[j].p2-sel.p[j].p1)), genstr.n);
|
||||
}else
|
||||
Straddc(&genstr, c);
|
||||
|
|
@ -240,7 +240,7 @@ s_cmd(File *f, Cmd *cp)
|
|||
else{
|
||||
if(sel.p[0].p2-sel.p[0].p1>BLOCKSIZE)
|
||||
error(Elongrhs);
|
||||
bufread(f, sel.p[0].p1, genbuf, sel.p[0].p2-sel.p[0].p1);
|
||||
bufread(&f->b, sel.p[0].p1, genbuf, sel.p[0].p2-sel.p[0].p1);
|
||||
Strinsert(&genstr,
|
||||
tmprstr(genbuf, (int)(sel.p[0].p2-sel.p[0].p1)),
|
||||
genstr.n);
|
||||
|
|
@ -390,15 +390,15 @@ display(File *f)
|
|||
|
||||
p1 = addr.r.p1;
|
||||
p2 = addr.r.p2;
|
||||
if(p2 > f->_.nc){
|
||||
fprint(2, "bad display addr p1=%ld p2=%ld f->_.nc=%d\n", p1, p2, f->_.nc); /*ZZZ should never happen, can remove */
|
||||
p2 = f->_.nc;
|
||||
if(p2 > f->b.nc){
|
||||
fprint(2, "bad display addr p1=%ld p2=%ld f->b.nc=%d\n", p1, p2, f->b.nc); /*ZZZ should never happen, can remove */
|
||||
p2 = f->b.nc;
|
||||
}
|
||||
while(p1 < p2){
|
||||
np = p2-p1;
|
||||
if(np>BLOCKSIZE-1)
|
||||
np = BLOCKSIZE-1;
|
||||
bufread(f, p1, genbuf, np);
|
||||
bufread(&f->b, p1, genbuf, np);
|
||||
genbuf[np] = 0;
|
||||
c = Strtoc(tmprstr(genbuf, np+1));
|
||||
if(downloaded)
|
||||
|
|
|
|||
|
|
@ -1,6 +0,0 @@
|
|||
CC=gcc
|
||||
CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -I. -I${PREFIX}/include
|
||||
O=o
|
||||
AR=ar
|
||||
ARFLAGS=rvc
|
||||
NAN=nan64.$O
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
CC=gcc
|
||||
CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -I. -I$(PREFIX)/include
|
||||
O=o
|
||||
AR=ar
|
||||
ARFLAGS=rvc
|
||||
NAN=nan64.$O # default, can be overriden by Make.$(SYSNAME)
|
||||
NAN=nan64.$O
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
CC=cc
|
||||
CFLAGS=-O -c -Ae -I.
|
||||
O=o
|
||||
AR=ar
|
||||
ARFLAGS=rvc
|
||||
NAN=nan64.$O
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
CC=gcc
|
||||
CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -I.
|
||||
O=o
|
||||
AR=ar
|
||||
ARFLAGS=rvc
|
||||
NAN=nan64.$O # default, can be overriden by Make.$(SYSNAME)
|
||||
NAN=nan64.$O
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
CC=gcc
|
||||
CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -I. -I$(PREFIX)/include
|
||||
O=o
|
||||
AR=ar
|
||||
ARFLAGS=rvc
|
||||
NAN=nan64.$O # default, can be overriden by Make.$(SYSNAME)
|
||||
NAN=nan64.$O
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
CC=cc
|
||||
CFLAGS+=-g -c -I.
|
||||
O=o
|
||||
AR=ar
|
||||
ARFLAGS=rvc
|
||||
NAN=nan64.$O
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
include Make.SunOS-sun4u-$(CC)
|
||||
NAN=nan64.$O
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
CC=cc
|
||||
CFLAGS+=-g -c -I. -O
|
||||
O=o
|
||||
AR=ar
|
||||
ARFLAGS=rvc
|
||||
NAN=nan64.$O
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
CC=gcc
|
||||
CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c
|
||||
O=o
|
||||
AR=ar
|
||||
ARFLAGS=rvc
|
||||
NAN=nan64.$O
|
||||
|
|
@ -1,22 +1,5 @@
|
|||
|
||||
# this works in gnu make
|
||||
SYSNAME:=${shell uname}
|
||||
OBJTYPE:=${shell uname -m | sed 's;i.86;386;; s;/.*;;; s; ;;g'}
|
||||
|
||||
# this works in bsd make
|
||||
SYSNAME!=uname
|
||||
OBJTYPE!=uname -m | sed 's;i.86;386;; s;/.*;;; s; ;;g'
|
||||
|
||||
# the gnu rules will mess up bsd but not vice versa,
|
||||
# hence the gnu rules come first.
|
||||
|
||||
include Make.$(SYSNAME)-$(OBJTYPE)
|
||||
|
||||
PREFIX=/usr/local
|
||||
|
||||
NUKEFILES=
|
||||
|
||||
TGZFILES=
|
||||
9SRC=..
|
||||
include $(9SRC)/Makehdr
|
||||
|
||||
TARG=samterm
|
||||
OFILES=\
|
||||
|
|
@ -33,62 +16,12 @@ OFILES=\
|
|||
HFILES=\
|
||||
samterm.h\
|
||||
flayer.h\
|
||||
$(PREFIX)/include/frame.h\
|
||||
../sam/sam.h\
|
||||
../sam/mesg.h\
|
||||
$(9SRC)/include/frame.h\
|
||||
$(9SRC)/include/draw.h\
|
||||
|
||||
all: $(TARG)
|
||||
CFLAGS+=-I../sam
|
||||
LDFLAGS+=-lframe -ldraw -lthread -l9 -lregexp9 -lbio -lfmt -lutf -L$(X11)/lib -lX11 -lm
|
||||
|
||||
install:
|
||||
install -c -m 0755 samterm $(PREFIX)/bin/samterm
|
||||
|
||||
|
||||
$(TARG): $(OFILES)
|
||||
$(CC) -o $(TARG) $(OFILES) -L$(PREFIX)/lib -lframe -ldraw -lthread -l9 -lregexp9 -lbio -lfmt -lutf -L/usr/X11R6/lib -lX11 -lm -ldraw
|
||||
|
||||
|
||||
.c.$O:
|
||||
$(CC) $(CFLAGS) -I/usr/X11R6/include -I../sam -I$(PREFIX)/include $*.c
|
||||
|
||||
%.$O: %.c
|
||||
$(CC) $(CFLAGS) -I/usr/X11R6/include -I../sam -I$(PREFIX)/include $*.c
|
||||
|
||||
|
||||
$(OFILES): $(HFILES)
|
||||
|
||||
tgz:
|
||||
rm -rf $(NAME)-$(VERSION)
|
||||
mkdir $(NAME)-$(VERSION)
|
||||
cp Makefile Make.* README LICENSE NOTICE *.[ch137] rpm.spec bundle.ports $(TGZFILES) $(NAME)-$(VERSION)
|
||||
tar cf - $(NAME)-$(VERSION) | gzip >$(NAME)-$(VERSION).tgz
|
||||
rm -rf $(NAME)-$(VERSION)
|
||||
|
||||
clean:
|
||||
rm -f $(OFILES) $(LIB)
|
||||
|
||||
nuke:
|
||||
rm -f $(OFILES) *.tgz *.rpm $(NUKEFILES)
|
||||
|
||||
rpm:
|
||||
make tgz
|
||||
cp $(NAME)-$(VERSION).tgz /usr/src/RPM/SOURCES
|
||||
rpm -ba rpm.spec
|
||||
cp /usr/src/RPM/SRPMS/$(NAME)-$(VERSION)-1.src.rpm .
|
||||
cp /usr/src/RPM/RPMS/i586/$(NAME)-$(VERSION)-1.i586.rpm .
|
||||
scp *.rpm rsc@amsterdam.lcs.mit.edu:public_html/software
|
||||
|
||||
PORTDIR=/usr/ports/$(PORTPLACE)
|
||||
|
||||
ports:
|
||||
make tgz
|
||||
rm -rf $(PORTDIR)
|
||||
mkdir $(PORTDIR)
|
||||
cp $(NAME)-$(VERSION).tgz /usr/ports/distfiles
|
||||
cat bundle.ports | (cd $(PORTDIR) && awk '$$1=="---" && $$3=="---" { ofile=$$2; next} {if(ofile) print >ofile}')
|
||||
(cd $(PORTDIR); make makesum)
|
||||
(cd $(PORTDIR); make)
|
||||
(cd $(PORTDIR); /usr/local/bin/portlint)
|
||||
rm -rf $(PORTDIR)/work
|
||||
shar `find $(PORTDIR)` > ports.shar
|
||||
(cd $(PORTDIR); tar cf - *) | gzip >$(NAME)-$(VERSION)-ports.tgz
|
||||
scp *.tgz rsc@amsterdam.lcs.mit.edu:public_html/software
|
||||
|
||||
.phony: all clean nuke install tgz rpm ports
|
||||
include ../Makeone
|
||||
|
|
|
|||
|
|
@ -1,22 +0,0 @@
|
|||
TARG=samterm
|
||||
OFILES=\
|
||||
main.$O\
|
||||
icons.$O\
|
||||
menu.$O\
|
||||
mesg.$O\
|
||||
rasp.$O\
|
||||
scroll.$O\
|
||||
flayer.$O\
|
||||
io.$O\
|
||||
plan9.$O\
|
||||
|
||||
HFILES=\
|
||||
samterm.h\
|
||||
flayer.h\
|
||||
$(PREFIX)/include/frame.h\
|
||||
|
||||
all: $(TARG)
|
||||
|
||||
install:
|
||||
install -c -m 0755 samterm $(PREFIX)/bin/samterm
|
||||
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
all:V: Makefile Make.FreeBSD-386 Make.Linux-386 Make.HP-UX-9000 Make.OSF1-alpha \
|
||||
Make.SunOS-sun4u Make.SunOS-sun4u-cc Make.SunOS-sun4u-gcc \
|
||||
Make.NetBSD-386 Make.Darwin-PowerMacintosh
|
||||
|
||||
Makefile:D: ../libutf/Makefile.TOP Makefile.MID ../libutf/Makefile.CMD ../libutf/Makefile.BOT
|
||||
cat $prereq >$target
|
||||
|
||||
Make.%: ../libutf/Make.%
|
||||
cp $prereq $target
|
||||
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue