Browse Source

Plan 9 from Bell Labs 2004-02-25

David du Colombier 18 years ago
parent
commit
0e28fba470

+ 7 - 5
dist/replica/plan9.db

@@ -524,7 +524,7 @@
 386/lib/lib9p.a - 664 sys sys 1073851264 80496
 386/lib/libString.a - 664 sys sys 1073851264 22204
 386/lib/libauth.a - 664 sys sys 1076990357 56134
-386/lib/libauthsrv.a - 664 sys sys 1073851265 33806
+386/lib/libauthsrv.a - 664 sys sys 1077636970 33806
 386/lib/libbin.a - 664 sys sys 1073851265 2556
 386/lib/libbio.a - 664 sys sys 1073851265 28338
 386/lib/libc.a - 664 sys sys 1077076820 504454
@@ -543,7 +543,7 @@
 386/lib/libmemdraw.a - 664 sys sys 1073851273 291288
 386/lib/libmemlayer.a - 664 sys sys 1073851273 47636
 386/lib/libmp.a - 664 sys sys 1077508785 77700
-386/lib/libndb.a - 664 sys sys 1073851273 54474
+386/lib/libndb.a - 664 sys sys 1077636970 54474
 386/lib/libplumb.a - 664 sys sys 1073851274 18876
 386/lib/libregexp.a - 664 sys sys 1073851274 37502
 386/lib/libscribble.a - 664 sys sys 1073851274 107542
@@ -3413,7 +3413,7 @@ sys/include/memdraw.h - 664 sys sys 1039752978 5616
 sys/include/memlayer.h - 664 sys sys 1051031022 1851
 sys/include/mouse.h - 664 sys sys 1035232010 1003
 sys/include/mp.h - 664 sys sys 1014929065 4610
-sys/include/ndb.h - 664 sys sys 1032058245 3781
+sys/include/ndb.h - 664 sys sys 1077632684 4009
 sys/include/nfs3.h - 664 sys sys 1045589438 15082
 sys/include/plumb.h - 664 sys sys 1014929065 989
 sys/include/pool.h - 664 sys sys 1032058257 1156
@@ -3891,14 +3891,16 @@ sys/lib/lp/process - 20000000775 sys sys 1015012169 0
 sys/lib/lp/process/dpost - 775 sys sys 1015012079 2412
 sys/lib/lp/process/dvipost - 775 sys sys 954037459 3123
 sys/lib/lp/process/g3post - 775 sys sys 954037459 2348
-sys/lib/lp/process/generic - 775 sys sys 1015700868 4064
+sys/lib/lp/process/generic - 775 sys sys 1077634895 4849
 sys/lib/lp/process/gifpost - 775 sys sys 1015012079 2317
 sys/lib/lp/process/gspipe - 775 sys sys 1015012079 434
+sys/lib/lp/process/gspipeijs - 775 sys sys 1077670465 949
 sys/lib/lp/process/hpost - 775 sys sys 1057868801 3247
 sys/lib/lp/process/jpgpost - 775 sys sys 1015012079 2313
 sys/lib/lp/process/noproc - 775 sys sys 954037459 62
 sys/lib/lp/process/p9bitpost - 775 sys sys 954037459 2436
 sys/lib/lp/process/pdfgs - 775 sys sys 1016833869 1732
+sys/lib/lp/process/pdfgsijs - 775 sys sys 1077634892 1687
 sys/lib/lp/process/pdfpost - 775 sys sys 1015012079 2100
 sys/lib/lp/process/post - 775 sys sys 1045164703 1955
 sys/lib/lp/process/ppost - 775 sys sys 969500538 2874
@@ -4833,7 +4835,7 @@ sys/man/2/mouse - 664 sys sys 971455512 4966
 sys/man/2/mp - 664 sys sys 1071238964 10690
 sys/man/2/muldiv - 664 sys sys 984709633 639
 sys/man/2/nan - 664 sys sys 975084242 937
-sys/man/2/ndb - 664 sys sys 1050078464 7686
+sys/man/2/ndb - 664 sys sys 1077632681 8901
 sys/man/2/notify - 664 sys sys 1032058674 6376
 sys/man/2/object - 664 sys sys 944959695 3864
 sys/man/2/open - 664 sys sys 1015091524 3404

+ 7 - 0
dist/replica/plan9.log

@@ -13989,3 +13989,10 @@
 1077508821 0 c 386/bin/snoopy - 775 sys sys 1077508785 153943
 1077508821 1 c 386/lib/libmp.a - 664 sys sys 1077508785 77700
 1077595239 0 c sys/man/6/font - 664 sys sys 1077594184 2528
