From 522b0689c340d26feeac360640bf7e2e0582353c Mon Sep 17 00:00:00 2001 From: rsc Date: Tue, 30 Sep 2003 19:05:50 +0000 Subject: Reorg --- src/libbio/Make.FreeBSD-386 | 7 - src/libbio/Make.HP-UX-9000 | 6 - src/libbio/Make.Linux-386 | 7 - src/libbio/Make.NetBSD-386 | 7 - src/libbio/Make.OSF1-alpha | 6 - src/libbio/Make.SunOS-sun4u | 2 - src/libbio/Make.SunOS-sun4u-cc | 6 - src/libbio/Make.SunOS-sun4u-gcc | 6 - src/libbio/Makefile | 85 +--------- src/libbio/Makefile.MID | 37 ----- src/libbio/bio.3 | 336 ---------------------------------------- src/libbio/bio.h | 79 ---------- src/libbio/bundle.ports | 45 ------ src/libbio/mkfile | 1 - src/libbio/rpm.spec | 30 ---- 15 files changed, 4 insertions(+), 656 deletions(-) delete mode 100644 src/libbio/Make.FreeBSD-386 delete mode 100644 src/libbio/Make.HP-UX-9000 delete mode 100644 src/libbio/Make.Linux-386 delete mode 100644 src/libbio/Make.NetBSD-386 delete mode 100644 src/libbio/Make.OSF1-alpha delete mode 100644 src/libbio/Make.SunOS-sun4u delete mode 100644 src/libbio/Make.SunOS-sun4u-cc delete mode 100644 src/libbio/Make.SunOS-sun4u-gcc delete mode 100644 src/libbio/Makefile.MID delete mode 100644 src/libbio/bio.3 delete mode 100644 src/libbio/bio.h delete mode 100644 src/libbio/bundle.ports delete mode 100644 src/libbio/mkfile delete mode 100644 src/libbio/rpm.spec (limited to 'src/libbio') diff --git a/src/libbio/Make.FreeBSD-386 b/src/libbio/Make.FreeBSD-386 deleted file mode 100644 index 087ed3ab..00000000 --- a/src/libbio/Make.FreeBSD-386 +++ /dev/null @@ -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 diff --git a/src/libbio/Make.HP-UX-9000 b/src/libbio/Make.HP-UX-9000 deleted file mode 100644 index edbdc111..00000000 --- a/src/libbio/Make.HP-UX-9000 +++ /dev/null @@ -1,6 +0,0 @@ -CC=cc -CFLAGS=-O -c -Ae -I. -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O diff --git a/src/libbio/Make.Linux-386 b/src/libbio/Make.Linux-386 deleted file mode 100644 index 74b0252c..00000000 --- a/src/libbio/Make.Linux-386 +++ /dev/null @@ -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 diff --git a/src/libbio/Make.NetBSD-386 b/src/libbio/Make.NetBSD-386 deleted file mode 100644 index 087ed3ab..00000000 --- a/src/libbio/Make.NetBSD-386 +++ /dev/null @@ -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 diff --git a/src/libbio/Make.OSF1-alpha b/src/libbio/Make.OSF1-alpha deleted file mode 100644 index 3d45279b..00000000 --- a/src/libbio/Make.OSF1-alpha +++ /dev/null @@ -1,6 +0,0 @@ -CC=cc -CFLAGS+=-g -c -I. -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O diff --git a/src/libbio/Make.SunOS-sun4u b/src/libbio/Make.SunOS-sun4u deleted file mode 100644 index c5fe67b8..00000000 --- a/src/libbio/Make.SunOS-sun4u +++ /dev/null @@ -1,2 +0,0 @@ -include Make.SunOS-sun4u-$(CC) -NAN=nan64.$O diff --git a/src/libbio/Make.SunOS-sun4u-cc b/src/libbio/Make.SunOS-sun4u-cc deleted file mode 100644 index 829301de..00000000 --- a/src/libbio/Make.SunOS-sun4u-cc +++ /dev/null @@ -1,6 +0,0 @@ -CC=cc -CFLAGS+=-g -c -I. -O -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O diff --git a/src/libbio/Make.SunOS-sun4u-gcc b/src/libbio/Make.SunOS-sun4u-gcc deleted file mode 100644 index 5c415948..00000000 --- a/src/libbio/Make.SunOS-sun4u-gcc +++ /dev/null @@ -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 diff --git a/src/libbio/Makefile b/src/libbio/Makefile index 2d1a0cad..e3a39a7b 100644 --- a/src/libbio/Makefile +++ b/src/libbio/Makefile @@ -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 LIB=libbio.a -VERSION=2.0 -PORTPLACE=devel/libbio -NAME=libbio OFILES=\ bbuffered.$O\ @@ -44,65 +24,8 @@ OFILES=\ 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) +include $(9SRC)/Makesyslib bcat: bcat.$O $(LIB) - $(CC) -o bcat bcat.$O $(LIB) -L/usr/local/lib -lfmt -lutf - -$(LIB): $(OFILES) - $(AR) $(ARFLAGS) $(LIB) $(OFILES) - -NUKEFILES+=$(LIB) -.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 + $(CC) -o bcat bcat.$O -L$(9SRC)/lib -lbio -lfmt -lutf -.phony: all clean nuke install tgz rpm ports diff --git a/src/libbio/Makefile.MID b/src/libbio/Makefile.MID deleted file mode 100644 index 610659ba..00000000 --- a/src/libbio/Makefile.MID +++ /dev/null @@ -1,37 +0,0 @@ -LIB=libbio.a -VERSION=2.0 -PORTPLACE=devel/libbio -NAME=libbio - -OFILES=\ - bbuffered.$O\ - bfildes.$O\ - bflush.$O\ - bgetc.$O\ - bgetd.$O\ - binit.$O\ - boffset.$O\ - bprint.$O\ - bputc.$O\ - brdline.$O\ - brdstr.$O\ - bread.$O\ - bseek.$O\ - bwrite.$O\ - bgetrune.$O\ - bputrune.$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 - diff --git a/src/libbio/bio.3 b/src/libbio/bio.3 deleted file mode 100644 index cf504631..00000000 --- a/src/libbio/bio.3 +++ /dev/null @@ -1,336 +0,0 @@ -.TH BIO 3 -.SH NAME -Bopen, Binit, Binits, Brdline, Brdstr, Bgetc, Bgetd, Bungetc, Bread, Bseek, Boffset, Bfildes, Blinelen, Bputc, Bprint, Bvprint, Bwrite, Bflush, Bterm, Bbuffered \- buffered input/output -.SH SYNOPSIS -.ta \w'Biobuf* 'u -.B #include -.B #include -.PP -.B -Biobuf* Bopen(char *file, int mode) -.PP -.B -int Binit(Biobuf *bp, int fd, int mode) -.PP -.B -int Bterm(Biobuf *bp) -.PP -.B -int Bprint(Biobuf *bp, char *format, ...) -.PP -.B -int Bvprint(Biobuf *bp, char *format, va_list arglist); -.PP -.B -void* Brdline(Biobuf *bp, int delim) -.PP -.B -char* Brdstr(Biobuf *bp, int delim, int nulldelim) -.PP -.B -int Blinelen(Biobuf *bp) -.PP -.B -off_t Boffset(Biobuf *bp) -.PP -.B -int Bfildes(Biobuf *bp) -.PP -.B -int Bgetc(Biobuf *bp) -.PP -.B -long Bgetrune(Biobufhdr *bp) -.PP -.B -int Bgetd(Biobuf *bp, double *d) -.PP -.B -int Bungetc(Biobuf *bp) -.PP -.B -int Bungetrune(Biobufhdr *bp) -.PP -.B -off_t Bseek(Biobuf *bp, off_t n, int type) -.PP -.B -int Bputc(Biobuf *bp, int c) -.PP -.B -int Bputrune(Biobufhdr *bp, long c) -.PP -.B -long Bread(Biobuf *bp, void *addr, long nbytes) -.PP -.B -long Bwrite(Biobuf *bp, void *addr, long nbytes) -.PP -.B -int Bflush(Biobuf *bp) -.PP -.B -int Bbuffered(Biobuf *bp) -.PP -.SH DESCRIPTION -These routines implement fast buffered I/O. -I/O on different file descriptors is independent. -.PP -.I Bopen -opens -.I file -for mode -.B O_RDONLY -or creates for mode -.BR O_WRONLY . -It calls -.IR malloc (3) -to allocate a buffer. -.PP -.I Binit -initializes a buffer -with the open file descriptor passed in -by the user. -.PP -Arguments -of types pointer to Biobuf and pointer to Biobuf -can be used interchangeably in the following routines. -.PP -.IR Bopen , -.IR Binit , -or -.I Binits -should be called before any of the -other routines on that buffer. -.I Bfildes -returns the integer file descriptor of the associated open file. -.PP -.I Bterm -flushes the buffer for -.IR bp . -If the buffer was allocated by -.IR Bopen , -the buffer is -.I freed -and the file is closed. -.PP -.I Brdline -reads a string from the file associated with -.I bp -up to and including the first -.I delim -character. -The delimiter character at the end of the line is -not altered. -.I Brdline -returns a pointer to the start of the line or -.L 0 -on end-of-file or read error. -.I Blinelen -returns the length (including the delimiter) -of the most recent string returned by -.IR Brdline . -.PP -.I Brdstr -returns a -.IR malloc (3)-allocated -buffer containing the next line of input delimited by -.IR delim , -terminated by a NUL (0) byte. -Unlike -.IR Brdline , -which returns when its buffer is full even if no delimiter has been found, -.I Brdstr -will return an arbitrarily long line in a single call. -If -.I nulldelim -is set, the terminal delimiter will be overwritten with a NUL. -After a successful call to -.IR Brdstr , -the return value of -.I Blinelen -will be the length of the returned buffer, excluding the NUL. -.PP -.I Bgetc -returns the next byte from -.IR bp , -or a negative value -at end of file. -.I Bungetc -may be called immediately after -.I Bgetc -to allow the same byte to be reread. -.PP -.I Bgetrune -calls -.I Bgetc -to read the bytes of the next -.SM UTF -sequence in the input stream and returns the value of the rune -represented by the sequence. -It returns a negative value -at end of file. -.I Bungetrune -may be called immediately after -.I Bgetrune -to allow the same -.SM UTF -sequence to be reread as either bytes or a rune. -.I Bungetc -and -.I Bungetrune -may back up a maximum of five bytes. -.PP -.I Bgetd -uses -.I fmtcharstod -(undocumented) -and -.I Bgetc -to read the formatted -floating-point number in the input stream, -skipping initial blanks and tabs. -The value is stored in -.BR *d. -.PP -.I Bread -reads -.I nbytes -of data from -.I bp -into memory starting at -.IR addr . -The number of bytes read is returned on success -and a negative value is returned if a read error occurred. -.PP -.I Bseek -applies -.IR lseek (2) -to -.IR bp . -It returns the new file offset. -.I Boffset -returns the file offset of the next character to be processed. -.PP -.I Bputc -outputs the low order 8 bits of -.I c -on -.IR bp . -If this causes a -.IR write -to occur and there is an error, -a negative value is returned. -Otherwise, a zero is returned. -.PP -.I Bputrune -calls -.I Bputc -to output the low order -16 bits of -.I c -as a rune -in -.SM UTF -format -on the output stream. -.PP -.I Bprint -is a buffered interface to -.IR print (2). -If this causes a -.IR write -to occur and there is an error, -a negative value -.RB ( Beof ) -is returned. -Otherwise, the number of bytes output is returned. -.I Bvprint -does the same except it takes as argument a -.B va_list -parameter, so it can be called within a variadic function. -.PP -.I Bwrite -outputs -.I nbytes -of data starting at -.I addr -to -.IR bp . -If this causes a -.IR write -to occur and there is an error, -a negative value is returned. -Otherwise, the number of bytes written is returned. -.PP -.I Bflush -causes any buffered output associated with -.I bp -to be written. -The return is as for -.IR Bputc . -.I Bflush -is called on -exit for every buffer still open -for writing. -.PP -.I Bbuffered -returns the number of bytes in the buffer. -When reading, this is the number of bytes still available from the last -read on the file; when writing, it is the number of bytes ready to be -written. -.PP -This library uses -.IR fmt (3) -for diagnostic messages about internal errors, -as well as for the implementation of -.I Bprint -and -.IR Bvprint . -It uses -.IR utf (3) -for the implementation of -.I Bgetrune -and -.IR Bputrune . -.SH SEE ALSO -.IR atexit (3). -.IR open (2), -.IR print (3), -.IR utf (7) -.SH DIAGNOSTICS -.I Bio -routines that return integers yield -.B Beof -if -.I bp -is not the descriptor of an open file. -.I Bopen -returns zero if the file cannot be opened in the given mode. -.SH HISTORY -The -.IR bio (3) -library originally appeared in Plan 9. -This is a port of the Plan 9 bio library. -.SH BUGS -.I Brdline -returns an error on strings longer than the buffer associated -with the file -and also if the end-of-file is encountered -before a delimiter. -.I Blinelen -will tell how many characters are available -in these cases. -In the case of a true end-of-file, -.I Blinelen -will return zero. -At the cost of allocating a buffer, -.I Brdstr -sidesteps these issues. -.PP -The data returned by -.I Brdline -may be overwritten by calls to any other -.I bio -routine on the same -.IR bp. diff --git a/src/libbio/bio.h b/src/libbio/bio.h deleted file mode 100644 index c4812392..00000000 --- a/src/libbio/bio.h +++ /dev/null @@ -1,79 +0,0 @@ -#ifndef _BIOH_ -#define _BIOH_ 1 - -#include /* for off_t */ -#include /* for O_RDONLY, O_WRONLY */ - -typedef struct Biobuf Biobuf; - -enum -{ - Bsize = 8*1024, - Bungetsize = 4, /* space for ungetc */ - Bmagic = 0x314159, - Beof = -1, - Bbad = -2, - - Binactive = 0, /* states */ - Bractive, - Bwactive, - Bracteof, - - Bend -}; - -struct Biobuf -{ - int icount; /* neg num of bytes at eob */ - int ocount; /* num of bytes at bob */ - int rdline; /* num of bytes after rdline */ - int runesize; /* num of bytes of last getrune */ - int state; /* r/w/inactive */ - int fid; /* open file */ - int flag; /* magic if malloc'ed */ - off_t offset; /* offset of buffer in file */ - int bsize; /* size of buffer */ - unsigned char* bbuf; /* pointer to beginning of buffer */ - unsigned char* ebuf; /* pointer to end of buffer */ - unsigned char* gbuf; /* pointer to good data in buf */ - unsigned char b[Bungetsize+Bsize]; -}; - -#define BGETC(bp)\ - ((bp)->icount?(bp)->bbuf[(bp)->bsize+(bp)->icount++]:Bgetc((bp))) -#define BPUTC(bp,c)\ - ((bp)->ocount?(bp)->bbuf[(bp)->bsize+(bp)->ocount++]=(c),0:Bputc((bp),(c))) -#define BOFFSET(bp)\ - (((bp)->state==Bractive)?\ - (bp)->offset + (bp)->icount:\ - (((bp)->state==Bwactive)?\ - (bp)->offset + ((bp)->bsize + (bp)->ocount):\ - -1)) -#define BLINELEN(bp)\ - (bp)->rdline -#define BFILDES(bp)\ - (bp)->fid - -int Bbuffered(Biobuf*); -int Bfildes(Biobuf*); -int Bflush(Biobuf*); -int Bgetc(Biobuf*); -int Bgetd(Biobuf*, double*); -int Binit(Biobuf*, int, int); -int Binits(Biobuf*, int, int, unsigned char*, int); -int Blinelen(Biobuf*); -off_t Boffset(Biobuf*); -Biobuf* Bopen(char*, int); -int Bprint(Biobuf*, char*, ...); -int Bputc(Biobuf*, int); -void* Brdline(Biobuf*, int); -long Bread(Biobuf*, void*, long); -off_t Bseek(Biobuf*, off_t, int); -int Bterm(Biobuf*); -int Bungetc(Biobuf*); -long Bwrite(Biobuf*, void*, long); -char* Brdstr(Biobuf*, int, int); -long Bgetrune(Biobuf*); -int Bputrune(Biobuf*, long); - -#endif diff --git a/src/libbio/bundle.ports b/src/libbio/bundle.ports deleted file mode 100644 index bea32d34..00000000 --- a/src/libbio/bundle.ports +++ /dev/null @@ -1,45 +0,0 @@ ---- Makefile --- -# New ports collection makefile for: libbio -# Date Created: 11 Feb 2003 -# Whom: rsc -# -# THIS LINE NEEDS REPLACING. IT'S HERE TO GET BY PORTLINT -# $FreeBSD: ports/devel/libbio/Makefile,v 1.1 2003/02/12 00:51:22 rsc Exp $ - -PORTNAME= libbio -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/libfmt ${PORTSDIR}/devel/libutf - -MAN3= bio.3 -USE_REINPLACE= yes - -.include - -post-patch: - ${REINPLACE_CMD} -e 's,$$(PREFIX),${PREFIX},g' ${WRKSRC}/Makefile - -.include ---- pkg-comment --- -Simple buffered I/O library from Plan 9 ---- pkg-descr --- -Libbio is a port of Plan 9's formatted I/O library. -It provides most of the same functionality as stdio or sfio, -but with a simpler interface and smaller footprint. - -WWW: http://pdos.lcs.mit.edu/~rsc/software/#libbio -http://plan9.bell-labs.com/magic/man2html/2/bio - -Russ Cox -rsc@post.harvard.edu ---- pkg-plist --- -lib/libbio.a -include/bio.h ---- /dev/null --- -This is just a way to make sure blank lines don't -creep into pkg-plist. diff --git a/src/libbio/mkfile b/src/libbio/mkfile deleted file mode 100644 index bb99a25a..00000000 --- a/src/libbio/mkfile +++ /dev/null @@ -1 +0,0 @@ -<../libutf/mkfile diff --git a/src/libbio/rpm.spec b/src/libbio/rpm.spec deleted file mode 100644 index 5cb9830c..00000000 --- a/src/libbio/rpm.spec +++ /dev/null @@ -1,30 +0,0 @@ -Summary: Simple buffered I/O library from Plan 9 -Name: libbio -Version: 2.0 -Release: 1 -Group: Development/C -Copyright: LGPL -Packager: Russ Cox -Source: http://pdos.lcs.mit.edu/~rsc/software/libbio-2.0.tgz -URL: http://pdos.lcs.mit.edu/~rsc/software/#libbio -Requires: libfmt libutf - -%description -Libbio is a port of Plan 9's formatted I/O library. -It provides most of the same functionality as stdio or sfio, -but with a simpler interface and smaller footprint. - -http://plan9.bell-labs.com/magic/man2html/2/bio -%prep -%setup - -%build -make - -%install -make install - -%files -/usr/local/include/bio.h -/usr/local/lib/libbio.a -/usr/local/man/man3/bio.3 -- cgit v1.2.3