Build Unix-friendly versions directly from library.

This commit is contained in:
rsc 2004-03-01 19:36:29 +00:00
parent 63dd44c8ca
commit aa73861453
34 changed files with 966 additions and 0 deletions

7
unix/Makefile Normal file
View file

@ -0,0 +1,7 @@
all:
for i in libutf libfmt libbio libregexp mk
do
(cd $i; make)
done
ls -l mk/mk

40
unix/NOTICE.bio Normal file
View file

@ -0,0 +1,40 @@
This copyright NOTICE applies to all files in this directory and
subdirectories, unless another copyright notice appears in a given
file or subdirectory. If you take code from this software to use in
other programs, you must somehow include with it an appropriate
copyright notice that includes the copyright notice and the other
notices above.
This Computer Program is subject to Copyright owned by one or more Authors:
Copyright © 1994-1999 Lucent Technologies Inc. All rights reserved.
Revisions Copyright © 2000-2003 Vita Nuova Holdings Limited (www.vitanuova.com). All rights reserved.
Under a licence agreement with Lucent Technologies Inc. effective 1st March 2000,
Vita Nuova Holdings Limited has the right to determine (within a specified scope)
the form and content of sublicences for this software.
Free-for-all Licence
The associated software is hereby made available to Recipients with a
royalty-free licence for its use, reproduction, transfer
to other parties and amendment for any purpose not excluding
product development provided that any such use et cetera
shall be deemed to be acceptance of the following conditions:
(1) Its Recipients shall ensure that this Notice
and all other copyright notices are reproduced
upon any copies or amended versions of it;
(2) Any amended version of it shall be clearly marked to
show both the nature of and the organisation responsible
for the relevant amendment or amendments;
(3) Its agreed onward transfer from a Recipient to another
party shall be deemed to be that party's acceptance of
these conditions;
(4) the Authors give no warranty or assurance as to its
quality or suitability for any purpose and the Authors accept
no liability whatsoever in relation to any use to which
it may be put.

19
unix/NOTICE.fmt Normal file
View file

@ -0,0 +1,19 @@
/*
* The authors of this software are Rob Pike and Ken Thompson.
* Copyright (c) 2002 by Lucent Technologies.
* Permission to use, copy, modify, and distribute this software for any
* purpose without fee is hereby granted, provided that this entire notice
* is included in all copies of any software which is or includes a copy
* or modification of this software and in all copies of the supporting
* documentation for such software.
* THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
* WARRANTY. IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE ANY
* REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
* OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
*/
This is a Unix port of the Plan 9 formatted I/O package.
Please send comments about the packaging
to Russ Cox <rsc@swtch.com>.

40
unix/NOTICE.mk Normal file
View file

@ -0,0 +1,40 @@
This copyright NOTICE applies to all files in this directory and
subdirectories, unless another copyright notice appears in a given
file or subdirectory. If you take code from this software to use in
other programs, you must somehow include with it an appropriate
copyright notice that includes the copyright notice and the other
notices above.
This Computer Program is subject to Copyright owned by one or more Authors:
Copyright © 1994-1999 Lucent Technologies Inc. All rights reserved.
Revisions Copyright © 2000-2003 Vita Nuova Holdings Limited (www.vitanuova.com). All rights reserved.
Under a licence agreement with Lucent Technologies Inc. effective 1st March 2000,
Vita Nuova Holdings Limited has the right to determine (within a specified scope)
the form and content of sublicences for this software.
Free-for-all Licence
The associated software is hereby made available to Recipients with a
royalty-free licence for its use, reproduction, transfer
to other parties and amendment for any purpose not excluding
product development provided that any such use et cetera
shall be deemed to be acceptance of the following conditions:
(1) Its Recipients shall ensure that this Notice
and all other copyright notices are reproduced
upon any copies or amended versions of it;
(2) Any amended version of it shall be clearly marked to
show both the nature of and the organisation responsible
for the relevant amendment or amendments;
(3) Its agreed onward transfer from a Recipient to another
party shall be deemed to be that party's acceptance of
these conditions;
(4) the Authors give no warranty or assurance as to its
quality or suitability for any purpose and the Authors accept
no liability whatsoever in relation to any use to which
it may be put.