+1077633046 0 c sys/include/ndb.h - 664 sys sys 1077632684 4009
+1077633046 1 c sys/man/2/ndb - 664 sys sys 1077632681 8901
+1077636646 0 c sys/lib/lp/process/generic - 775 sys sys 1077634895 4849
+1077636646 1 a sys/lib/lp/process/pdfgsijs - 775 sys sys 1077634892 1687
+1077638447 0 c 386/lib/libauthsrv.a - 664 sys sys 1077636970 33806
+1077638447 1 c 386/lib/libndb.a - 664 sys sys 1077636970 54474
+1077670852 0 a sys/lib/lp/process/gspipeijs - 775 sys sys 1077670465 949

+ 18 - 13
sys/include/ndb.h

@@ -120,21 +120,26 @@ struct Ndbs
 
 #define NDB_IPlen 16
 
-ulong		ndbhash(char*, int);
-Ndbtuple*	ndbparse(Ndb*);
-void		ndbfree(Ndbtuple*);
-Ndb*		ndbopen(char*);
+Ndbtuple*	csgetval(char*, char*, char*, char*, char*);
+Ndbtuple*	csipinfo(char*, char*, char*, char**, int);
+Ndbtuple*	dnsquery(char*, char*, char*);
+char*		ipattr(char*);
 Ndb*		ndbcat(Ndb*, Ndb*);
-int		ndbreopen(Ndb*);
+int		ndbchanged(Ndb*);
 void		ndbclose(Ndb*);
+Ndbtuple*	ndbconcatenate(Ndbtuple*, Ndbtuple*);
+Ndbtuple*	ndbdiscard(Ndbtuple*, Ndbtuple*);
+void		ndbfree(Ndbtuple*);
+Ndbtuple*	ndbgetipaddr(Ndb*, char*);
+Ndbtuple*	ndbgetval(Ndb*, Ndbs*, char*, char*, char*, char*);
+ulong		ndbhash(char*, int);
+Ndbtuple*	ndbipinfo(Ndb*, char*, char*, char**, int);
 Ndbtuple*	ndblookval(Ndbtuple*, Ndbtuple*, char*, char*);
-long		ndbseek(Ndb*, long);
+Ndb*		ndbopen(char*);
+Ndbtuple*	ndbparse(Ndb*);
+int		ndbreopen(Ndb*);
+Ndbtuple*	ndbreorder(Ndbtuple*, Ndbtuple*);
 Ndbtuple*	ndbsearch(Ndb*, Ndbs*, char*, char*);
+long		ndbseek(Ndb*, long);
 Ndbtuple*	ndbsnext(Ndbs*, char*, char*);
-Ndbtuple*	ndbgetval(Ndb*, Ndbs*, char*, char*, char*, char*);
-Ndbtuple*	csgetval(char*, char*, char*, char*, char*);
-char*		ipattr(char*);
-Ndbtuple*	ndbipinfo(Ndb*, char*, char*, char**, int);
-Ndbtuple*	csipinfo(char*, char*, char*, char**, int);
-Ndbtuple*	dnsquery(char*, char*, char*);
-int		ndbchanged(Ndb *db);
+Ndbtuple*	ndbsubstitute(Ndbtuple*, Ndbtuple*, Ndbtuple*);

+ 12 - 1
sys/lib/lp/process/generic

@@ -1,3 +1,4 @@
+--------/sys/lib/lp/process/generic--------
 #!/bin/rc
 # Tries to determine what type of file you are printing and do the correct
 # thing with it.
@@ -19,7 +20,7 @@ case troff;
 					case UTF; $LPLIB/process/tr2post < $TMPFILE
 					}
 