19
unix/NOTICE.regexp Normal file
View file

@ -0,0 +1,19 @@
/*
* The authors of this software is Rob Pike.
* Copyright (c) 2002 by Lucent Technologies.
* Permission to use, copy, modify, and distribute this software for any
* purpose without fee is hereby granted, provided that this entire notice
* is included in all copies of any software which is or includes a copy
* or modification of this software and in all copies of the supporting
* documentation for such software.
* THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
* WARRANTY. IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE ANY
* REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
* OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
*/
This is a Unix port of the Plan 9 regular expression library.
Please send comments about the packaging
to Russ Cox <rsc@swtch.com>.

19
unix/NOTICE.utf Normal file
View file

@ -0,0 +1,19 @@
/*
* The authors of this software are Rob Pike and Ken Thompson.
* Copyright (c) 2002 by Lucent Technologies.
* Permission to use, copy, modify, and distribute this software for any
* purpose without fee is hereby granted, provided that this entire notice
* is included in all copies of any software which is or includes a copy
* or modification of this software and in all copies of the supporting
* documentation for such software.
* THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
* WARRANTY. IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE ANY
* REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
* OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
*/
This is a Unix port of the Plan 9 formatted I/O package.
Please send comments about the packaging
to Russ Cox <rsc@swtch.com>.

2
unix/README Normal file
View file

@ -0,0 +1,2 @@
This software was packaged for Unix by Russ Cox.
Please send comments to rsc@swtch.com.

106
unix/fmt.h Normal file
View file

@ -0,0 +1,106 @@
/*
* The authors of this software are Rob Pike and Ken Thompson.
* Copyright (c) 2002 by Lucent Technologies.
* Permission to use, copy, modify, and distribute this software for any
* purpose without fee is hereby granted, provided that this entire notice
* is included in all copies of any software which is or includes a copy
* or modification of this software and in all copies of the supporting
* documentation for such software.
* THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
* WARRANTY. IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE ANY
* REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
* OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
*/
#ifndef _FMTH_
#define _FMTH_ 1
#ifdef __cplusplus
extern "C" {
#endif
#include <stdarg.h>
#ifndef _UTFH_
#include <utf.h>
#endif
typedef struct Fmt Fmt;
struct Fmt{
unsigned char runes; /* output buffer is runes or chars? */
void *start; /* of buffer */
void *to; /* current place in the buffer */
void *stop; /* end of the buffer; overwritten if flush fails */
int (*flush)(Fmt *); /* called when to == stop */
void *farg; /* to make flush a closure */
int nfmt; /* num chars formatted so far */
va_list args; /* args passed to dofmt */
int r; /* % format Rune */
int width;
int prec;
unsigned long flags;
};
enum{
FmtWidth = 1,
FmtLeft = FmtWidth << 1,
FmtPrec = FmtLeft << 1,
FmtSharp = FmtPrec << 1,
FmtSpace = FmtSharp << 1,
FmtSign = FmtSpace << 1,
FmtZero = FmtSign << 1,
FmtUnsigned = FmtZero << 1,
FmtShort = FmtUnsigned << 1,
FmtLong = FmtShort << 1,
FmtVLong = FmtLong << 1,
FmtComma = FmtVLong << 1,
FmtByte = FmtComma << 1,
FmtLDouble = FmtByte << 1,
FmtFlag = FmtLDouble << 1
};
extern int print(char*, ...);
extern char* seprint(char*, char*, char*, ...);
extern char* vseprint(char*, char*, char*, va_list);
extern int snprint(char*, int, char*, ...);
extern int vsnprint(char*, int, char*, va_list);
extern char* smprint(char*, ...);
extern char* vsmprint(char*, va_list);
extern int sprint(char*, char*, ...);
extern int fprint(int, char*, ...);
extern int vfprint(int, char*, va_list);
extern int runesprint(Rune*, char*, ...);
extern int runesnprint(Rune*, int, char*, ...);
extern int runevsnprint(Rune*, int, char*, va_list);
extern Rune* runeseprint(Rune*, Rune*, char*, ...);
extern Rune* runevseprint(Rune*, Rune*, char*, va_list);
extern Rune* runesmprint(char*, ...);
extern Rune* runevsmprint(char*, va_list);
extern int fmtfdinit(Fmt*, int, char*, int);
extern int fmtfdflush(Fmt*);
extern int fmtstrinit(Fmt*);
extern char* fmtstrflush(Fmt*);
extern int runefmtstrinit(Fmt*);
extern int quotestrfmt(Fmt *f);
extern void quotefmtinstall(void);
extern int (*fmtdoquote)(int);
extern int fmtinstall(int, int (*)(Fmt*));
extern int dofmt(Fmt*, char*);
extern int fmtprint(Fmt*, char*, ...);
extern int fmtvprint(Fmt*, char*, va_list);
extern int fmtrune(Fmt*, int);
extern int fmtstrcpy(Fmt*, char*);
extern double fmtstrtod(const char *, char **);
extern double fmtcharstod(int(*)(void*), void*);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,6 @@
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

View file

@ -0,0 +1,7 @@
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

View file

@ -0,0 +1,6 @@
CC=cc
CFLAGS=-O -c -Ae -I.
O=o
AR=ar
ARFLAGS=rvc
NAN=nan64.$O

7
unix/make/Make.Linux-386 Normal file
View file

@ -0,0 +1,7 @@
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

View file

@ -0,0 +1,7 @@
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

View file

@ -0,0 +1,6 @@
CC=cc
CFLAGS+=-g -c -I.
O=o
AR=ar
ARFLAGS=rvc
NAN=nan64.$O

View file

@ -0,0 +1,2 @@
include Make.SunOS-sun4u-$(CC)
NAN=nan64.$O

View file

@ -0,0 +1,6 @@
CC=cc
CFLAGS+=-g -c -I. -O
O=o
AR=ar
ARFLAGS=rvc
NAN=nan64.$O

View file

@ -0,0 +1,6 @@
CC=gcc
CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c
O=o
AR=ar
ARFLAGS=rvc
NAN=nan64.$O

47
unix/make/Makefile.BOT Normal file
View file

@ -0,0 +1,47 @@
.c.$O:
$(CC) $(CFLAGS) -I../libutf -I../libfmt -I../libbio -I../libregexp -I$(PREFIX)/include $*.c
%.$O: %.c
$(CC) $(CFLAGS) -I../libutf -I../libfmt -I../libbio -I../libregexp -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

5
unix/make/Makefile.CMD Normal file
View file

@ -0,0 +1,5 @@
$(TARG): $(OFILES)
$(CC) -o $(TARG) $(OFILES) -L$(PREFIX)/lib -L../libutf -L../libfmt -L../libbio -L../libregexp -lregexp9 -lbio -lfmt -lutf

4
unix/make/Makefile.LIB Normal file
View file

@ -0,0 +1,4 @@
$(LIB): $(OFILES)
$(AR) $(ARFLAGS) $(LIB) $(OFILES)
NUKEFILES+=$(LIB)

41
unix/make/Makefile.MID Normal file
View file

@ -0,0 +1,41 @@
LIB=libutf.a
VERSION=2.0
PORTPLACE=devel/libutf
NAME=libutf
OFILES=\
rune.$O\
runestrcat.$O\
runestrchr.$O\
runestrcmp.$O\
runestrcpy.$O\
runestrdup.$O\
runestrlen.$O\
runestrecpy.$O\
runestrncat.$O\
runestrncmp.$O\
runestrncpy.$O\
runestrrchr.$O\
runestrstr.$O\
runetype.$O\
utfecpy.$O\
utflen.$O\
utfnlen.$O\
utfrrune.$O\
utfrune.$O\
utfutf.$O\
HFILES=\
utf.h\
all: $(LIB)
install: $(LIB)
test -d $(PREFIX)/man/man3 || mkdir $(PREFIX)/man/man3
install -c -m 0644 isalpharune.3 $(PREFIX)/man/man3/isalpharune.3
install -c -m 0644 utf.7 $(PREFIX)/man/man7/utf.7
install -c -m 0644 rune.3 $(PREFIX)/man/man3/rune.3
install -c -m 0644 runestrcat.3 $(PREFIX)/man/man3/runestrcat.3
install -c -m 0644 utf.h $(PREFIX)/include/utf.h
install -c -m 0644 $(LIB) $(PREFIX)/lib/$(LIB)

20
unix/make/Makefile.TOP Normal file
View file

@ -0,0 +1,20 @@
# 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=

38
unix/make/Makefile.bio Normal file
View file

@ -0,0 +1,38 @@
LIB=libbio.a
VERSION=2.0
PORTPLACE=devel/libbio
NAME=libbio
OFILES=\
bbuffered.$O\
bfildes.$O\
bflush.$O\
bfmt.$O\
bgetc.$O\
bgetd.$O\
bgetrune.$O\
binit.$O\
boffset.$O\
bprint.$O\
bputc.$O\
bputrune.$O\
brdline.$O\
brdstr.$O\
bread.$O\
bseek.$O\
bwrite.$O\
HFILES=\
bio.h\
all: $(LIB)
install: $(LIB)
test -d $(PREFIX)/man/man3 || mkdir $(PREFIX)/man/man3
install -m 0644 bio.3 $(PREFIX)/man/man3/bio.3
install -m 0644 bio.h $(PREFIX)/include
install -m 0644 $(LIB) $(PREFIX)/lib/$(LIB)
bcat: bcat.$O $(LIB)
$(CC) -o bcat bcat.$O $(LIB) -L/usr/local/lib -lfmt -lutf

64
unix/make/Makefile.fmt Normal file
View file

@ -0,0 +1,64 @@
LIB=libfmt.a
VERSION=2.0
PORTPLACE=devel/libfmt
NAME=libfmt
NUM=\
charstod.$O\
pow10.$O\
OFILES=\
dofmt.$O\
dorfmt.$O\
errfmt.$O\
fltfmt.$O\
fmt.$O\
fmtfd.$O\
fmtfdflush.$O\
fmtlock.$O\
fmtprint.$O\
fmtquote.$O\
fmtrune.$O\
fmtstr.$O\
fmtvprint.$O\
fprint.$O\
print.$O\
runefmtstr.$O\
runeseprint.$O\
runesmprint.$O\
runesnprint.$O\
runesprint.$O\
runevseprint.$O\
runevsmprint.$O\
runevsnprint.$O\
seprint.$O\
smprint.$O\
snprint.$O\
sprint.$O\
strtod.$O\
vfprint.$O\
vseprint.$O\
vsmprint.$O\
vsnprint.$O\
$(NUM)\
$(NAN)\
HFILES=\
fmtdef.h\
fmt.h\
all: $(LIB)
install: $(LIB)
test -d $(PREFIX)/man/man3 || mkdir $(PREFIX)/man/man3
install -m 0644 print.3 $(PREFIX)/man/man3/print.3
install -m 0644 fmtinstall.3 $(PREFIX)/man/man3/fmtinstall.3
install -m 0644 fmt.h $(PREFIX)/include/fmt.h
install -m 0644 $(LIB) $(PREFIX)/lib/$(LIB)
$(NAN).$O: nan.h
strtod.$O: nan.h
test: $(LIB) test.$O
$(CC) -o test test.$O $(LIB) -L$(PREFIX)/lib -lutf

45
unix/make/Makefile.mk Normal file
View file

@ -0,0 +1,45 @@
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

35
unix/make/Makefile.regexp Normal file
View file

@ -0,0 +1,35 @@
LIB=libregexp9.a
VERSION=2.0
PORTPLACE=devel/libregexp9
NAME=libregexp9
OFILES=\
regcomp.$O\
regerror.$O\
regexec.$O\
regsub.$O\
regaux.$O\
rregexec.$O\
rregsub.$O\
rregaux.$O\
HFILES=\
regexp9.h\
regcomp.h\
all: $(LIB)
install: $(LIB)
test -d $(PREFIX)/man/man3 || mkdir $(PREFIX)/man/man3
test -d $(PREFIX)/man/man7 || mkdir $(PREFIX)/man/man7
install -m 0644 regexp9.3 $(PREFIX)/man/man3/regexp9.3
install -m 0644 regexp9.7 $(PREFIX)/man/man7/regexp9.7
install -m 0644 $(LIB) $(PREFIX)/lib/$(LIB)
install -m 0644 regexp9.h $(PREFIX)/include/regexp9.h
test: test.$O $(LIB)
$(CC) -o test test.$O $(LIB) -L/usr/local/lib -lfmt -lutf
test2: test2.$O $(LIB)
$(CC) -o test2 test2.$O $(LIB) -L/usr/local/lib -lfmt -lutf

41
unix/make/Makefile.utf Normal file
View file

@ -0,0 +1,41 @@
LIB=libutf.a
VERSION=2.0
PORTPLACE=devel/libutf
NAME=libutf
OFILES=\
rune.$O\
runestrcat.$O\
runestrchr.$O\
runestrcmp.$O\
runestrcpy.$O\
runestrdup.$O\
runestrlen.$O\
runestrecpy.$O\
runestrncat.$O\
runestrncmp.$O\
runestrncpy.$O\
runestrrchr.$O\
runestrstr.$O\
runetype.$O\
utfecpy.$O\
utflen.$O\
utfnlen.$O\
utfrrune.$O\
utfrune.$O\
utfutf.$O\
HFILES=\
utf.h\
all: $(LIB)
install: $(LIB)
test -d $(PREFIX)/man/man3 || mkdir $(PREFIX)/man/man3
install -c -m 0644 isalpharune.3 $(PREFIX)/man/man3/isalpharune.3
install -c -m 0644 utf.7 $(PREFIX)/man/man7/utf.7
install -c -m 0644 rune.3 $(PREFIX)/man/man3/rune.3
install -c -m 0644 runestrcat.3 $(PREFIX)/man/man3/runestrcat.3
install -c -m 0644 utf.h $(PREFIX)/include/utf.h
install -c -m 0644 $(LIB) $(PREFIX)/lib/$(LIB)

52
unix/mkfile Normal file
View file

@ -0,0 +1,52 @@
bio fmt mk regexp utf:V:
case $target in
mk) t=mk ;;
regexp) t=libregexp ;;
*) t=lib$target ;;
esac
mkdir $t || true
rm $t/* || true
cd $t
mk -f ../mkfile.$target
case $target in
bio) d=$PLAN9/src/$t;;
regexp) d=$PLAN9/src/$t;;
fmt) d=$PLAN9/src/lib9/$target ;;
utf) d=$PLAN9/src/lib9/$target ;;
mk) d=$PLAN9/src/cmd/mk ;;
esac
for i in `ls -p $d/*.c`
do
if [ ! -f $i ]
then
echo missing $i
fi
done
make
for i in `ls *.c`
do
if [ ! -f `echo $i | sed 's/.c$/.o/'` ]
then
echo not building $i
fi
done
cd ..
rm $t/* || true
cd $t
mk -f ../mkfile.$target
lib%.tgz:
mk $stem
tar cf - lib$stem |gzip >lib$stem.tgz
libregexp9.tgz:
mk regexp
tar cf - libregexp | gzip >libregexp9.tgz
mk.tgz:
mk mk
tar cf - mk | gzip >mk.tgz
mk-all.tgz:
tar cf - Makefile libutf libfmt libbio libregexp mk | gzip >mk-all.tgz

42
unix/mkfile.bio Normal file
View file

@ -0,0 +1,42 @@
MAKEALL=`{cd ../make; ls Make.*}
TARG=\
$MAKEALL\
NOTICE\
README\
Makefile\
bio.3\
bio.h\
lib9.h\
`{ls -p $PLAN9/src/libbio/*.c}\
all:V: $TARG
%: $PLAN9/include/%
cp $prereq $target
%: $PLAN9/src/libbio/%
cp $prereq $target
%: $PLAN9/man/man1/%
cp $prereq $target
%: $PLAN9/man/man3/%
cp $prereq $target
%: $PLAN9/man/man7/%
cp $prereq $target
lib9.h: $PLAN9/src/libbio/lib9.std.h
cp $prereq $target
%: ../make/%
cp $prereq $target
Makefile:D: ../make/Makefile.TOP ../make/Makefile.bio ../make/Makefile.LIB ../make/Makefile.BOT
cat $prereq >$target
README: ../README
cp $prereq $target
NOTICE: ../NOTICE.bio
cp $prereq $target

45
unix/mkfile.fmt Normal file
View file

@ -0,0 +1,45 @@
MAKEALL=`{cd ../make; ls Make.*}
TARG=\
$MAKEALL\
NOTICE\
README\
Makefile\
`{ls -p $PLAN9/src/lib9/fmt/*.c}\
fmt.h\
fmtdef.h\
nan.h\
all:V: $TARG
%: $PLAN9/include/%
cp $prereq $target
%: $PLAN9/src/lib9/fmt/%
cp $prereq $target
%: $PLAN9/man/man1/%
cp $prereq $target
%: $PLAN9/man/man3/%
cp $prereq $target
%: $PLAN9/man/man7/%
cp $prereq $target
%: ../make/%
cp $prereq $target
Makefile:D: ../make/Makefile.TOP ../make/Makefile.fmt ../make/Makefile.LIB ../make/Makefile.BOT
cat $prereq >$target
README: ../README
cp $prereq $target
NOTICE: ../NOTICE.fmt
cp $prereq $target
fmt.h: ../fmt.h
cp $prereq $target
fmt.c: $PLAN9/src/lib9/fmt/fmt.c
cat $prereq | sed "/'u',.*__flagfmt/ s/__flagfmt/__ifmt/" >$target

39
unix/mkfile.mk Normal file
View file

@ -0,0 +1,39 @@
MAKEALL=`{cd ../make; ls Make.*}
TARG=\
$MAKEALL\
NOTICE\
README\
Makefile\
mk.1\
mk.h\
fns.h\
`{ls -p $PLAN9/src/cmd/mk/*.c}\
all:V: $TARG
%: $PLAN9/include/%
cp $prereq $target
%: $PLAN9/src/cmd/mk/%
cp $prereq $target
%: $PLAN9/man/man1/%
cp $prereq $target
%: $PLAN9/man/man3/%
cp $prereq $target
%: $PLAN9/man/man7/%
cp $prereq $target
%: ../make/%
cp $prereq $target
Makefile:D: ../make/Makefile.TOP ../make/Makefile.mk ../make/Makefile.CMD ../make/Makefile.BOT
cat $prereq >$target
README: ../README
cp $prereq $target
NOTICE: ../NOTICE.mk
cp $prereq $target

44
unix/mkfile.regexp Normal file
View file

@ -0,0 +1,44 @@
MAKEALL=`{cd ../make; ls Make.*}
TARG=\
$MAKEALL\
NOTICE\
README\
Makefile\
regexp9.3\
regexp9.7\
regexp9.h\
regcomp.h\
lib9.h\
`{ls -p $PLAN9/src/libregexp/*.c}\
all:V: $TARG
%: $PLAN9/include/%
cp $prereq $target
%: $PLAN9/src/libregexp/%
cp $prereq $target
%: $PLAN9/man/man1/%
cp $prereq $target
%: $PLAN9/man/man3/%
cp $prereq $target
%: $PLAN9/man/man7/%
cp $prereq $target
%: ../make/%
cp $prereq $target
Makefile:D: ../make/Makefile.TOP ../make/Makefile.regexp ../make/Makefile.LIB ../make/Makefile.BOT
cat $prereq >$target
README: ../README
cp $prereq $target
NOTICE: ../NOTICE.regexp
cp $prereq $target
lib9.h: $PLAN9/src/libregexp/lib9.h
cp $prereq $target

42
unix/mkfile.utf Normal file
View file

@ -0,0 +1,42 @@
MAKEALL=`{cd ../make; ls Make.*}
TARG=\
$MAKEALL\
NOTICE\
README\
Makefile\
`{ls -p $PLAN9/src/lib9/utf/*.c}\
utf.h\
utfdef.h\
all:V: $TARG
%: $PLAN9/include/%
cp $prereq $target
%: $PLAN9/src/lib9/utf/%
cp $prereq $target
%: $PLAN9/man/man1/%
cp $prereq $target
%: $PLAN9/man/man3/%
cp $prereq $target
%: $PLAN9/man/man7/%
cp $prereq $target
%: ../make/%
cp $prereq $target
Makefile:D: ../make/Makefile.TOP ../make/Makefile.utf ../make/Makefile.LIB ../make/Makefile.BOT
cat $prereq >$target
README: ../README
cp $prereq $target
NOTICE: ../NOTICE.utf
cp $prereq $target
utf.h: ../utf.h
cp $prereq $target

57
unix/utf.h Normal file
View file

@ -0,0 +1,57 @@
#ifndef _UTFH_
#define _UTFH_ 1
#ifdef __cplusplus
extern "C" {
#endif
typedef unsigned short Rune; /* 16 bits */
enum
{
UTFmax = 3, /* maximum bytes per rune */
Runesync = 0x80, /* cannot represent part of a UTF sequence (<) */
Runeself = 0x80, /* rune and UTF sequences are the same (<) */
Runeerror = 0x80, /* decoding error in UTF */
};
/*
* rune routines
*/
extern int runetochar(char*, Rune*);
extern int chartorune(Rune*, char*);
extern int runelen(long);
extern int runenlen(Rune*, int);
extern int fullrune(char*, int);
extern int utflen(char*);
extern int utfnlen(char*, long);
extern char* utfrune(char*, long);
extern char* utfrrune(char*, long);
extern char* utfutf(char*, char*);
extern char* utfecpy(char*, char*, char*);
extern Rune* runestrcat(Rune*, Rune*);
extern Rune* runestrchr(Rune*, Rune);
extern int runestrcmp(Rune*, Rune*);
extern Rune* runestrcpy(Rune*, Rune*);
extern Rune* runestrncpy(Rune*, Rune*, long);
extern Rune* runestrecpy(Rune*, Rune*, Rune*);
extern Rune* runestrdup(Rune*);
extern Rune* runestrncat(Rune*, Rune*, long);
extern int runestrncmp(Rune*, Rune*, long);
extern Rune* runestrrchr(Rune*, Rune);
extern long runestrlen(Rune*);
extern Rune* runestrstr(Rune*, Rune*);
extern Rune tolowerrune(Rune);
extern Rune totitlerune(Rune);
extern Rune toupperrune(Rune);
extern int isalpharune(Rune);
extern int islowerrune(Rune);
extern int isspacerune(Rune);
extern int istitlerune(Rune);
extern int isupperrune(Rune);
#ifdef cplusplus
}
#endif
#endif