-	case *gs!*;	switch ($FILETYPE(5)) {
+	case *gs!* *gsijs!*;	switch ($FILETYPE(5)) {
 					# Latin1 is for compatibility with old research UNIX systems, doesn't work on Plan 9
 					case Latin1 post; tcs -s -f utf -t latin1 < $TMPFILE |$LPLIB/process/dpost |$LPLIB/process/gspipe
 
@@ -33,6 +34,7 @@ case special;
 	case '#b';		switch ($LPCLASS) {
 				case *post*;	$LPLIB/process/p9bitpost < $TMPFILE
 				case *gs!*;	$LPLIB/process/p9bitpost < $TMPFILE |$LPLIB/process/gspipe
+				case *gsijs!*;	$LPLIB/process/p9bitpost < $TMPFILE |$LPLIB/process/gspipeijs
 				}
 
 	case *;		echo $FILETYPE file is improper for $LPDEST >[1=2]
@@ -42,23 +44,27 @@ case Compressed plan old;	# type is really 'Compressed image' or 'plan 9 image'
 	switch ($LPCLASS) {
 	case *post*;	$LPLIB/process/p9bitpost < $TMPFILE
 	case *gs!*;	$LPLIB/process/p9bitpost < $TMPFILE |$LPLIB/process/gspipe
+	case *gsijs!*;	$LPLIB/process/p9bitpost < $TMPFILE |$LPLIB/process/gspipeijs
 	}
 case jpeg;
 	switch ($LPCLASS) {
 	case *post*;	$LPLIB/process/jpgpost < $TMPFILE
 	case *gs!*;	$LPLIB/process/jpgpost < $TMPFILE |$LPLIB/process/gspipe
+	case *gsijs!*;	$LPLIB/process/jpgpost < $TMPFILE |$LPLIB/process/gspipeijs
 	}
 
 case GIF;
 	switch ($LPCLASS) {
 	case *post*;	$LPLIB/process/gifpost < $TMPFILE
 	case *gs!*;	$LPLIB/process/gifpost < $TMPFILE |$LPLIB/process/gspipe
+	case *gsijs!*;	$LPLIB/process/gifpost < $TMPFILE |$LPLIB/process/gspipeijs
 	}
 
 case ccitt-g31;
 	switch ($LPCLASS) {
 	case *post*;	$LPLIB/process/g3post < $TMPFILE
 	case *gs!*;	$LPLIB/process/g3post < $TMPFILE |$LPLIB/process/gspipe
+	case *gsijs!*;	$LPLIB/process/g3post < $TMPFILE |$LPLIB/process/gspipeijs
 	}
 
 # bitmap for research UNIX compatibility, does not work on Plan 9.
@@ -74,12 +80,14 @@ case tex;
 	switch ($LPCLASS) {
 	case *post*;	$LPLIB/process/dvipost $TMPFILE
 	case *gs!*;	$LPLIB/process/dvipost $TMPFILE |$LPLIB/process/gspipe
+	case *gsijs!*;	$LPLIB/process/dvipost $TMPFILE |$LPLIB/process/gspipeijs
 	case *;		echo $FILETYPE(2) file is improper for $LPDEST >[1=2]
 	}
 case postscript;
 	switch ($LPCLASS) {
 	case *post*;		$LPLIB/process/post < $TMPFILE
 	case *gs!*;		$LPLIB/process/post < $TMPFILE |$LPLIB/process/gspipe
+	case *gsijs!*;		$LPLIB/process/post < $TMPFILE |$LPLIB/process/gspipeijs
 	case *;			echo $FILETYPE(2) file is improper for $LPDEST >[1=2]
 	}
 case HPJCL;
@@ -95,6 +103,7 @@ case English short extended alef limbo [Aa]scii assembler c latin rc sh as mail
 	switch ($LPCLASS) {
 	case *post*;	$LPLIB/process/ppost < $TMPFILE
 	case *gs!*;	$LPLIB/process/ppost < $TMPFILE |$LPLIB/process/gspipe
+	case *gsijs!*;	$LPLIB/process/ppost < $TMPFILE |$LPLIB/process/gspipeijs
 	case *canon*;	$LPLIB/process/can $* < $TMPFILE
 	case *;		echo Unrecognized class of line printer for $LPDEST >[1=2]
 	}
@@ -103,12 +112,14 @@ case tiff;
 	switch ($LPCLASS) {
 	case *post*;	$LPLIB/process/tiffpost $TMPFILE
 	case *gs!*;	$LPLIB/process/tiffpost $TMPFILE |$LPLIB/process/gspipe
+	case *gsijs!*;	$LPLIB/process/tiffpost $TMPFILE |$LPLIB/process/gspipeijs
 	case *;		echo Unrecognized class of line printer for $LPDEST >[1=2]
 	}
 case PDF;
 	switch ($LPCLASS) {
 	case *post*;	$LPLIB/process/pdfpost $TMPFILE
 	case *gs!*;	$LPLIB/process/pdfgs $TMPFILE
+	case *gsijs!*;	$LPLIB/process/pdfgsijs $TMPFILE
 	case *;		echo Unrecognized class of line printer for $LPDEST >[1=2]
 	}
 case empty;

+ 35 - 0
sys/lib/lp/process/gspipeijs

@@ -0,0 +1,35 @@
+#!/bin/rc
+# extended to IJS driver by K.Okamoto
+# duble-sided printing for PSC 2550 printer
+#
+if (! ~ $DEBUG '') flag x +
+
+# usage: gspipeijs [dev]
+# assumes postscript on stdin
+
+switch($#*) {
+case 0
+	MODEL=`{echo $LPCLASS | sed 's/(.*\+)?gsijs!([^+]*)(\+.*)?/\2/'}
+	NUMBER=`{echo $LPCLASS | sed 's/(.*\+)?gsijs!([^+]*)\+(.*)?/\3/'}
+case 1
+	IJS=$1
+case *
+	echo 'usage: gspipeijs [dev]' >[1=2]
+	exit gspipeijs
+}
+
+GSTMPFILE=/tmp/gsp$pid
+
+switch($NUMBER) {
+case 2100
+	GSOPT=(-q -sDEVICE'='ijs -sIjsServer'='hpijs -sDeviceManufacturer'='HP '-sDeviceModel='"$MODEL^' '^$NUMBER" -r600 -sOutputFile'='^$GSTMPFILE -sPAPERSIZE'='a4 -dIjsUseOutputFD -dSAFER -dNOPAUSE -DBATCH)
+case 2500
+	GSOPT=(-q -sDEVICE'='ijs -sIjsServer'='hpijs -sDeviceManufacturer'='HP '-sDeviceModel='"$MODEL^' '^$NUMBER" -r600 -sOutputFile'='^$GSTMPFILE -dDuplex'='true -sPAPERSIZE'='a4 -dIjsUseOutputFD -dSAFER -dNOPAUSE -DBATCH)
+}
+
+gs $GSOPT  - 
+
+cat $GSTMPFILE
+rm $GSTMPFILE
+
+exit

+ 63 - 0
sys/lib/lp/process/pdfgsijs

@@ -0,0 +1,63 @@
+#!/bin/rc
+
+# usage: pdfgsijs pdffile
+
+gs -dSAFER -dNOPAUSE -dBATCH -q -s'DEVICE=pswrite' -d'LanguageLevel=2' -s'OutputFile=/tmp/pdf2ps.ps' $1
+
+MODEL=`{echo $LPCLASS | sed 's/(.*\+)?gsijs!([^+]*)(\+.*)?/\2/'}
+NUMBER=`{echo $LPCLASS | sed 's/(.*\+)?gsijs!([^+]*)\+(.*)?/\3/'}
+
+GSTMPFILE=/tmp/pdf^$pid
+
+switch($NUMBER) {
+case 2100
+	GSOPT=(-q -sDEVICE'='ijs -sIjsServer'='hpijs -sDeviceManufacturer'='HP '-sDeviceModel='"$MODEL^' '^$NUMBER" -r600 -sOutputFile'='^$GSTMPFILE  -sPAPERSIZE'='a4 -dIjsUseOutputFD -dSAFER -dNOPAUSE -dBATCH)
+case 2500
+	GSOPT=(-q -sDEVICE'='ijs -sIjsServer'='hpijs -sDeviceManufacturer'='HP '-sDeviceModel='"$MODEL^' '^$NUMBER" -r600 -sOutputFile'='^$GSTMPFILE -dDuplex'='true -sPAPERSIZE'='a4 -dIjsUseOutputFD -dSAFER -dNOPAUSE -DBATCH)
+}
+
+
+if(~ $OLIST '')
+	gs $GSOPT /tmp/pdf2ps.ps
+if not {
+	PGLIST=`{echo $OLIST | sed 's/-o//;s/,/ /g;s/	/ /g' | tr -cd '0-9 -'}
+	GSPGLIST=()
+	for(i in $PGLIST){
+		switch($i){
+		case -*
+			GSPGLIST=($GSPGLIST `{seq 1 `{echo $i|tr -d '-'}})
+		case *-
+			# BUG assume 100 >= number of pages
+			GSPGLIST=($GSPGLIST `{seq `{echo $i|tr -d '-'} 100})
+		case *-*
+			GSPGLIST=($GSPGLIST `{seq `{echo $i|tr '-' ' '}})
+		case *
+			GSPGLIST=($GSPGLIST $i)
+		}
+	}
+	GSPGLIST=$"GSPGLIST
+	echo '
+		/Page null def
+		/Page# 0 def
+		/PDFSave null def
+		/DSCPageCount 0 def
+		/DoPDFPage {dup /Page# exch store pdfgetpage pdfshowpage} def
+		GS_PDF_ProcSet begin
+		pdfdict begin
+		('^$1^') (r) file pdfopen begin
+		/npage pdfpagecount def
+		['^$GSPGLIST^']
+		{
+			dup dup
+				1 ge exch npage le and 
+				{ DoPDFPage }
+				{ pop }
+			ifelse
+		} forall
+	' | gs $GSOPT - >/dev/null >[2=1]
+}
+
+cat $GSTMPFILE
+rm -f $GSTMPFILE
+rm -f /tmp/pdf2ps.ps
+exit ''

+ 75 - 4
sys/man/2/ndb

@@ -1,6 +1,6 @@
 .TH NDB 2
 .SH NAME
-ndbopen, ndbcat, ndbchanged, ndbclose, ndbreopen, ndbsearch, ndbsnext, ndbgetval, ndbfree, ipattr, ndbipinfo, csipinfo, ndbhash, ndbparse, csgetval, ndblookval, dnsquery \- network database
+ndbopen, ndbcat, ndbchanged, ndbclose, ndbreopen, ndbsearch, ndbsnext, ndbgetval, ndbfree, ipattr, ndbgetipaddr, ndbipinfo, csipinfo, ndbhash, ndbparse, csgetval, ndblookval, dnsquery, ndbdiscard, ndbconcatenate, ndbreorder, ndbsubstitute \- network database
 .SH SYNOPSIS
 .B #include <u.h>
 .br
@@ -42,10 +42,10 @@ Ndbtuple*	ndbgetval(Ndb *db, Ndbs *s, char *attr, char *val,
 Ndbtuple*	csgetval(char *netroot, char *attr, char *val, char *rattr, char *buf)
 .PP
 .B
-void	ndbfree(Ndbtuple *db)
+char*	ipattr(char *name)
 .PP
 .B
-char*	ipattr(char *name)
+Ndbtuple*	ndbgetipaddr(Ndb *db, char *sys);
 .PP
 .B
 Ndbtuple*	ndbipinfo(Ndb *db, char *attr, char *val, char **attrs,
@@ -68,6 +68,21 @@ Ndbtuple*	dnsquery(char *netroot, char *domainname, char *type)
 .PP
 .B
 Ndbtuple*	ndblookval(Ndbtuple *entry, Ndbtuple *line, char *attr, char *to)
+.PP
+.B
+void	ndbfree(Ndbtuple *db)
+.PP
+.B
+Ndbtuple*	ndbdiscard(Ndbtuple  *t, Ndbtuple *a)
+.PP
+.B
+Ndbtuple*	ndbconcatenate(Ndbtuple *a, Ndbtuple *b);
+.PP
+.B
+Ndbtuple*	ndbreorder(Ndbtuple *t, Ndbtuple *a);
+.PP
+.B
+Ndbtuple*	ndbsubstitute(Ndbtuple *t, Ndbtuple *from, Ndbtuple *to);
 .SH DESCRIPTION
 These routines are used by network administrative programs to search
 the network database.
@@ -213,6 +228,21 @@ Internet number
 system name
 .RE
 .PP
+.I Ndbgetipaddr
+looks in
+.I db
+for an entry matching
+.I sys
+as the value of a
+.B sys=
+or
+.B dom=
+attribute/value pair and returns all IP addresses in the entry.
+If
+.I sys
+is already an IP address, a tuple containing just
+that address is returned.
+.PP
 .I Ndbipinfo
 looks up Internet protocol information about a system.
 This is an IP aware search.  It looks first for information
@@ -260,7 +290,7 @@ as
 is to
 .IR ndbgetval .
 .PP
-The last three calls are used by programs that create the
+The next three routines are used by programs that create the
 hash tables and database files.
 .I Ndbhash
 computes a hash offset into a table of length
@@ -371,6 +401,47 @@ routine can be used by the application to periodicly
 check for changes.  It returns zero
 if none of the files comprising the database have
 changes and non-zero if they have.
+.PP
+Finally, a number of routines are provided for manipulating
+tuples.
+.PP
+.I Ndbdiscard
+removes attr/val pair
+.I a
+from tuple
+.I t
+and frees it.
+If
+.I a
+isn't in
+.I t
+it is just freed.
+.PP
+.I Ndbconcatenate
+concatenates two tuples and returns the result.  Either
+or both tuples may be nil.
+.PP
+.I Ndbreorder
+reorders a tuple
+.IR t
+to make the line containing attr/val pair
+.I a
+first in the entry and making
+.I a
+first in its line.
+.PP
+.I Ndbsubstitute
+replaces a single att/val pair
+.I from
+in
+.I t
+with the tuple
+.IR to .
+All attr/val pairs in
+.I to
+end up on the same line.
+.I from
+is freed.
 .SH FILES
 .BR /lib/ndb "    directory of network database files
 .SH SOURCE