diff options
| author | Jacob McDonnell <jacob@jacobmcdonnell.com> | 2026-04-26 16:38:00 -0400 |
|---|---|---|
| committer | Jacob McDonnell <jacob@jacobmcdonnell.com> | 2026-04-26 16:38:00 -0400 |
| commit | 97d5c458cfa039d857301e1ca7d5af3beb37131d (patch) | |
| tree | b460cd850d0537eb71806ba30358840377b27688 /static/unix-v10/man3 | |
| parent | b89dc2331a50c63f8b33272a5c4c61ab98abdaa3 (diff) | |
build: Better Build System
Diffstat (limited to 'static/unix-v10/man3')
165 files changed, 16247 insertions, 0 deletions
diff --git a/static/unix-v10/man3/Makefile b/static/unix-v10/man3/Makefile new file mode 100644 index 00000000..c070e829 --- /dev/null +++ b/static/unix-v10/man3/Makefile @@ -0,0 +1,3 @@ +MAN = $(wildcard *.3) + +include ../../mandoc.mk diff --git a/static/unix-v10/man3/abort.3 b/static/unix-v10/man3/abort.3 new file mode 100644 index 00000000..aea85081 --- /dev/null +++ b/static/unix-v10/man3/abort.3 @@ -0,0 +1,19 @@ +.TH ABORT 3 +.CT 2 proc_man +.SH NAME +abort \- generate a fault +.SH SYNOPSIS +.B int abort() +.PP +.SH DESCRIPTION +.I Abort +sends the current process a +.L SIGIOT +signal, which normally terminates +the process with a core dump. +.SH SEE ALSO +.IR adb (1), +.IR signal (2), +.IR exit (2) +.SH DIAGNOSTICS +Usually `abort \- core dumped' from the shell. diff --git a/static/unix-v10/man3/arith.3 b/static/unix-v10/man3/arith.3 new file mode 100644 index 00000000..d5b6a5c8 --- /dev/null +++ b/static/unix-v10/man3/arith.3 @@ -0,0 +1,97 @@ +.TH ARITH 3 +.CT 2 math +.SH NAME +abs, sgn, gcd, lcm, min, max, labs \(mi integer arithmetic functions: +absolute value, sign, +greatest common divisor, least common multiple, minimum, maximum +.SH SYNOPSIS +.B int abs(a) +.PP +.B int sgn(a) +.PP +.B int gcd(a, b) +.PP +.B long lcm(a, b) +.PP +.B int min(a, b) +.PP +.B int max(a, b) +.PP +.B long labs(a) +.br +.B long a; +.SH DESCRIPTION +.I Abs +returns +the absolute value of +.I a. +.PP +.I Sgn +returns +\-1, 0, 1, +if +.L +\fIa\fR<0, \fIa\fR=0, \fIa\fR>0, +respectively. +.PP +.I Gcd +returns the greatest common divisor of +.I a +and +.I b. +More precisely, +.I gcd +returns the largest machine-representable +generator of the ideal generated by +.I a +and +.I b. +This means that +.B gcd(0,0) += 0, and +.B gcd(N,0) += +.B gcd(N,N) += +.BR N , +where +.B N +is the most negative integer. +.PP +.I Lcm +returns the least common multiple of +.I a +and +.I b. +When the result is representable, it satisfies +.BR "abs(a*b)== lcm(a,b)*gcd(a,b)" . +.PP +.I Min +.RI ( max ) +returns the minimum (maximum) of +.I a +and +.I b. +.SH SEE ALSO +.IR floor (3) +for +.I fabs +.SH DIAGNOSTICS +.I Abs +returns +the most negative integer when the true result is unrepresentable. +.PP +There are no guarantees about the value of +.I lcm +when the true value is unrepresentable. +.SH BUGS +The result of +.I lcm +is undefined when it doesn't fit in a long. +.br +.I Labs, +provided for +.SM ANSI +compatibility, is lonely; there is no +.I lsign, lmax, +etc. diff --git a/static/unix-v10/man3/assert.3 b/static/unix-v10/man3/assert.3 new file mode 100644 index 00000000..973b6d36 --- /dev/null +++ b/static/unix-v10/man3/assert.3 @@ -0,0 +1,38 @@ +.TH ASSERT 3X +.CT 2 debug_tune +.SH NAME +assert \(mi assertion checking +.SH SYNOPSIS +.B #include <assert.h> +.PP +.B void assert(expression); +.SH DESCRIPTION +.PP +.I Assert +is a macro that indicates +.I expression +is expected to be nonzero at this point in the program. +It causes an +.IR abort (3) +with a diagnostic comment on the standard output +when +.I expression +is zero. +Compiling with the +.IR cc (1) +option +.B -DNDEBUG +effectively makes the expression always nonzero. +.SH DIAGNOSTICS +`Assertion failed: file +.I f +line +.I n', +where +.I f +is the source file and +.I n +the source line number +of the +.I assert +statement. diff --git a/static/unix-v10/man3/atan.3 b/static/unix-v10/man3/atan.3 new file mode 100644 index 00000000..543c8edd --- /dev/null +++ b/static/unix-v10/man3/atan.3 @@ -0,0 +1,29 @@ +.pa 1 +.he 'ATAN, ATAN2 (III)'1/15/73'ATAN, ATAN2 (III)' +.ti 0 +NAME atan -- arc tangent function +.sp +.ti 0 +SYNOPSIS jsr r5,atan[2] +.sp +.ti 0 +DESCRIPTION The +atan entry returns the arc tangent +of fr0 in fr0. +The range is -J/2 to J/2. +.sp +The atan2 entry returns the arc tangent +of fr0/fr1 in fr0. +The range is -J to J. +.sp +.ti 0 +FILES kept in /lib/liba.a +.sp +.ti 0 +SEE ALSO -- +.sp +.ti 0 +DIAGNOSTICS there is no error return +.sp +.ti 0 +BUGS -- diff --git a/static/unix-v10/man3/atof.3 b/static/unix-v10/man3/atof.3 new file mode 100644 index 00000000..07d59613 --- /dev/null +++ b/static/unix-v10/man3/atof.3 @@ -0,0 +1,43 @@ +.pa 1 +.he 'ATOF (III)'1/15/73'ATOF (III)' +.ti 0 +NAME atof -- ascii to floating +.sp +.ti 0 +SYNOPSIS jsr r5,atof; subr +.sp +.ti 0 +DESCRIPTION atof____ +will convert an ascii stream to a floating +number returned in fr0. + +The subroutine subr____ +(supplied by the caller) +is called on r5 for each character of the +ascii stream. +subr____ should return the character in r0. +The first character not used in the conversion +is left in r0. +.sp +The only numbers recognized are: an optional minus +sign followed by a string of digits optionally containing +one decimal point, then followed optionally by the +letter "e" followed by a signed integer. +.sp +The subroutine subr____ must not disturb any registers. +.sp +.ti 0 +FILES kept in /lib/liba.a +.sp +.ti 0 +SEE ALSO Calls atoi (III) +.sp +.ti 0 +DIAGNOSTICS There are none; overflow results in a very large +number and garbage characters terminate the scan. +.sp +.ti 0 +BUGS The +routine should accept initial "+", initial blanks, and "E" for "e". + +Overflow should be signalled with the carry bit. diff --git a/static/unix-v10/man3/atoi.3 b/static/unix-v10/man3/atoi.3 new file mode 100644 index 00000000..9db85352 --- /dev/null +++ b/static/unix-v10/man3/atoi.3 @@ -0,0 +1,43 @@ +.pa 1 +.he 'ATOI (III)'1/15/73'ATOI (III)' +.ti 0 +NAME atoi -- ascii to integer +.sp +.ti 0 +SYNOPSIS jsr r5,atoi; subr +.sp +.ti 0 +DESCRIPTION atoi____ +will convert an ascii stream to a binary +number returned in r1. + +The subroutine subr____ +(supplied by the caller) +is called on r5 for each character of the +ascii stream. +subr____ should return the character in r0. +The first character not used in the conversion +is left in r0. +.sp +The numbers recognized are: an optional minus sign +followed by a string of digits. +.sp +The subroutine subr____ must not disturb any registers. +.sp +.ti 0 +FILES kept in /lib/liba.a +.sp +.ti 0 +SEE ALSO -- +.sp +.ti 0 +DIAGNOSTICS There are none; +the routine charges on regardless of consequences; see BUGS. +.sp +.ti 0 +BUGS It +pays no attention to overflow - you get whatever the machine +instructions mul and div happen to leave in the low order half +- in fact, the carry bit should be set and isn't. +.sp +The routine should accept initial "+" and initial blanks. diff --git a/static/unix-v10/man3/bessel.3 b/static/unix-v10/man3/bessel.3 new file mode 100644 index 00000000..bdc6b05c --- /dev/null +++ b/static/unix-v10/man3/bessel.3 @@ -0,0 +1,39 @@ +.TH BESSEL 3M +.CT 2 math +.SH NAME +besj0, besj1, besjn, besy0, besy1, besyn \(mi bessel functions +.SH SYNOPSIS +.nf +.B #include <math.h> +.PP +.B double besj0(x) +.B double x; +.PP +.B double besj1(x) +.B double x; +.PP +.B double besjn(n, x) +.B double x; +.PP +.B double besy0(x) +.B double x; +.PP +.B double besy1(x) +.B double x; +.PP +.B double besyn(n, x) +.B double x; +.fi +.SH DESCRIPTION +These functions calculate Bessel functions of the first +and second kinds for real arguments and integer orders. +.SH DIAGNOSTICS +Negative arguments cause +.I besy0, besy1, +and +.I besyn +to return a huge negative value +and set +.I errno +to +.BR EDOM . diff --git a/static/unix-v10/man3/bits.3 b/static/unix-v10/man3/bits.3 new file mode 100644 index 00000000..57318b39 --- /dev/null +++ b/static/unix-v10/man3/bits.3 @@ -0,0 +1,198 @@ +.TH BITS 3+ +.CT 2 datatype +.SH NAME +bits \- variable length bit strings +.SH SYNOPSIS +.nf +.B "#include <Bits.h>" +.PP +.B "typedef unsigned long Bits_chunk;" +.PP +.B "struct Bits {" +.B " Bits() { }" +.B " Bits(Bits_chunk, unsigned = 1);" +.B " Bits(const Bits&)" +.B " ~Bits(); +.BR " Bits& operator= (const Bits&); // " also " = &= |= ^= +.BR " Bits& operator<<= (int); // " also " >>= +.B " int operator[] (unsigned);" +.B " operator Bits_chunk();" +.B " unsigned size();" +.B " unsigned size(unsigned);" +.B " Bits& compl();" +.B " Bits& concat(const Bits&);" +.B " Bits& set(unsigned, unsigned long = 1);" +.B " Bits& reset(unsigned);" +.B " Bits& compl(unsigned);" +.B " unsigned count();" +.B " unsigned signif();" +.B " unsigned trim();" +.B "};" +.PP +.B "Bits operator~ (const Bits&); +.BR "Bits operator& (const Bits&, const Bits&); // " also " | ^ +.BR "Bits operator<< (const Bits&, int); // " also " >> +.BR "int operator< (const Bits&, const Bits&); // " also " > <= >= == != +.fi +.SH DESCRIPTION +A +.B Bits +object contains a variable-length bit string. +The bits of a +.B Bits +object +.I b +are numbered from 0 through +.IB b .size()\fR\-1,\fP +with the rightmost bit numbered 0. +.PP +.B Bits_chunk +is the largest unsigned integral type +acceptable for conversion to and from +.BR Bits , +.BR "unsigned long" +in this implementation. +.SS Constructors +.TP \w'\fIa\fL.concat(\fIb\fL)\ 'u +.B Bits() +An empty bit string. +.TP +.BI Bits( n ) +The bits are copied from the binary representation of +.I n +with the ones-digit of +.I n +becoming bit 0. +Leading zero-bits are removed, +except that +.B Bits(0) +is a one-bit string. +.TP +.BI Bits( n , m ) +The same, but padded with leading zeros to size +.I m +if necessary. +.SS Operators +Bit strings have +value semantics; +assigning a +.B Bits +object or passing it to or returning it from a function +creates a copy of its value. +The meanings of operators are mostly predictable from C. +.PP +Under binary and comparison operators, +the shorter operand +is considered to be padded on the left with zeros to the +length of the longer. +If, after padding, two strings of different length compare equal, +the shorter is deemed the smaller. +.PP +Negative shift amounts +reverse the sense of shift operators. +.PP +Under conversion (or assignment) to a +.BR Bits_chunk , +a +.B Bits +is interpreted as an unsigned integer. +If it has a value small enough to fit, +that value is assigned. +Otherwise, a non-zero value is +assigned. +Thus a +.B Bits +is considered `true' in an +.B if +test if it contains any one-bit, `false' otherwise. +.TP \w'\fIa\fL.concat(\fIb\fL)\ 'u +.IB a [ s ] +Bit number +.I s +of +.IR a ; +0 if +.I s +is out of bounds. +.SS Other functions +.TP \w'\fIa\fL.concat(\fIb\fL)\ 'u +.IB a .size( s ) +Set the size of +.I a +to +.I s +by truncating or padding with zeros on the left as necessary. +Return the new size. +.TP +.IB a .compl() +Complement the bits of +.I a. +Return +.I a. +.TP +.IB a .set( s ) +.PD 0 +.TP +.IB a .reset( s ) +.TP +.IB a .compl ( s ) +Set, reset, or complement bit +.I s +of +.I a. +No effect if +.IB a .size()<= s. +Return +.I a. +.PD +.TP +.IB a .set( s , n ) +If +.I n +is 0, reset bit +.I s +of +.I a, +otherwise set bit +.I s. +Equivalent to +.BR "n? a.set(s): a.reset(s)" . +.TP +.IB a .count() +Return the number of one-bits in +.I a. +.TP +.IB a .signif() +Return the number of significant bits in +.BR a : +one more than the +number of the leftmost one-bit, or +zero if there is no one-bit. +.TP +.IB a .trim() +Discard high-order zero-bits. +Equivalent to +.BR a.size(a.signif()) . +.TP +.IB a .concat( b ) +Concatenate the value of +.I b +to the right (low-order) end of +.I a. +Return +.I a. +.TP +.BI concat( a , b ) +Return a newly created concatenated object. +.SH DIAGNOSTICS +An operation that runs out of memory sets +the length of the affected +.B Bits +to zero. +.SH BUGS +Too bad C++ can't support +.BR "a[s] = n" . +.br +Things would be more consistent if +.B Bits(0).size() +were zero. diff --git a/static/unix-v10/man3/block.3 b/static/unix-v10/man3/block.3 new file mode 100644 index 00000000..a8351c17 --- /dev/null +++ b/static/unix-v10/man3/block.3 @@ -0,0 +1,175 @@ +.TH BLOCK 3+ +.CT 2 datatype +.SH NAME +block \- adjustable arrays +.SH SYNOPSIS +.nf +.B "#include <Block.h>" +.PP +.ds T \fIT\fP +.ft L +Blockdeclare(\*T) +Blockimplement(\*T) +.PP +.ft L +struct Block(\*T) { + Block(\*T)(unsigned = 0); + Block(\*T)(const Block(\*T&); + ~Block(\*T); + Block(\*T)& operator= (const Block(\*T)&); + \*T& operator[] (int); + operator \*T* (); + unsigned size(); + unsigned size(unsigned); + \*T* end(); + void swap(const Block(\*T)&); +} +.ft R +.fi +.SH DESCRIPTION +A +.BI Block( T ) +is an array of zero or more +.IR elements +of type +.I T, +where +.I T +is a type name. +.I T +must have assignment +.RB ( operator= ) +and initialization +.RB ( \*T(\*T&) ) +operations. +.PP +The macro call +.BI Blockdeclare( T ) +declares the class +.BI Block( T ) . +It must appear once in every source file that uses type +.BI Block( T ) . +The macro call +.BI Blockimplement( T ) +defines the functions that implement the block class. +It must appear exactly once in the entire program. +.PP +New elements +are initialized to the value of an otherwise +uninitialized static object of type +.I T. +.SS Constructors +.nr xx \w'\fLBlock(\fIT\fL)(\fIb\fL)' +.TP \n(xxu +.BI Block( T ) +An empty block. +.TP +.BI Block( T )( n ) +A block of +.I n +elements. +.TP +.BI Block( T )( b ) +A new block +whose elements are copies of the elements of +.BR b . +.SS Operations +Assignment copies elements and size. +.TP \n(xxu +.IB b [ k ] +A reference to element +.L k +of block +.IR b ; +undefined if +.I k +is out of bounds. +.TP +.BI ( T *) b +A pointer to the first element of block +.I b. +.SS Other functions +.TP \n(xxu +.IB b .size() +Return the number of elements in +.I b. +.TP +.IB b .size( n ) +Set the size of +.I b +to +.LR n . +If the new size is greater than the old. +Otherwise, +.I n +old elements are kept. +Return the new size. +.TP +.IB b .reserve( n ) +The size of +.I b +is increased, if necessary, to some value greater than +.I n. +If +.I b +already has room, +.I b +is not changed. +Return zero if memory could not be allocated +and non-zero otherwise. +.TP +.IB b .end() +Returns +a pointer to just past the last element in +.LR b . +Equivalent to +.BR (T*)b+b.size() . +.TP +.IB a .swap( b ) +The memory associated with blocks +.I a +and +.I b +is exchanged. +.SS Performance +Most operations +are implemented by the obvious uses of the +.L new +and +.L delete +operators. +.I Reserve +checks the size inline. +If it isn't big enough, the size is increased by multiplying by 3/2 +(and adding one) enough times to increase it beyond +.I n . +.SH EXAMPLES +.EX +Blockdeclare(long) +unsigned n = 0; +Block(long) b; +long x; +while (cin >> x) { + b.reserve(n); + b[n++] = x; +} +.EE +.SH SEE ALSO +.IR malloc (3), +.IR map (3) +.SH DIAGNOSTICS +The only error detected is running out of memory; +this is indicated in all cases by setting the size of the +block for which allocation failed to zero. +.SH BUGS +Elements are copied during reallocation by using +.L T::operator= +instead of +.LR T(T&) . +.br +Because the `type parameter' +.I T +is implemented by the C preprocessor, white space is +forbidden inside the parentheses of +.BI Block( T ) . + diff --git a/static/unix-v10/man3/buildmap.3 b/static/unix-v10/man3/buildmap.3 new file mode 100644 index 00000000..a142dd05 --- /dev/null +++ b/static/unix-v10/man3/buildmap.3 @@ -0,0 +1,62 @@ +.TH BUILDMAP 3X +.SH NAME +buildmap, transin, transout \(mi translate labels between computers +.SH SYNOPSIS +.nf +.PP +.B +#include <cbit.h> +.PP +.B "struct mapping *buildmap(int fd, char *file, char *me, char *pw, server);" +.PP +.B "transin(struct mapping *map, struct label *foreign, struct label *domestic);" +.PP +.B "transout(struct mapping *map, struct label *domestic, struct label *foreign);" +.fi +.SH DESCRIPTION +Buildmap and its partner (which may be another instance of +.IR buildmap ) +at the far end of the stream +.I fd +work out a mapping for translating labels. +The label space at the near end is defined by +.I file , +which contains ASCII representations of +.IR cbit (3) +structures. +The identity (for authorization purposes) +of the near end +is +.IR me , +using a secret password +.IR pw . +Each end challenges the other, using its own password to compose a +response, whose +validity is checked by +.I verify ; +see +.IR notary (3); +The ends need not know each other's passwords. +.I Server +is to simplify the protocol: one end should have server set to zero, +the other end to one. +.PP +.I Transout +and +.I transin +translate labels according to the formula +determined by +.IR buildmap . +Labels in transit are represented in the binary form of the source machine +and are translated on receipt, so +.IR transout 's +job is simpler. +Both routines +return 0 if translation is impossible or illegal, +otherwise they perform the translation and return 1. +.SH SEE ALSO +.IR cbit (3), +.IR notary (3) +.SH DIAGNOSTICS +These routines all return 0 +on error. diff --git a/static/unix-v10/man3/cbit.3 b/static/unix-v10/man3/cbit.3 new file mode 100644 index 00000000..e7e2eb98 --- /dev/null +++ b/static/unix-v10/man3/cbit.3 @@ -0,0 +1,105 @@ +.TH CBIT 3X +.SH NAME +cbit, cbitread, cbitlookup, cbitparse, cbitcert \(mi security category manipulation +.SH SYNOPSIS +.nf +.PP +.B #include <cbit.h> +.PP +.B "struct cbit *cbitparse(char **fields, struct cbit *cb);" +.PP +.B "struct cbit *cbitread(char *file);" +.PP +.B "struct cbit *cbitlookup(char *name, struct cbit *cb);" +.PP +.B "char *cbitcert(struct cbit *p);" +.fi +.SH DESCRIPTION +These functions manipulate +certificates entitling computers to handle +compartmented security categories. +Each security compartment is represented by a structure of form: +.EX +.ta 8n +25n +.nf +\fLstruct cbit { + \fLchar *name;\fR official name of category + \fLint floor;\fR default value (only bottom bit used) + \fLchar *owner;\fR public name of issuing authority + \fLchar *nickname;\fR our version of category name + \fLint bitslot;\fR where we store it + \fLchar *exerciser;\fR who we are + \fLchar *certificate;\fR owner's signature +\fL} +.fi +.EE +which describes the meaning of the +.IR bitslot -th +bit in a computer's label space. +By convention, the lines of the file +.F /etc/cbits +contain (in ASCII colon-separated form) the compartments currently +held on the local computer. +.PP +.I Cbitparse +fills in and returns a +cbit +in the obvious way from a vector of seven strings. +If the second argument is zero +.I cbitparse +allots a new structure using +.IR malloc (3). +.PP +.I "Cbitread" +reads and parses an ASCII file of +cbits, +returning an array of +filled in structures. +The last entry in the array is a dummy; it is signalled by having +a zero value of +.IR name . +.PP +.IR Cbitlookup , +when fed a category name and an array of +cbits +(such as returned by +.IR cbitread ), +returns a pointer to the unique entry whose category name is +.IR name , +or returns zero. +.PP +.IR Cbitcert +composes a certificate granting +.I exerciser +the right to hold files with the given security category. +The output of +.I cbitcert +depends only on +.IR name , +.IR floor , +.IR owner , +and +.IR exerciser . +The output +must be signed by +.I owner +with +.IR xs +(see +.IR notary (3)) +to produce +the checksum value in +.IR certificate . +Third parties may check validity of a cbit +by calling +.EX +.B "verify(p->exerciser, p->certificate, cbitcert(p), strlen(cbitcert(p)))" +.EE +.SH FILES +.F /etc/cbits +.SH SEE ALSO +.IR notary (3). +.SH DIAGNOSTICS +These routines all return 0 +on error. + diff --git a/static/unix-v10/man3/cbt.3 b/static/unix-v10/man3/cbt.3 new file mode 100644 index 00000000..6f25914f --- /dev/null +++ b/static/unix-v10/man3/cbt.3 @@ -0,0 +1,86 @@ +.SH NAME +bread, bwrite, bopen, bclose, bseek, bkey, bdelete, bfirst, bflush, breclen +.TH +cbt(3) +.SH SYNOPSIS +.nf +.B typedef struct { char *mdata; unsigned short mlen; } mbuf; +.B #include "cbt.h" +.B bfile *bopen(file, type) char *file; +.B bseek(bf, key) bfile *bf; mbuf key; +.B bfirst(bf) bfile *bf; +.B bclose(bf) bfile *bf; +.B breclen(bf) bfile *bf; +.B bread(bf, key, value) bfile *bf; mbuf *key, *value; +.B bdelete(bf, key) bfile *bf; mbuf key; +.B bflush(bf) bfile *bf; +.fi +.SH DESCRIPTION +These subroutines are the C interface to B-tree files. +Load them using +.I -lcbt. +The include file contains the definition of +.I mbuf. +B-trees may be shared by multiple readers and a single writer, since the effect of a writer's changes +are not seen until the root of the tree is written back. +Keys can be no longer than 255 bytes. +The routines communicate by means of +a +.I bfile +pointer returned by +.I bopen. +A B-tree named +.I file +corresponds to two +.UX +files, +.I file.T +and (if the file is not an index) +.I file.F. +The +.I type +parameter to +.I bopen +should be either 0 or 2, as in open (2). +.br +.I bclose +closes a B-tree and (if necessary) rewrites +its root. +.br +.I bflush +writes the root without closing the B-tree. +.PP +The subroutines keep track of a current +position in each open B-tree. +When the B-tree is opened the current +position is just before the first key. +Calling +.I bfirst +has the same effect. +.I bseek +makes the current position just before the +.I key +and returns FOUND, +if the key exists in the file, +or it makes the current position just before +the next largest key and returns NOTFOUND, +or, if there is no larger key in the file +it returns EOF. +.I bread +returns the key and value at the current +position, and advances the current position. +Note that the arguments to +.I bread +are all pointers. +If either +.I key +or +.I value +are NULL, the corresponding argument is not returned. +.I bread stores its results in the buffers +given in the arguments, and sets the lengths +of the results in the arguments. +.I breclen +returns the length of the value which will +be returned by the next call to +.I bread. diff --git a/static/unix-v10/man3/chrtab.3 b/static/unix-v10/man3/chrtab.3 new file mode 100644 index 00000000..34fed355 --- /dev/null +++ b/static/unix-v10/man3/chrtab.3 @@ -0,0 +1,24 @@ +.TH CHRTAB 3 +.CT 2 graphics +.SH NAME +chrtab \(mi simple character bitmaps +.SH SYNOPSIS +.B extern char chrtab[95][16]; +.SH DESCRIPTION +.I Chrtab +contains 8-by-16 bitmaps for +.SM ASCII +printing characters. +The 16 bytes pointed to by +.B chrtab[c-'\ '] +are the 16 rows of character +.I c +from top to bottom. +The most significant bit is the leftmost bit. +The bottom row is always empty (has all bits 0). +.SH SEE ALSO +.IR font (9.5) +.SH BUGS +The bitmaps of +.I chrtab +are intended for use with line printers, not bitmap devices. diff --git a/static/unix-v10/man3/closeshares.3 b/static/unix-v10/man3/closeshares.3 new file mode 100644 index 00000000..34a4d819 --- /dev/null +++ b/static/unix-v10/man3/closeshares.3 @@ -0,0 +1,21 @@ +.TH CLOSESHARES 3 SHARE +.SH NAME +closeshares \- close shares file +.SH SYNOPSIS +.B "int closeshares()" +.SH DESCRIPTION +.I Closeshares +closes the shares file (if open) which otherwise remains open across +shares file routine calls. +.SH FILES +.PD 0 +.TP "\w'/etc/sharesXXXX'u" +/etc/shares +Shares data-base. +.PD +.SH "SEE ALSO" +getshares(3), +getshput(3), +openshares(3), +putshares(3), +sharesfile(3). diff --git a/static/unix-v10/man3/compar.3 b/static/unix-v10/man3/compar.3 new file mode 100644 index 00000000..3fc488d5 --- /dev/null +++ b/static/unix-v10/man3/compar.3 @@ -0,0 +1,43 @@ +.pa 1 +.he 'COMPAR (III)'1/15/73'COMPAR (III)' +.ti 0 +NAME compar -- default comparison routine for qsort +.sp +.ti 0 +SYNOPSIS jsr pc,compar +.sp +.ti 0 +DESCRIPTION Compar is the default comparison routine +called by qsort and is separated out so that the user can +supply his own comparison. +.sp +The routine is called with the width (in bytes) of +an element in r3 and it compares byte-by-byte the element +pointed to by r0 with the element pointed to by r4. +.sp +Return is via the condition codes, +which are tested by the instructions "blt" and "bgt". +.a +That is, in the absence of overflow, then the +condition (r0) < (r4) should leave the Z-bit off and N-bit +on while (r0) > (r4) should leave Z and N off. +Still another way of putting it is that for elements +of length 1 the instruction + + cmpb (r0),(r4) + +suffices. +.sp +Only r0 is changed by the call. +.sp +.ti 0 +FILES kept in /lib/liba.a +.sp +.ti 0 +SEE ALSO qsort (III) +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS It could be recoded to run faster. diff --git a/static/unix-v10/man3/crypt.3 b/static/unix-v10/man3/crypt.3 new file mode 100644 index 00000000..a6b05463 --- /dev/null +++ b/static/unix-v10/man3/crypt.3 @@ -0,0 +1,30 @@ +.pa 1 +.he 'CRYPT (III)'1/15/73'CRYPT (III)' +.ti 0 +NAME crypt -- password encoding +.sp +.ti 0 +SYNOPSIS mov $key,r0 +.br +jsr pc,crypt +.sp +.ti 0 +DESCRIPTION On entry, r0 should point to a string of +characters terminated by an ASCII NULL. The routine +performs an operation on the key which is difficult to invert +(i.e. encrypts it) and leaves the resulting eight bytes +of ASCII alphanumerics in a global cell called "word". +.sp +Login uses this result as a password. +.sp +.ti 0 +FILES kept in /lib/liba.a +.sp +.ti 0 +SEE ALSO passwd(I),passwd(V), login(I) +.sp +.ti 0 +DIAGNOSTICS there are none; garbage is accepted. +.sp +.ti 0 +BUGS -- diff --git a/static/unix-v10/man3/ctime.3 b/static/unix-v10/man3/ctime.3 new file mode 100644 index 00000000..a0c25144 --- /dev/null +++ b/static/unix-v10/man3/ctime.3 @@ -0,0 +1,36 @@ +.pa 1 +.he 'CTIME (III)'1/15/73'CTIME (III)' +.ti 0 +NAME ctime -- convert date and time to ASCII +.sp +.ti 0 +SYNOPSIS sys time +.br +mov $buffer,r2 +.br +jsr pc,ctime +.br +.sp +.ti 0 +DESCRIPTION The output buffer +is 16 characters long and +the time has the format +.sp + Oct 9 17:32:24\\0 +.sp +The input time must be in the r0 and r1 registers in the form +returned by sys___ time____. +.sp +.ti 0 +FILES kept in /lib/liba.a +.sp +.ti 0 +SEE ALSO ptime(III), time(II) +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS The routine must be reassembled for leap year. +.br +Dec 31 is followed by Dec 32 and so on. diff --git a/static/unix-v10/man3/ctype.3 b/static/unix-v10/man3/ctype.3 new file mode 100644 index 00000000..227d35f2 --- /dev/null +++ b/static/unix-v10/man3/ctype.3 @@ -0,0 +1,102 @@ +.TH CTYPE 3 +.CT 2 data_man +.SH NAME +isalpha, isupper, islower, isdigit, isxdigit, isalnum, isspace, ispunct, isprint, isgraph, iscntrl, isascii \(mi character classification +.SH SYNOPSIS +.2C +.B #include <ctype.h> +.PP +.B isalpha(c) +.PP +.B isupper(c) +.PP +.B islower(c) +.PP +.B isdigit(c) +.PP +.B isxdigit(c) +.PP +.B isalnum(c) +.PP +.B isspace(c) +.PP +.B ispunct(c) +.PP +.B isprint(c) +.PP +.B isgraph(c) +.PP +.B iscntrl(c) +.PP +.B isascii(c) +.1C +.SH DESCRIPTION +These macros classify ASCII-coded integer values +by table lookup. +Each is a predicate returning nonzero for true, +zero for false. +.I Isascii +is defined on all integer values; the rest +are defined only where +.I isascii +is true and on the single non-ASCII value +.BR EOF ; +.IR stdio (3). +.TP "\w'isalnum 'u" +.I isalpha +.I c +is a letter, a-z or A-Z +.TP +.I isupper +.I c +is an upper case letter, A-Z +.TP +.I islower +.I c +is a lower case letter, a-z +.TP +.I isdigit +.I c +is a digit, 0-9 +.TP +.I isxdigit +.I c +is a hexadecimal digit, 0-9 or a-f or A-F +.TP +.I isalnum +.I c +is an alphanumeric character, a-z or A-Z or 0-9 +.TP +.I isspace +.I c +is a space, horizontal tab, vertical tab, carriage return, newline, or formfeed +(040, 011, 012, 013, 014, 015) +.TP +.I ispunct +.I c +is a punctuation character +(one of +.L +!"#$%&'()*+,-./:;<=>?@[\e]^_`{|}~\fR) +.TP +.I isprint +.I c +is a printing character, 040 (space) +through 0176 (tilde) +.TP +.I isgraph +.I c +is a visible printing character, 041 (exclamation) through 0176 +(tilde) +.TP +.I iscntrl +.I c +is a delete character, 0177, +or ordinary control character, 000 through 037 +.TP +.I isascii +.I c +is an ASCII character, 000 through 0177 +.SH "SEE ALSO" +.IR tolower (3), +.IR ascii (6) diff --git a/static/unix-v10/man3/curses.3 b/static/unix-v10/man3/curses.3 new file mode 100644 index 00000000..dcfd1947 --- /dev/null +++ b/static/unix-v10/man3/curses.3 @@ -0,0 +1,98 @@ +.TH CURSES 3X +.CT 2 comm_term +.SH NAME +curses \(mi screen functions with `optimal' cursor motion +.SH DESCRIPTION +These routines give the user a method +of updating screens with reasonable optimization. +They keep an image of the current screen, +and the user sets up an image of a new one. +Then +.I refresh() +tells the routines to make the current screen look +like the new one. +The initialization routine +.I initscr() +must be called before any other routines +that deal with windows and screens. +The routine +.I endwin() +should be called before exiting. +.PP +To load the functions use the +.IR ld (1) +options +.BR \-lcurses\ \-ltermcap . +.SH SEE ALSO +.IR ioctl (2), +.IR termcap (5) +.br +Ken Arnold, +`Screen Updating and Cursor Movement Optimization: A Library Package', +.I UNIX Programmer's Manual, +Seventh Edition, Virtual VAX-11 Version, 1980 +(Berkeley) +.SH FUNCTIONS +.nf +.ds w \fIwin\fR +.ds s \fIstdscr\fR +.ta 3.3i +\fLaddch(ch)\fP add a character to \*s +\fLaddstr(str)\fP add a string to \*s +\fLbox(win,vert,hor)\fP draw a box around a window +\fLcrmode()\fP set cbreak mode +\fLclear()\fP clear \*s +\fLclearok(scr,boolf)\fP set clear flag for \fIscr\fR +\fLclrtobot()\fP clear to bottom on \*s +\fLclrtoeol()\fP clear to end of line on \*s +\fLdelwin(win)\fP delete \*w +\fLecho()\fP set echo mode +\fLendwin()\fP end window modes +\fLerase()\fP erase \*s +\fLgetch()\fP get a char through \*s +\fLgetstr(str)\fP get a string through \*s +\fLgettmode()\fP get tty modes +\fLgetyx(win,y,x)\fP get (y,x) co-ordinates +\fLinch()\fP get char at current (y,x) co-ordinates +\fLinitscr()\fP initialize screens +\fLleaveok(win,boolf)\fP set leave flag for \*w +\fLlongname(termbuf,name)\fP get long name from \fItermbuf\fR +\fLmove(y,x)\fP move to (y,x) on \*s +\fLmvcur(lasty,lastx,newy,newx)\fP actually move cursor +\fLnewwin(lines,cols,begin_y,begin_x)\ \fP create a new window +\fLnl()\fP set newline mapping +\fLnocrmode()\fP unset cbreak mode +\fLnoecho()\fP unset echo mode +\fLnonl()\fP unset newline mapping +\fLnoraw()\fP unset raw mode +\fLoverlay(win1,win2)\fP overlay win1 on win2 +\fLoverwrite(win1,win2)\fP overwrite win1 on top of win2 +\fLprintw(fmt,arg1,arg2,...)\fP printf on \*s +\fLraw()\fP set raw mode +\fLrefresh()\fP make current screen look like \*s +\fLresetty()\fP reset tty flags to stored value +\fLsavetty()\fP stored current tty flags +\fLscanw(fmt,arg1,arg2,...)\fP scanf through \*s +\fLscroll(win)\fP scroll \*w one line +\fLscrollok(win,boolf)\fP set scroll flag +\fLsetterm(name)\fP set term variables for name +\fLstandend()\fP end standout mode +\fLstandout()\fP start standout mode +\fLsubwin(win,lines,cols,begin_y,begin_x)\ \fP create a subwindow +\fLtouchwin(win)\fP `change' all of \*w +\fLunctrl(ch)\fP printable version of \fIch\fR +\fLwaddch(win,ch)\fP add char to \*w +\fLwaddstr(win,str)\fP add string to \*w +\fLwclear(win)\fP clear \*w +\fLwclrtobot(win)\fP clear to bottom of \*w +\fLwclrtoeol(win)\fP clear to end of line on \*w +\fLwerase(win)\fP erase \*w +\fLwgetch(win)\fP get a char through \*w +\fLwgetstr(win,str)\fP get a string through \*w +\fLwinch(win)\fP get char at current (y,x) in \*w +\fLwmove(win,y,x)\fP set current (y,x) co-ordinates on \*w +\fLwprintw(win,fmt,arg1,arg2,...)\ \fP printf on \*w +\fLwrefresh(win)\fP make screen look like \*w +\fLwscanw(win,fmt,arg1,arg2,...)\ \fP scanf through \*w +\fLwstandend(win)\fP end standout mode on \*w +\fLwstandout(win)\fP start standout mode on \*w diff --git a/static/unix-v10/man3/dbm.3 b/static/unix-v10/man3/dbm.3 new file mode 100644 index 00000000..3653f441 --- /dev/null +++ b/static/unix-v10/man3/dbm.3 @@ -0,0 +1,144 @@ +.TH DBM 3X +.CT 2 data_man +.SH NAME +dbminit, fetch, store, delete, firstkey, nextkey \(mi database subroutines +.SH SYNOPSIS +.nf +.B dbminit(file) +.B char *file; +.PP +.B datum fetch(key) +.B datum key; +.PP +.B store(key, value) +.B datum key, value; +.PP +.B delete(key) +.B datum key; +.PP +.B datum firstkey() +.PP +.B datum nextkey(key) +.B datum key; +.SH DESCRIPTION +These functions maintain +key/value pairs (each pair is a +.IR datum ) +in a data base. +The functions will handle very large databases +in one or two file system accesses per key. +The functions are loaded +with +.IR ld (1) +option +.BR -ldbm . +A datum is defined as +.IP +.EX +.ta \w'typedef 'u +\w'struct 'u +typedef struct { + char *dptr; + int dsize; +} datum; +.EE +.PP +A +.B datum +object specifies a string of +.B dsize +bytes pointed to by +.BR dptr . +Arbitrary binary data, as well as normal +ASCII strings, are allowed. +The data base is stored in two files. +One file is a directory containing a bit map +and has +.L .dir +as its suffix. +The second file contains all data and +has +.L .pag +as its suffix. +.PP +Before a database can be accessed, +it must be opened by +.I dbminit. +At the time of this call, +the files +.IB file .dir +and +.IB file .pag +must exist. +(An empty database has empty +.L .dir +and +.L .pag +files.) +.PP +The value associated with a key is +retrieved by +.I fetch +and assigned by +.IR store . +A key and its associated value +are deleted by +.IR delete . +A linear pass through all keys in a database +may be made, +in random order, +by use of +.I firstkey +and +.IR nextkey . +.I Firstkey +will return the first key +in the database. +With any key +.I nextkey +will return the next key in the database. +This code will traverse the data base: +.IP +.L +for(key = firstkey(); key.dptr != NULL; key = nextkey(key)) +.SH SEE ALSO +.IR cbt (3) +.SH DIAGNOSTICS +All functions that return integers +indicate errors with negative values. +A zero return indicates success. +Routines that return a +.B datum +indicate errors with zero +.BR dptr . +.SH BUGS +The +.L .pag +file contains holes; +its apparent size is about +four times its actual content. +These files cannot be copied +by normal means +.RI ( cat (1), +.IR tar (1), +.IR cpio (1), +.IR ar (1)) +without filling in the holes. +.br +Pointers returned +by these subroutines +refer to static data +that is changed by subsequent calls. +.br +The sum of the sizes of +a +key/value pair must not exceed +a fixed internal block size. +Moreover all key/value pairs that hash +together must fit on a single block. +.I Store +will return an error in the event that +a disk block fills with inseparable data. +.br +.I Delete +does not physically reclaim file space, +although it does make it available for reuse. diff --git a/static/unix-v10/man3/ddsput.3 b/static/unix-v10/man3/ddsput.3 new file mode 100644 index 00000000..b84a058b --- /dev/null +++ b/static/unix-v10/man3/ddsput.3 @@ -0,0 +1,82 @@ +.pa 1 +.he 'DDSPUT, DDSINIT (III)'1/15/73'DDSPUT, DDSINIT (III)' +.ti 0 +NAME ddsput -- put a character on display data set +.sp +.ti 0 +SYNOPSIS (file descriptor in r0) +.br +jsr pc,ddsinit + +.br +(character in r0) +.br +jsr pc,ddsput +.sp +.ti 0 +DESCRIPTION These routines +provide an interface to the Display Data Set, a peculiar +device which can be called by Picturephone sets and which +will display some of the ASCII character set and certain +other graphics on the Picturephone screen. + +If the DC11 or other interface hardware is not already +set up to talk to the Display Data Set, the ddsinit_______ +entry should be called with the appropriate file descriptor in r0. +On the only known DDS attached to UNIX, the associated special file +is called "/dev/ttyc". +ddsinit_______ also clears the display. + +Thereafter, characters may be displayed +by calling ddsput______. +To the extent possible, ddsput______ simulates an ordinary terminal. +Characters falling to the right of the 22X22 screen +area are ignored; the 23rd line on the screen causes +the screen to be erased and that line to be put at the top +of the new display. +Certain ASCII characters are interpreted specially as follows: + +.in +5 +.ti -5 +FF clear screen, go to top left +.ti -5 +HT expand to right number of spaces +.ti -5 +DC1 treat as reverse line feed (move N) +.ti -5 +DC2 move cursor 1 place right (move E) +.ti -5 +DC3 forward line feed (move S) +.ti -5 +DC4 backspace 1 position (move W) +.ti -5 +SO enter graph mode +.ti -5 +SI leave graph mode +.ti -5 +CR put cursor at start of current line + +.in -5 +Graph mode allows display of the non-ASCII characters and +will be described when hell freezes over. + +Lower-case ASCII alphabetics are mapped into upper case. +Several ASCII non-alphabetic graphics +are unavailable as well. Also the lower right circle of +the "%" character is missing. +Also one of the circuit cards in the DDS has a crack in it and +sometimes it doesn't work. +All in all, +it is best to avoid this device. +.sp +.ti 0 +FILES kept in /lib/liba.a +.sp +.ti 0 +SEE ALSO AT&T writeup on DDS +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS yes diff --git a/static/unix-v10/man3/dialout.3 b/static/unix-v10/man3/dialout.3 new file mode 100644 index 00000000..5291b724 --- /dev/null +++ b/static/unix-v10/man3/dialout.3 @@ -0,0 +1,86 @@ +.TH DIALOUT 3 +.CT 2 comm_mach +.SH NAME +dialout \(mi place call on ACU +.SH SYNOPSIS +.B int dialout(telno, class) +.br +.B char *telno, *class; +.SH DESCRIPTION +.I Dialout +places a data call via an automatic calling unit directly +attached to the calling computer. +To use an ACU on Datakit see the example in +.IR ipc (3). +.PP +.I Dialout +searches for an ACU of the appropriate service class +and places a data call on the associated line, using the given telephone +number. +If successful, it returns an open file descriptor for the line. +The file is in raw mode, and has exclusive-use and hangup-on-close modes set. +It returns \-1 +if all ACUs of the given class are busy, +\-3 +if carrier +could not be set, and +\-9 +if the service class is unidentifiable. +.PP +The routine consults a data file +.F /etc/aculist +that consists of lines containing six blank- or tab-separated fields. +.TP "\w'service class 'u" +service class +Each line with a service class matching the one specified is tried +in turn until an unoccupied one is found. +Service classes specify a switching office and a baud rate. +.IP +Defined service classes at the `research' site are +.B 300 +and +.BR 1200 , +for 300- and 1200-baud calls on 665- phone lines, with synonyms +.B D300 +and +.BR D1200 . +Internal calls on these lines require 5 digits. +Service classes +.B C300 +and +.B C1200 +use 582- phone lines. +Internal calls on these lines require 4 digits and reach only other +582- lines. +.TP +file +The file name of the associated special file for the telephone line. +.TP +acu +The file name of the associated ACU. +If specified as +.BR none , +no ACU is used and the telephone number is ignored. +This is for hardwired connections. +.TP +speed +The bit rate of the interface, chosen from the numbers given in +.IR ttyld (4). +.TP +prefix +A string to be prefixed to the number. +This is handy for shared ACUs in which the first digit specifies a line. +The prefix +.L - +is taken to be an empty prefix. +.TP +postfix +A string to be postfixed to the number to be dialed. +Some ACUs require an `end of number' code; it should be specified here. +.SH FILES +.TP +.F /etc/aculist +.SH SEE ALSO +.IR ttyld (4), +.IR cu (1), +.IR ipc (3) diff --git a/static/unix-v10/man3/directory.3 b/static/unix-v10/man3/directory.3 new file mode 100644 index 00000000..c4163a0e --- /dev/null +++ b/static/unix-v10/man3/directory.3 @@ -0,0 +1,110 @@ +.TH DIRECTORY 3 +.CT 2 dirs +.SH NAME +opendir, readdir, telldir, seekdir, closedir \(mi directory operations +.SH SYNOPSIS +.nf +.B #include <sys/types.h> +.B #include <ndir.h> +.PP +.B DIR *opendir(filename) +.B char *filename; +.PP +.B struct direct *readdir(dirp) +.B DIR *dirp; +.PP +.B long telldir(dirp) +.B DIR *dirp; +.PP +.B seekdir(dirp, loc) +.B DIR *dirp; +.B long loc; +.PP +.B closedir(dirp) +.B DIR *dirp; +.fi +.SH DESCRIPTION +.I Opendir +opens the directory named by +.I filename +and associates a `directory stream' +with it. +.I Opendir +returns a pointer to be used to identify the +directory stream +in subsequent operations. +The pointer value 0 +is returned if +.I filename +cannot be accessed or is not a directory. +.PP +.I Readdir +returns a pointer to the next directory entry. +It returns 0 +upon reaching the end of the directory or detecting +an invalid +.I seekdir +operation. +.PP +.I Telldir +returns the current location associated with the named +directory stream. +.PP +.I Seekdir +sets the position of the next +.I readdir +operation on the +directory stream. +The new position reverts to the one associated with the +directory stream +when the +.I telldir +operation was performed. +Values returned by +.I telldir +are good only for the lifetime of the +.B DIR +pointer from +which they are derived. +.PP +.I Closedir +causes the named +directory stream +to be closed, +and the structure associated with the +.B DIR +pointer to be freed. +.LP +.nf +.ftL +.ta \w'struct\ 'u +\w'direct\ 'u +\w'd_name[MAXNAMLEN+1];\ 'u +struct direct { + \fLu_long d_ino;\fR inode for the entry + \fLshort d_reclen;\fP don't use + \fLshort d_namlen;\fP equivalent to \fLstrlen(d_name)\fP + \fLchar d_name[MAXNAMLEN+1];\fP null-terminated entry name +\fL};\fR +.fi +.PP +The preferred way to search the current directory is: +.ft L +.nf +.ta 8n +8n +8n +8n + DIR *dirp; + dirp = opendir("."); + for(dp = readdir(dirp); dp != 0; dp = readdir(dir)) + if(strcmp(dp->d_name, name) == 0) + break; + closedir(dirp); + /* found name if dp != 0 */ +.fi +.ft P +.SH "SEE ALSO" +.IR dir (5), +.IR open (2), +.IR dirread (2), +.IR read (2), +.IR lseek (2), +.IR ftw (3) +.SH BUGS +The return values point to static data whose content is overwritten by each call. diff --git a/static/unix-v10/man3/ecvt.3 b/static/unix-v10/man3/ecvt.3 new file mode 100644 index 00000000..753307ff --- /dev/null +++ b/static/unix-v10/man3/ecvt.3 @@ -0,0 +1,47 @@ +.pa 1 +.he 'ECVT, FCVT (III)'1/15/73'ECVT, FCVT (III)' +.ti 0 +NAME ecvt, fcvt -- output conversion +.sp +.ti 0 +SYNOPSIS jsr pc,ecvt +.sp +or +.sp +jsr pc,fcvt +.sp +.ti 0 +DESCRIPTION Ecvt +is called with a floating point number in fr0. +.sp +On exit, the number has been converted into a +string of ascii digits in a buffer pointed to by r0. +The number of digits produced is controlled +by a global variable "_ndigits". + +Moreover, the position of the decimal point is +contained in r2: r2=0 means the d.p. is at the +left hand end of the string of digits; +r2>0 means the d.p. is within or to the right +of the string. + +The sign of the number is indicated by r1 (0 for +; 1 for -). + +The low order digit has suffered decimal rounding +(i. e. may have been carried into). +.sp +Fcvt is identical to ecvt, except that the correct digit +has had decimal rounding for F-style output of the number +of digits specified by "_ndigits". +.sp +.ti 0 +FILES kept in /lib/liba.a +.sp +.ti 0 +SEE ALSO ftoa(III) +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS -- diff --git a/static/unix-v10/man3/end.3 b/static/unix-v10/man3/end.3 new file mode 100644 index 00000000..c7ec5f6a --- /dev/null +++ b/static/unix-v10/man3/end.3 @@ -0,0 +1,45 @@ +.TH END 3 +.CT 2 mem_man +.SH NAME +end, etext, edata \(mi last locations in program +.SH SYNOPSIS +.nf +.B extern end; +.B extern etext; +.B extern edata; +.fi +.SH DESCRIPTION +These names refer neither to routines +nor to locations with interesting contents. +The address of +.I etext +is the first address above the program text, +.I edata +above the initialized data region, and +.I end +above the uninitialized data region. +.PP +When execution begins, the program break +coincides with +.I end, +but it is reset by +the routines +.IR brk (2), +.IR malloc (3), +standard input/output +.RI ( stdio (3)), +the profile +.RB ( -p ) +option of +.IR cc (1), +etc. +The current value of the program break +is reliably returned by +.BR sbrk(0) ; +see +.IR brk (2). +.SH "SEE ALSO" +.IR brk (2), +.IR malloc (3), +.IR stdio (3), +.IR cc (1) diff --git a/static/unix-v10/man3/erf.3 b/static/unix-v10/man3/erf.3 new file mode 100644 index 00000000..a146d686 --- /dev/null +++ b/static/unix-v10/man3/erf.3 @@ -0,0 +1,39 @@ +.EQ +delim $$ +.EN +.TH ERF 3M +.CT 2 math +.SH NAME +erf, erfc \(mi error function +.SH SYNOPSIS +.B #include <math.h> +.PP +.B double erf(x) +.br +.B double x; +.PP +.B double erfc(x) +.br +.B double x; +.SH DESCRIPTION +These functions calculate the error function +.RI erf( x ) +.if n .ig +$=~2 pi sup -1/2 int from 0 to x roman e sup -t sup 2 dt$ +.. +and the complementary error function +.RI erfc( x ) +.if n .ig +$=~ 1 - erf( x )$ +.. +\&. +The error criterion for both +.I erf +and +.I erfc +is relative. +.SH DIAGNOSTICS +There are no error returns. +.EQ +delim off +.EN diff --git a/static/unix-v10/man3/exit.3 b/static/unix-v10/man3/exit.3 new file mode 100644 index 00000000..af44b48a --- /dev/null +++ b/static/unix-v10/man3/exit.3 @@ -0,0 +1,61 @@ +.TH EXIT 3 +.CT 2 proc_man +.SH NAME +exit, onexit \(mi terminate process +.SH SYNOPSIS +.nf +.B void exit(status) +.B int status; +.PP +.B int onexit(fn) +.B int (*fn)(); +.fi +.SH DESCRIPTION +.I Exit +is the conventional way to terminate a process. +Before calling +.I _exit +(see +.IR exit (2)) +with +.I status +as an argument, +it calls in reverse order all the functions +recorded by +.IR onexit . +.PP +.I Exit +can never return. +.PP +.I Onexit +records +.I fn +as a function to be called by +.IR exit . +It returns zero if it failed, +nonzero otherwise. +Typical uses include cleanup routines for +.IR stdio (3) +and profiling; see +.IR monitor (3). +.PP +Calling +.I onexit +twice (or more) with the same function argument causes +.I exit +to invoke the function twice (or more). +.PP +The function +.I fn +should be declared as +.EX + int fn() +.EE +.PP +The constant +.B NONEXIT +defined in +.B <libc.h> +determines how many functions can be recorded. +.SH "SEE ALSO" +.IR exit (2) diff --git a/static/unix-v10/man3/exp.3 b/static/unix-v10/man3/exp.3 new file mode 100644 index 00000000..43f56f35 --- /dev/null +++ b/static/unix-v10/man3/exp.3 @@ -0,0 +1,28 @@ +.pa 1 +.he 'EXP (III)'1/15/73'EXP (III)' +.ti 0 +NAME exp -- exponential function +.sp +.ti 0 +SYNOPSIS jsr r5,exp +.sp +.ti 0 +DESCRIPTION The +exponential of fr0 is returned in fr0. +.sp +.ti 0 +FILES kept in /lib/liba.a +.sp +.ti 0 +SEE ALSO -- +.sp +.ti 0 +DIAGNOSTICS If +the result is not representable, the +c-bit is set +and the largest positive number is returned. +.sp +Zero is returned if the result would underflow. +.sp +.ti 0 +BUGS --- diff --git a/static/unix-v10/man3/ferror.3 b/static/unix-v10/man3/ferror.3 new file mode 100644 index 00000000..227e4834 --- /dev/null +++ b/static/unix-v10/man3/ferror.3 @@ -0,0 +1,62 @@ +.TH FERROR 3S +.CT 2 file_io file_inq_creat +.SH NAME +feof, ferror, clearerr, fileno \(mi stream status inquiries +.SH SYNOPSIS +.B #include <stdio.h> +.PP +.B int feof(stream) +.br +.SM +.B FILE +.B *stream; +.PP +.B int ferror(stream) +.br +.SM +.B FILE +.B *stream +.PP +.B int clearerr(stream) +.br +.SM +.B FILE +.B *stream +.PP +.B int fileno(stream) +.br +.SM +.B FILE +.B *stream; +.SH DESCRIPTION +.I Feof +returns non-zero if end of file has been encountered on the named input +.I stream, +otherwise zero. +.PP +.I Ferror +returns non-zero when an error has occurred reading or writing +the named +.I stream, +otherwise zero. +Unless cleared by +.I clearerr, +the error indication lasts until +the stream is closed. +.PP +.I Clearerr +resets the error indication on the named +.I stream. +.PP +.I Fileno +returns the integer file descriptor +associated with the +.I stream, +see +.IR open (2). +.PP +These functions +are implemented as macros; +they cannot be redeclared. +.SH "SEE ALSO" +.IR stdio (3) diff --git a/static/unix-v10/man3/fgets.3 b/static/unix-v10/man3/fgets.3 new file mode 100644 index 00000000..3e33caaf --- /dev/null +++ b/static/unix-v10/man3/fgets.3 @@ -0,0 +1,73 @@ +.TH FGETS 3S +.CT 2 file_io +.SH NAME +fgets, puts, fputs, gets \(mi string input/out on streams +.SH SYNOPSIS +.nf +.B #include <stdio.h> +.PP +.B char *fgets(s, n, stream) +.B char *s; +.B FILE *stream; +.PP +.B int puts(s) +.B char *s; +.PP +.B int fputs(s, stream) +.B char *s; +.B FILE *stream; +.fi +.SH DESCRIPTION +.I Fgets +reads +.IR n \-1 +characters, or up to a newline +character, whichever comes first, +from the +.I stream +into the string +.IR s . +The last character read into +.I s +is followed by a null character. +.I Fgets +returns its first argument. +.PP +.I Puts +copies the null-terminated string +.I s +to the standard output stream +.I stdout +and appends a +newline character. +.PP +.I Fputs +copies the null-terminated string +.I s +to the named output +.IR stream . +.PP +Neither routine copies the terminal null character. +Both return the result of calling +.IR putc +with the last character written; see +.IR getc (3). +.SH "SEE ALSO" +.IR getc (3) +.IR stdio (3) +.SH DIAGNOSTICS +.IR Fgets +returns a null pointer +upon end of file or error. +.SH BUGS +For safety reasons the +.SM ANSI +standard function +.BR "char *gets(s)" , +which reads from standard input up to a newline and +discards the newline, is not supported. +.br +.I Puts +appends a newline, +.I fputs +does not, all in the name of backward compatibility. diff --git a/static/unix-v10/man3/filebuf.3 b/static/unix-v10/man3/filebuf.3 new file mode 100644 index 00000000..e2ea5447 --- /dev/null +++ b/static/unix-v10/man3/filebuf.3 @@ -0,0 +1,200 @@ +. \"ident "%W%" +. \"Copyright (c) 1984 AT&T +. \"All Rights Reserved +. \"THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +. \"The copyright notice above does not evidence any +. \"actual or intended publication of such source code. +.TH FILEBUF 3I+ "C++ Stream Library" " " +.SH NAME +filebuf \- buffer for file input/output +.SH SYNOPSIS +.ft B +.nf +.ta1i 2i +#include <iostream.h> + +typedef long streamoff, streampos; +class ios { +public: + enum seek_dir { beg, cur, end }; + enum open_mode { in, out, ate, app } ; + // \fIand lots of other stuff ... \fP + } ; + +#include <fstream.h> + +class filebuf : streambuf { +public: + filebuf() ; + filebuf(int d); + filebuf(int d, char* p, int len) ; + + filebuf* attach(int d) ; + int close(); + int fd(); + int is_open(); + filebuf* open(char *name, open_mode om, int prot=0664) ; + streampos seekoff(streamoff o, seek_dir d, open_mode m) ; + streampos seekpos(strempos p, open_mode m ) ; + streambuf* setbuf(char* p, int len) ; + int sync() ; +}; +.fi +.ft R +.SH DESCRIPTION +\f(CWfilebuf\fRs +specialize +\f(CWstreambuf\fRs +to use a file as source or sink of characters. +Characters are consumed by doing +writes to the +file, and are produced by doing +reads. +When the file is seekable, +a \f(CWfilebuf\fR allows seeks. +At least 4 characters of putback are guaranteed. +When the file permits reading and writing the buffer permits +both storing and fetching. No special action is required between +gets and puts. +A +\f(CWfilebuf\fRs that is connected to a file descriptor is said +to be \fIopen\fR. +.PP +Assume: +.br +\(em \fBf\fR is a \f(CWfilebuf\fR. +.br +\(em \fBpfb\fR is a \f(CWfilebuf*\fR. +.br +\(em \fBpsb\fR is a \f(CWstreambuf*\fR. +.br +\(em \fBi\fR, \fBd\fR, \fBlen\fR, and \fBprot\fR are \f(CWint\fR +.br +\(em \fBname\fR and \fBptr\fR are \f(CWchar*\fR. +.br +\(em \fBm\fR is \f(CWopen_mode\fR. +.br +\(em \fBoff\fR is \f(CWstreamoff\fR. +.br +\(em \fBp\fR and \fBpos\fR are \f(CWstreampos\fR. +.br +\(em \fBdir\fR is \f(CWseek_dir\fR. +.PP +Constructors: +.TP +\fBfilebuf()\fR +Constructs an initially closed \f(CWfilebuf\fR. +.TP +\fBfilebuf(d)\fR +Constructs a \f(CWfilebuf\fR connected to \fBd\fR. +.TP +\fBfilebuf(d,p,len)\fR +Constructs a \f(CWfilebuf\fR connected to \fBd\fR +and initialized to use the reserve area starting at \fBp\fR and containing +\fBlen\fR bytes. +If \fBp\fR is null or \fBlen\fR is zero or less, +the \f(CWfilebuf\fR will be unbuffered. +.PP +Members: +.TP +\fBpfb=f.attach(d) +Connects \fBf\fR +to an open file descriptor, \fBd\fR. +\fBpfb\fR is normally \fB&f\fR +but is 0 if \fBf\fR is already open. +.TP +\fBi=f.close() +Flushes any waiting output, closes the file descriptor, and disconnects +\fBf\fR. Unless an error occurs, \fBf\fR's error state will be cleared. +\fBi\fR is 0 unless errors occur in which case it is \f(CWEOF\fR . +Even if errors occur +\fBattach\fR leaves the file descriptor and \fBf\fR +closed. +.TP +\fBi=f.fd()\fR +Returns \fBi\fR, the file descriptor \fBf\fR is connected to. +If \fBf\fR is closed \fBi\fR is \f(CWEOF\fR. +.TP +\fBi=f.is_open()\fR +Returns non-zero when \fBf\fR is connected to a file descriptor, +and zero otherwise. +.TP +\fBpfb=f.open(name,m,prot)\fR +Opens a file with the specified pathname, mode, and protection, +and connects \fBf\fR to it. +\f(CWopen_mode\fRs may be or'ed together to form \fBm\fR. +\f(CWin\fR and \f(CWout\fR translate to corresponding UNIX modes. +\f(CWate\fR and +\f(CWapp\fR +both cause the file to be positioned +at its end during the open. \f(CWapp\fR implies \f(CWoutput\fR. +In addition, +\f(CWapp\fR causes all subsequent +writes to occur at the end of a file. +(In some systems this is supported directly by the kernel, in other +instances the desired effect is approximated by seeking to the +end of the file before each write.) +\f(CWout\fR may be specified even if \fBprot\fR does not permit +output. +Normally \fBpfb\fR is \fB&f\fR +but if an error occurs it is 0. +.TP +\fBp=f.seekoff(off,dir,m)\fR +Moves the get/put pointer as designated by \fBoff\fR and \fBdir\fR. +It fails if the file that \fBf\fR is attached to +does not support seeking, or if the attempted motion +is otherwise invalid (such as attempting to seek to a position +before the beginning of file). +\fBoff\fR is interpreted as a count +relative to the place in the file specified by \fBdir\fR +as described in \fIsbuf.pub\fR(3C++). +\f(CWm\fR is ignored. +\fBp\fR is the position after movement, or \f(CWEOF\fR if +a failure occurs. +The position of the file after a failure is undefined. +.TP +\fBp=f.seekpos(pos,m)\fR +Moves the file to a position \fBpos\fR +as described in \fIsbuf.pub\fR(3C++). +\f(CWm\fR is ignored. +Normally \fBp\fR is \fBpos\fR, but on failure it is \f(CWEOF\fR. +.TP +\fBpsb=f.setbuf(ptr,len)\fR +Sets up the reserve area as \fBlen\fR bytes beginning at \fBp\fR. +If \fBptr\fR is null or \fBlen\fR is less than or equal to 0, the +\fBf\fR will be unbuffered. +Normally \fBpsb\fR is \fB&f\fR, but +it is 0 if \fBf\fR is open, and in the latter case no changes +are made to the reserve area or buffering status. +.TP +\fBi=f.sync()\fR +Attempts to force the state of get/put pointers of \fBf\fR to agree +(be synchronized) with +the state of the file \fBf.fd()\fR. This means it +may write characters to the file if some have been buffered for +output or attempt to reposition (seek) the file if characters have +been read and buffered for input. Normally \fBi\fR is 0, but it +is \f(CWEOF\fR if synchronization is not possible. +Sometimes it is neccessary to guarantee that certain +characters are written together. +To do this, the program should use +\fBsetbuf\fR +(or a constructor) +to guarantee that the reserve area is at least as large as +the number of characters that must be written together. +It can then do a \fBsync\fR, +followed by storing the characters, +followed by another \fBsync\fR. +.SH CAVEATS +\fBattach\fR +and the constructors should test if the file descriptor they +are given is open, but I can't figure out a portable way to do that. +.PP +There is no way to force atomic reads. +.PP +Unix does usually report failures of seek (e.g. on a tty) and +so a filebuf does not either. +.SH SEE ALSO +sbuf.pub(3C++) +sbuf.prot(3C++) +fstream(3C++) diff --git a/static/unix-v10/man3/fio.3 b/static/unix-v10/man3/fio.3 new file mode 100644 index 00000000..1ba4766d --- /dev/null +++ b/static/unix-v10/man3/fio.3 @@ -0,0 +1,255 @@ +.TH FIO 3 +.CT 2 file_io +.SH NAME +Finit, Frdline, Fgetc, Fread, Fseek, Fundo, +Fputc, Fprint, Fwrite, Fflush, Ftie, Fclose, Fexit \(mi fast buffered input/output +.SH SYNOPSIS +.nf +.2C +.B #include <fio.h> +.PP +.B void Finit(fd, buf) +.B char *buf; +.PP +.B void Fclose(fd); +.PP +.B int Fprint(fildes, format [, arg ...]) +.B int fildes; +.B char \(**format; +.PP +.B char *Frdline(fd) +.PP +.B int FIOLINELEN(fd) +.PP +.B long FIOSEEK(fd) +.PP +.B int Fgetc(fd) +.PP +.B void Fundo(fd) +.PP +.B long Fseek(fd, offset, ptr) +.B long offset; +.PP +.B int Fputc(fd, c) +.PP +.B long Fread(fd, addr, nbytes) +.B char *addr; +.B long nbytes; +.PP +.B int Fwrite(fd, addr, nbytes) +.B char *addr; +.B long nbytes; +.PP +.B int Fflush(fd) +.PP +.B void Ftie(ifd, ofd) +.PP +.B Fexit(type) +.1C +.fi +.SH DESCRIPTION +These routines provide buffered I/O, faster than, and incompatible +with +.IR stdio (3). +The routines can be called in any order. +I/O on different file descriptors is independent. +.PP +.I Finit +initializes a buffer (whose type is +.IR Fbuffer ) +associated with the file descriptor +.IR fd . +Any buffered input associated with +.I fd +will be lost. +The buffer can be supplied by the user +(it should be at least +.B sizeof(Fbuffer) +bytes) +or if +.I buf +is +.BR "(char *)0" , +.I Finit +will use +.IR malloc (3). +.IR Finit +must be called after a stretch of +.IR non- fio +activity, such as +.IR close +or +.IR lseek (2), +between +.I fio +calls on the same file descriptor number; +it is unnecessary, but harmless, before the first +.I fio +activity on a given file descriptor number. +.PP +.I Fclose +flushes the buffer for +.IR fd , +.IR free s +the buffer if it was allocated by +.IR Finit , +and then closes +.IR fd . +.PP +.I Frdline +reads a line from the file associated with the file descriptor +.IR fd . +The newline at the end of the line is replaced by a 0 +byte. +Lines longer than 4096 characters will have characters deleted. +.I Frdline +returns a pointer to the start of the line or +.L (char *)0 +on end of file or read error. +The macro +.I FIOLINELEN +returns the length (not including the 0 +byte) of the most recent line returned by +.IR Frdline . +The value is undefined after a call to any other +.I fio +routine. +.PP +.I Fgetc +returns the next character from the file descriptor +.IR fd , +or a negative value +at end of file. +.PP +.I Fread +reads +.I nbytes +of data from the file descriptor +.I fd +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 Fseek +applies +.IR lseek (2) +to +.I fd +taking buffering into account. +It returns the new file offset. +The macro +.I FIOSEEK +returns the file offset of the next character to be processed. +.PP +.I Fundo +makes the characters returned by the last call to +.I Frdline +or +.I Fgetc +available for reading again. +There is only one level of undo. +.PP +.I Fputc +outputs the low order 8 bits of +.I c +on the file associated with file descriptor +.IR fd . +If this causes a +.IR write +(see +.IR read (2)) +to occur and there is an error, +a negative value is returned. +Otherwise, zero is returned. +.PP +.I Fprint +is a buffered interface to +.IR print (3). +If this causes a +.IR write +to occur and there is an error, +a negative value is returned. +Otherwise, the number of chars output is returned. +.PP +.I Fwrite +outputs +.I nbytes +bytes of data starting at +.I addr +to the file associated with file descriptor +.IR fd . +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 Fflush +causes any buffered output associated with +.I fd +to be written; +it must precede a call of +.I close +on +.IR fd. +The return is as for +.IR Fputc . +.PP +.I Ftie +links together two file descriptors such that any +.IR fio -initiated +.IR read (2) +on +.I ifd +causes a +.I Fflush +of +.I ofd +(if it has been initialized). +It is appropriate for most programs used as filters to do +.BR Ftie(0,1) . +The tie may be broken by +.BR "Ftie(ifd, -1)" . +.PP +.I Fexit +is used to clean up all +.I fio +buffers. +If +.I type +is zero, the buffers are +.IR Fflush ed, +otherwise they are +.IR Fclose d. +.B "Fexit(0)" +is automatically called at +.IR exit (3). +.SH SEE ALSO +.IR open (2), +.IR print (3), +.IR stdio (3) +.SH DIAGNOSTICS +.I Fio +routines that return integers yield +.B -1 +if +.I fd +is not the descriptor of an open file or if the operation +is inapplicable to +.I fd. +.SH BUGS +The data returned by +.I Frdline +may be overwritten by calls to any other +.I fio +routine. +.br +.I Fgetc +is much slower than +access through a pointer returned by +.I Frdline. +.br +There is no +.IR scanf (3) +analogue. diff --git a/static/unix-v10/man3/floor.3 b/static/unix-v10/man3/floor.3 new file mode 100644 index 00000000..d62ea271 --- /dev/null +++ b/static/unix-v10/man3/floor.3 @@ -0,0 +1,57 @@ +.TH FLOOR 3M +.CT 2 math +.SH NAME +fabs, fmod, floor, ceil \(mi absolute value, remainder, floor, ceiling functions +.SH SYNOPSIS +.nf +.B #include <math.h> +.PP +.B double floor(x) +.B double x; +.PP +.B double ceil(x) +.B double x; +.PP +.B double fabs(x) +.B double x; +.PP +.B double fmod(x,y) +.B double x, y; +.nf +.SH DESCRIPTION +.I Fabs +returns the absolute value +.RI | \|x\| |. +.PP +.I Floor +returns the +largest integer +not greater than +.IR x . +.PP +.I Ceil +returns the +smallest integer +not less than +.IR x . +.PP +.I Fmod +returns +.I x +if +.I y +is zero, otherwise the number +.I f +with the same sign as +.IR x , +such that +.I "x = iy + f" +for some integer +.IR i , +and +.RI | \|f\| | +< +.RI | \|x\| |. +.SH SEE ALSO +.IR arith (3), +.IR frexp (3) diff --git a/static/unix-v10/man3/fopen.3 b/static/unix-v10/man3/fopen.3 new file mode 100644 index 00000000..d8638862 --- /dev/null +++ b/static/unix-v10/man3/fopen.3 @@ -0,0 +1,107 @@ +.TH FOPEN 3S +.CT 2 file_io +.SH NAME +fopen, freopen, fdopen, fclose, fflush \(mi open, close, or flush a stream +.SH SYNOPSIS +.nf +.B #include <stdio.h> +.PP +.B FILE *fopen(filename, type) +.B char *filename, *type; +.PP +.B FILE *freopen(filename, type, stream) +.B char *filename, *type; +.B FILE *stream; +.PP +.B FILE *fdopen(fildes, type) +.B char *type; +.PP +.B int fclose(stream) +.B FILE *stream; +.PP +.B int fflush(stream) +.B FILE *stream; +.fi +.SH DESCRIPTION +.I Fopen +opens the file named by +.I filename +and associates a stream with it. +.I Fopen +returns a pointer to be used to identify +the stream in subsequent operations. +.PP +.I Type +is a character string having one of the following values: +.nf +.ta 8n +\fL"r"\fP open for reading +\fL"w"\fP create for writing +\fL"r+w"\fP +\fL"w+r"\fP open for reading and writing +\fL"a"\fP append: open for writing at end of file, or create for writing +.fi +.PP +.I Freopen +substitutes the named file in place +of the open +.IR stream . +It returns the original value of +.IR stream . +The original stream is closed. +.I Freopen +is typically used to attach the preopened +constant names +.LR stdin , +.L stdout +and +.L stderr +to specified files. +.PP +.I Fdopen +associates a stream with a file descriptor. +The +.I type +of the stream must agree with the mode of the open file. +.PP +.I Fclose +causes any buffers for the named +.I stream +to be emptied, and the file to be closed. +Buffers allocated by the standard input/output system +are freed. +.PP +.I Fclose +is performed automatically upon +calling +.IR exit (3). +.PP +.I Fflush +causes any buffered data for the named output +.I stream +to be written to that file. +The stream remains open. +.SH "SEE ALSO" +.IR open (2), +.IR popen (3), +.IR stdio (3), +.IR ferror (3) +.SH DIAGNOSTICS +.I Fopen +and +.I freopen +return +.B NULL +if +.I filename +cannot be accessed. +.PP +.I Fclose +and +.I fflush +return +.B EOF +if +.I stream +is not associated with a file, or +if buffered data cannot be transferred to that file. diff --git a/static/unix-v10/man3/fptrap.3 b/static/unix-v10/man3/fptrap.3 new file mode 100644 index 00000000..489015c3 --- /dev/null +++ b/static/unix-v10/man3/fptrap.3 @@ -0,0 +1,94 @@ +.pa 1 +.he '3/15/72''FPTRAP (III)' +.ti 0 +NAME fptrap -- PDP-11/45 floating point simulator +.sp +.ti 0 +.nf +SYNOPSIS .globl fptrap +.br +sys ilgins; fptrap +.fi +.sp +.ti 0 +DESCRIPTION fptrap______ +is a package which picks up instructions which are illegal +for the PDP-11/20, and if they correspond to 11/45 floating +point instructions, simulates their operation. +The following instructions are supported: + + cfcc + setf + seti + setd + setl +. ldfps src (not in assembler) +. stfps dst (not in assembler) + clrf fdst + tstf fsrc + absf fdst + negf fdst + mulf fsrc,fr + modf fsrc,fr + addf fsrc,fr + movf fsrc,fr (=ldf) + movf fr,fdst (=stf) + subf fsrc,fr + cmpf fsrc,fr + divf fsrc,fr +.nf +. movei fr,dst (=stexp) (not in assembler) +. movie src,fr (=ldexp) (not in assembler) + movfi fr,dst (=stcfi) + movif src,fr (=ldcif) + movfo fr,fdst (=stcxy) + movof fsrc,fr (=ldcyx) +.fi + +Here src___ and dst___ stand for source and destination, fsrc____ +and fdst____ for floating source and destination, and fr__ for +floating register. +Notice that the names of several of the opcodes have changed. +The only strange instruction +is movf____, which turns into stf___ if its source +operand is a floating register, and into ldf___ if not. +.sp +The simulator sets the floating condition codes +on both ldf___ and stf___. +The 11/45 hardware does not set +the fcc on stf. + +Short and long format for both floating point numbers +and integers is supported. Truncation mode is always in effect. +Traps for overflow and other arithmetic errors are not supported. +Illegal instructions or addresses cause a simulated trap +so that a core image is produced. + +The condition code bits are maintained correctly. + +For floating-point source operands, immediate mode ((pc)+) is +not supported, since the PDP-11/45 +handbook is not clear on what to do about it. + +After an arithmetic error the result is generally +meaningless. + +The arithmetic is always done in double-precision, so exact +but unrounded results are to be expected in single-precision +mode. Double precision results are probably less correct +than the hardware will be. + +The lower parts of the floating registers become meaningless +during single-precision operations. +.sp +.ti 0 +FILES kept in /usr/lib/liba.a +.sp +.ti 0 +SEE ALSO PDP-11/45 handbook, ilgins(II) +.sp +.ti 0 +DIAGNOSTICS trap, c-bit, v-bit +.sp +.ti 0 +BUGS see above diff --git a/static/unix-v10/man3/fread.3 b/static/unix-v10/man3/fread.3 new file mode 100644 index 00000000..bd78f3fc --- /dev/null +++ b/static/unix-v10/man3/fread.3 @@ -0,0 +1,55 @@ +.TH FREAD 3S +.CT 2 file_io +.SH NAME +fread, fwrite \(mi buffered binary input/output +.SH SYNOPSIS +.B #include <stdio.h> +.PP +.B int fread(ptr, sizeof(*ptr), nitems, stream) +.br +.SM +.B FILE +.B *stream; +.PP +.B int fwrite(ptr, sizeof(*ptr), nitems, stream) +.br +.SM +.B FILE +.B *stream; +.SH DESCRIPTION +.I Fread +reads from the named input +.IR stream +at most +.I nitems +of data of the type of +.I *ptr +into a block beginning at +.I ptr. +It returns the number of items actually read. +.PP +.I Fwrite +appends to the named output +.I stream +at most +.I nitems +of data of the type of +.I *ptr +from a block beginning at +.I ptr. +It returns the number of items actually written. +.SH "SEE ALSO" +.IR read (2), +.IR stdio (3) +.SH DIAGNOSTICS +.I Fread +and +.I fwrite +return 0 +upon end of file or error. +.SH BUGS +Write errors of the data for any +.I fwrite +call may occur a long time after that call. +.br +These routines are much slower than you might imagine. diff --git a/static/unix-v10/man3/frexp.3 b/static/unix-v10/man3/frexp.3 new file mode 100644 index 00000000..1008ccf7 --- /dev/null +++ b/static/unix-v10/man3/frexp.3 @@ -0,0 +1,49 @@ +.TH FREXP 3 +.CT 2 math data_man +.SH NAME +frexp, ldexp, modf \(mi split into mantissa and exponent +.SH SYNOPSIS +.B #include <math.h> +.PP +.nf +.B double frexp(value, eptr) +.B double value; +.B int *eptr; +.PP +.B double ldexp(value, exp) +.B double value; +.PP +.B double modf(value, iptr) +.B double value, *iptr; +.SH DESCRIPTION +.I Frexp +returns the mantissa of +.I value +and stores the exponent indirectly through +.I eptr, +so that +.I value += +.if t .IR frexp ( value )\(mu2\u\s-2 \(**eptr \s0\d. +.if n .IR frexp ( value )*2** (*eptr). +.PP +.I Ldexp +returns the quantity +.if t .IR value \(mu2\u\s-2 exp \s0\d. +.if n .IR value *2** exp. +.PP +.I Modf +returns the positive fractional part of +.I value +and stores the integer part indirectly +through +.I iptr. +.SH DIAGNOSTICS +On underflow +.I ldexp +returns 0; on +overflow it returns a properly signed largest value. +In both cases it sets +.I errno +to +.BR ERANGE . diff --git a/static/unix-v10/man3/fseek.3 b/static/unix-v10/man3/fseek.3 new file mode 100644 index 00000000..02e0e125 --- /dev/null +++ b/static/unix-v10/man3/fseek.3 @@ -0,0 +1,51 @@ +.TH FSEEK 3S +.CT 2 file_io +.SH NAME +fseek, ftell, rewind \(mi reposition a stream +.SH SYNOPSIS +.nf +.B #include <stdio.h> +.PP +.B int fseek(stream, offset, ptrname) +.B FILE *stream; +.B long offset; +.PP +.B long ftell(stream) +.B FILE *stream; +.PP +.B int rewind(stream) +.fi +.SH DESCRIPTION +.I Fseek +sets the position of the next input or output +operation on the +.IR stream . +The new position is at the signed distance +.I offset +bytes +from the beginning, the current position, or the end of the file, +as +.I ptrname +has the value 0, 1 or 2 respectively. +.PP +.I Ftell +returns the current value of the file pointer for the file +associated with the named +.IR stream . +.PP +.IR Rewind ( stream ) +is equivalent to +.BR "fseek(stream, 0L, 0)" . +.SH "SEE ALSO" +.IR lseek (2), +.IR stdio (3) +.SH DIAGNOSTICS +.I Fseek +returns \-1 +for improper seeks. +.SH BUGS +The interaction of +.I fseek +and +.IR ungetc (3) +is undefined. diff --git a/static/unix-v10/man3/fstream.3 b/static/unix-v10/man3/fstream.3 new file mode 100644 index 00000000..301bdd0f --- /dev/null +++ b/static/unix-v10/man3/fstream.3 @@ -0,0 +1,154 @@ +. \"ident "%W%" +. \"Copyright (c) 1984 AT&T +. \"All Rights Reserved +. \"THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +. \"The copyright notice above does not evidence any +. \"actual or intended publication of such source code. +.TH FSTREAM 3I+ "C++ Stream Library" " " +.SH NAME +fstream \- iostream and streambuf specialized to files +.SH SYNOPSIS +.nf +.ft B +.ta1i 2i +#include <fstream.h> + +typedef long streamoff, streampos; +class ios { +public: + enum seek_dir { beg, cur, end }; + enum open_mode { in, out, ate, app } ; + // \fIand lots of other stuff ... \fP + } ; + +class ofstream : ostream { + ofstream() ; + ofstream(char* name, open_mode mode, int prot=0664) ; + ofstream(int fd) ; + ofstream(int fd, char* p, int l) ; + + void attach(int fd); + void close(); + void open(char* name, open_mode, int=0664) ; + filebuf* rdbuf(); +}; + +class ifstream : istream { \fI same as ofstream\fP }; +class fstream : iostream { \fI same as ofstream\fP }; +.fi +.ft R +.SH DESCRIPTION +\f(CWifstream\fRs, \f(CWofstream\fR and \f(CWfstream\fR +specialize \f(CWistream\fR, \f(CWostream\fR and \f(CWiostream\fR +(respectively) to files. +That is, the associated streambuf will be a \f(CWfilebuf\fR. +.PP +Assume +.br +\(em \fBf\fR any of \f(CWifstream\fR, \f(CWofstream\fR or \f(CWfstream\fR. +.br +\(em \fBpfb\fR is a \f(CWfilebuf*\fR. +.br +\(em \fBpsb\fR is a \f(CWstreambuf*\fR. +.br +\(em \fBname\fR and \fBptr\fR are \f(CWchar*\fR. +.br +\(em \fBi\fR, \fBfd\fR, \fBlen\fR and \fBprot\fR are \f(CWint\fR. +.br +\(em \fBmode\fR is an \f(CWopen_mode\fR. +.PP +The constructors for \fIx\f(CWstream\fR, where \fIx\fR is either +\f(CWif\fR, +\f(CWof\fR or \f(CWf\fR, are: +.TP +\fIx\fBstream()\fR +Constructs an unopened \f(CWxstream\fR. +.TP +\fIx\fBstream()(name,mode,prot)\fR +Constructs an \f(CWxstream\fR and tries to opens it using +\fBname\fR, \fBmode\fR, and \fBprot\fR. +The status of the constructed \f(CWxstream\fR +will indicate failure in case the +\fBopen\fR fails. +.TP +\fIx\fBstream()\fR +Constructs an \f(CWxstream\fR connected to file descriptor \fBd\fR, +which must be previously opened. +.TP +\fIx\fBstream(d,ptr,len)\fR +Constructs an \f(CWxstream\fR connected to file descriptor \fBfd\fR +and in addition initializes +the associated \f(CWfilebuf\fR to use the \fBlen\fR bytes +at \fBptr\fR as the +reserve area. If \fBptr\fR is null or \fBlen\fR is 0, the \f(CWfilebuf\fR +will be unbuffered. +.PP +Member functions: +.TP +\fBf.attach(d)\fR +Connects \fBf\fR to the file descriptor \fBd\fR. +A failure occurs when \fBf\fR is already connected to a file. +A failure sets \f(CWfailbit\fR in \fBf\fR's error state. +.TP +\fBf.close()\fR +Closes any associated \f(CWfilebuf\fR and thereby breaks the connection +of the \fBf\fR to a file. +\\fBf\fR's error state is cleared except on failure. +A failure occurs when the call to \fBf.rdbuf()->close\fR fails. +.TP +\fBf.open(name,mode,prot)\fR +Opens file \fBname\fR and connects \fBf\fR to it. +If the file is created, it is created with protection mode \fBprot\fR. +\fBopen\fR normally returns 0, but it returns \f(CWEOF\fR on failure. +Failure +occurs if \fBf\fR is already open, or the call to \fBf.rdbuf()->open\fR +fails. \f(CWfailbit\fR is set in \fBf\fR's error status on failure. +The members of \f(CWopen_mode\fR are bits that may be or'ed together. +The meaning of these bits in \fBmode\fR is +.RS +.TP +\f(CWapp\fR +A seek to the end of file is performed. +Subsequent data written to the file is always added (appended) +at the end of file. +On some systems this is implemented in the kernel. +In +others it is implemented by seeking to the end of the file +before each write. \f(CWapp\fR implies \f(CWoutput\fR. +.TP +\f(CWate\fR +A seek to the end of the file is performed during the \fBopen\fR. +\f(CWate\fR does not imply \f(CWoutput\fR. +.TP +\f(CWin\fR +Implied by construction and opens of \f(CWifstream\fRs. +For \f(CWfstream\fRs it indicates that input operations should be +allowed possible. Is is legal to include \f(CWin\fR in the modes +of an \f(CWostream\fR in which case it implies that the original +file (if it exists) should not be truncated. +.TP +\f(CWout\fR +Implied by construction and opens of \f(CWofstream\fRs. +For \f(CWfstream\fR it says that output operations are to +be allowed. +.RE +.TP +\fBpfb=f.rdbuf()\fR +Returns a pointer to the associated \f(CWfilebuf\fR. +\fBfstream::rdbuf\fR has the same meaning as +\fBiostream::rdbuf\fR +but is typed differently. +.TP +\fBpsb=f.setbuf(p,len)\fR +Has the usual effect of a \fBsetbuf\fR, offering space +for a reserve area or requesting unbuffered I/O. +Normally the returned \fBpsb\fR is \fBf.rdbuf()\fR, but it is 0 +on failure. +A failure occurs if \fBf\fR is open or the call to \fBf.rdbuf()->setbuf\fR +fails. +.SH SEE ALSO +filebuf(3C++) +istream(3C++) +ios(3C++) +ostream(3C++) +sbuf.pub(3C++) diff --git a/static/unix-v10/man3/ftoa.3 b/static/unix-v10/man3/ftoa.3 new file mode 100644 index 00000000..be2061a4 --- /dev/null +++ b/static/unix-v10/man3/ftoa.3 @@ -0,0 +1,39 @@ +.pa 1 +.he 'FTOA (III)'1/15/73'FTOA (III)' +.ti 0 +NAME ftoa -- floating to ascii conversion +.sp +.ti 0 +SYNOPSIS jsr r5,ftoa; subr +.sp +.ti 0 +DESCRIPTION ftoa____ +will convert the floating point number in fr0 +into ascii in the form + + [-]ddddd.dd* + +if possible, otherwise in the form + + [-]d.dddddddde_[-]dd*. +.sp +For each character generated by ftoa, +the subroutine subr____ (supplied by the caller) is called on +register r5 with the character in r0. +.sp +The number of digits can be changed by changing the value +of "_ndigits" in ecvt (default is 10.). +.sp +The subroutine subr____ must not disturb any registers. +.sp +.ti 0 +FILES kept in /lib/liba.a +.sp +.ti 0 +SEE ALSO ecvt(III), itoa(III) +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS -- diff --git a/static/unix-v10/man3/ftoo.3 b/static/unix-v10/man3/ftoo.3 new file mode 100644 index 00000000..cebd1b3e --- /dev/null +++ b/static/unix-v10/man3/ftoo.3 @@ -0,0 +1,32 @@ +.pa 1 +.he 'FTOO (III)'1/15/73'FTOO (III)' +.ti 0 +NAME ftoo -- floating to octal conversion +.sp +.ti 0 +SYNOPSIS jsr r5,ftoo; subr +.sp +.ti 0 +DESCRIPTION ftoo wil convert the floating point number +in fr0 into ascii in the conventional octal form + + 000000;000000;000000;000000 +.sp +For each character generated by ftoo, the subroutine +subr____ +(supplied by the caller) is called on register r5 +with the character in r0. +.sp +The subroutine subr____ must not disturb any registers. +.sp +.ti 0 +FILES kept in /lib/liba.a +.sp +.ti 0 +SEE ALSO -- +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS -- diff --git a/static/unix-v10/man3/ftw.3 b/static/unix-v10/man3/ftw.3 new file mode 100644 index 00000000..b2b0432b --- /dev/null +++ b/static/unix-v10/man3/ftw.3 @@ -0,0 +1,165 @@ +.TH FTW 3 +.CT 2 dirs +.SH NAME +ftw \- file tree walk +.SH SYNOPSIS +.nf +.B #include <ftw.h> +.PP +.B int ftw(path, fn, depth) +.B char *path; +.B int (*fn)(); +.B int depth; +.PP +.B #include <sys/types.h> +.B #include <sys/stat.h> +.PP +.IB fn "(name, statb, code, S)" +.B char *name; +.B struct stat *statb; +.B struct FTW *S; +.fi +.SH DESCRIPTION +.I Ftw +recursively descends the directory hierarchy +rooted in +.IR path . +For each entry in the hierarchy, +.I ftw +calls +.IR fn , +passing it information about the entry: +a pointer to a null-terminated pathname +string, a pointer to a +.B stat +structure (see +.IR stat (2)), +and a pointer to the following structure. +.PP +.EX +.ta \w'struct 'u +\w'int level 'u +struct FTW { + int quit; \fRsee below\fP + int base; &name[base] \fRpoints to basename\fP + int level; \fRrecursion level (initially 0)\fP +}; +.EE +.LP +Possible values of +.IR code , +defined in +.FR <ftw.h> , +are +.TF FTW_DNR +.PD 0 +.TP +.B FTW_D +Entry is a directory (before visiting descendants). +.TP +.B FTW_DP +Entry is a directory (after visiting descendants). +.TP +.B FTW_SL +Entry is a symbolic link. +.TP +.B FTW_F +Entry is some other kind of file. +.TP +.B FTW_DNR +Entry is a directory that cannot be read; +no descendants will be visited. +.TP +.B FTW_NS +.I Lstat +(see +.IR stat (2)) +failed on +.IR name ; +contents of +.I statb +are undefined +.TP +.B FTW_NSL +.I Lstat +succeeded, but +.I stat +failed; contents of +.I statb +are undefined. +.PD +.PP +The tree traversal continues until the tree is exhausted or +.I fn +returns a nonzero value. +When the tree is exhausted, +.I ftw +returns zero. +When +.I fn +returns a nonzero value, +.I ftw +stops and returns that value. +.PP +Normally symbolic links are not followed. +But if on a symbolic link +.RB ( FTW_SL ) +.IR fn +sets +.B S->quit +to +.BR FTW_FOLLOW , +.IR ftw +will next attempt to follow the link. +.PP +.I Ftw +normally visits a readable directory twice, before and +after visiting its descendants. +But if on a previsit +.RB ( FTW_D ) +.I fn +sets +.B S->quit +to +.B FTW_SKD, +.I ftw +will skip the descendants and the postvisit +.RB ( FTW_DP ). +.PP +.I Ftw +uses one file descriptor for each level in the tree up to a +maximum of +.I depth +(or 1, if +.IR depth <1) +descriptors. +.I Depth +must not exceed the number of available file descriptors; small +values of +.I depth +may cause +.I ftw +to run slowly, but will not change its effect. +.SH "SEE ALSO" +.IR stat (2), +.IR directory (3) +.SH DIAGNOSTICS +.I Ftw +returns \-1 +with +.I errno +set to +.B ENOMEM +when +.IR malloc (3) +fails. +.PP +.I Errno +is set appropriately when +.I ftw +calls +.I fn +with code +.BR FTW_DNR , +.BR FTW_NS , +or +.BR FTW_NSL . diff --git a/static/unix-v10/man3/ftwalk.3 b/static/unix-v10/man3/ftwalk.3 new file mode 100644 index 00000000..9d2642d0 --- /dev/null +++ b/static/unix-v10/man3/ftwalk.3 @@ -0,0 +1,209 @@ +.TH FTWALK 3 +.SH NAME +\fBftwalk\fR \- file tree walker +.SH SYNOPSIS +.ta .75i 1.5i 2.25i 3i 3.75i 4.5i 5.25i 6i +.PP +.nf +\fB +#include <ftwalk.h> + +ftwalk(char* path, int (*userf)(struct FTW* ftw), int options, + int (*comparf)(struct FTW* ftw1, struct FTW* ftw2)) +\fR +.fi +.SH DESCRIPTION +.PP +\fIFtwalk\fR traverses a directory hierarchy using depth-first search. +Upon visiting each file or directory in the hierarchy, it calls +the user function \fIuserf\fP to process that file or directory. +On a directory object, \fIuserf\fR may be called twice, once in preorder +and once in postorder. +On a terminal object such as a file or an unreadable directory, +\fIuserf\fP is called only once. +Cycles due to hard links or symbolic links are detected +to avoid infinite loops. +.PP +\fIPath\fR is the starting point of the search. +It may be an absolute path name or a path name relative to +the current directory. +If \fIpath\fR is a null pointer or points to an empty string, it is treated +as if it points to the current (dot) directory. +.PP +\fIOptions\fR consists of zero or more of the following bits: +.IP +FTW_CHILDREN: +This implies preorder calls to \fIuserf\fR on directory objects. +On such a call to \fIuserf\fR, +the field \fIftw->link\fR (below) points to a link list of +the children of the respective directory. +Upon returning from \fIuserf\fP, +if the field \fIftw->status\fR of any child object +is set to FTW_SKIP (below), that child is pruned from the search. +.IP +FTW_DELAY: When \fBFTW_CHILDREN\fP is turned on, +the fields \fIftw->statb\fP (\fIstruct stat\fP) of children objects +remain undefined until these objects are visited. +.IP +FTW_DOT: Do not use \fIchdir\fR(2) during the traversal. +Normally \fIchdir\fR is used so that +the base name of the object about to be processed can be used +in accessing its data. +This can enhance \fIftwalk\fR efficiency but certain program effects +such as core dumps may be generated in unexpected places +or may not even be generated at all. +Whenever \fIchdir\fR generates an error, if possible, +the current directory is restored to the starting directory +(see FTW_NAME and FTW_PATH). +.IP +FTW_MULTIPLE: The \fIpath\fP argument is treated as a \fIchar**\fP +pointer to a null-terminated array of path names. +All hierarchies rooted at these paths will be searched +.IP +FTW_POST: Calls to the user function are issued only in postorder. +That is, \fIuserf\fP is called on a directory only after its descendants have +been processed. +The absence of this bit indicates that calls to the user functions +are issued in preorder. That is, \fIuserf\fP is +called on a directory before its descendants are processed. +.IP +FTW_PHYSICAL: Use \fIlstat\fR(2) instead of \fIstat\fR(2) to get +file status and allow detection of symbolic links. +In addition, if each component +of the absolute path to the starting object has search permission, +the absolute path is used for early detection of cycles. +.IP +FTW_TWICE: Calls to the user function are issued in both preorder and postorder +for directory objects. +.IP +FTW_USER: The first of 6 user defined option bits. +These bits are ignored by \fIftwalk\fP. +.PP +\fIUserf\fR is a user supplied function that is +called upon different visits of an object. +If the return value of \fIuserf\fR is non-zero, +\fIftwalk\fR returns immediately with the same value. +The \fIuserf\fP prototype is: +.PP +.nf + int userf(struct FTW* ftw) +.fi +.PP +\fBstruct FTW\fP contains at least the following elements: +.PP +.nf + struct FTW* link; /* link list of children */ + struct FTW* parent; /* parent object on the search path */ + union + { + long number; /* local number */ + void* pointer; /* local pointer */ + } local; /* user defined */ + struct stat statb; /* stat buffer of this object */ + char* path; /* full pathname */ + short pathlen; /* strlen(path) */ + unsigned short info; /* type of object */ + unsigned short status; /* status of object */ + short level; /* depth of object on the search path */ + short namelen; /* strlen(name) */ + char name[]; /* file name of object */ +.fi +.PP +The \fIlink\fR field is normally NULL. +If the option FTW_CHILDREN was turned on, +it points to the start of the list of children +of the directory being visited in preorder. +Finally, if the directory being visited causes a cycle, +\fIlink\fR points to the object on the search path that is +identical to this directory. Note that if FTW_PHYSICAL was turned on, +this may point to a directory that is an ancestor of the starting +object. +.PP +The \fIparent\fR field points to the parent object +on the search path. For convenience, a parent object is also supplied for +the starting object. +In this case, except for the \fIlocal\fR field which is initialized +to 0 and the \fIlevel\fR field which contains a negative number, +the rest of the structure may be undefined. +.PP +The \fIinfo\fR field indicates the type of the object +being visited and the type of the visit. The types are: +.IP +FTW_D: A directory being visited in preorder, i.e., +none of its children has been visited by the search. +.IP +FTW_DNX: A directory being visited in preorder that does not have +search permission. +.IP +FTW_DP: A directory being visited in postorder, i.e., all of its +descendants have been completely processed. +.IP +FTW_DC: A directory that causes cycles. This is a terminal object. +.IP +FTW_DNR: A directory that cannot be opened for reading. This is a terminal object. +.IP +FTW_F: An ordinary file. +.IP +FTW_SL: A symbolic link. +Unless FTW_FOLLOW (below) is issued by the user function, +this object is terminal. +.IP +FTW_NS: \fIStat\fR failed on this object. +The stat buffer \fIstatb\fR is undefined. +This object is terminal. +.PP +The \fIstatus\fR field of \fIstruct FTW\fR is used to communicate information +between \fIftwalk\fR and \fIuserf\fR. On calls to \fIuserf\fR, it has one of +two values: +.IP +FTW_NAME: The name of the object as defined in \fIftw->name\fR should be used for +accessing its file information. This is because \fIchdir\fR(2) has been used +to set the current directory to a suitable place (see FTW_CHDIR). +.IP +FTW_PATH: The argument \fIpath\fR of \fIuserf\fR should be used +for accessing the file information of the object. +.PP +Upon returning, \fIuserf\fR may set the \fIstatus\fR field +to one of the following values: +.IP +FTW_AGAIN: If this is a directory object being visited in postorder, +it will be processed \fIagain\fR as if it had not been visited. +.IP +FTW_NOPOST: If this is a directory object being visited in preorder, +the user function will not be called on its postorder visit. +.IP +FTW_SKIP: This object and its descendants are pruned from the search. +.IP +FTW_FOLLOW: If this object is a symbolic link, +follow the link to its physical counterpart. +.PP +\fIComparf\fR, if not NULL, is a pointer to a function +used to define a search ordering for children of a directory. +If FTW_CHILDREN is turned on, the ordering of the children of +a directory is done before the preorder call to \fIuserf\fR on that directory. +Therefore, in that case, \fIftw->link\fR will point to the smallest child. +.PP +The \fIcomparf\fP prototype is: +.PP +.nf + int comparf(struct FTW* ftw1, struct FTW* ftw2) +.fi +.PP +\fIComparf\fR should return a value <0, 0, or >0 to indicate whether +\fIftw1\fR is considered smaller, equal, or larger than \fIftw2\fR. +.PP +\fIFtwalk\fR normally returns 0. +On hard errors such as running out of memory, it returns -1. +\fIFtwalk\fR may also return other values as discussed with respect +to \fIuserf\fR. +.SH HISTORY +\fIFtwalk\fR performs similar functions as that of +the routine \fIftw\fR provided in System V. +However, it is more general than \fIftw\fR +and suitable for use as a base in implementing +popular tools such as \fIls, find, tar, du,\fR and \fIrm\fR. +\fIFtwalk\fR also handles symbolic links and hard links gracefully. +.SH AUTHORS +Phong Vo, Glenn Fowler, Dave Korn +.SH SEE ALSO +find(1), rm(1), du(1), ls(1), tar(1), stat(2), symlink(2), chdir(3), ftw(3). diff --git a/static/unix-v10/man3/galloc.3 b/static/unix-v10/man3/galloc.3 new file mode 100644 index 00000000..06548bf4 --- /dev/null +++ b/static/unix-v10/man3/galloc.3 @@ -0,0 +1,75 @@ +.TH GALLOC 3 +.CT 2 mem_man +.SH NAME +galloc, gfree, garbage \(mi storage allocation with garbage collection +.SH SYNOPSIS +.nf +.B char *galloc(n) +.B unsigned n; +.PP +.B void gfree(p) +.B char *p; +.PP +.B void garbage() +.fi +.SH DESCRIPTION +These functions perform heap storage allocation with +garbage collection. +.PP +.I Galloc +allocates a block of at least +.I n +bytes and returns a pointer to it. +.I Gfree +frees a block previously allocated by +.I galloc. +.PP +When space gets tight, garbage blocks +are freed automatically. +A block allocated by +.I galloc +is deemed to be garbage unless it is reachable. +A reachable block is one whose first byte is +pointed to by a declared C variable +or by a pointer in a reachable block. +.PP +The frequency of garbage collection is controlled by external +variables declared +.IP +.B "long gcmax = 5000, gcmin = 50;" +.LP +No more than +.I gcmax +allocations may intervene between automatic collections; this feature +will help contain the growth of virtual address space. +At least +.I gcmin +allocations must intervene, otherwise +garbage collection will be abandoned as fruitless. +.I Garbage +may be called to do garbage collection at an arbitrary time. +.PP +.IR Malloc (3) +and +.I galloc +allocate from the same arena, but garbage collection +affects only +.I galloc +blocks. +.I Free +(see +.IR malloc (3)) +must not be used on blocks allocated with +.IR galloc . +.SH SEE ALSO +.IR malloc (3) +.SH DIAGNOSTICS +.I Galloc +returns 0 +when space cannot be found. +.SH BUGS +Garbage collection is conservative; +blocks that appear to be pointed to from +within declared storage will not be freed, +regardless of whether the apparent `pointers' +were declared as such. diff --git a/static/unix-v10/man3/gamma.3 b/static/unix-v10/man3/gamma.3 new file mode 100644 index 00000000..0c7e2dd9 --- /dev/null +++ b/static/unix-v10/man3/gamma.3 @@ -0,0 +1,48 @@ +.TH GAMMA 3M +.CT 2 math +.SH NAME +gamma \(mi log gamma function +.SH SYNOPSIS +.nf +.B #include <math.h> +.PP +.B double gamma(x) +.B double x; +.PP +.B extern int signgam; +.fi +.SH DESCRIPTION +.I Gamma +returns +ln |\(*G(\|\fIx\fP\|)|. +The sign of +\(*G(\|\fIx\fP\|) +is returned in the external integer +.IR signgam . +.SH EXAMPLES +Computation of the gamma function: +.PP +.nf +.ta 8n +8n +.ft L + errno = 0; + y = gamma(x); + if(errno || (y > 88.0)) + error(); + y = signgam*exp(y); +.fi +.ft P +.SH DIAGNOSTICS +A large value +.RL ( HUGE ) +is returned for negative integer arguments +and +.I errno +is set to +.BR EDOM . +.SH BUGS +There should be a positive indication of error. +.br +The name should indicate the answer is a logarithm, +perhaps +.IR lgamma . diff --git a/static/unix-v10/man3/gerts.3 b/static/unix-v10/man3/gerts.3 new file mode 100644 index 00000000..2738ac26 --- /dev/null +++ b/static/unix-v10/man3/gerts.3 @@ -0,0 +1,43 @@ +.pa 1 +.he 'CONNECT, GERTS (III)'3/15/72'CONNECT, GERTS (III)' +.ti 0 +NAME connect, gerts -- Gerts communication over 201 +.sp +.ti 0 +SYNOPSIS jsr r5,connect +.br +(error return) +.a +.br +.li +... + +jsr r5,gerts; fc; oc; ibuf; obuf +.br +(error return) +.br +.li +... +.sp +other entry points: gcset, gout +.sp +.ti 0 +DESCRIPTION The +GCOS GERTS interface is so bad that +a description here is inappropriate. +Anyone needing to use this interface should +seek divine guidance. +.sp +.ti 0 +FILES /dev/dn0, /dev/dp0 +.br +kept in /lib/liba.a +.sp +.ti 0 +SEE ALSO dn(IV), dp(IV), HIS documentation +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS -- diff --git a/static/unix-v10/man3/getarg.3 b/static/unix-v10/man3/getarg.3 new file mode 100644 index 00000000..fdf3d532 --- /dev/null +++ b/static/unix-v10/man3/getarg.3 @@ -0,0 +1,49 @@ +.th GETARG III 11/24/73 +.sh NAME +getarg \*- get command arguments from Fortran +.sh SYNOPSIS +.ft B +call getarg ( i, iarray, \fR[ \fB, isize \fR]\fB ) +.s3 +.li +... = iargc(dummy) +.ft R +.sh DESCRIPTION +The +.it getarg +entry fills in +.it iarray +(which is considered to be +.it integer) +with the Hollerith string representing the +.it i +th +argument to the command +in which it it is called. +If no +.it isize +argument is specified, +at least one blank is placed after the argument, +and the last word affected is blank padded. +The user should make sure that the array is big enough. +.s3 +If the +.it isize +argument is given, +the argument will be followed by blanks +to fill up +.it isize +words, but even if the argument is long no more than +that many words will be filled in. +.s3 +The blank-padded array is suitable for use as an +argument to setfil (III). +.s3 +The +.it iargc +entry returns the number of arguments to the command, +counting the first (file-name) argument. +.sh "SEE ALSO" +exec (II), +setfil (III) +.sh BUGS diff --git a/static/unix-v10/man3/getc.3 b/static/unix-v10/man3/getc.3 new file mode 100644 index 00000000..7a1557ab --- /dev/null +++ b/static/unix-v10/man3/getc.3 @@ -0,0 +1,59 @@ +.pa 1 +.he 'GETC, GETW, FOPEN (III)'3/15/72'GETC, GETW, FOPEN (III)' +.ti 0 +NAME getw, getc, fopen -- buffered input +.sp +.ti 0 +SYNOPSIS mov $filename,r0 +.br +jsr r5,fopen; iobuf + +jsr r5,getc; iobuf +.br +(character in r0) + +jsr r5,getw; iobuf +.br +(word in r0) +.sp +.ti 0 +DESCRIPTION These routines are used to provide a buffered input +facility. +iobuf_____ is the address of a 518(10) byte buffer area whose +contents are maintained by these routines. Its format is: +.sp +.nf +ioptr: .=.+2 / file descriptor + .=.+2 / characters left in buffer + .=.+2 / ptr to next character + .=.+512. / the buffer +.sp +.fi +fopen_____ may be called initially to open the file. On return, +the error bit (c-bit) is set if the open failed. +If fopen_____ is never called, get___ will read from the standard +input file. +.sp +getc____ returns the next byte from the file in r0. The +error bit is set on end of file or a read error. +.sp +getw____ returns the next word in r0. getc____ and getw____ +may be used alternately; there are no odd/even +problems. +.sp +iobuf_____ must be provided by the user; it must be on a word boundary. + +To reuse the same buffer for another file, it is sufficient +to close the original file and call fopen_____ again. +.sp +.ti 0 +FILES kept in /lib/liba.a +.sp +.ti 0 +SEE ALSO open(II), read(II), putc(III) +.sp +.ti 0 +DIAGNOSTICS c-bit set on EOF or error +.sp +.ti 0 +BUGS -- diff --git a/static/unix-v10/man3/getchr.3 b/static/unix-v10/man3/getchr.3 new file mode 100644 index 00000000..8a41ae69 --- /dev/null +++ b/static/unix-v10/man3/getchr.3 @@ -0,0 +1,55 @@ +.th GETCHAR III 4/7/73 +.sh NAME +getchar \*- read character +.sh SYNOPSIS +.ft B +getchar( ) +.br +.ft R +.sh DESCRIPTION +.it Getchar +provides the simplest means of reading characters from +the standard input for C programs. +It returns successive characters until end-of-file, +when it returns ``\\0''. +.s3 +Associated with this routine is an external variable +called \fIfin\fR, which is a structure containing +a buffer such as described under \fIgetc\fR (III). +.s3 +Normally input via \fIgetchar\fR is unbuffered, +but if the file-descriptor (first) word of +.it fin +is non-zero, +.it getchar +calls +.it getc +with +.it fin +as +argument. +This means that +.s3 + fin = open(...) +.s3 +makes +.it getchar +return (buffered) input from +the opened file; also +.s3 + fin = dup(0); +.s3 +causes the standard input to be buffered. +.s3 +Generally speaking, +.it getchar +should be used only for the simplest applications; +.it getc +is better when there are multiple input files. +.sh "SEE ALSO" +getc (III) +.sh DIAGNOSTICS +Null character returned on EOF or error. +.sh BUGS +\*-1 should be +returned on EOF; null is a legitimate character. diff --git a/static/unix-v10/man3/getdate.3 b/static/unix-v10/man3/getdate.3 new file mode 100644 index 00000000..37d9a625 --- /dev/null +++ b/static/unix-v10/man3/getdate.3 @@ -0,0 +1,169 @@ +.TH GETDATE 3 unc +.SH NAME +getdate \- convert time and date from ASCII +.SH SYNOPSIS +.B #include <sys/types.h> +.br +.B #include <sys/timeb.h> +.PP +.B time_t getdate(buf, now) +.br +.B char *buf; +.br +struct timeb *now; +.SH DESCRIPTION +.I Getdate +is a routine that converts most common time specifications to standard UNIX +format. The first argument is the character string containing the +time and date; the second is the assumed current time (used for relative +specifications); if +.B NULL +is passed, +.IR ftime (2) +is used to obtain the current time and timezone. +.PP +The character string consists of 0 or more specifications of the following +form: +.TP .75i +tod +A +.I tod +is a time of day, which is of the form +.IR hh : mm [: ss ] +(or +.IR hhmm ) +.RI [ meridian ] +.RI [ zone ]. +If no meridian \- +.B am +or +.B pm +\- is specified, a 24-hour clock is used. A +.I tod +may be specified as just +.I hh +followed by a +.IR meridian. +.TP .75i +date +A +.I date +is a specific month and day, and possibly a year. Acceptable formats are +.IR mm/dd [ /yy ] +and +.IR "monthname dd" "[, " yy ] +If omitted, the year defaults to the +current year; if a year is specified +as a number less than 100, 1900 is added. +If a number not followed by a day or relative time unit occurs, it will +be interpreted as a year if a +.IR tod , +.IR monthname , +and +.I dd +have already been specified; otherwise, it will be treated as a +.IR tod . +This rule allows the output from +.IR date (1) +or +.IR ctime (3) +to be passed as input to +.IR getdate . +.TP .75i +day +A +.I day +of the week may be specified; the current day will be used if appropriate. +A +.I day +may be preceeded by a +.IR number, +indicating which instance of that day is desired; the default is +.BR 1 . +Negative +.I numbers +indicate times past. Some symbolic +.I numbers +are accepted: +.BR last , +.BR next , +and the ordinals +.B first +through +.B twelfth +.RB ( second +is ambiguous, and is not accepted as an ordinal number). +The symbolic number +.B next +is equivalent to +.BR 2 ; +thus, +.I "next monday" +refers not to the immediately coming Monday, but to the one a week later. +.TP .75i +relative time +Specifications relative to the current time are also accepted. +The format is +.RI [ number "] " unit ; +acceptable units are +.BR year , +.BR month , +.BR fortnight , +.BR week , +.BR day , +.BR hour , +.BR minute , +and +.BR second . +.PP +The actual date is formed as follows: first, any absolute date and/or time +is processed and converted. Using that time as the base, day-of-week +specifications are added; last, relative specifications are used. If a +date or day is specified, and no absolute or relative time is given, midnight +is used. +Finally, a correction is applied so that the correct hour of the day is +produced after allowing for daylight savings time differences. +.PP +.I Getdate +accepts most common abbreviations for days, months, etc.; in particular, +it will recognize them with upper or lower case first letter, and will +recognize three-letter abbreviations for any of them, with or without +a trailing period. Units, such as +.BR week s, +may be specified in the singular or plural. Timezone and meridian +values may be in upper or lower case, and with or without periods. +.SH FILES +/usr/lib/libu.a +.SH "SEE ALSO" +ctime(3), time(2) +.SH AUTHOR +Steven M. Bellovin (unc!smb) +.br +Dept. of Computer Science +.br +University of North Carolina at Chapel Hill +.SH BUGS +Because +.IR yacc (1) +is used to parse the date, +.I getdate +cannot be used a subroutine to any program that also needs +.IR yacc . +.br +The grammar and scanner are rather primitive; certain desirable and +unambiguous constructions are not accepted. Worse yet, the meaning of +some legal phrases is not what is expected; +.I next week +is identical to +.IR "2 weeks" . +.br +The daylight savings time correction is not perfect, and can get confused +if handed times between midnight and 2:00 am on the days that the +reckoning changes. +.br +Because +.IR localtime (2) +accepts an old-style time format without zone information, attempting +to pass +.I getdate +a current time containing a different zone will probably fail. diff --git a/static/unix-v10/man3/getenv.3 b/static/unix-v10/man3/getenv.3 new file mode 100644 index 00000000..02ca41e0 --- /dev/null +++ b/static/unix-v10/man3/getenv.3 @@ -0,0 +1,30 @@ +.TH GETENV 3 +.CT 2 data_man +.SH NAME +getenv \(mi value for environment name +.SH SYNOPSIS +.nf +.B char *getenv(name) +.B char *name; +.fi +.SH DESCRIPTION +.I Getenv +searches the environment list +(see +.IR environ (5)) +for a string starting with +\fIname\fL=\fR. +If no such a string is found, 0 +is returned. +Otherwise, +the address of the character following the +.L = +is returned. +.SH SEE ALSO +.IR printenv (1), +.IR environ (5), +.IR exec (2) +.SH BUGS +.I Getenv +ignores shell functions; see +.IR sh (1). diff --git a/static/unix-v10/man3/getfields.3 b/static/unix-v10/man3/getfields.3 new file mode 100644 index 00000000..2f0b90ce --- /dev/null +++ b/static/unix-v10/man3/getfields.3 @@ -0,0 +1,74 @@ +.TH GETFIELDS 3 +.CT 2 data_man +.SH NAME +getfields, getmfields, setfields \(mi break a string into fields +.SH SYNOPSIS +.nf +.B int getfields(str, ptrs, nptrs) +.B char *str, **ptrs; +.PP +.B int getmfields(str, ptrs, nptrs) +.B char *str, **ptrs; +.PP +.B void setfields(fielddelim) +.B char *fielddelim; +.fi +.SH DESCRIPTION +.I Getfields +breaks the null-terminated string +.I str +into at most +.I nptrs +null-terminated fields and places pointers to the start of these fields in the array +.IR ptrs . +It returns the number of fields +and terminates the list of pointers with a zero pointer. +It overwrites some of the bytes in +.IR str . +If there are +.I nptr +or more fields, the list will not end with zero +and the last `field' will extend to the end of the +input string and may contain delimiters. +.PP +A field is defined as a maximal sequence of characters not in a set +of field delimiters. +Adjacent fields are separated by exactly one delimiter. +No field follows a delimiter at the end of string. +Thus a string of just two delimiter characters +contains two empty fields, +and a nonempty string with no delimiters contains +one field. +.PP +.I Getmfields +is the same as +.I getfields +except that fields are separated by maximal strings of +field delimiters rather than just one. +.PP +.I Setfields +makes the field delimiters (space and tab by default) +be the characters of the string +.I fielddelim. +.SH EXAMPLES +Print the words in a string, where words are non-whitespace +strings. +There is no bound on the number of words. +.EX +printwords(string) +char *string; +{ + char *ptrs[2]; + int n; + setfields(" \et\en"); + for(n=2; n>=2; string=ptrs[1]) { + n = getmfields(string, ptrs, 2); + if(n == 0) + break; + if(ptrs[0][0] != 0) /* skip initial blanks */ + printf("%s\en", ptrs[0]); + } +} +.EE +.SH SEE ALSO +.IR string (3) diff --git a/static/unix-v10/man3/getflags.3 b/static/unix-v10/man3/getflags.3 new file mode 100644 index 00000000..1352e5a5 --- /dev/null +++ b/static/unix-v10/man3/getflags.3 @@ -0,0 +1,116 @@ +.TH GETFLAGS 3 +.CT 2 data_man +.SH NAME +getflags \(mi process flag arguments in argv +.SH SYNOPSIS +.nf +#include </usr/include/getflags.h> +.PP +.B int getflags(argc, argv, flags) +.B char **argv, *flags; +.PP +.B usage(tail) +.B char *tail; +.PP +.B extern char **flag[], cmdline[], *cmdname, *flagset[]; +.fi +.SH DESCRIPTION +.I Getflags +digests an argument vector +.IR argv , +finding flag arguments listed in +.IR flags . +.I Flags +is a string of flag letters. +A letter followed by a colon and a number +is expected to have the given number of parameters. +A flag argument starts with +.RB ` - ' +and is followed by any number of flag letters. +A flag with one or more parameters must be the last flag in an argument. +If any characters follow it, they are the flag's first parameter. Otherwise +the following argument is the first parameter. Subsequent parameters are taken +from subsequent arguments. +.PP +The global array +.I flag +is set to point to an array of parameters for each flag found. +Thus, if flag +.B -x +was seen, +.B flag['x'] +is non-zero, and +.B flag['x'][i] +is the flag's +.IR i th +parameter. +If flag +.B -x +has no parameters +.BR flag['x']==flagset . +Flags not found +are marked with a zero. +Flags and their parameters are deleted from +.I argv. +.I Getflags +returns the adjusted argument count. +.PP +.I Getflags +stops scanning for flags upon encountering a non-flag argument, +or an argument whose only character is +.RB ` - ', +which argument is deleted. +.PP +.I Getflags +places a pointer to +.I argv[0] +in the external variable +.I cmdname. +It also concatenates the original members of +.IR argv , +separated by spaces, and places the result in the external array +.IR cmdline . +.PP +.I Usage +constructs a usage message, prints it on the standard error file, +and exits with status 1. +The command name printed is +.IR argv[0] . +Appropriate flag usage syntax is generated from +.IR flags . +As an aid, +explanatory information about flag parameters may be included in +.I flags +in square brackets as in the example. +.I Tail +is printed at the end of the message. +If +.I getflags +encountered an error, +.I usage +tries to indicate the cause. +.SH EXAMPLES +.EX + main(argc, argv) + char *argv[]; + { + if((argc=getflags(argc, argv, "vinclbhse:1[expr]", 1))==-1) + usage("[file ...]"); + } +.EE +might print: +.EX + Illegal flag -u + Usage: grep [-vinclbhs] [-e expr] [file ...] +.EE +.SH "SEE ALSO" +.IR getopt (3) +.SH DIAGNOSTICS +.I Getflags +returns \-1 on error: +a syntax error in +.I flags, +setting a flag more than once, setting a flag not mentioned +in +.IR flags , +or running out of argv while collecting a flag's parameters. diff --git a/static/unix-v10/man3/getflds.3 b/static/unix-v10/man3/getflds.3 new file mode 100644 index 00000000..4c6ed8b1 --- /dev/null +++ b/static/unix-v10/man3/getflds.3 @@ -0,0 +1,86 @@ +.TH GETFLDS 3S +.SH NAME +getflds \(mi read a line from a file and break it into fields +.SH SYNOPSIS +.nf +.B #include <stdio.h> +.PP +.B char **getflds(stream) +.B FILE *stream; +.fi +.SH DESCRIPTION +.I Getflds +reads a line from the +.I stream +given as argument, breaks it into fields, +and returns a pointer to a null-terminated array of +character pointers, each of which points +to a null-terminated string representing one field. +These strings, and the array that points to them, +persist until the next call to +.IR getflds . +On end of file, a null pointer is returned. +.PP +If the first character of a line is a +.LR # , +that line is considered to be a comment and ignored. +.PP +Fields are separated by white space (spaces or tabs). +Leading and trailing white space on a line is ignored. +White space may appear inside a field in one of three +ways: each space or tab may be preceded by a backslash, +the white space may be enclosed in single or +double quotes, or characters may described +in octal, as detailed below. +.PP +A field, or any parts of a field, may be enclosed in single +or double quotes. +Within quotes, white space and +quotes of the other sort are treated as +ordinary characters, but a closing quote +is silently inserted before a newline. +.PP +Inside or outside quotes, a backslash +and the character(s) after it are changed as follows: +.nf +.ta 10n +\fL\eb\fR backspace +\fL\ef\fR form feed +\fL\en\fR newline +\fL\er\fR return +\fL\et\fR horizontal tab +\fL\ev\fR vertical tab +\fL\e\e\fR \e +\fL\e\'\fR \' +\fL\e"\fR " +\fL\e#\fR # +\fL\e\fIspace\fR space +\fL\e\fItab\fR tab +\fL\e\fInewline\fR completely ignored; this allows a logical line to span any number of physical lines. +\fL\e\fIdigits\fR the one, two, or three octal digits are the value of the character to be used. +.fi +.PP +If any other character follows the +.LR \e , +both +characters lose their special interpretation. +.SH DIAGNOSTICS +If +.I getflds +detects an error, it returns +.LR 0 , +just as it does at end of file. +However, the error will have changed +.I errno +(see +.IR intro (2)). +To distinguish between error and +end of file set +.I errno +to zero before calling +.I getflds +and test it afterwards. +.SH BUGS +.I Getflds +provides no way to distinguish a null character +within a field from the end of the field. diff --git a/static/unix-v10/man3/getfsent.3 b/static/unix-v10/man3/getfsent.3 new file mode 100644 index 00000000..3f6d67e4 --- /dev/null +++ b/static/unix-v10/man3/getfsent.3 @@ -0,0 +1,89 @@ +.TH GETFSENT 3 +.CT 2 sa +.SH NAME +getfsent, getfsspec, getfsfile, setfsent, endfsent \(mi get file system description file entry +.SH SYNOPSIS +.nf +.B #include <fstab.h> +.PP +.B struct fstab *getfsent() +.PP +.B struct fstab *getfsspec(name) +.B char *name; +.PP +.B struct fstab *getfsfile(name) +.B char *name; +.PP +.B int setfsent() +.PP +.B int endfsent() +.fi +.SH DESCRIPTION +.I Getfsent, +.I getfsspec +and +.I getfsfile +each return a pointer to a structure +containing the broken-out +fields of a line in +.IR fstab (5), +which describes mountable file systems. +.PP +.EX +.ta \w'struct 'u +\w'char fs_spec[FSNMLG]; 'u +struct fstab { + char fs_spec[FSNMLG]; \fRblock device name\fP + char fs_file[FSNMLG]; \fRfile system mount point\fP + int fs_ftype; \fRfile system type\fP + int fs_flags; \fRfile system flags\fP + int fs_passno; \fRpass number for parallel \fP\fIfsck\fR(8)\fP +}; +.EE +.PP +Type numbers and flags are listed in +.IR fmount (2). +Entries that aren't file systems +(should not be mounted) +have negative values for +.LR fs_ftype : +.TP .7i +.L FSNONE +(\-1) Ignore this entry. +.PD 0 +.TP +.L FSSWAP +(\-2) +.L fs_spec +is a device available for swapping. +.PD +.PP +.I Getfsent +reads the next line of the file, opening the file if necessary. +.PP +.I Setfsent +opens and rewinds the file. +.PP +.I Endfsent +closes the file. +.PP +.I Getfsspec +and +.I getfsfile +sequentially search from the beginning +of the file until a matching +special file name or +file system file name is found, +or until EOF +is encountered. +.SH FILES +.TP +.F /etc/fstab +.SH "SEE ALSO" +.IR fmount (2), +.IR fstab (5) +.SH DIAGNOSTICS +Zero is returned on EOF +or error. +.SH BUGS +The return values point to static data +whose content is overwritten by each call. diff --git a/static/unix-v10/man3/getgrent.3 b/static/unix-v10/man3/getgrent.3 new file mode 100644 index 00000000..8c3fc41f --- /dev/null +++ b/static/unix-v10/man3/getgrent.3 @@ -0,0 +1,79 @@ +.TH GETGRENT 3 +.CT 2 secur +.SH NAME +getgrent, getgrgid, getgrnam, setgrent, endgrent \(mi get group file entry +.SH SYNOPSIS +.nf +.B #include <grp.h> +.PP +.B struct group *getgrent(); +.PP +.B struct group *getgrgid(gid) +.PP +.B struct group *getgrnam(name) +.B char *name; +.PP +.B int setgrent(); +.PP +.B int endgrent(); +.fi +.SH DESCRIPTION +.I Getgrent, +.I getgrgid +and +.I getgrnam +each return pointers +to a structure +containing the broken-out +fields of a line in +.FR /etc/group . +.EX +.ta \w'struct 'u +\w'group 'u +\w'*gr_passwd; 'u +struct group { + \fLchar *gr_name;\fR the group name + \fLchar *gr_passwd;\fP the encrypted group passwd + \fLint gr_gid;\fP the numeric groupid + \fLchar **gr_mem;\fP null-terminated vector of pointers to the individual member names +\fL};\fP +.EE +.PP +.I Getgrent +simply reads the next +line while +.I getgrgid +and +.I getgrnam +search until a matching +.I gid +or +.I name +is found +(or until EOF is encountered). +Each routine picks up +where the others leave off +so successive calls may be used +to search the entire file. +.PP +A call to +.I setgrent +has the effect of rewinding +the group file +to allow +repeated searches. +.I Endgrent +may be called to +close the group file +when processing is complete. +.SH FILES +.TP +.F /etc/group +.SH "SEE ALSO" +.IR getlogin (3), +.IR getpwent (3), +.IR passwd (5) +.SH DIAGNOSTICS +Zero is returned on EOF +or error. +.SH BUGS +The return values point to static data +whose content is overwritten by each call. diff --git a/static/unix-v10/man3/getlogin.3 b/static/unix-v10/man3/getlogin.3 new file mode 100644 index 00000000..bc9e500c --- /dev/null +++ b/static/unix-v10/man3/getlogin.3 @@ -0,0 +1,32 @@ +.TH GETLOGIN 3 +.CT 2 secur +.SH NAME +getlogin \(mi get login name +.SH SYNOPSIS +.B char *getlogin() +.SH DESCRIPTION +.I Getlogin +returns a pointer to +the login name +as set by +.IR setlogname ; +see +.IR getuid (2). +.PP +It is preferable, but less portable, to call +.IR getlogname ; +see +.IR getuid (2). +.SH FILES +.TP +.F /etc/utmp +.SH "SEE ALSO" +.IR getpwent (3), +.IR getgrent (3), +.IR utmp (5), +.IR getuid (2) +.SH DIAGNOSTICS +Zero is returned if the name could not be found. +.SH BUGS +The return values point to static data +whose content is overwritten by each call. diff --git a/static/unix-v10/man3/getopt.3 b/static/unix-v10/man3/getopt.3 new file mode 100644 index 00000000..e7339fb9 --- /dev/null +++ b/static/unix-v10/man3/getopt.3 @@ -0,0 +1,99 @@ +.TH GETOPT 3 +.CT 2 data_man +.SH NAME +getopt \(mi get option letter from argv +.SH SYNOPSIS +.nf +.B int getopt (argc, argv, optstring) +.B int argc; +.B char **argv; +.B char *optstring; +.PP +.B extern char *optarg; +.B extern int optind; +.fi +.SH DESCRIPTION +.I Getopt +returns the next option letter in +.I argv +that matches a letter in +.IR optstring . +.I Optstring +is a string of recognized option letters; +if a letter is followed by a colon, the option +is expected to have an argument, which may or +may not be separated from it by white space. +.I Optarg +is set to point to the start of the option argument +on return from +.IR getopt . +.PP +.I Getopt +places in +.I optind +the +.I argv +index of the next argument to be processed. +Since +.I optind +is external, it is normally initialized to zero +automatically before the first call to +.IR getopt . +.PP +Option letters appear in nonempty clusters preceded by +.BR - . +When all options have been processed +(i.e., up to the first non-option argument), +.I getopt +returns \-1. +The special option +.L -- +may be used to delimit the end of the options; +\-1 +will be returned, and +.L -- +will be skipped. +.SH EXAMPLES +This fragment processes arguments +for a command that can take option +.B a +and option +.BR f , +which requires an argument. +.PP +.EX +.ta \w'12345678'u +\w'12345678'u +main (argc, argv) char **argv; +{ + int c, errflg; + extern int optind; + extern char *optarg, *ifile; + while((c = getopt(argc, argv, "af:")) != -1) + switch (c){ + case 'a': aflg=1; break; + case 'f': ifile = optarg; break; + case '?': errflg=1; break; + } + if(errflg){ + fprintf(stderr, "usage: . . . "); + exit(2); + } + for( ; optind < argc; optind++){ + if(access(argv[optind], 4)){ + ... + } + } + ... +} +.EE +.SH SEE ALSO +.IR getflags (3) +.SH DIAGNOSTICS +.I Getopt +prints an error message on +.I stderr +and returns a +question mark +.L ? +when it encounters an option letter not included in +.IR optstring . diff --git a/static/unix-v10/man3/getpass.3 b/static/unix-v10/man3/getpass.3 new file mode 100644 index 00000000..d57d68a3 --- /dev/null +++ b/static/unix-v10/man3/getpass.3 @@ -0,0 +1,27 @@ +.TH GETPASS 3 +.CT 2 secur +.SH NAME +getpass \(mi read a password +.SH SYNOPSIS +.nf +.B char *getpass(prompt) +.B char *prompt; +.fi +.SH DESCRIPTION +.I Getpass +reads a password from the file +.FR /dev/tty , +or if that cannot be opened, from the standard input, +after prompting with the null-terminated string +.I prompt +and disabling echoing. +A pointer is returned to a null-terminated string +of at most 8 characters. +.SH FILES +.TP +.F /dev/tty +.SH "SEE ALSO" +.IR crypt (3) +.SH BUGS +The return value points to static data +whose content is overwritten by each call. diff --git a/static/unix-v10/man3/getpw.3 b/static/unix-v10/man3/getpw.3 new file mode 100644 index 00000000..56189a36 --- /dev/null +++ b/static/unix-v10/man3/getpw.3 @@ -0,0 +1,28 @@ +.th GETPW III 4/7/73 +.sh NAME +getpw \*- get name from UID +.sh SYNOPSIS +.ft B +getpw(uid, buf) +.br +char *buf; +.ft R +.sh DESCRIPTION +.it Getpw +searches the password file for +the (numerical) +\fIuid\fR, and fills in \fIbuf\fR +with the corresponding line; +it returns non-zero if \fIuid\fR could not +be found. +The line is null-terminated. +.sh FILES +/etc/passwd +.sh "SEE ALSO" +passwd(V) +.sh DIAGNOSTICS +non-zero +return on error. +.sh BUGS +It disturbs +buffered input via \fIgetchar\fR (III). diff --git a/static/unix-v10/man3/getpwent.3 b/static/unix-v10/man3/getpwent.3 new file mode 100644 index 00000000..1d779758 --- /dev/null +++ b/static/unix-v10/man3/getpwent.3 @@ -0,0 +1,83 @@ +.TH GETPWENT 3 +.CT 2 secur +.SH NAME +getpwent, getpwuid, getpwnam, setpwent, endpwent, pwdecode \(mi get password file entry +.SH SYNOPSIS +.nf +.B #include <pwd.h> +.PP +.B struct passwd *getpwent() +.PP +.B struct passwd *getpwuid(uid) +.B int uid; +.PP +.B struct passwd *getpwnam(name) +.B char *name; +.PP +.B int setpwent() +.PP +.B int endpwent() +.PP +.B struct passwd *pwdecode(p) +.B char *p; +.fi +.SH DESCRIPTION +.I Getpwent, +.I getpwuid +and +.I getpwnam +each return a pointer to a structure +containing the broken-out +fields of a line in +.FR /etc/passwd . +.EX +.ta \w'struct 'u +\w'passwd 'u +\w'*pw_comment; 'u +struct passwd { + \fLchar *pw_name;\fR login name + \fLchar *pw_passwd;\fP encrypted password + \fLint pw_uid;\fP numeric userid + \fLint pw_gid;\fP numeric groupid + \fLint pw_quota;\fP unused + \fLchar *pw_comment;\fP unused + \fLchar *pw_gecos;\fP field for local use + \fLchar *pw_dir;\fP login directory + \fLchar *pw_shell;\fP program to use as Shell +\fL};\fP +.EE +.PP +.I Getpwent +reads the next +line (opening the file if necessary); +.I setpwent +rewinds the file; +.I endpwent +closes it. +.PP +.I Getpwuid +and +.I getpwnam +search from the beginning until a matching +.I uid +or +.I name +is found +(or until end-of-file is encountered). +.PP +.I Pwdecode +breaks out a null-terminated character string +.I p +containing a password file entry. +The input string is modified by the call and +the output structure contains pointers into it. +.SH FILES +.TP +.F /etc/passwd +.SH "SEE ALSO" +.IR getlogin (3), +.IR getgrent (3), +.IR passwd (5) +.SH DIAGNOSTICS +These routines return 0 for end of file or error. +.SH BUGS +The return values point to static data +whose content is overwritten by each call. diff --git a/static/unix-v10/man3/getshares.3 b/static/unix-v10/man3/getshares.3 new file mode 100644 index 00000000..afbf6741 --- /dev/null +++ b/static/unix-v10/man3/getshares.3 @@ -0,0 +1,43 @@ +.TH GETSHARES 3 SHARE +.SH NAME +getshares \- get shares file entry given uid +.SH SYNOPSIS +.B "#include <shares.h>" +.br +.sp +.B "unsigned long getshares(lp, uid, lock)" +.br +.B "struct lnode * lp;" +.br +.B "int uid;" +.br +.B "int lock;" +.SH DESCRIPTION +.I Getshares +finds the shares entry with the same uid as +.I uid +and reads it into an area pointed to by +.IR lp . +.I lock +should be non-zero if the shares data-base should be opened for writing. +Returns zero if no entry exists, +(in which case all +.RI non- uid +fields of +.I *lp +will have been cleared), +or the ``last used'' time of the entry. +.I lp\->l_uid +will always have been set to +.I uid +on return. +.SH "SEE ALSO" +closeshares(3), +getshput(3), +openshares(3), +putshares(3), +sharesfile(3). +.SH DIAGNOSTICS +.I Getshares +returns 0 +if entry can't be found, or on error. diff --git a/static/unix-v10/man3/getshput.3 b/static/unix-v10/man3/getshput.3 new file mode 100644 index 00000000..248518b7 --- /dev/null +++ b/static/unix-v10/man3/getshput.3 @@ -0,0 +1,50 @@ +.TH GETSHPUT 3 SHARE +.SH NAME +getshput \- read, modify, and write shares file entry +.SH SYNOPSIS +.B "#include <shares.h>" +.br +.sp +.B "unsigned long getshput(lp, func)" +.br +.B "struct lnode * lp;" +.br +.B "unsigned long (*func)();" +.SH DESCRIPTION +.I Getshput +finds the shares entry with the same uid as +.I lp\->l_uid +and reads it into an internal +.I lnode +structure. +The function pointed to by +.I func +is then called with two arguments, +the first pointing to the original +.I lnode +structure, +and the second pointing to the internal +.I lnode +structure. +If +.I func +returns with a value other than 0 +the (presumably modified) second structure is written back to the shares file, +with the ``extime'' field in the shares record filled with the value returned by +.IR func . +Otherwise +.I getshput +simply returns. +.I Getshput +returns the value returned by +.IR func . +.SH "SEE ALSO" +closeshares(3), +getshares(3), +openshares(3), +putshares(3), +sharesfile(3). +.SH DIAGNOSTICS +.I Getshput +returns 0 +if the entry can't be modified. diff --git a/static/unix-v10/man3/getstsrc.3 b/static/unix-v10/man3/getstsrc.3 new file mode 100644 index 00000000..4ec8e711 --- /dev/null +++ b/static/unix-v10/man3/getstsrc.3 @@ -0,0 +1,43 @@ +.TH GETSTSRC 3 +.CT 2 sa secur +.SH NAME +getstsrc, setstsrc \(mi read and write a stream identifier +.SH SYNOPSIS +.nf +.B char *getstsrc(fd) +.B setstsrc(fd, name) +.B char *name; +.fi +.SH DESCRIPTION +.I Setstsrc +attaches a descriptive string to the indicated stream, +and +.I getstsrc +returns a pointer to a static buffer containing the string. +The string persists until final close of the stream. +When a stream is first opened the string is trivial. +.PP +.I Setstsrc +requires capability +.BR T_EXTERN ; +see +.IR getplab (2). +The string conventionally names the off-machine source of the +stream. +Since only trusted processes may modify it, +it may be relied on for security calculations. +.PP +.I Getstsrc +returns 0 on error, +.I setstsrc +returns \-1 on error. +.SH "SEE ALSO" +.IR stream (4) +.SH DIAGNOSTICS +.BR EPERM , +.BR ENOTTY +.SH BUGS +The return value of +.I getstsrc +points to static data +whose content is overwritten by each call. diff --git a/static/unix-v10/man3/getwd.3 b/static/unix-v10/man3/getwd.3 new file mode 100644 index 00000000..3f26286d --- /dev/null +++ b/static/unix-v10/man3/getwd.3 @@ -0,0 +1,41 @@ +.TH GETWD 3 +.CT 2 dirs +.SH NAME +getwd, getcwd \(mi get current directory +.SH SYNOPSIS +.B char *getwd(buf) +.br +.B char *buf; +.PP +.B char *getcwd(buf, size) +.br +.B char *buf; +.SH DESCRIPTION +.I Getwd +and +.I getcwd +fill +.I buf +with a null-terminated string representing the current directory +and return +.IR buf . +.PP +.I Getwd +is in the style of BSD systems and +.I getcwd +in that of System V. +If +.I buf +is 0, +.I getcwd +will call +.IR malloc (3) +to allocate +.I size +bytes for the buffer. +.SH "SEE ALSO +.IR pwd (1) +.SH DIAGNOSTICS +On error, zero is returned and +.I buf +is filled with a diagnostic message. diff --git a/static/unix-v10/man3/hash.3 b/static/unix-v10/man3/hash.3 new file mode 100644 index 00000000..5d3f972b --- /dev/null +++ b/static/unix-v10/man3/hash.3 @@ -0,0 +1,611 @@ +.de L \" literal font +.ft 5 +.it 1 }N +.if !\\$1 \&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6 +.. +.de LR +.}S 5 1 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" +.. +.de RL +.}S 1 5 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" +.. +.de EX \" start example +.ta 1i 2i 3i 4i 5i 6i +.PP +.RS +.PD 0 +.ft 5 +.nf +.. +.de EE \" end example +.fi +.ft +.PD +.RE +.PP +.. +.TH HASH 3 +.SH NAME +hash \- hash table support +.SH SYNOPSIS +.L "#include <hash.h>" +.SH DESCRIPTION +The +.I hash +routines manipulate collections of dynamic, scoped hash tables. +.PP +A hash table provides an association between a +.I key +and its +.IR value . +A +.I key +is a sequence of +.L char +elements and a +.I value +is a user supplied pointer to the value. +Each hash table has a dynamic number of slots, +each pointing to the head of a forward linked +.IR "collision chain" . +.PP +Hashing occurs as follows: +a +.I "hash function" +takes a +.I key +as an argument and returns a non-negative index. +The index modulo the table size produces a +slot that points to a +.IR "collision chain" . +The collision chain is sequentially searched until a match is found for +.IR key . +The hash tables are automatically resized as new entries are added. +.PP +Each hash table has one key type. +The default key type is a pointer to a null-terminated string. +The alternate key type is a pointer to a fixed length byte buffer, +declared for a given table by the +.L hashalloc() +function described below. +.PP +Hash table information is partitioned into two parts for efficient scoping. +The +.I root +part contains fixed information that is shared among a set of related +hash tables. +The remaining information is maintained on a per-table basis. +.PP +These basic types are defined in the header file +.B hash.h +(alternate names are listed in parenthesis): +.TP +.L "HASHTABLE (Hashtab_t)" +The per-table information. +The readonly public elements are: +.RS +.TP +.L "int buckets" +The number of table entries. +.TP +.L "char* name" +The hash table name. +.TP +.L "root" +The root information. +The public elements are: +.RS +.TP +.L "int root->accesses" +The number of lookups. +.TP +.L "int root->collisions" +The number of lookup collisions. +.RE +.TP +.L "HASHTABLE* scope" +The table that this scope covers, +.L NULL +if the table is not a scope. +.TP +.L "int size" +The current hash table size. +.RE +.TP +.L "HASHBUCKET (Hashbin_t)" +A collision chain hash bucket. +The public structure elements are: +.RS +.TP +.L "char* hashname(HASHBUCKET*)" +Returns a pointer to the hash bucket key given the bucket pointer. +.TP +.L "char* value" +The value associated with the key. +.RE +.TP +.L "HASHHEADER (Hashhdr_t)" +The hash bucket header that must be the first element in all user defined +buckets. +.L HASH_VALUE +may not be used with user defined buckets. +.TP +.L "HASHPOSITION (Hashpos_t)" +Stores the hash table position for +.LR hashscan . +The public elements are: +.RS +.TP +.L "HASHBUCKET* bucket" +The current hash bucket pointer. +.RE +.PP +The routines are: +.TP +.L "HASHTABLE* hashalloc(HASHTABLE* ref, int op, ...)" +Creates a new hash table and returns a pointer to the table. +.IR malloc (3) +is used to allocate space for the table. +.L NULL +is returned if the table cannot be created. +.L ref +is a pointer to a reference hash table that provides +default values for unspecified information. +The new hash table and +.L ref +share the same root information. +If +.L ref +is +.L NULL +then new root information is created for the new table. +The remaining arguments appear in +.I op-arg +pairs, followed by a final +.L 0 +argument. +The +.I op-arg +pairs are: +.RS +.TP +.L "HASH_alloc, (char(*)()) alloc" +.L alloc +is a function that is called to process +.L HASHBUCKET +.L value +assignments. +The single argument is +.L "char* value" +and the processed +.L char* +value is returned. +.TP +.L "HASH_clear, int flags" +.L flags +are the +.L ref +flags to be cleared in the new hash table. +See +.L HASH_set +below. +.TP +.L "HASH_compare, (int(*)()) compare" +Specifies an alternate +.I key +comparison function. +The arguments and return value for +.L compare +are the same as for +.IR strncmp (3) +if +.L HASH_namesize +is specified and +.IR strcmp (3) +otherwise. +The first argument is the +.I key +from the current hash bucket on the +.I "collision chain" +and the second argument is the user supplied +.IR key . +.TP +.L "HASH_free, (int(*)()) free" +.L free +is a function that is called when a hash bucket is freed. +If +.L HASH_BUCKET +was set in +.L hashalloc +then the hash bucket pointer is passed, otherwise the bucket +.L value +pointer is passed. +.TP +.L "HASH_hash, (int(*)()) hash" +Specifies an alternate +.I key +hash function. +A +.L char* +key argument (and, if +.L HASH_namesize +is specified, an +.L int +key size argument) is passed to +.LR hash . +The return value must be a non-negative +.LR int . +.TP +.L "HASH_meanchain, int meanchain" +Specifies the mean collision chain length. +The hash table is automatically resized when this value is exceeded. +The default mean chain length is 2. +.TP +.L "HASH_name, char* name" +Associates +.L name +with the hash table. +Used by +.LR hashdump) . +.TP +.L "HASH_namesize, int namesize" +The fixed size in bytes for +.I keys +in the table. +If +.L namesize +is 0 (the default) then the +.I keys +are interpreted as null-terminated strings. +.TP +.L "HASH_set, int flags" +Changes the hash table flags by +.IR or ing +in +.LR flags . +The flags, which may be +.IR or ed +together, are: +.RS +.TP +.L HASH_ALLOCATE +Keys for new hash table entries are to be copied to data areas obtained from +.IR malloc (3). +.TP +.L HASH_FIXED +Fixes the hash table size, disabling any automatic table resizing. +.TP +.L HASH_SCOPE +The new hash table is a scope that is to be pushed on top of +.LR ref . +.L ref +must be +.RL non- NULL . +.RE +.RE +.TP +.L "HASHTABLE* hashfree(HASHTABLE* tab)" +The hash table +.L tab +is freed. +The scope covered table pointer is returned, +.L NULL +if +.L tab +is not a scope. +.TP +.L "char* hashlook(HASHTABLE* tab, char* name, int flags, char* value)" +Operates on the key +.L name +in the hash table +.L tab +according to +.L flags +and +.LR value . +A +.L HASHBUCKET +pointer is returned unless otherwise noted. +There are three basic lookup operations: +.RS +.TP +.L HASH_CREATE +.L name +is entered into the top level scope if it does not already exist. +If +.L name +also appears in a lower scope and +.L HASH_ALLOC +is set for the table then the new bucket will share the +.L name +field value with the lower scope. +.TP +.L HASH_DELETE +.L name +is deleted from the top level scope if it exists. +.L NULL +is returned. +.TP +.L HASH_LOOKUP +The scopes are searched in order from top to bottom for +.L name . +The bucket pointer for the first occurrence is returned. +.L NULL +is returned if +.L name +is not found. +.RE +The basic operations may be qualified by the following +(the qualifiers are restricted to the basic operations in +the parenthesized list): +.RS +.TP +.L "HASH_BUCKET (HASH_CREATE,HASH_DELETE,HASH_LOOKUP)" +.L name +is a pointer to a bucket that has already been entered into the table. +.TP +.L "HASH_FIXED (HASH_CREATE)" +.L value +is taken to be the size of the hash bucket to be created for +.L name +in the top level scope. +The minimum bucket size is silently restricted to +.LR sizeof(HASHHEADER) . +.TP +.L "HASH_INSTALL (HASH_CREATE)" +.L name +is a pointer to a bucket that has not been entered into the table. +.TP +.L "HASH_NOSCOPE (HASH_LOOKUP)" +The lookup is restricted to the top level scope. +.TP +.L "HASH_OPAQUE (HASH_CREATE,HASH_DELETE)" +Sets +.L (HASH_CREATE) +or clears +.L (HASH_DELETE) +the +.I opaque +property for the bucket. +An opaque bucket is not visible in lower scopes. +.TP +.L "HASH_SCOPE (HASH_CREATE,HASH_DELETE)" +All scopes are searched for the bucket. +If the bucket is not found for +.L HASH_CREATE +then a new bucket is created in the lowest scope. +.TP +.L "HASH_VALUE (HASH_CREATE,HASH_LOOKUP)" +For +.L HASH_CREATE +the bucket +.L value +field is set to +.L value +and the bucket +.L name +value is returned. +For +.L HASH_LOOKUP +the bucket +.L value +field is returned, +.L NULL +if the bucket is not found. +.RE +If +.L name +.L NULL +then the name from the most recent +.L hashlook() +is used, avoiding recomputation of some internal parameters. +.TP +.L "char* hashget(HASHTABLE* tab, char* name)" +Returns the value +associated with the key +.L name +in the hash table +.LR tab . +If +.L name +is +.L NULL +then the name from the most recent +.L hashget() +is used, avoiding recomputation of some internal parameters. +.L NULL +is returned if +.L name +is not in the table. +All scope covered tables are searched. +.TP +.L "HASHBUCKET* hashlast(HASHTABLE* tab)" +Returns a pointer to the most recent hash bucket for +the most recent hash table. +The value is set by +.LR hashlook() , +.L hashscan() +and +.LR hashwalk() . +.TP +.L "char* hashput(HASHTABLE* tab, char* name, char* value)" +Set the value of the key +.L name +to +.L value +in the top level scope of the hash table +.LR tab . +.L name +is entered into the top level scope if necessary. +The (possibly re-allocated) key name pointer is returned +(see +.LR HASH_ALLOCATE ). +.TP +.L "int hashwalk(HASHTABLE* tab, int flags, (int(*)()) walker)" +The function +.L walker +is applied to each entry (not covered by a scope starting at +.LR tab ) +in the hash table +.LR tab . +If +.L flags +is +.L HASH_NOSCOPE +then only the top level hash table is used, otherwise the walk includes +all scope covered tables. +.L walker +is called with +.L char* +.I key +as the first argument and +.L char* +.I value +as the second argument. +The walk terminates after the last entry or when +.L walker +returns a negative value. +The return value of the last call to +.L walker +is returned. +Only one walk may be active within a collection of scoped tables. +.TP +.L "void hashscan(HASHTABLE* tab, int flags, HASHPOSITION* pos)" +Initializes +.L pos +for a sequential scan on the hash table +.LR tab . +If +.L flags +is +.L HASH_NOSCOPE +then only the top level hash table is used, otherwise the scan includes +all scope covered tables. +Only one scan may be active within a collection of scoped tables. +.L hashdone() +must be called to terminate the scan. +.TP +.L "int hashnext(HASHPOSITION* pos)" +Generates the next element in the sequential scan set up by +.L hashscan() +on +.LR pos . +If no elements remain then +.L 0 +is returned. +Otherwise +.L pos->bucket +points to the hash bucket of the next element and +.L 1 +is returned. +.TP +.L "void hashdone(HASHPOSITION* pos)" +Completes a scan initiated by +.L hashscan() +on +.LR pos . +.TP +.L "int hashset(HASHTABLE* tab, int flags)" +Sets the flags for the hash table +.L tab +by +.IR or ing +in +.LR flags . +Only +.L HASH_ALLOCATE +and +.L HASH_FIXED +may be set. +.TP +.L "int hashclear(HASHTABLE* tab, int flags)" +Clears the flags for the hash table +.L tab +by masking out +.LR flags . +Only +.L HASH_ALLOCATE +and +.L HASH_FIXED +may be cleared. +.TP +.L "void hashdump(FILE* fp, HASHTABLE* tab, int flags)" +Dumps hash table accounting info to the output file stream +.LR fp . +If +.L tab +is +.L NULL +then all allocated hash tables are dumped, otherwise only information on +.L tab +is dumped. +If +.L flags +is +.L HASH_BUCKET +then the hash bucket +.I key-value +pairs for each collision chain are also dumped. +.TP +.L "void hashsize(HASHTABLE* tab, int size)" +Changes the size of the hash table +.L tab +to +.L size +where +.L size +must be a power of 2. +Explicit calls to this routine are not necessary as hash tables +are automatically resized. +.TP +.L "int strhash(char* name)" +Hashes the null terminated character string +.L name +using a linear congruent pseudo-random number generator algorithm +and returns a non-negative +.L int +hash value. +.TP +.L "int memhash(char* buf, int siz)" +Hashes the buffer +.L buf +of +.L siz +bytes using a linear congruent pseudo-random number generator algorithm +and returns a non-negative +.L int +hash value. +.TP +.L "long strsum(char* name, long sum)" +Returns a running 31-bit checksum of the string +.L name +where +.L sum +is +.L 0 +on the first call and +the return value from a previous +.L memsum +or +.L strsum +call otherwise. +The checksum value is consistent across all implementations. +.TP +.L "long memsum(char* buf, int siz, long sum)" +Returns a running 31-bit checksum of buffer +.L buf +of +.L siz +bytes where +.L sum +is +.L 0 +on the first call and +the return value from a previous +.L memsum +or +.L strsum +call otherwise. +The checksum value is consistent across all implementations. +.SH "SEE ALSO" +sum(1) diff --git a/static/unix-v10/man3/hmul.3 b/static/unix-v10/man3/hmul.3 new file mode 100644 index 00000000..8a5ccb34 --- /dev/null +++ b/static/unix-v10/man3/hmul.3 @@ -0,0 +1,16 @@ +.th HMUL III 4/7/73 +.sh NAME +hmul \*- high-order product +.sh SYNOPSIS +.ft B +hmul(x, y) +.ft R +.sh DESCRIPTION +.it Hmul +returns the high-order 16 bits of the product of +.bd x +and +.bd y. +(The binary multiplication operator generates +the low-order 16 bits of a product.) +.sh BUGS diff --git a/static/unix-v10/man3/huff.3 b/static/unix-v10/man3/huff.3 new file mode 100644 index 00000000..f90bb0ea --- /dev/null +++ b/static/unix-v10/man3/huff.3 @@ -0,0 +1,89 @@ +.TH HUFF 3 +.CT 2 data_man +.SH NAME +huff \(mi huffman codebook/tree generator +.SH SYNOPSIS +.nf +.B #include <huff.h> +.PP +.B NODE *huff(inrout) +.B int (*inrout)(); +.fi +.SH DESCRIPTION +.I Huff +generates a binary Huffman codebook. +It obtains a list of messages one at a time from an input routine, +.I inrout, +declared as +.IP +.EX +int inrout(str, p) +char ** str; +float *p; +.EE +.LP +.I Inrout +makes +.I *str +point to a null-terminated string identifying a message, +and places in +.I *p +the (arbitrarily normalized) frequency of the message. +.I Inrout +returns non-zero when data is returned and zero when there +is no more data. +.PP +.I Huff +returns a pointer to a root of type +.BR NODE : +.IP +.EX +typedef struct node { + char *datump; + struct node *to; + struct node *from; + struct node *ldad; + struct node *rdad; + struct node *kid; + float prob; +} NODE; +.EE +.LP +The root heads a linked list and the Huffman tree. +The doubly linked list, +connected via +.B from +and +.BR to , +is ordered as the codebook was generated. +The tree is connected +via +.BR kid , +.BR ldad , +and +.BR rdad , +with null pointers at the various ends. +The +.B kid +field points towards the root, +.B ldad +and +.B rdad +point away: +.B node->ldad->kid==node +and +.BR node->rdad->kid==node . +the +.B datump +field is null or points to a message identifier. +.PP +The codeword for a message may be read off from the +path from the root to the node containing the message identifier, +counting +.I ldad +branches as 0 and +.I rdad +branches as 1. +.SH "BUGS" +A code with only one message dumps core. + diff --git a/static/unix-v10/man3/hypot.3 b/static/unix-v10/man3/hypot.3 new file mode 100644 index 00000000..2b477a7a --- /dev/null +++ b/static/unix-v10/man3/hypot.3 @@ -0,0 +1,35 @@ +.pa 1 +.he 'HYPOT (III)'6/12/72'HYPOT (III)' +.ti 0 +NAME hypot -- calculate hypotenuse +.sp +.ti 0 +SYNOPSIS movf a,fr0 +.br +movf b,fr1 +.br +jsr r5,hypot +.br +movf fr0,... +.sp +.ti 0 +DESCRIPTION The +square root of fr0*fr0 + fr1*fr1 +is returned in fr0. +The calculation is done in such a way +that overflow will not occur unless +the answer is not representable in floating point. +.sp +.ti 0 +FILES kept in /lib/liba.a +.sp +.ti 0 +SEE ALSO sqrt(III) +.sp +.ti 0 +DIAGNOSTICS The +c-bit is set if the result cannot +be represented. +.sp +.ti 0 +BUGS -- diff --git a/static/unix-v10/man3/ierror.3 b/static/unix-v10/man3/ierror.3 new file mode 100644 index 00000000..e4c106b0 --- /dev/null +++ b/static/unix-v10/man3/ierror.3 @@ -0,0 +1,52 @@ +.th IERROR III 10/29/73 +.sh NAME +ierror \*- catch Fortran errors +.sh SYNOPSIS +.ft B +if ( ierror ( \fIerrno\fB ) .ne. 0 ) goto \fIlabel\fR +.sh DESCRIPTION +.it Ierror +provides a way of detecting errors during the running of a Fortran +program. +Its argument is a run-time error number +such as enumerated in +.it fc +(I). +.s3 +When +.it ierror +is called, +it returns a 0 value; thus the +.bd goto +statement in the synopsis is not executed. +However, the routine stores inside itself the +call point and invocation level. +If and when the indicated error occurs, +a +.bd return +is simulated from +.it ierror +with a non-zero value; +thus the +.bd goto +(or other statement) +is executed. +It is a ghastly error to call +.it ierror +from a subroutine which +has already returned when the error occurs. +.s3 +This routine is essentially tailored to +catching end-of-file situations. +Typically it is called just before the start +of the loop which reads the input file, +and the +.bd goto +jumps to a graceful termination of the program. +.s3 +There is a limit of 5 on the number +of different error numbers which can be caught. +.sh "SEE ALSO" +fc (I) +.sh BUGS +There is no way to ignore errors. diff --git a/static/unix-v10/man3/internet.3 b/static/unix-v10/man3/internet.3 new file mode 100644 index 00000000..c28fb445 --- /dev/null +++ b/static/unix-v10/man3/internet.3 @@ -0,0 +1,104 @@ +.TH INTERNET 3X +.CT 2 comm_mach +.SH NAME +in_host, in_ntoa, in_address, in_service \- internet networking functions +.SH SYNOPSIS +.nf +.B #include <sys/inet/in.h> +.PP +.B char *in_host(hostaddr) +.B in_addr hostaddr; +.PP +.B char *in_ntoa(hostaddr) +.B in_addr hostaddr; +.PP +.B in_addr in_address(hostname) +.B char *hostname; +.PP +.B struct in_service *in_service(name, proto, port) +.B char *name, *proto; +.B unsigned long port; +.fi +.PP +.SH DESCRIPTION +These routines are loaded by the +.B -lin +option of +.IR ld (1). +.PP +Internet addresses, type +.I in_addr, +are 32-bit quantities global to the network. +The +.SM ASCII +representation of an +.I in_addr +can be either a host name or of the form +.I b1.b2.b3.b4, +where each +.I `bx' +is the value of the +.IR x 'th +byte of the +address in decimal. +Since host names are considered local `aliases' for internet +addresses, the host-to-address mapping is subjective. +.PP +.I In_address +maps an internet host name to an address +and returns 0 +if the name is not found in the host +table. +.PP +.I In_host +maps an internet address into a host name. +If the host is not found in the host table, the +.SM ASCII +representation of the address is returned. +.PP +.I In_ntoa +maps an internet address to its +.SM ASCII +numeric format. +.PP +.I In_service +returns the closest match to +.I name +in the services file. +If either +.I name +or +.I port +are 0, +they will match any name or port. +If +.I proto +is +.BR "(char *)0" , +the +.B tcp +protocol is assumed. +.SH FILES +.nf +.ta 32n +\fL/usr/inet/lib/hosts\fP mapping between host names and addresses +\fL/usr/inet/lib/networks\fP mapping between network names and addresses +\fL/usr/inet/lib/services\fP database of services +\fL/usr/inet/lib/hosts.equiv\fP machines with common administration +.fi +.SH SEE ALSO +.IR ipc (3), +.IR tcp (3), +.IR udp (3) +.SH BUGS +.PP +The mappings between internet addresses and names is arbitrary at best. +The hosts file may contain many addresses for each name and/or many +names for each address. +.I In_address +and +.I in_host +each start at the beginning of the file and search sequentially for a match. +Therefore, +.B "in_addr(in_host(addr)) \=\= addr" +is not necessarily true. diff --git a/static/unix-v10/man3/intro.3 b/static/unix-v10/man3/intro.3 new file mode 100644 index 00000000..c60dd206 --- /dev/null +++ b/static/unix-v10/man3/intro.3 @@ -0,0 +1,109 @@ +.TH INTRO 3 +.SH NAME +intro \(mi introduction to library functions +.SH SYNOPSIS +.nf +.B #include <libc.h> +.PP +.B #include <stdio.h> +.PP +.B #include <math.h> +.fi +.SH DESCRIPTION +This section describes functions that may be found +in various libraries, other than the system calls +described in section 2. +Functions are divided into various libraries distinguished +by the section number at the top of the page: +.TP +(3) +These functions, together with those of section 2 and those +marked (3S) and (3M), constitute library +.I libc, +which is automatically loaded by the C compiler +.IR cc (1) +and the Fortran compiler +.IR f77 (1). +The same functions appear also in +.IR libC, +which is automatically loaded by the C++ compiler; see +.IR c++ (1). +The link editor +.IR ld (1) +searches this library under option +.BR \-lc +.RB ( -lC +for +.IR libC ). +Declarations for some of these functions may be obtained +from include files indicated on the appropriate pages. +Other declarations can be found in +.FR <libc.h> . +.TP +(3F) +These functions are in the Fortran library, +.I libF77, +automatically loaded by the Fortran compiler, and searched +under option +.B -lF77 +of the link editor. +.TP +(3M) +These functions constitute the math library, part of +.I libc. +(On some other systems they must be loaded by +.BR -lm ). +Declarations for these functions may be obtained from +the include file +.FR <math.h> . +.TP +(3S) +These functions constitute the +`standard IO package' +(see +.IR stdio (3)) +part of +.I libc +already mentioned. +Declarations for these functions may be obtained from +the include file +.FR <stdio.h> . +.TP +(3X) +Various +specialized libraries have not been given distinctive +captions. +Files in which such libraries are found are named +on appropriate pages. +.TP +(3+) +C++ functions in +.I libC +that are not in +.I libc. +.SH FILES +.TP +.F /lib/libc.a +.SH SEE ALSO +.IR stdio (3), +.IR nm (1), +.IR ld (1), +.IR cc (1), +.IR c++ (1), +.IR f77 (1), +.IR intro (2) +.SH DIAGNOSTICS +Functions in the math library (3M) may return +conventional values when the function is undefined for the +given arguments or when the value is not representable. +In these cases the external variable +.I errno +(see +.IR intro (2)) +is set to the value +.B EDOM +or +.BR ERANGE , +defined in +the include file +.FR <math.h> . diff --git a/static/unix-v10/man3/ios.3 b/static/unix-v10/man3/ios.3 new file mode 100644 index 00000000..9176eb79 --- /dev/null +++ b/static/unix-v10/man3/ios.3 @@ -0,0 +1,384 @@ +. \"ident "%W%" +. \"Copyright (c) 1984 AT&T +. \"All Rights Reserved +. \"THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +. \"The copyright notice above does not evidence any +. \"actual or intended publication of such source code. +.TH IOSTREAM 3I+ "C++ Stream Library" " " +.SH NAME +ios \- input/output formatting +.SH SYNOPSIS +.nf +.ta1i 2i +.ft B +#include <iostream.h> + +struct fmtinfo { + ostream* tie; + short convbase; + short width; + short precision; + char fill; + char ladjust; + char showbase; + char skip; + char floatfmt; +}; + +class ios { +public: + enum io_state { goodbit=0, eofbit, failbit, badbit }; + enum open_mode { in, out, ate, app }; + enum seek_dir { beg, cur, end }; +public: + ios(streambuf* b); + + int bad(); + void clear(state_value i = _good); + int convbase(); + void convbase(int i); + int eof(); + int fail(); + char fill(); + void fill(char c); + char floatfmt(); + void floatfmt(char c); + fmtinfo fmt(); + void fmt(fmtinfo& info); + int ladjust(); + void ladjust(int a); + int good(); + int operator!(); + operator int(); + int popfmt(); + int precision(); + void precision(int i); + void pushfmt(); + streambuf* rdbuf(); + int rdstate(); + int showbase(); + void showbase(int i); + int skip(); + int skip(int i); + void sync_with_stdio(); + streampos tellg(); + ostream* tie(); + ostream* tie(ostream* iosp); + int width(); + void width(int i); + + ios& operator<<(ios& (*)(ios&)); + ios& operator>>(ios& (*)(ios&)); +private: + iostream(iostream&) ; + iostream& operator=(iostream&) ; +}; + +class ios_withassign : ios { + ios_withassign(); + ios& operator=(ios&); + ios& operator=(streambuf*); +} ; + +ios& dec(ios& i) ; +ios& hex(ios& i) ; +ios& oct(ios& i) ; +ios& popfmt(ios& i) ; +ios& pushfmt(ios& i) ; +.fi +.ft R +.SH DESCRIPTION +The stream classes derived from \f(CWios\fRs +provide a high level interface that +supports transferring +formatted and unformatted information into and out of +\f(CWstreambuf\fRs. +.PP +In the following assume: +.br +\(em \fBs\fR is an \f(CWios\fR. +.br +\(em \fBswa\fR is an \f(CWios_withassign\fR. +.br +\(em \fBsp\fR is a \f(CWios*\fR. +.br +\(em \fBi\fR and \fBn\fR are \f(CWint\fR. +.br +\(em \fBc\fR is a \f(CWchar\fR. +.br +\(em \fBosp\fR is an \f(CWostream*\fR. +.br +\(em \fBsb\fR is a \f(CWstreambuf*\fR. +.br +\(em \fBpos\fR is a \f(CWstreampos\fR. +.br +\(em \fBoff\fR is a \f(CWstreamoff\fR. +.br +\(em \fBinfo\fR is a \f(CWformatinfo\fR. +.br +\(em \fBdir\fR is a \f(CWseek_dir\fR. +.br +\(em \fBmode\fR is a \f(CWseek_dir\fR. +.br +\(em \fBfct\fR is a function with type \f(CWios& (*)(ios&)\fR. +.PP +Constructors and assignment: +.TP +\fBios(sb)\fR +\fBsb\fR becomes the \f(CWstreambuf\fR associated with the +constructed \fBios\fR. This association is fixed for +the life of the \f(CWios\fR. If \fBsb\fR is null the effect is +undefined. +.TP +\fBios_withassign()\fR +Uninitialized variable. +.sp +.nf +.in -.5i +\fBios(ios&)\fR +\fBios=ios\fR +.in +.fi +Copying of \f(CWios\fR's is not in general +well defined and the constructor and assignment operators +are made private so that the compiler will complain about attempts to +do so. Usually what is desired +is copying of pointers to \f(CWiostream\fRs. +.TP +swa=sb +Associates \fBsb\fR with \fBswa\fR and initializes the entire +state of +\fBswa\fR. +.TP +swa=s +Associates \fBs->rdbuf()\fR with \fBswa\fR and +initializes the entire state of +\fBswa\fR. +.PP +An \fBios\fR has an internal error state (which is a collection +of the bits declared as \f(CWio_state\fRs). Members related +to the error state: +.RS +.TP +\fBi=s.rdstate()\fR +Returns the current error state. +.TP +\fBs.clear(i)\fR +Stores \fBi\fR as the error state. If \fBi\fR is zero +this clears all bits. To set a bit without clearing previously +set bits requires something like \fBs.clear(badbit|s.rdstate())\fR. +.TP +\fBi=s\fR +The \f(CWint\fR conversion operator is non-zero if \f(CWbadbit\fR or +\f(CWfailbit\fR is set in the error state. +.TP +\fBi=s.good()\fR +Non-zero if the error state has no bits set. +.TP +\fBi=s.eof()\fR +Non-zero if \f(CWeofbit\fR is set in the error state. Normally this +bit is set when an end of file has been encountered doing extraction. +.TP +\fBi=s.fail()\fR +Non-zero if either \f(CWbadbit\fR or \f(CWfailbit\fR are set in the +error state. Normally this indicates that some operation has failed. +.TP +\fBi=s.bad()\fR +Non-zero if \fBbadbit\fR is set in the error state. +Normally this indicates +that some operation on \fBs.rdbuf()\fR has failed. +.RE +.PP +An \f(CWios\fR has a collection of format state variables +that are used by input and output operations to control the +details of formatting operations. Otherwise their values +have no particular effect and they may be set and examined arbitrarily +by user code. +.RS +.TP +\fBs.convbase(i)\fR +Sets the "conversion base" format state variable to \fBi\fR. +.TP +\fBi=s.convbase()\fR +Returns the "conversion base" format state variable. +.TP +\fBs.fill(c)\fR +Sets the "fill character" format state variable to \fBc\fR. +.TP +\fBc=s.fill()\fR +Returns the "fill character" format state variable. +.TP +\fBs.fill(c)\fR +Sets the "fill character" format state variable to \fBc\fR. +.TP +\fBc=s.fill()\fR +Returns the "fill character" format state variable. +.TP +\fBs.floatfmt(c)\fR +Sets the "floating format" format state variable to \fBc\fR. +.TP +\fBc=s.floatfmt()\fR +Returns the "floating format" format state variable. +.TP +\fBs.ladjust(i)\fR +Sets the "left adjustment" format state variable to \fBi\fR. +.TP +\fBi=s.ladjust()\fR +Returns the "left adjustment" format state variable. +.TP +\fBs.precision(i)\fR +Sets the "precision" format state variable to \fBi\fR. +.TP +\fBi=s.precision()\fR +Returns the "precision" format state variable. +.TP +\fBs.showbase(i)\fR +Sets the "show explicit base" format state variable to \fBi\fR. +.TP +\fBi=s.showbase()\fR +Returns the "show explicit base" format state variable. +.TP +\fBsp=s.skip(sp)\fR +Sets the "skip whitespace" format state variable to \fBsp\fP. +.TP +\fBsp=s.skip()\fR +Returns the "skip whitespace" format state variable. +.TP +\fBosp=s.tie(osp)\fR +Sets the "tie" format state variable \fBsp\fP. +.TP +\fBosp=s.tie()\fR +Returns the "tie" format state variable. +.TP +\fBs.width(i)\fR +Sets the "field width" format state variable to \fBi\fP. +.TP +\fBi=s.width()\fR +Returns the "field width" format state variable. +.TP +\fBs.fmt(info)\fR +Sets the collection of all format state variables to \fBinfo\fP in +a single operation. +.TP +\fBinfo=s.fmt()\fR +Returns the collection of all format state variables in +a single operation. +.TP +\fBs.pushfmt()\fR +Pushes a \f(CWformatinfo\fR structure onto a (dynamically allocated) +stack associated with \fBs\fR. This copies the current +values of format state variables without changing them. +.TP +\fBi=s.popfmt()\fR +Pops the topmost \f(CWformatinfo\fR from the stack associated with +\fBs\fR and sets the format state variables accordingly. Normally +\fBi\fR is non-zero, but it will be zero if the stack is empty +(i.e., more \fBpopfmt\fR than \fBpushfmt\fR operations have been +performed. +.RE +.PP +Other members: +.TP +\fBsb=s.rdbuf()\fR +Returns a pointer to the \f(CWstreambuf\fR associated with +\fBs\fR when \fBs\fR was constructed. +.TP +\fB((ios*)0)->sync_with_stdio()\fR +Solves problems that arise when mixing stdio and +iostreams. The first time it is called it will reset the +standard iostreams (\f(CWinstream\fR, \f(CWoutstream\fR, \f(CWerrstream\fR, +\f(CWlogstream\fR) to be streams +using \f(CWstdiobuf\fRs. +After that input and output using these streams may +be mixed with input and output using the corresponding \f(CWFILE\fRs and +will be properly synchronized. +.RE +.PP +Convenient manipulators (functions that take an \f(CWios&\fR +and return their argument). +.TP +\fBios<<dec +.in -.5i +.br +.nf +\fBios<<dec +\fBios>>dec\fR +.fi +.in +Sets the convbase to 10. +.sp +.nf +.in -.5i +\fBios<<hex +\fBios>>hex\fR +.in +Sets the convbase to 16. +.sp +.nf +.in -.5i +\fBios<<oct +\fBios>>oct\fR +.fi +.in +Sets the convbase to 8. +.sp +.nf +.in -.5i +\fBios<<popfmt +\fBios>>popfmt\fR +.fi +.in +Does \fBs.popfmt()\fR +.in -.5i +.sp +.nf +\fBios<<pushfmt +\fBios>>pushfmt\fR +.fi +.in +Does \fBs.pushfmt()\fR +.PP +The \f(CWstreambuf\fR associated with an \f(CWios\fR may be manipulated +by other methods than through \f(CWios\fR. For example, characters may +be stored in a queuelike \f(CWstreambuf\fR through an \f(CWostream\fR +while they are being fetched through an \f(CWistream\fR. +Or for efficiency some +part of a program may choose to do \f(CWstreambuf\fR gets +directly rather than through the \f(CWios\fR. +In most cases +the program does not have to worry about this possibility, because +an \f(CWios\fR never saves information about the internal state +of a \f(CWstreambuf\fR. For example if the \f(CWstreambuf\fR is +repostitioned between extraction operations the extraction (input) +will proceed normally. +.SH CAVEATS +.PP +The effect of \fBios.sync_with_stdio()\fR +does not depend on \fBios\fR. +\fBsync_with_stdio\fR ought +to be a global function but it is a member of \fBiostream\fR to +avoid name space pollution. +The need for \fBsync_with_stdio\fR is a wart. The old stream +package did this as a default, but in the iostream package +unbuffered \f(CWstdiobuf\fRs are too inefficient to be the default. +.PP +The stream package had a constructor that took a \fBFILE*\fR argument. +This is now replaced by \f(CWstdiostream\fR. +It is not declared even as an obsolete form to avoid +having \f(CWiostream.h\fR +depend on \f(CWstdio.h\fR. +.PP +The old stream package allowed copying of streams. This is disallowed +by the iostream package. Old code using copying can usually be +rewritten to use pointers and copy pointers. +.PP +For compatibility with the old stream package, the versions of +.I tie +and +.I skip +that set the state variables also return the old value. +.SH SEE ALSO +IOS.INTRO(3C++) +streambuf(3C++) +istream(3C++) +ostream(3C++) diff --git a/static/unix-v10/man3/ipc.3 b/static/unix-v10/man3/ipc.3 new file mode 100644 index 00000000..68679457 --- /dev/null +++ b/static/unix-v10/man3/ipc.3 @@ -0,0 +1,348 @@ +.TH IPC 3X +.CT 2 comm_proc +.SH NAME +ipccreat, ipcopen, ipclisten, ipcaccept, ipcreject, ipcexec, ipcpath , ipclogin, ipcrogin +\(mi set up connections between processes or machines +.SH SYNOPSIS +.B #include <ipc.h> +.PP +.B char *ipcpath(name, network, service) +.br +.B char *name; +.br +.B char *network; +.br +.B char *service; +.PP +.B int ipcopen(name, param) +.br +.B char *name; +.br +.B char *param; +.PP +.B int ipccreat(name, param) +.br +.B char *name; +.br +.B char *param; +.PP +.B ipcinfo *ipclisten(fd) +.br +.B int fd; +.PP +.B int ipcaccept(ip) +.br +.B ipcinfo *ip; +.PP +.B int ipcreject(ip, no, str) +.br +.B ipcinfo *ip; +.br +.B int no; +.br +.B char *str; +.PP +.B int ipcexec(name, param, cmd) +.br +.B char *name; +.br +.B char *param; +.br +.B char *cmd; +.PP +.B int ipclogin(fd) +.br +.B int fd; +.PP +.B int ipcrogin(fd, opt) +.br +.B int fd; +.br +.B char *opt; +.PP +.B extern char *errstr; +.SH DESCRIPTION +These routines establish communication between unrelated +processes, often for networking purposes. +They are loaded by the +.B -lipc +option of +.IR ld (1). +.PP +End points in the network are identified by names of the form: +.BR element [ !element "]... " . +The name is translated element by element relative to the name space +selected by the previous element. +The first element is always a name in the local file system. +By convention, all network interfaces and services +mount themselves in +.FR /cs . +For example: +.TP +.B /cs/exec +refers to a local process which has mounted itself (via +.I ipccreat ) +on +.FR /cs/exec . +.TP +.B /cs/dk!nj/astro/voice +refers to a voice synthesizer attached +to Datakit; process +.F /cs/dk +is the Datakit interface. +.TP +.B /cs/dk!dutoit!exec +is the process that has mounted itself on +.F /cs/exec +in machine `dutoit'. +.PP +.I Ipcpath, +forms a network name from its arguments and returns a pointer to it. +It takes three arguments: the destination +.I name, +the default +.I network, +and the default +.I service. +It assumes that +.I name +is a three part name of the form: network!host!service. +If either network or service is missing from +.I name, ipcpath +supplies them +from the default arguments. +It then tacks a +.F /cs +on the front and returns a pointer to that. +Thus, +.IP +.EX +ipcpath("dutoit", "dk", "dcon") +.EE +.LP +returns a pointer to the string +.LR /cs/dk!dutoit!dcon . +.PP +.I Ipcopen +places a call to a named network end point and returns +a file descriptor for the resulting connection. +.I Param, +a whitespace-delimited string of values, specifies +properties which the connection must have. +At present four parameter values are defined: +.TF heavy +.TP +.B heavy +.br +.ns +.TP +.B light +Heavy (usually computer-to-computer) or light (computer-to-terminal) +traffic is expected. +.TP +.B delim +The connection must support delimiters; see +.IR stream (4). +.TP +.B hup +.B SIGHUP +must be generated at end of file; see +.IR signal (2). +.PD +.PP +.I Ipccreat +attaches a process to a name space. +It returns a file descriptor representing the attachment. +.I Name +and +.I param +mean the same as for +.I ipcopen. +.PP +.I Ipclisten +waits for calls (from +.I ipcopen +in other processes) appearing on file descriptor +.I fd +(obtained from +.IR ipccreat ). +When a call arrives, it returns an +.B ipcinfo +structure, defined in +.FR <ipc.h> : +.IP +.EX +.ta \w'typedef\ 'u +\w'char\ 'u +\w'reserved[5];\ 'u +typedef struct { + int reserved[5]; + char *name; that being dialed + char *param; parameters used to set up call + char *machine; machine id of caller + char *user; user name of caller + int uid, gid; uid, gid of caller +} ipcinfo; +.EE +.PP +The call may be accepted by +.I ipcaccept +or rejected by +.I ipcreject. +.I Ipcaccept +returns a file descriptor for the connection. +.I Ipcreject +takes an integer error number and an error message string, +which will be passed back to the caller as +.I errno +and +.I errstr. +.PP +A higher-level routine, +.I ipcexec, +executes the command, +.I cmd, +on a named machine. +The file descriptor returned by +.I ipcexec +is the standard input, standard output, and +standard error of the command. +As in +.I ipcopen, +.I param +lists properties required of the channel. +.PP +Once a connection is established using +.I ipcopen +it is often necessary to authenticate yourself +to the destination. +This is done using +.I ipclogin +and +.I ipcrogin. +.I Ipclogin +runs the client side of the authentication protocol +described in +.IR svcmgr (8) +for the +.I v9auth +action. +The supplied +.I fd +is the descriptor returned by +.I ipcopen. +Until the authentication is accepted, +.I ipclogin +will prompt the user (using +.F /dev/tty ) +for a login id and password to be sent over +.I fd. +.PP +.I Ipcrogin +runs the client side of the authentication protocol +used by BSD's +.I rlogin +and +.I rsh +services. +Unlike +.I ipclogin, +it will not prompt the user if the authentication +fails. +.I Ipcrogin +takes a second argument that is written to +.I fd +after the authentication is accepted. +.SH EXAMPLES +To connect to the voice synthesizer attached to the Datakit: +.EX +.ta \w'12345678'u +\w'12345678'u +\w'12345678'u +#include <ipc.h> +main() { + int fd; + fd = ipcopen(ipcpath("voice", "dk", 0), "light"); + if(fd<0){ + printf("can't connect: %s\en", errstr); + exit(1); + } + ... + close(fd); +} +.EE +.PP +To place a Dataphone call via Datakit; the service name is +derived in an obvious way from the ACU service class; see +.IR dialout (3). +.EX + fd = ipcopen(ipcpath("9-1-201-582-0000", "dk", "dial1200"), "light"); +.EE +.PP +To announce as a local service and wait for incoming calls: +.EX +.ta \w'12345678'u +\w'12345678'u +\w'12345678'u +#include <ipc.h> +main() { + int fd; + ipcinfo *ip; + fd = ipccreat("/tmp/service", 0); + if(fd<0){ + printf("can't announce: %s\en", errstr); + exit(1); + } + while(ip = ipclisten(fd)){ + int nfd; + if(i_hate_this_user(ip->machine, ip->user)) { + ipcreject(ip, EACCES, "i hate you"); + continue; + } + nfd = ipcaccept(ip); + ... + close(nfd); + } + printf("lost the announced connection somehow\en"); + exit(1); +} +.EE +.SH FILES +.TF /cs/tpc +.TP +.F /cs/dk +the announce point for the Datakit dialer +.TP +.F /cs/tcp +the announce point for the internet dialer +.SH SEE ALSO +.IR dialout (3), +.IR connld (4), +.IR dkmgr (8), +.IR svcmgr (8), +.IR tcpmgr (8) +.br +D. L. Presotto, +`Interprocess Communication in the Eighth Edition +.SM UNIX +System', +this manual, Volume 2 +.SH DIAGNOSTICS +Integer return values of \-1 and pointer return +values of 0 denote error. +.I Errno +contains an error code (see +.IR intro (2)) +and +.I errstr +points to an explanatory string. +.SH BUGS +Files created by +.I ipccreat +in the local name space are not removed when +the file descriptor returned by +.I ipccreat +is closed. +.br +Information in +.B ipcinfo +is no more trustworthy than its origin. +Information, such as user name, sent by foreign +machines may be suspect. +On Ethernet or dialup connections (but not on Datakit) +machine names can be forged. +Let's not even think about wire-swappers and wiretappers. diff --git a/static/unix-v10/man3/iread.3 b/static/unix-v10/man3/iread.3 new file mode 100644 index 00000000..637f0752 --- /dev/null +++ b/static/unix-v10/man3/iread.3 @@ -0,0 +1,35 @@ +.TH IREAD 3 +.SH NAME +iread \- insistent read +.SH SYNOPSIS +.B read(fildes, buf, n) +.B char *buf; +.SH DESCRIPTION +.I Iread, +like +.IR read (1), +reads +.I n +bytes from the file associated with the given file descriptor +into the block of store beginning at +.I buf. +.I Iread, +however, always places exactly +.I n +bytes in +.I buf, +unless +.I read +would return 0. +.PP +.I Iread +returns the number of bytes placed in +.I buf, +which is an integer in the range +.RI 0- n. +.SH DIAGNOSTICS +.I Iread +returns \-1 for an error; see +.IR read (1). +.SH SEE ALSO +read(2) diff --git a/static/unix-v10/man3/istream.3 b/static/unix-v10/man3/istream.3 new file mode 100644 index 00000000..9d2039cb --- /dev/null +++ b/static/unix-v10/man3/istream.3 @@ -0,0 +1,334 @@ +. \"ident "%W%" +. \"Copyright (c) 1984 AT&T +. \"All Rights Reserved +. \"THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +. \"The copyright notice above does not evidence any +. \"actual or intended publication of such source code. +.TH ISTREAM 3I+ "C++ Stream Library" " " +.SH NAME +istream \- formatted and unformatted input +.SH SYNOPSIS +.nf +.ft B +.ta1i 2i +#include <iostream.h> + +typedef long streamoff, streampos; +class ios { +public: + enum seek_dir { beg, cur, end }; + enum open_mode { in, out, ate, app } ; + // \fIand lots of other stuff ... \fP + } ; + +class istream : ios { +public: + int gcount(); + istream& get(char* ptr, int len, char delim='\en'); + istream& get(unsigned char* ptr,int len, char delim='\en'); + + istream& get(unsigned char& c); + istream& get(char& c); + istream& get(streambuf&, char delim ='\en'); + int get(); + istream& getline(char* ptr, int len, char delim='\en'); + istream& getline(unsigned char* ptr, int len, char delim='\en'); + istream& getline(streambuf& sb, int len, char delim='\en'); + istream& ignore(int len=1,int delim=EOF); + int ipfx(int need=0); + int peek(); + istream& putback(char c); + istream& read(char* s,int n); + istream& read(unsigned char* s,int n); + istream& seekg(streampos pos); + istream& seekg(streamoff off, seek_dir d); + streampos tellg(); + + istream& operator>>(char*); + istream& operator>>(unsigned char*); + istream& operator>>(unsigned char&); + istream& operator>>(char&); + istream& operator>>(short&); + istream& operator>>(int&); + istream& operator>>(long&); + istream& operator>>(unsigned short&); + istream& operator>>(unsigned int&); + istream& operator>>(unsigned long&); + istream& operator>>(float&); + istream& operator>>(double&); + istream& operator>>(streambuf&); + istream& operator>>(istream& (*)(istream&)); +}; + +class istream_withassign { + istream_withassign(); + istream& operator=(istream&); + istream& operator=(streambuf*); +}; + +extern istream_withassign cin; + +istream& ws(iostream& i) ; +.fi +.ft R +.SH DESCRIPTION +\f(CWistream\fRs support interpretation of characters +fetched from an associated \f(CWstreambuf\fR. +These are commonly refered to as input operations. +.PP +Assume that +.br +\(em \fBins\fR has type \f(CWistream\fR. +.br +\(em \fBinwa\fR has type \f(CWistream_withassign\fR. +.br +\(em \fBinsp\fR has type \f(CWistream*\fR. +.br +\(em \fBc\fR has type \f(CWchar&\fR +.br +\(em \fBdelim\fR has type \f(CWchar\fR. +.br +\(em \fBptr\fR has type \f(CWchar*\fR or \f(CWunsigned char*\fR. +.br +\(em \fBsb\fR has type \f(CWstreambuf&\fR. +.br +\(em \fBi\fR, \fBlen\fR, \fBd\fR, and \fBneed\fR have type \f(CWint\fR. +.br +\(em \fBpos\fR is a \f(CWstreampos\fR. +.br +\(em \fBoff\fR is a \f(CWstreamoff\fR. +.br +\(em \fBdir\fR is a \f(CWseek_dir\fR. +.br +\(em \fBmanip\fR is a function with type \f(CWistream& (*)(istream&)\fR. +.PP +Constructors and assignment: +.TP +\fBistream(sb)\fR +Initializes \fBios\fR state variables and associates stream with +buffer \fBsb\fR. +\fBistream_withassign()\fR +Does no initialization. This allows a file static +variable of this type +(\fBcin\fR for example) to be used before it is constructed provided +it is assigned to first. +.TP +\fBinswa=sb\fR +Associates \fBsb\fR with \fBswa\fR and initializes the entire +state of \fBinswa\fR. +.TP +\fBinswa=ins\fR +Associates \fBins->rdbuf()\fR with \fBswa\fR and initializes the entire +state of \fBinswa\fR. +.PP +Input prefix function: +.TP +\fBins.ipfx(need) +If \fBins\fR's error state is non-zero return immediately. +If neccessary (and it is non-null) \fBf.tie\fR is flushed. +Flushing is neccessary if either \fBneed==0\fR or there +are less than \fBneed\fR characters immediately available. +If \fBf.skip()\fR is non-zero and \fBneed\fR is zero +then leading whitespace characters are +extracted from \fBins\fR. Return zero +or an error occurs while skipping whitespace. +Otherwise it returns non-zero. +.PP +Formatted input functions: +.TP +\fBins\fP>>\fPx\fR +Calls \fBipfx(0)\fR and if that returns non-zero +extracts characters from \fBins\fR and converts them according +to the type of \fBx\fR. It stores the converted value in +\fBx\fR. +Errors are indicated by setting the +error state of \fBins\fR. \f(CWfailbit\fR means that characters +in \fBins\fR were not a representation of the required type. +\f(CWbadbit\fR indicates that attempts to extract characters failed. +\fBins\fR is always returned. +.RS +.PP +The details of conversion depend on the values of \fBins\fR's format +state variable (see \fIios\fR(3C++)) and the +type of \fBx\fR. Except as noted, the extraction operators +do not change the value +of the format state variables. +.TP +\f(CWchar*\fR, \f(CWunsigned char*\fR +Characters are stored in the array pointed at by \fBx\fR +until a whitespace character is found in \fBins\fR. +The terminating whitespace +is left in \fBins\fR. +If \fBins.width()\fR +is non-zero it is taken to be the size of the array, and +no more than \fBins.width()-1\fR characters are extracted. +A terminating +null character (0) is always stored (even when nothing else is +done because of \fBins\fR's status). +\fBins.width()\fR is reset to 0. +.TP +\f(CWchar&\fR, \f(CWunsigned char&\fR +A character is extracted and stored in \fBx\fR. +.TP +\f(CWshort&\fR, \f(CWunsigned short&\fR, \f(CWint&\fR, \f(CWunsigned int&\fR, \f(CWlong&\fR, \f(CWunsigned long&\fR +Characters are extracted and converted to an integral value +according to the conversion specified by +\fBins.convbase()\fR. +The first character may be a sign (\f(CW+\fR or \f(CW-\fR). After that, +if \fBins.convbase()\fR +is 8, 10, or 16 the conversion is octal, decimal, or hexadecimal respectively. +Conversion is terminated by the first "non-digit," which is left +in \fBins\fR. Octal digits are the characters '0' to '7'. +Decimal +digits are the octal digits plus '8' and '9'. +Hexadecimal digits +are the decimal digits plus the letters 'a' through 'f' (in either +upper or lower case). +If \fBins.convbase()\fR +is 0 then the number is interpreted according to C lexical +conventions. That is, if the first characters (after the optional +sign) are \f(CW0x\fR or \f(CW0X\fR a hexadecimal conversion +is performed +on following hexadecimal digits. Otherwise if the first character is a +\f(CW0\fR an +octal conversion is performed and in all other cases a decimal conversion +is performed. +\f(CWfailbit\fR is set if there are no +digits (not counting the \f(CW0\fR in \f(CW0x\fR or \f(CW0X\fR) during +hex conversion) available. +.TP +\f(CWfloat&\fR, \f(CWdouble&\fR +Converts the characters according to C++ syntax for a float or double, +and stores the result in \fBx\fR. \f(CWfailbit\fR is set if there are no +digits available in \fBins\fR or if it does not begin with a well formed +floating point number. +.RE +.PP +The type and name(\f(CWoperator>>\fR) of +the extraction operations are chosen +to give a convenient syntax for sequences of input operations. +The operator overloading of C++ permits +extraction functions to be declared for user defined classes. +These operations can then be used with the same syntax as the +member functions described here. +.PP +Unformatted input functions, which call \fBipfx(1)\fR and proceed only +if it returns non-zero: +.TP +\fBinsp=&ins.get(ptr,len,delim)\fR +Extracts characters and stores them in +the byte array beginning at \fBptr\fR +and extending for \fBlen\fR bytes. +Extraction stops when \fBdelim\fR is encountered +(\fBdelim\fR is left in \fBins\fR and not stored), +when \fBins\fR has no more characters, +or when the array has only one byte left. +\fBget\fR always stores a terminating null, even if it doesn't extract +any characters from \fBins\fR because of its error status. +\f(CWfailbit\fR is set only if \fBget\fR encounters +an end of file before it stores any characters. +.TP +\fBinsp=&ins.get(c)\fR +Extracts a single character +and stores it in \fBc\fR. +.TP +\fBinsp=&ins.get(sb,delim)\fB +Extracts characters from \fBins.rdbuf()\fR and stores +them into \fBsb\fR. +It stops if it encounters end of file or if a store into +\fBsb\fR +fails or +if it encounters \fBdelim\fR (which it leaves in \fBins\fR). +\f(CWfailbit\fR is set if it stops because the store into \fBsb\fR fails +.TP +\fBi=ins.get()\fR. +Extracts a character and returns it. +\fBi\fR is \f(CWEOF\fR if extraction encounters end of file. +\f(CWfailbit\fR is never set. +.TP +\fBinsp=&ins.getline(ptr,len,delim)\fR +Does the same thing as \fBins.get(ptr,len,delim)\fR with the exception +that it extracts a terminating \fBdelim\fR character from \fBins\fR. +In case \fBdelim\fR occurs when exactly \fBlen\fR characters +have been extracted, termination is treated as being due to the +array being filled, and this \fBdelim\fR is left in \fBins\fR. +.TP +\fBinsp=&ins.ignore(n,d)\fR +Extracts and throws away +up to \fBn\fR characters. +Extraction stops prematurely if +\fBd\fR is extracted or end of file is reached. +If \fBd\fR is \f(CWEOF\fR it can never cause termination. +.TP +\fBinsp=&ins.read(ptr,n)\fR +Extracts +\fBn\fR +characters and stores them in the array beginning at \fBptr\fR +If end of file is reached before \fBn\fR characters have been +extracted, +\fBread\fR +stores whatever it can extract and sets \f(CWfailbit\fR. +The number of characters extracted can be determined via \fBins.gcount()\fR. +.PP +Other members are: +.TP +\fBi=ins.gcount()\fR +Returns the number of characters extracted by the last unformatted +input function. Formatted input functions may call unformatted +input functions and thereby reset this number. +.TP +\fBi=ins.peek()\fR +Begins by calling \fBins.ipfx(1)\fR. +If that call returns zero or if \fBins\fR is at end of file, +it returns \f(CWEOF\fR. +Otherwise it returns (without extracting it) the next character. +.TP +\fBinsp=&ins.putback(c)\fR +Attempts to back up \fBins.rdbuf()\fR. +\fBc\fR must be the character before \fBins.rdbuf()\fR's get pointer. +(Unless other activity is modifying \fBins.rdbuf()\fR this +is the last character extracted from \fBins\fR.) +If it is not, the effect is undefined. +\fBputback\fR may fail (and set the error state). +Although it is a member of \f(CWistream\fR, +\fBputback\fR never extracts characters, so +it does not call \fBipfx\fR. It will, however, return without +doing anything if the error state is non-zero. +.TP +\fBins>>manip\fR +Equivalent to \fBmanip(ins)\fR. +Syntactically this looks like an extractor +operation, but semantically it does an arbitrary operations +rather than converting a sequence of characters and storing the +result in \fBmanip\fR. +.PP +Member functions related to positioning. +.TP +\fBinsp=&ins.seekg(off,dir)\fR +Repositions \fBins.rdbuf()\fR's get pointer. +See \fIsbuf.pub\fR(3C++)\fR for a discussion of positioning. +.TP +\fBinsp=&ins.seekg(pos)\fR +Repositions \fBins.rdbuf()\fR's get pointer. +See \fIsbuf.pub\fR(3C++)\fR for a discussion of positioning. +.TP +\fBpos=ins.tellg()\fR +The current position of \fBios.rdbuf()\fR's get pointer. +See \fIsbuf.pub\fR(3C++)\fR for a discussion of positioning. +.PP +Manipulator: +.TP +\fBins>>ws\fR +Extracts whitespace characters. +.SH CAVEATS +.PP +There is no overflow detection on conversion of integers. There should +be, and overflow should cause the error state to be set. +.PP +There should be a way to input an arbitrary length string without +knowing a maximum size beforehand. +.PP +.SH SEE ALSO +ios(3C++) +sbuf.pub(3C++) +manip(3C++) diff --git a/static/unix-v10/man3/itoa.3 b/static/unix-v10/man3/itoa.3 new file mode 100644 index 00000000..1c7a7db4 --- /dev/null +++ b/static/unix-v10/man3/itoa.3 @@ -0,0 +1,30 @@ +.pa 1 +.he 'ITOA (III)'3/15/72'ITOA (III)' +.ti 0 +NAME itoa -- integer to ascii conversion +.sp +.ti 0 +SYNOPSIS jsr r5,itoa; subr +.sp +.ti 0 +DESCRIPTION itoa____ +will convert the number in r0 +into ascii decimal preceded +by a - sign if appropriate. +For each character generated by itoa, +the subroutine subr____ (supplied by the caller) is called on +register r5 with the character in r0. +.sp +The subroutine subr____ must not disturb any registers. +.sp +.ti 0 +FILES kept in /lib/liba.a +.sp +.ti 0 +SEE ALSO -- +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS -- diff --git a/static/unix-v10/man3/juke.3 b/static/unix-v10/man3/juke.3 new file mode 100644 index 00000000..ef905153 --- /dev/null +++ b/static/unix-v10/man3/juke.3 @@ -0,0 +1,115 @@ +.TH INTERNAL 3 +.CT 2 file_io +.SH NAME +jukebox routines +.tr %" +.SH SYNOPSIS +.B "#include %hdr.h%" +.PP +.tr %% +.B "int j_shelf_to_drive(int sh, Side side, int dr, char *err)" +.PP +.B "int j_drive_to_shelf(int dr, int sh, Side side, char *err)" +.PP +.B "int j_empty_drive(int tlim, char *buf)" +.PP +.B "void j_rdshelves(char *buf)" +.PP +.B "int j_getstatus(char *buf)" +.PP +.B "int j_scsiio(struct scsi_cmd *cmd, int ncmd," +.br +.B "\ \ \ \ \ \ struct scsi_return *ret, int nret, char *err)" +.PP +.B "int j_shelfof(char *vol_id)" +.PP +.B "int j_volid(int dr, char *err)" +.PP +.B "extern char *j_shelf[NSHELF];" +.PP +.B "extern void pperror(char *buf, char *mesg); +.SH DESCRIPTION +.I J_shelf_to_drive +places the disk in shelf +.I sh +in logical drive +.IR dr . +It returns 0 on success; +otherwise an error message is placed in +.I err . +.PP +.I J_drive_to_shelf +places the disk +in logical drive +.IR dr +in shelf +.IR sh . +If +.I sh +is negative, +the disk is returned to its home shelf. +It returns 0 on success; +otherwise an error message is placed in +.IR err . +.PP +.I J_rdshelves +initializes each element of +.I j_shelf +to the volid of the disk on that shelf. +A zero pointer means there is no disk; +a name of +.B UNALLOCATED +means the disk has not been allocated a name yet. +It returns 0 on success; +otherwise an error message is placed in +.IR err . +.PP +.I J_getstatus +initializes +.B j_status +which include the following fields: +.EX + struct Lunstatus lun[NLUN]; /* disk status */ + uchar shelf[NSHELF]; /* shelf status */ + uchar iounit; /* I/O unit status */ + uchar carrier; /* carrier status */ + uchar udrive; /* upper drive status */ + uchar ldrive; /* lower drive status */ +.EE +A return value of 0 implies success; +otherwise \-1 is returned and an error message is placed in +.IR err . +.PP +.I J_scsiio +performs a SCSI transaction. +It sends the command in +.I cmd +and +.I ncmd +data bytes and stores the return status in +.IR ret . +A return value of 0 implies success; +otherwise \-1 is returned and an error message is placed in +.IR err . +.PP +.I J_shelfof +returns the shelf number of the disk labelled +.IR vol_id . +If there is no such disk, +\-1 is returned. +.PP +.I J_volid +returns the volid of the disk on drive +.I dr +in +.IR err . +A return value of 0 implies success; +otherwise \-1 is returned and an error message is placed in +.IR err . +.PP +.I Pperror +returns an error message that is contained in +.IR buf. +.PP +.SH "SEE ALSO" +.SH DIAGNOSTICS diff --git a/static/unix-v10/man3/l3tol.3 b/static/unix-v10/man3/l3tol.3 new file mode 100644 index 00000000..75009964 --- /dev/null +++ b/static/unix-v10/man3/l3tol.3 @@ -0,0 +1,34 @@ +.TH L3TOL 3 +.CT 2 data_man +.SH NAME +l3tol, ltol3 \(mi convert between 3-byte integers and long integers +.SH SYNOPSIS +.nf +.B l3tol(lp, cp, n) +.B long *lp; +.B char *cp; +.PP +.B ltol3(cp, lp, n) +.B char *cp; +.B long *lp; +.fi +.SH DESCRIPTION +.I L3tol +converts a list of +.I n +three-byte integers packed into a character string +pointed to by +.I cp +into a list of long integers pointed to by +.IR lp . +.PP +.I Ltol3 +performs the reverse conversion from long integers +.RI ( lp ) +to three-byte integers +.RI ( cp ). +.PP +These functions are useful for file-system maintenance +where the block numbers are three bytes long. +.SH SEE ALSO +.IR filsys (5) diff --git a/static/unix-v10/man3/labconst.3 b/static/unix-v10/man3/labconst.3 new file mode 100644 index 00000000..0347c472 --- /dev/null +++ b/static/unix-v10/man3/labconst.3 @@ -0,0 +1,32 @@ +.TH LABCONST 3 +.SH NAME +labelyes, labelno, labeltop, labelbot \- label constants +.SH SYNOPSIS +.B extern struct label labelyes; +.PP +.B extern struct label labelno; +.PP +.B extern struct label labeltop; +.PP +.B extern struct label labelbot; +.SH DESCRIPTION +These objects are initialized as follows, where the +coded values are as in +.IR labtoa (3). +.TF labeltop +.TP +.B labelyes +The universally permissive label, +.LR Y . +.TP +.B labelno +The universally denying label, +.LR N . +.TP +.B labeltop +The top lattice value, +.LR ffff... . +.TP +.B labelbot +The bottom lattice value, +.LR 0000... . diff --git a/static/unix-v10/man3/labeq.3 b/static/unix-v10/man3/labeq.3 new file mode 100644 index 00000000..e858faca --- /dev/null +++ b/static/unix-v10/man3/labeq.3 @@ -0,0 +1,80 @@ +.TH LABEQ 3 +.SH NAME +labeq, lable, labmax, labmin \- compare security labels +.SH SYNOPSIS +.B #include <sys/label.h> +.PP +.B labEQ(x, y) +.br +.B struct label *x, *y; +.PP +.B labLE(x, y) +.br +.B struct label *x, *y; +.PP +.B struct label labMAX(x, y) +.br +.B struct label *x, *y; +.PP +.B struct label labMIN(x, y) +.br +.B struct label *x, *y; +.SH DESCRIPTION +.I LabEQ +returns 1 if +.I x +and +.I y +point to equal labels, otherwise 0. +The result is 1 if and only if neither argument is 0, the +flag fields are the same, and, when the flag fields are +.BR L_BITS , +the lattice values are the same. +.PP +.I LabLE +returns 1 if the security label pointed to by +.I x +compares less than or equal to the security label pointed to by +.I y. +An improper argument is treated as if it had flag +.BR L_NO . +If one of the labels has flag +.BR L_YES , +the result is 1; otherwise if one of the labels has flag +.BR L_NO , +the result is 0; +otherwise the the result is 1 +if and only if the lattice value of +.I x +is bitwise less than or +equal to the lattice value of +.I y. +(Inequalities involving +.BR L_YES +and +.BR L_NO +are not transitive.) +.PP +.I LabMAX +and +.I labMIN +respectively return the maximum (bitwise OR) and +minimum (bitwise AND) of lattice values of labels +pointed to by +.I x +and +.I y. +An improper argument is treated as if it had flag +.BR L_NO . +If one of the labels has flag +.BR L_YES , +the result is the other label; otherwise +if one of the labels has flag +.BR L_NO , +the result has flag +.BR L_NO . +.PP +The privilege and frozen-label +fields of the labels are disregarded by all of these functions. +.SH SEE ALSO +.IR getflab (2) diff --git a/static/unix-v10/man3/labtoa.3 b/static/unix-v10/man3/labtoa.3 new file mode 100644 index 00000000..b6a02cb0 --- /dev/null +++ b/static/unix-v10/man3/labtoa.3 @@ -0,0 +1,123 @@ +.TH LABTOA 3 +.SH NAME +labtoa, atolab, atopriv, privtoa \- security label conversion +.SH SYNOPSIS +.B #include <sys/label.h> +.PP +.B char *labtoa(labp) +.B struct label *labp; +.br +.B struct label *atolab(string) +.B char *string; +.PP +.B atopriv(string) +.B char *string; +.PP +.B char *privtoa(n) +.SH DESCRIPTION +.I Labtoa +returns a pointer to a null-terminated +.SM ASCII +string that represents +the value of the security label pointed to by +.I labp. +The string has a form exemplified by +.IP +.B "guxnlp guxnlpFY 0000 0000 ... +.LP +The characters of the first group +.L guxnlp +denote capabilities +.BR T_LOG , +.BR T_UAREA , +.BR T_EXTERN , +.BR T_NOCHK , +.BR T_SETLIC , +and +.BR T_SETPRIV +respectively. +Characters of the second group denote corresponding licenses; see +.IR getplab (2). +Missing capabilities or licenses are denoted by +.LR - . +.PP +The character shown as +.L F +denotes the fixity of the label. +It may be a space (loose), +.L F +(frozen), +.L R +(rigid), +or +.L C +(constant) +The character shown as +.L Y +denotes the label's flag. +It may be a space for a lattice label, +.L N +for +.BR L_NO , +.L Y +for +.BR L_YES , +or +.L U +for the erroneous flag value 0. +.PP +Each group of four zeros may be any four lower case hex digits +representing the value of two bytes of the lattice value. +Repeating groups at the end of the string are denoted +.LR ... . +.LP +.I Atolab +inverts the process. +The order of characters in, and length of, privilege strings are +arbitrary, except that a nonempty license string must be +preceded by a nonempty capability string. +The order of characters from the set +.B YNUFRC +is arbitrary. +Spaces must separate nonempty capability and license strings, +and may be interspersed arbitrarily after the license string. +A final +.B ... +causes the last four hex digits +to be repeated, provided the preceding label contains +a multiple of four digits. +A short or missing lattice value is padded with zeros. +.PP +.I Atopriv +converts a string of characters from the set +.L guxnlp- +into privilege bits that may be stored in the +.B lb_t +or +.B lb_u +fields of a label structure. +The order and number of characters are arbitrary. +.PP +.I Privtoa +is inverse to +.I atopriv. +.SH SEE ALSO +.IR getflab (2), +.IR getplab (2), +.IR getlab (1) +.SH DIAGNOSTICS +.I Atolab +returns 0 for unrecognizable input. +.PP +.I Atopriv +returns the negative value +.B ~(T_LOG|T_UAREA|T_EXTERN|T_NOCHK|T_SETLIC|T_SETPRIV) +for unrecognizable input. +.SH BUGS +The value returned by +.I labtoa, +.I atolab, +or +.I privtoa +points to a static buffer that is overwritten +at each call. diff --git a/static/unix-v10/man3/ldiv.3 b/static/unix-v10/man3/ldiv.3 new file mode 100644 index 00000000..ad949620 --- /dev/null +++ b/static/unix-v10/man3/ldiv.3 @@ -0,0 +1,43 @@ +.th LDIV III 5/7/73 +.sh NAME +ldiv \*- long division +.sh SYNOPSIS +.ft B +ldiv(hidividend, lodividend, divisor) +.s3 +lrem(hidividend, lodividend, divisor) +.ft R +.sh DESCRIPTION +The +concatenation of the signed +16-bit +.it hidividend +and the unsigned 16-bit +.it lodividend +is divided by +\fIdivisor\fR. +The 16-bit signed quotient is returned by +.it ldiv +and the 16-bit signed remainder is returned by +.it lrem. +Divide check and erroneous results +will occur +unless the magnitude of the +divisor is greater than that of the high-order +dividend. +.s3 +An integer division of an unsigned +dividend by a signed divisor may +be accomplished by +.s3 + quo = ldiv(0, dividend, divisor); +.s3 +and similarly for the remainder operation. +.s3 +Often both the quotient and the remainder are wanted. +Therefore +.it ldiv +leaves a remainder in the external cell +.it ldivr. +.sh BUGS +No divide check check. diff --git a/static/unix-v10/man3/log.3 b/static/unix-v10/man3/log.3 new file mode 100644 index 00000000..37e0fc84 --- /dev/null +++ b/static/unix-v10/man3/log.3 @@ -0,0 +1,26 @@ +.pa 1 +.he 'LOG (III)'3/15/72'LOG (III)' +.ti 0 +NAME log -- logarithm (base e) +.sp +.ti 0 +SYNOPSIS jsr r5,log +.sp +.ti 0 +DESCRIPTION The +logarithm (base e) of fr0 is returned in fr0. +.sp +.ti 0 +FILES kept in /lib/liba.a +.sp +.ti 0 +SEE ALSO -- +.sp +.ti 0 +DIAGNOSTICS The error bit (c-bit) +is set if the input argument is less than or +equal to zero and the result is set to the largest +negative number. +.sp +.ti 0 +BUGS -- diff --git a/static/unix-v10/man3/malloc.3 b/static/unix-v10/man3/malloc.3 new file mode 100644 index 00000000..2b241b30 --- /dev/null +++ b/static/unix-v10/man3/malloc.3 @@ -0,0 +1,94 @@ +.TH MALLOC 3 +.CT 2 mem_man +.SH NAME +malloc, free, realloc, calloc, cfree \- memory allocator +.SH SYNOPSIS +.nf +.B char *malloc(size) +.B unsigned size; +.PP +.B free(ptr) +.B char *ptr; +.PP +.B char *realloc(ptr, size) +.B char *ptr; +.B unsigned size; +.PP +.B char *calloc(nelem, elsize) +.B unsigned nelem, elsize; +.PP +.B cfree(ptr) +.B char *ptr; +.fi +.SH DESCRIPTION +.I Malloc +and +.I free +provide a simple memory allocation package. +.I Malloc +returns a pointer to a new block of at least +.I size +bytes. +The block is suitably aligned for storage of any type of object. +No two active pointers from +.I malloc +will have the same value. +.PP +The argument to +.I free +is a pointer to a block previously allocated by +.IR malloc ; +this space is made available for further allocation. +.PP +.I Realloc +changes the size of the block pointed to by +.I ptr +to +.I size +bytes and returns a pointer to the (possibly moved) +block. +The contents will be unchanged up to the +lesser of the new and old sizes. +The call +.B "realloc((char*)0, size) +means the same as +.LR malloc(size) . +.PP +.I Calloc +allocates space for +an array of +.I nelem +elements of size +.I elsize. +The space is initialized to zeros. +.I Cfree +frees such a block. +.SH SEE ALSO +.IR galloc (3), +.IR brk (2), +.IR pool (3), +.IR block (3) +.SH DIAGNOSTICS +.I Malloc, realloc +and +.I calloc +return 0 if there is no available memory +or if the arena has been detectably corrupted. +.SH BUGS +When +.I realloc +returns 0, the block pointed to by +.I ptr +may have been destroyed. +.PP +User errors can corrupt the storage arena. +The most common gaffes are (1) freeing an already freed block, +(2) storing beyond the bounds of an allocated block, and (3) +freeing data that was not obtained from the allocator. +To help find such errors, a diagnosing allocator +may be loaded; use flag +.B -ldmalloc +of +.IR cc (1). +An even more stringently checking version may be created +by recompilation; see the source. diff --git a/static/unix-v10/man3/manip.3 b/static/unix-v10/man3/manip.3 new file mode 100644 index 00000000..70adfcbc --- /dev/null +++ b/static/unix-v10/man3/manip.3 @@ -0,0 +1,186 @@ +. \"ident "%W%" +. \"Copyright (c) 1984 AT&T +. \"All Rights Reserved +. \"THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +. \"The copyright notice above does not evidence any +. \"actual or intended publication of such source code. +.TH MANIP 3I+ "C++ Stream Library" " " +.SH NAME +manipulators \- iostream out of band manipulations +.SH SYNOPSIS +.ft B +.ta1i 2i +.nf +#include <iostream.h> +#include <iomanip.h> + +IOMANIPdeclare(T) ; + +class SMANIP(T) { + SMANIP(T)( ios& (*)(ios&,T), T); +}; + +class SAPP(T) { + SAPP(T)( ios& (*)(ios&,T)); + SMANIP(T) operator()(T); +}; + +ios& SMANIP(T)::operator<<(ios&); +ios& SMANIP(T)::operator>>(ios&); +istream& SMANIP(T)::operator>>(istream&); +ostream& SMANIP(T)::operator<<(ostream&); +iostream& SMANIP(T)::operator<<(iostream&); +iostream& SMANIP(T)::operator>>(iostream&); + +class IMANIP(T) { + IMANIP(T)( istream& (*)(istream&,T), T); +}; + +class IAPP(T) { + IAPP(T)( istream& (*)(istream&,T)); + IMANIP(T) operator()(T); +}; + +istream& operator>>(IMANIP(T), istream&); + +class OMANIP(T) { + OMANIP(T)( ostream& (*)(ostream&,T), T); +}; + +class OAPP(T) { + OAPP(T)( ostream& (*)(ostream&,T)); + OMANIP(T) operator()(T); +}; + +ostream& operator<<(OMANIP(T), ostream&); + +class IOMANIP(T) { + IOMANIP(T)( ios& (*)(ios&,T), T); +}; + +class IOAPP(T) { + IOAPP(T)( ios& (*)(ios&,T)); + IOMANIP(T) operator()(T); +}; + +iostream& operator<<(SMANIP(T), iostream&); +iostream& operator>>(SMANIP(T), iostream&); + + +IOMANIPdeclare(int) ; + +IOMANIP(int) setbase(int b) ; +IOMANIP(int) setw(int w) ; +.fi +.ft R +.SH DESCRIPTION +Manipulators are values that may be "inserted into" or +"extracted from" streams in order to achieve some effect +(other than to insert a representation of their value). +Ideally the types relating to manipulators would be parameterized +as "templates". +The macros defined in \f(CWiomanip.h\fR are used to simulate a templates. +\BIOMANIP(T)\fR declares +the various classes and operators. (All code is declared as inlines +so that no separate definitions are required.) Each of the other +\fBT\fR is used to construct the real names and therefore +must be a single +identifer. Each of the other macros also requires an identifier +and expands to a name. +.br +\(em \fBt\fR is a \fBT\fR. +.br +\(em \fBs\fR is an \f(CWios\fR. +.br +\(em \fBi\fR is an \f(CWistream\fR. +.br +\(em \fBo\fR is an \f(CWostream\fR. +.br +\(em \fBio\fR is an \f(CWiostream\fR. +.br +\(em \fBf\fR is an \f(CWios& (*)(ios&)\fR. +.br +\(em \fBif\fR is an \f(CWistream& (*)(istream&)\fR. +.br +\(em \fBof\fR is an \f(CWostream& (*)(ostream&)\fR. +.br +\(em \fBiof\fR is an \f(CWiostream& (*)(iostream&)\fR. +.TP +\fBs<<SMANIP(T)(f,t)\fR +.nf +.in -.5i +\fBs<<SMANIP(T)(f,t)\fR +\fBs>>SMANIP(T)(f,t)\fR +\fBs<<SAPP(T)(f)(t)\fR +\fBs>>SAPP(T)(f)(t)\fR +\fBi>>SMANIP(T)(if,t)\fR +\fBi>>SAPP(T)(if)(t)\fR +\fBo<<SMANIP(T)(of,t)\fR +\fBo<<SAPP(T)(of)(t)\fR +\fBio<<SMANIP(T)(iof,t)\fR +\fBio>>SMANIP(T)(iof,t)\fR +\fBio<<SAPP(T)(iof)(t)\fR +\fBio>>SAPP(T)(iof)(t)\fR +.in +.fi +Returns \fBfct(s,t)\fR, where \fBs\fR is the left operand of +the insertion or extractor operator and \fBfct\fR is \fBf\fR, +\fBif\R, \fBof\fR or \fBiof\fR. +.sp +.nf +.in -.5i +\fBi>>IMANIP(T)(if,t)\fR +\fBi>>IAPP(T)(if)(t)\fR +.in +.fi +Return \fBif(i,t)\fR. +.sp +.nf +.in -.5i +\fBo<<OMANIP(T)(of,t)\fR +\fBo<<OAPP(T)(of)(t)\fR +.in +.fi +Return \fBof(i,t)\fR. +.sp +.nf +.in -.5i +\fBio<<IOMANIP(T)(iof,t)\fR +\fBio>>IOMANIP(T)(iof,t)\fR +\fBio<<IOAPP(T)(iof)(t)\fR +\fBio>>IOAPP(T)(iof)(t)\fR +.in +.fi +Return \fBiof(s,t)\fR. +.PP +\f(CWiomanip.h\fR contains a declaration, \f(CWIOMANIPdeclare(int)\fR +and some functions: +.sp +.nf +.in -.5i +\fBo<<setbase(n)\fR +\fBi>>setbase(n)\fR +\fBio<<setbase(n)\fR +\fBio>>setbase(n)\fR +.in +.fi +Sets the conversion base of the stream (left hand operand) to \fBn\fR. +.sp +.nf +.in -.5i +\fBo<<setw(n)\fR +\fBi>>setw(n)\fR +\fBio<<setw(n)\fR +\fBio>>setw(n)\fR +.in +.fi +Sets the \f(CWwidth\fR format state variable +the stream (left hand operand) to \fBn\fR. +.SH CAVEATS +Syntax errors will be reported if +\fBIOMANIP(T)\fR occurs more than once in a file with the +same \fBT\fR. +.SH SEE ALSO +ios(3C++) +istream(3C++) +ostream(3C++) diff --git a/static/unix-v10/man3/map.3 b/static/unix-v10/man3/map.3 new file mode 100644 index 00000000..21c3caf5 --- /dev/null +++ b/static/unix-v10/man3/map.3 @@ -0,0 +1,274 @@ +.TH MAP 3+ +.CT 2 datatype +.SH NAME +Map \- associative array classes +.SH SYNOPSIS +.nf +.B "#include <Map.h>" +.PP +.ds 1s \*S +.ds S \fIS\fP +.ds T \fIT\fP +.ft L +Mapdeclare(\*S,\*T) +Mapimplement(\*S,\*T) +.PP +.ft L +struct Map(\*S,\*T) { + Map(\*S,\*T)(); + Map(\*S,\*T)(const \*T&); + Map(\*S,\*T)(const Map(\*S,\*T)&); + ~Map(\*S,\*T); + Map(\*S,\*T)& operator= (const Map(\*S,\*T)&); + \*T& operator[] (int); + int size(); + Mapiter(\*S,\*T) element(const \*S&); + Mapiter(\*S,\*T) first(); + Mapiter(\*S,\*T) last(); +}; +.PP +.ft L +struct Mapiter(\*S,\*T) { + Mapiter(\*S,\*T) (const Map(\*S,\*T)&); + ~Mapiter(\*S,\*T); + operator int(); + \*S key(); + \*T value(); + Mapiter(\*S,\*T)& operator++ (Mapiter(\*S,\*T)&); + Mapiter(\*S,\*T)& operator-- (Mapiter(\*S,\*T)&); +}; +.ft R +.fi +.SH DESCRIPTION +A +.I map +is a collection of +.I elements, +each of which contains a +.I key +part of type +.I S +and a +.I value +part of type +.I T, +where +.I S +and +.I T +are type names. +Both +.I S +and +.I T +must have value semantics: +assignment or initialization have the effect of copying. +(It is unlikely for +.I S +and +.I T +to be pointers.) +.PP +Map elements are ordered by key: type +.I S +must have a transitive boolean +.BR operator< . +.PP +The macro call +.L Mapdeclare(\*S,\*T) +declares the classes +.B Map(\*S,\*T) +and +.BR Mapiter(\*S,\*T) . +It must appear once in every source file that uses either. +The macro call +.B Mapimplement(\*S,\*T) +defines the functions that implement the map classes. +It must appear exactly once in the entire program. +.SS Map constructors +.nr xx \w'\fLMap(\*S,\*T)(m)\ \fP' +.TP \n(xxu +.B Map(\*S,\*T)() +An empty map. +The value part of future elements +is the value of an otherwise uninitialized +static object of type +.I T . +.TP +.BI Map(\*S,\*T)( x ) +An empty map whose future elements have +default value +.I x . +.TP +.BI Map(\*S,\*T)( m ) +A copy of map +.I m +obtained by copying the elements and default value of +.I m. +.SS Map operators +.TP \n(xxu +.IB n " = " m +All the elements of map +.I n +are deleted and and +copies of the elements of +.I m +are added. +The default value of +.I n +does not change. +Running time is +.IR O (log(| m |) ++ +.RI log(| n |)), +where +.RI | m | +means +.IB m .size() . +.TP +.IB m [ k ] +A reference +to the value part of the element of map +.I m +with key +.BR k . +If the element does not exist, it is created. +Running time is +.IR O (log(| m |)) . +.SS Other Map functions +.TP \n(xxu +.IB m .size() +The number of elements in +.LR m . +Running time is +.IR O (1). +.TP +.IB m .element( k ) +A map iterator +referring to the element of +.I m +with key +.I k +if such an element exists. +Otherwise the result is vacuous. +Running time is +.IR O (log(| m |)) . +.TP +.IB m .first() +.br +.ns +.TP +.IB m .last() +A map iterator +referring to the element of +.I m +with the smallest (or largest) key. +If +.L m +has no elements, the result is vacuous. +Running time is +.IR O (log(| m |)) . +.SS "Map iterators" +For every class +.B Map(\*S,\*T) +there is a class +.BR Mapiter(\*S,\*T) . +A map iterator identifies a map object and possibly +an element in that map. +An iterator that does not identify an element is +.IR vacuous . +.SS Mapiter constructors +.TP \n(xxu +.BI Mapiter(\*S,\*T)( m ) +A vacuous iterator referring to map +.I m. +Running time is +.IR O (1). +.SS Mapiter operators +.TP \n(xxu +.IB i " = " j +Make iterator +.I i +refer (for now) to the same map as does +.I j. +.TP +.BI (int) i +Zero if iterator +.I i +is vacuous, otherwise nonzero. +.TP +.BI ++ i +.br +.ns +.TP +.BI -- i +If iterator +.I i +is vacuous, make it refer to the map element with +the smallest (or largest) key +Otherwise, make it refer to the map element with the +next key greater (or less) than the key of the +current element. +If no such element exists, +.I i +becomes vacuous. +The running time of a single increment +operation for map +.I m +is +.IR O (log(| m |)). +However an iterator +takes only time +.IR O (| m |) +to sequence through the whole map. +.SS Other mapiter functions +.TP \n(xxu +.IB i .key() +.br +.ns +.TP +.IB i .value() +The key (or value) part of the element referred to by +.I i . +If +.I i +is vacuous, return +the value of an otherwise uninitialized static +object of appropriate type. +Running time is +.IR O (1). +.SH EXAMPLES +.EX +struct city { char name[100]; }; +typedef int population; +int operator< (const city&, const city&); +.EE +.PP +.B Mapdeclare(name,population) +.PP +.B Map(name,population) gazetteer; +.PP +.B "// Print big cities; set populations of others to zero. +.PP +.EX + for(Mapiter(name,population) i = gazetteer.first(); i; i++) + if(i.value() > 1000000) + printf("%s\en", i.key().name); + else + gazetteer[i.key()] = 0; +.EE +.SH BUGS +A `type name' +.B Map(\*S,\*T) +or +.BR Mapiter(\*S,\*T) +that contains spaces will be mangled by +.IR cpp (8). +.br +There is no way to delete a single element. +.br +Ambiguities can occur if the type name +.I S +contains an underscore. +.br +No precautions are taken against running out of memory. diff --git a/static/unix-v10/man3/memory.3 b/static/unix-v10/man3/memory.3 new file mode 100644 index 00000000..2edea28c --- /dev/null +++ b/static/unix-v10/man3/memory.3 @@ -0,0 +1,118 @@ +.TH MEMORY 3 +.CT 2 mem_man +.SH NAME +memccpy, memchr, memcmp, memcpy, memmove, memset \(mi memory operations +.SH SYNOPSIS +.nf +.B char *memccpy(s1, s2, c, n) +.B char *s1, *s2; +.B int c, n; +.PP +.B char *memchr(s, c, n) +.B char *s; +.B int c, n; +.PP +.B int memcmp(s1, s2, n) +.B char *s1, *s2; +.B int n; +.PP +.B char *memcpy(s1, s2, n) +.B char *s1, *s2; +.B int n; +.PP +.B char *memmove(s1, s2, n) +.B char *s1, *s2; +.B int n; +.PP +.B char *memset(s, c, n) +.B char *s; +.B int c, n; +.fi +.SH DESCRIPTION +These functions operate efficiently on memory areas +(arrays of characters bounded by a count, not terminated by a null character). +They do not check for the overflow of any receiving memory area. +.PP +.I Memccpy +copies characters from memory area +.I s2 +into +.IR s1 , +stopping after the first occurrence of character +.I c +has been copied, or after +.I n +characters have been copied, whichever comes first. +It returns a pointer to the character after +the copy of +.I c +in +.IR s1 , +or zero if +.I c +was not found in the first +.I n +characters of +.IR s2 . +.PP +.PP +.I Memchr +returns a pointer to the first +occurrence of character +.I c +in the first +.I n +characters of memory area +.IR s, +or zero if +.I c +does not occur. +.PP +.I Memcmp +compares its arguments, looking at the first +.I n +characters only, and returns an integer +less than, equal to, or greater than 0, +according as +.I s1 +is lexicographically less than, equal to, or +greater than +.IR s2 . +.PP +.I Memcpy +copies +.I n +characters from memory area +.I s2 +to +.I s1. +It returns +.I s1. +.PP +.I Memmove +is the same as +.I memcpy, +except it is guaranteed to handle overlapping strings as +if the move had been made to a temporary and then to the destination. +.PP +.I Memset +sets the first +.I n +characters in memory area +.I s +to the value of character +.IR c . +It returns +.IR s . +.SH SEE ALSO +.IR string (3) +.SH BUGS +.I Memcmp +uses native character comparison, which is signed +on some machines, unsigned on others; +thus the sign of the value returned when a +character has its high-order bit set is implementation-dependent. +.br +Thanks to ANSI X3J11 for the +.IR memcpy/memmove +distinction. diff --git a/static/unix-v10/man3/mesg.3 b/static/unix-v10/man3/mesg.3 new file mode 100644 index 00000000..f44f6e5c --- /dev/null +++ b/static/unix-v10/man3/mesg.3 @@ -0,0 +1,25 @@ +.pa 1 +.he 'MESG (III)'3/15/72'MESG (III)' +.ti 0 +NAME mesg -- write message on typewriter +.sp +.ti 0 +SYNOPSIS jsr r5,mesg; <Now is the time\\0>; .even +.sp +.ti 0 +DESCRIPTION mesg____ +writes the string immediately following its call onto +the standard output file. +The string must be terminated by an ASCII NULL byte. +.sp +.ti 0 +FILES kept in /lib/liba.a +.sp +.ti 0 +SEE ALSO -- +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS -- diff --git a/static/unix-v10/man3/mktemp.3 b/static/unix-v10/man3/mktemp.3 new file mode 100644 index 00000000..8505dce3 --- /dev/null +++ b/static/unix-v10/man3/mktemp.3 @@ -0,0 +1,45 @@ +.TH MKTEMP 3 +.CT 2 file_inq_creat +.SH NAME +mktemp, tmpnam \(mi make a unique file name +.SH SYNOPSIS +.nf +.B char *mktemp(template) +.B char *template; +.PP +.B #include <tmpnam.h> +.PP +.B char *tmpnam(s) +.B char s[L_tmpnam]; +.fi +.SH DESCRIPTION +.I Mktemp +replaces +.I template +by a unique file name, and returns the +address of the template. +The template should look like a file name with six trailing +.LR X s, +which will be replaced with the +current process id and a unique letter. +.PP +.I Tmpnam +places in the string pointed to by +.I s +a unique file name referring to the standard +.F /tmp +directory for temporary files and returns +.I s. +If +.I s +is 0, +.I tmpnam +returns the address of a fixed internal buffer that contains the name. +(Note: it is bad form to leave files in the temporary directory.) +.SH "SEE ALSO" +.IR getpid " in" +.IR getuid (2) +.SH BUGS +After many calls to +.IR tmpnam , +the resulting filenames may have strange characters. diff --git a/static/unix-v10/man3/mkunique.3 b/static/unix-v10/man3/mkunique.3 new file mode 100644 index 00000000..dc123c83 --- /dev/null +++ b/static/unix-v10/man3/mkunique.3 @@ -0,0 +1,45 @@ +.TH MKUNIQUE 3 +.CT 2 file_inq_creat +.SH NAME +mkunique, tmpnam \(mi make a file with a unique name +.SH SYNOPSIS +.nf +.B char *mkunique(template, mode, fdp) +.B char *template; +.B int *fdp; +.PP +.B tmpnam(s) +.B char *s; +.fi +.SH DESCRIPTION +.I Mkunique +creates a file with a unique name and the specified +.I mode +and returns a pointer to a +.IR malloc (3)-ed +copy of the unique name. +.PP +If the new file resides in an ordinary directory, +the unique name will be the template suffixed by 8 digits, +the first 5 of which are the current process id. +The last component of the template should not +be more than 6 characters long. +In a blind directory, the entire last component of +the unique name will be a random string; see +.IR creat (2). +.LP +If the pointer +.I fdp +is nonzero, the location pointed to will be filled in +with a file descriptor for the file, open for writing. +.LP +Note. +It is bad form to leave files in the temporary directory. +One way to avoid doing so is to +.IR unlink (2) +temporary files as soon +as they are opened. +.SH "SEE ALSO" +.IR tmpnam (1) +.SH DIAGNOSTICS +Zero is returned if the operation fails for any reason. diff --git a/static/unix-v10/man3/mon.3 b/static/unix-v10/man3/mon.3 new file mode 100644 index 00000000..782d31db --- /dev/null +++ b/static/unix-v10/man3/mon.3 @@ -0,0 +1,60 @@ +.th MONITOR III 5/10/73 +.sh NAME +monitor \*- prepare execution profile +.sh SYNOPSIS +.ft B +monitor(lowpc, highpc, buffer, bufsize) +.br +int lowpc( ), highpc( ), buffer[ ], bufsize; +.sh DESCRIPTION +.it Monitor +is an interface to the system's profile entry (II). +.it lowpc +and +.it highpc +are the names of two functions; +.it buffer +is the address of a (user supplied) +array of +.it bufsize +integers. +.it Monitor +arranges for the system to sample the user's +program counter periodically +and record the execution histogram in +the buffer. +The lowest address sampled +is that of +.it lowpc +and the highest is +just below \fIhighpc\fR. +For the results to be significant, +especially where there are small, heavily +used routines, +it is suggested that the buffer be no more +than a few times smaller than the range +of locations sampled. +.s3 +To profile the entire program, +it is sufficient to use +.s3 + extern etext; + ... + monitor(2, &etext, buf, bufsize); +.s3 +.it etext +is a loader-defined symbol which lies just above all the +program text. +.s3 +To stop execution monitoring and write the results +on the file \fBmon.out\fR. +use +.s3 + monitor(0); +.s3 +Then, when the program exits, prof (I) can be used +to examine the results. +.sh FILES +mon.out +.sh "SEE ALSO" +prof (I), profil (II) diff --git a/static/unix-v10/man3/monitor.3 b/static/unix-v10/man3/monitor.3 new file mode 100644 index 00000000..761b30bd --- /dev/null +++ b/static/unix-v10/man3/monitor.3 @@ -0,0 +1,103 @@ +.TH MONITOR 3 +.CT 2 debug_tune +.SH NAME +monitor \(mi prepare execution profile +.SH SYNOPSIS +.nf +.B monitor(lowpc, highpc, buffer, bufsize, nfunc) +.B int (*lowpc)(), (*highpc)(); +.B short buffer[]; +.fi +.SH DESCRIPTION +An executable program created by +.L +cc -p +automatically includes calls for +.I monitor +with default parameters; +.I monitor +needn't be called explicitly +except to gain fine control over profiling. +.PP +.I Monitor +is an interface to +.IR profil (2). +.I Lowpc +and +.I highpc +are the addresses of two functions; +.I buffer +is the address of a (user supplied) +array of +.I bufsize +bytes. +.I Monitor +arranges to record a histogram of +periodically sampled values of the program counter, +and of counts of calls +of certain functions, in the buffer. +The lowest address sampled +is that of +.I lowpc +and the highest is +just below +.IR highpc . +At most +.I nfunc +call counts can be kept; only calls of functions +compiled with the profiling option +.B -p +of +.IR cc (1) +are recorded. +For the results to be significant, +especially where there are small, heavily +used routines, +it is suggested that the buffer be no more +than a few times smaller than the range +of locations sampled. +The default values for +.I bufsize +and +.I nfunc +are +(\f2highpc\fP\-\f2lowpc\fP)/8 +and 300 respectively. +.PP +To profile the entire program, use +.PP +.nf +.ft L + extern etext(); + . . . + monitor((int (*)())2, etext, buf, bufsize, nfunc); +.ft P +.fi +.PP +.I Etext +lies just above all the +program text, see +.IR end (3). +For the highest resolution profiling on the VAX, use +.B +bufsize = ((int)highpc)-((int)lowpc)+12+8*nfunc\fR. +.PP +To stop execution monitoring and write the results +on the file +.I mon.out, +use +.PP +.L + monitor((int (*)())0); +.LP +then +.IR prof (1) +can be used +to examine the results. +.SH FILES +.TP +.F mon.out +.SH "SEE ALSO" +.IR prof (1), +.IR profil (2), +.IR cc (1) diff --git a/static/unix-v10/man3/mp.3 b/static/unix-v10/man3/mp.3 new file mode 100644 index 00000000..51ea232d --- /dev/null +++ b/static/unix-v10/man3/mp.3 @@ -0,0 +1,154 @@ +.TH MP 3X +.CT 2 math +.SH NAME +itom, mfree, madd, msub, mult, mdiv, sdiv, msqrt, mgcd, min, mout, +fmin, fmout, move, mcmp, +rpow, mpow \(mi multiple precision integer arithmetic +.SH SYNOPSIS +.nf +.2C +.B "#include <mp.h>" +.B "#include <stdio.h>" +.PP +.B mint *itom(n) +.B short n; +.PP +.B mfree(a) +.B mint *a; +.PP +.B madd(a, b, c) +.B mint *a, *b, *c; +.PP +.B msub(a, b, c) +.B mint *a, *b, *c; +.PP +.B mult(a, b, c) +.B mint *a, *b, *c; +.PP +.B mgcd(a, b, c) +.B mint *a, *b, *c; +.PP +.B mdiv(a, b, q, r) +.B mint *a, *b, *q, *r; +.PP +.B sdiv(a, n, q, r) +.B mint *a, *q; +.B short n, *r; +.PP +.B \& +.B msqrt(a, b, r) +.B mint *a, *b, *r; +.PP +.B rpow(a, n, c) +.B mint *a, *c; +.PP +.B mpow(a, b, m, c) +.B mint *a, *b, *m, *c; +.PP +.B move(a, b) +.B mint *a, *b; +.PP +.B mcmp(a, b) +.B mint *a, *b; +.PP +.B int min(a) +.B mint *a; +.PP +.B mout(a) +.B mint *a; +.PP +.B int fmin(a, f) +.B mint *a; +.B FILE *f; +.PP +.B fmout(a, f) +.B mint *a; +.B FILE *f; +.1C +.SH DESCRIPTION +These routines perform arithmetic on arbitrary-length integers +of defined type +.I mint. +The functions are obtained with the +.IR ld (1) +option +.BR -lmp . +.PP +Pointers to +.I mint +must be initialized using the function +.IR itom , +which sets the initial value to +.IR n . +Thereafter space is managed automatically. +The space may be freed by +.IR mfree , +making the variable uninitialized. +.PP +.I Madd, msub, mult, +and +.I mgcd +assign to their third arguments the sum, difference, +product, and greatest common divisor, respectively, of their first two arguments. +.PP +.I Mdiv +assigns the quotient and remainder, respectively, +to its third and fourth arguments. +The remainder is nonnegative and less than the divisor in magnitude. +.I Sdiv +is like +.I mdiv +except that the divisor is an ordinary integer. +.PP +.I Msqrt +assigns the square root and remainder to its second and third arguments, +respectively. +.PP +.I Rpow +calculates +.I a +raised to the power +.IR n ; +.I mpow +calculates this reduced modulo +.IR m . +.PP +.IR Move +assigns (by copying) the value of its first argument to its second argument. +.PP +.IR Mcmp +returns a negative, zero, or positive integer if the value of its +first argument is less than, +equal to, or greater than, respectively, +the value of its second argument. +.PP +.I Min +and +.I mout +do decimal conversion from +.B stdin +and to +.BR stdout , +.I fmin +and +.I fmout +use file +.IR f ; +see +.IR stdio (3). +.I Min +and +.I fmin +return +.B EOF +on end of file. +.SH DIAGNOSTICS +Illegal operations and running out of memory +produce messages and core images. +.SH BUGS +.I Itom +and +.I sdiv +fail if +.I n +is the most negative short integer. diff --git a/static/unix-v10/man3/mvefil.3 b/static/unix-v10/man3/mvefil.3 new file mode 100644 index 00000000..e4252e49 --- /dev/null +++ b/static/unix-v10/man3/mvefil.3 @@ -0,0 +1,62 @@ +.TH MVEFIL 3X cray +.SH NAME +mvefil \- movie of a function f(x, y, t) +.SH SYNOPSIS +.B "call mvefil(unit, time, nx, ny, fmin, fmax, outsid, f)" +.br +.B "integer unit, nx, ny" +.br +.B "real time, fmin, fmax, outsid, f(nx,ny)" +.SH DESCRIPTION +Each call of the FORTRAN routine +.I mvefil +writes a frame in a printing ascii format +that can be converted to +.IR view2d (5). +When loading, use the +.IR f77 (1) +option +.BR \-lspec . +.I Unit +is a FORTRAN logical unit number for output, typically 30. +.I Nx, ny +give the grid size. +.I Time +is a (nondecreasing) frame index, typically set to simulation time +or iteration count. +.I Fmin +and +.I fmax +should normally be 0 on input; +on output they will be set to the range of the data. +If not equal on input, they will be assumed as the +range of the data. +.I f +is the +.I nx +by +.I ny +array of data. +There is a threshold for describing nonrectangular regions: +any value less than or equal to +.I outsid +is treated as +out of bounds and will appear as black. +.PP +After running this on +.I 3k, +on your local machine, type +.br +.BI view3k " crayfile localfile" +.br +where +.I crayfile +is typically +.B fort.30 +and +.I localfile +will be created in +.IR view2d (5) +format. +.SH "SEE ALSO" +view2d(1), view2d(5) diff --git a/static/unix-v10/man3/nargs.3 b/static/unix-v10/man3/nargs.3 new file mode 100644 index 00000000..019287a0 --- /dev/null +++ b/static/unix-v10/man3/nargs.3 @@ -0,0 +1,19 @@ +.th NARGS III 5/10/73 +.sh NAME +nargs \*- argument count +.sh SYNOPSIS +.bd "nargs( )" +.sh DESCRIPTION +.it Nargs +returns the number of actual parameters +supplied by the caller of the routine which calls +\fInargs\fR. +.s3 +The argument count is accurate only when +none of the actual parameters is +.it float +or +\fIdouble\fR. +Such parameters count as four arguments instead of one. +.sh BUGS +As indicated. diff --git a/static/unix-v10/man3/nlist.3 b/static/unix-v10/man3/nlist.3 new file mode 100644 index 00000000..5c67d5ed --- /dev/null +++ b/static/unix-v10/man3/nlist.3 @@ -0,0 +1,62 @@ +.pa 1 +.he 'NLIST (III)'6/12/72'NLIST (III)' +.ti 0 +NAME nlist -- get entries from name list +.sp +.ti 0 +SYNOPSIS jsr r5,nlist; file; list +.br +.li +... +.br +.ti -6 +file: <file name\\0>; .even +.br +.ti -6 +list: +.br +<name1xxx>; type1; value1 +.br +<name2xxx>; type2; value2 +.br +.li +... +.br +0 +.sp +.ti 0 +DESCRIPTION nlist_____ +will examine the name list in +the given assembler output file +and selectively extract a +list of values. +The name list consists of +a list of 8-character names (null padded) +each followed by two words. +The list is terminated with a zero. +Each name is looked up in the name list of +the file. +If the name is found, the type and value of the +name are placed in the two words following +the name. +If the name is not found, the type entry is set to -1. +.sp +This subroutine is useful for +examining the system name list kept in +the file /sys/sys/unix. +In this way programs can obtain system 'magic' +numbers that are up to date. +.sp +.ti 0 +FILES kept in /lib/liba.a +.sp +.ti 0 +SEE ALSO a.out(V) +.sp +.ti 0 +DIAGNOSTICS All +type entries are set to -1 if the file cannot be found +or if it is not a valid namelist. +.sp +.ti 0 +BUGS -- diff --git a/static/unix-v10/man3/notary.3 b/static/unix-v10/man3/notary.3 new file mode 100644 index 00000000..c90e56ce --- /dev/null +++ b/static/unix-v10/man3/notary.3 @@ -0,0 +1,92 @@ +.TH NOTARY 3 +.CT 2 sa secur +.SH NAME +xs, enroll, verify, reverify, keynotary \(mi certification functions +.SH SYNOPSIS +.nf +.B "char *xs(char *key, char *buf, int n) +.B "enroll(char *name, char *oldkey, char *newkey) +.B "verify(char *name, char *xsum, char *buf, int n) +.B "rverify(char *name, char *xsum, char *buf, int n) +.B "keynotary(char *key1, char *key2) +.fi +.SH DESCRIPTION +.PP +All these functions except +.I xs +must be linked with option +.B -lipc +of +.IR ld (1). +.PP +.I Xs +composes a cryptographic checksum of the +.I n +characters starting at +.IR buf. +The +.I key +argument points to an 8-character checksumming key. +A pointer is returned to a null-terminated +.SM ASCII +checksum. +.PP +.I Enroll +registers a checksumming key for user +.I name +with +.IR notary (1), +only one checksumming key per user name at a time. +On first registry +the +.I oldkey +argument is ignored. +On subsequent registries, the +.I oldkey +argument must match the currently stored +checksumming key. +The new checksumming key is +.IR newkey ; +if +.I newkey +is trivial, +.I name +is deregistered. +.PP +.I Verify +consults the notary oracle +to check the validity of a checksum composed by +.IR xs. +A non zero return value signifies that the checksum was +calculated using the checksumming key registered with +the notary oracle as belonging to user +.IR name . +.I Rverify +does what +.I verify +does, but leaves the connection to the oracle open +until presented with a NULL +value for +.IR name . +Hence, subsequent calls to +.I rverify +should be quicker. +.PP +.I Keynotary +is used to tell the notary daemon the key for +its private encrypted data. +.I Key1 +is the key the data is currently encrypted with; +.I key2 +(if nonzero) +is the key to use in the future. +A file descriptor is returned, from which diagnostic information +may be read. +.SH "SEE ALSO" +.IR notary (1), +.IR ipc (3) +.SH DIAGNOSTICS +.I Verify +and +.I enroll +return zero on failure, otherwise nonzero. diff --git a/static/unix-v10/man3/openshares.3 b/static/unix-v10/man3/openshares.3 new file mode 100644 index 00000000..270c64e4 --- /dev/null +++ b/static/unix-v10/man3/openshares.3 @@ -0,0 +1,33 @@ +.TH OPENSHARES 3 SHARE +.SH NAME +openshares \- open shares file +.SH SYNOPSIS +.B "int openshares(lock)" +.br +.B "int lock;" +.SH DESCRIPTION +.I Openshares +attempts to open the shares file for writing, +otherwise, +if +.I lock +is 0, +it attempts to open it for reading. +If one of the opens succeeds, +it returns 1, +otherwise it returns 0. +.PP +If the shares file is already open, +this routine does nothing. +.SH FILES +.PD 0 +.TP "\w'/etc/sharesXXXX'u" +/etc/shares +Shares data-base. +.PD +.SH "SEE ALSO" +closeshares(3), +getshares(3), +getshput(3), +putshares(3), +sharesfile(3). diff --git a/static/unix-v10/man3/ostream.3 b/static/unix-v10/man3/ostream.3 new file mode 100644 index 00000000..29107c78 --- /dev/null +++ b/static/unix-v10/man3/ostream.3 @@ -0,0 +1,249 @@ +. \"ident "%W%" +. \"Copyright (c) 1984 AT&T +. \"All Rights Reserved +. \"THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +. \"The copyright notice above does not evidence any +. \"actual or intended publication of such source code. +.TH IOS.OUT 3I+ "C++ Stream Library" " " +.SH NAME +ostream \- formatted and unformatted output +.SH SYNOPSIS +.ft B +.ta1i 2i +.nf +#include <iostream.h> + +typedef long streamoff, streampos; +class ios { +public: + enum seek_dir { beg, cur, end }; + enum open_mode { in, out, ate, app } ; + // \fIand lots of other stuff ... \fP + } ; + +class ostream : ios { +public: + ostream& flush(); + int opfx(); + ostream& put(char c); + ostream& seekp(streampos pos); + ostream& seekp(streamoff off, seek_dir d); + streampos tellp(); + ostream& write(const char* ptr,int n); + ostream& write(const unsigned char* ptr, int n); + ostream& operator<<(const char*); + ostream& operator<<(char); + ostream& operator<<(short); + ostream& operator<<(int a); + ostream& operator<<(long); + ostream& operator<<(double); + ostream& operator<<(unsigned char); + ostream& operator<<(unsigned short); + ostream& operator<<(unsigned int); + ostream& operator<<(unsigned long); + ostream& operator<<(void*); + ostream& operator<<(const streambuf&); + ostream& operator<<(ostream& (*)(ostream&)); +}; + +class ostream_withassign { + ostream_withassign(); + istream& operator=(istream&); + istream& operator=(streambuf*); +}; + +extern ostream_withassign cout; +extern ostream_withassign cerr; +extern ostream_withassign clog; + + +ostream& endl(ostream& i) ; +ostream& ends(ostream& i) ; +ostream& flush(ostream& i) ; +.fi +.ft R +.SH DESCRIPTION +\f(CWistream\fRs support +insertion (storing) into an \f(CWstreambuf\fR. +These are commonly refered to as output operations. +.PP +Assume: +.br +\(em \fBouts\fR is an \f(CWostream\fR. +.br +\(em \fBoutswa\fR is an \f(CWostream_withassign\fR. +.br +\(em \fBoutsp\fR is an \f(CWostream*\fR. +.br +\(em \fBc\fR is a \f(CWchar\fR. +.br +\(em \fBptr\fR is a \f(CWchar*\fR or \f(CWunsigned char*\fR. +.br +\(em \fBsb\fR is a \f(CWstreambuf*\fR +.br +\(em \fBi\fR and \fBn\fR are \f(CWint\fR. +.br +\(em \fBpos\fR is a \f(CWstreampos\fR. +.br +\(em \fBoff\fR is a \f(CWstreamoff\fR. +.br +\(em \fBdir\fR is a \f(CWseek_dir\fR. +.br +\(em \fBmanip\fR is a function with type \f(CWostream& (*)(ostream&)\fR. +.PP +.PP +Constructors and assignment: +.TP +\fBostream(sb)\fR +Initializes \fBios\fR state variables and associates stream with +buffer \fBsb\fR. +\fBostream_withassign()\fR +Does no initialization. This allows a file static +variable of this type +(\fBcout\fR for example) to be used before it is constructed provided +it is assigned to first. +.TP +\fBoutswa=sb\fR +Associates \fBsb\fR with \fBswa\fR and initializes the entire +state of \fBoutswa\fR. +.TP +\fBinswa=ins\fR +Associates \fBins->rdbuf()\fR with \fBswa\fR and initializes the entire +state of \fBoutswa\fR. +The inserters: +.TP +\fBouts<<x\fR +First call \fBouts.opfx()\fR. If that returns 0 do nothing. +Otherwise insert a sequence of characters +representing \fBx\fR into \fBouts.rdbuf()\fR. +Errors are indicated by setting +the error state of \fBouts\fR. +\fBouts\fR is always returned. +.RS +.PP +\fBx\fR is converted into a sequence of characters +(its representation) according +to rules that depend on \fBx\fR's type and +\fBouts\fR's format state variables (see \fIios\fR(3C++)): +.TP +\f(CWchar*\fR +The representation is the sequence of characters up to +(but not including) +the terminating null of the string \fBx\fR points at. +.TP +\fIany integral type\fR +If \fBx\fR is positive +the representation contains a sequence of +decimal, octal, or hexadecimal digits with no leading zeros +according to whether +\fBouts.convbase()\fR is 10, 8, or 16 respectively. +If \fBx\fR is zero the representation is a single +zero character(\f(CW0\fR). +If \fBx\fR is negative, decimal conversion converts is to a minus +sign (\f(CW-\fR) followed by decimal digits. +The other conversions treat all values as unsigned. +A value of 0 for \fBouts.convbase()\fR +also causes decimal conversion. +The effect of other values of \fBouts.convbase()\fR is undefined. +If \fBouts.showbase()\fR +is non-zero the hex representation contains +\f(CW0x\fR before the hex digits. +If \fBouts.showbase()\fR is non-zero the octal representation contains +a leading 0. +.TP +\f(CWvoid*\fR +Pointers are cast to integral values and then converted +to hexadecimal numbers as if \fBouts.showbase()\fR were set. +.TP +\f(CWfloat\fR, \f(CWdouble\fR +The arguments are converted according to the current values +of \fBouts.precision()\fR, \fBouts.floatfmt()\fR, and \fBouts.width()\fR +using the printf formatting conventions for +\f(CW"%\fBfloatfmt\f(CW"\fR. +The default values for \fBouts.floatfmt()\fR and \fBouts.precision()\fR +are \f(CWg\fR and 6 respectively. +.PP +After the representation is determined, padding occurs. +If \fBouts.width()\fR +is greater than 0 +and the representation contains less than \fBouts.width()\fR +characters, then enough \fBouts.fill()\fR characters are added +to bring the total number of characters to \fBios.width()\fR. +If \fBios.ladjust()\fR is non-zero the sequence is left adjusted. +That is, characters are added after the characters determined above. +Otherwise the padding is added before the characters determined +above. \fBios.width()\fR is reset to 0, but all other format +state variables are unchanged. The resulting sequence (padding +plus representation) is inserted into \fBouts.rdbuf()\fR. +.RE +.TP +\fBouts<<sb\fR +If \fBouts.opfx()\fR returns non-zero +the sequence of characters that can be fetched from \fBsb\fR +are inserted into \fBouts.rdbuf\fR. Insertion stops when +no more characters can be fetcheded from \fBsb\fR. No padding +is performed. Always return \fBouts\fR. +.PP +Other members: +.TP +\fBi=outs.opfx()\fR +If \fBouts\fR's error state is nonzero returns immediately. +If \fBouts.tie()\fR is non-null flush it. +Returns non-zero except when \fBouts\fR'es error state is nonzero. +.TP +\fBoutsp=&outs.flush()\fR +storing characters into a streambuf does not always +cause them to be consumed (e.g., written to the external file) +immediately. +\fBflush\fR +causes any characters that may have been stored but not yet consumed +to be consumed by calling \fBouts.rdbuf()->sync\fR. +.TP +\fBouts<<manip\fR +Equivalent to \fBmanip(outs)\fR. +Syntactically this looks like an insertion +operation, but semantically it does an arbitrary operations +rather than converting \fBmanip\fR to a sequence of characters as +do the insertion operators. +.PP +Unformatted output functions: +.TP +\fBoutsp=&outs.put(c)\fR +Inserts \fBc\fR into \fBouts.rdbuf()\fR. Sets the error state if +the insertion fails. +.TP +\fBoutsp=&outs.write(s,n)\fR +Inserts the +\fBn\fR +characters starting at \fBs\fR into \fBouts.rdbuf()\fR. +These characters may include zeros (i.e., \fBs\fR need not be +a null terminated string). +.PP +Positioning functions: +.TP +\fBoutsp=&ins.seekp(off,dir)\fR +Repositions \fBouts.rdbuf()\fR's put pointer. +See \fIsbuf.pub\fR(3C++)\fR for a discussion of positioning. +.TP +\fBoutsp=&outs.seekp(pos)\fR +Repositions \fBouts.rdbuf()\fR's put pointer. +See \fIsbuf.pub\fR(3C++)\fR for a discussion of positioning. +.TP +\fBpos=outs.tellp()\fR +The current position of \fBouts.rdbuf()\fR's put pointer. +See \fIsbuf.pub\fR(3C++)\fR for a discussion of positioning. +.PP +Manipulators: +.TP +\fBouts<<endl\fR +Ends a line by inserting a newline character and flushing. +.TP +\fBouts<<ends\fR +Ends a string by inserting a null(0) character. +.TP +\fBouts<<flush\fR +Flushes \fBouts\fR +.SH SEE ALSO +ios(3C++) +sbuf.pub(3C++) +manip(3C++) diff --git a/static/unix-v10/man3/perror.3 b/static/unix-v10/man3/perror.3 new file mode 100644 index 00000000..f1b603d5 --- /dev/null +++ b/static/unix-v10/man3/perror.3 @@ -0,0 +1,46 @@ +.th PERROR III 11/5/73 +.sh NAME +perror \*- system error messages +.sh SYNOPSIS +.ft B +perror(s) +.br +char *s; +.s3 +int sys\*_nerr; +.br +char *sys\*_errlist[]; +.s3 +int errno; +.ft R +.br +.sh DESCRIPTION +.it Perror +produces a short error message +describing the last error encountered during a call +to the system from a C program. +First the argument string +.it s +is printed, then a colon, then the message and a new-line. +Most usefully, the argument string is the name +of the program which incurred the error. +The error number is taken from the external variable +.it errno, +which is set when errors occur but not cleared when +non-erroneous calls are made. +.s3 +To simplify variant formatting +of messages, the vector of message strings +.it sys\*_errlist +is provided; +.it errno +can be used as an index in this table to get the +message string without the newline. +.it Sys\*_nerr +is the largest message number provided for in the table; +it should be checked because new +error codes may be added to the system before +they are added to the table. +.sh "SEE ALSO" +Introduction to System Calls +.sh BUGS diff --git a/static/unix-v10/man3/pex.3 b/static/unix-v10/man3/pex.3 new file mode 100644 index 00000000..7ca3ce03 --- /dev/null +++ b/static/unix-v10/man3/pex.3 @@ -0,0 +1,63 @@ +.TH PEX 3 +.SH NAME +pex, unpex \- obtain process-exclusive file access +.SH SYNOPSIS +.B #include <sys/pex.h> +.PP +.B int pex(fd, seconds, pexbuf) +.br +.B struct pexclude *pexbuf; +.PP +.B int unpex(fd, seconds) +.SH DESCRIPTION +.I Pex +tries, using the +.CW FIOPX +ioctl call, to obtain exclusive access to the file designated by +file descriptor +.IR fd ; +see +.IR pex (4). +If +.I pexbuf +is nonzero, facts about the +other end of the pipe are placed in the object +.I pexbuf +points to, as described in +.IR pex (4). +.PP +If +.I fd +refers to a stream, +.I pex +first empties the input and output queues, +flushing if +.I seconds +is negative, and otherwise waiting up to the specified +time interval for the queues to drain. +If the queues do not drain, an error results. +.PP +.I Unpex +uses +.CW FIONPX +to try to reverse the effect of +.I pex, +again flushing or draining queues as specified by +.I seconds. +.PP +On a pipe, +.I pex +or +.I unpex +succeeds only if the process at the other end answers +with an FIOPX or FIONPX ioctl respectively. +.I Pex +and +.I unpex +should not be used to answer. +.SH SEE ALSO +.IR pex (4) +.SH DIAGNOSTICS +.I Pex +returns \-1 on failure, 0 on success, and 1 for a half-pexed +pipe. diff --git a/static/unix-v10/man3/picfile.3 b/static/unix-v10/man3/picfile.3 new file mode 100644 index 00000000..43061a17 --- /dev/null +++ b/static/unix-v10/man3/picfile.3 @@ -0,0 +1,253 @@ +.TH PICFILE 3X +.CT graphics files +.SH NAME +picopen_r, picopen_w, picread, picwrite, picclose, picputprop, picgetprop, picunpack, picpack, picerror \- picture file I/O +.SH SYNOPSIS +.nf +.B #include <picfile.h> +.PP +.B PICFILE *picopen_r(name) +.B char *name; +.PP +.B "PICFILE *picopen_w(name, type, x0, y0, w, h, chan, argv, cmap) +.B "char *name, *type, *chan, *argv[], *cmap; +.PP +.B int picread(pf, buf) +.B PICFILE *pf; +.B char *buf; +.PP +.B int picwrite(pf, buf) +.B PICFILE *pf; +.B char *buf; +.PP +.B void picclose(pf) +.B PICFILE *pf; +.PP +.B PICFILE *picputprop(pf, name, value) +.B PICFILE *pf; +.B char *name, *value; +.PP +.B char *picgetprop(pf, name) +.B PICFILE *pf; +.B char *name; +.PP +.B "void picunpack(pf, pix, fmt, arg ...) +.B PICFILE *pf; +.B char *pix, *fmt; +.PP +.B "void picpack(pf, pix, fmt, arg ...) +.B PICFILE *pf; +.B char *pix, *fmt; +.PP +.B "void picerror(string) +.B char *string; +.fi +.SH DESCRIPTION +These functions read and write raster images in +.IR picfile (5) +format. +They are loaded by option +.B -lpicfile +of +.IR ld (1). +Open picture files are referred to by pointers of type +.BR PICFILE* . +.PP +.I Picopen_r +opens the named picfile for reading and returns a pointer +to the open file. +If +.I name +is +.L +"IN"\fR, +standard input is used. +.PP +.I Picopen_w +similarly creates the named image file for writing. +The name +.L +"OUT" +refers to standard output. +.I Type +is a +.B TYPE +attribute, as described in +.IR picfile (5); +.I x0 +and +.I y0 +are the upper left coordinates of the +.BR WINDOW +attribute; +.I w +and +.I h +are the image width and heigth in pixels. +.I Chan +is a string specifying the order of channels for the +.B CHAN +attribute; the length of this string becomes the value of +.BR NCHAN . +.I Argv, +if nonzero, is +conventionally the second argument of the main program; +see +.IR exec (2). +It becomes a +.B COMMAND +attribute recording the provenance of the file. +.PP +The special call +.B picopen_w(name, PIC_SAMEARGS(pf)) +creates a file with the same attributes as an already open +picfile. +.B PIC_SAMEARGS +mentions +.I argv +by name, hence the name must be visible at the point of call. +.PP +.I Picread +and +.I picwrite +read or write a single row of pixels using the +character array +.I buf. +The length of the row is determined from the file's +.B WINDOW +and +.B NCHAN +attributes. +One-bit-per-pixel images (of type +.B bitmap +or +.BR ccitt-g4 , +for example) +are decoded to one byte per pixel, 0 for black, 255 for white, and +are encoded as 1 for pixel values less than 128 and 0 otherwise. +Files of type +.B ccir601 +are decoded into conventional +.B rgb +channels. +.PP +.I Picclose +closes a picfile and frees associated storage. +.PP +.I Picputprop +called after +.I picopen_w +but before +.I picwrite +adds header attributes, returning a (probably changed) value of the +.B PICFILE +pointer. +.PP +.I Picgetprop +returns a pointer to the value of the named attribute, or +0 if the picfile does not have the attribute. +In both +.I Picputprop +and +.I picgetprop, +with multiple appearances (e.g. +.BR COMMAND ) +are expressed as a sequence of +values separated by newlines. +.PP +The header file defines macros to extract commonly-used +attributes: +.IP +.EX +PIC_NCHAN(pf), PIC_WIDTH(pf), PIC_HEIGHT(pf), +PIC_SAMEARGS(pf) \fR(see \fP\&picopen_w\fR)\fP +.EE +.PP +.I Picunpack +extracts the channels of pixel array +.I pix +into separate array +.I args +of types described by the +.I fmt +character string. +Format characters are +.BR c , +.BR s , +.BR l , +.BR f , +.BR d , +for arrays of types unsigned char, short, long, +float, and double. +Format character +.B _ +designates a picfile channel to be skipped. +.I Picpack +reverses the process. +These routines effect a standard machine-independent byte +ordering. +.PP +.IR Picerror +prints messages for errors resulting from calls to +.I picfile +routines. +.RI ( Perror (3) +cannot describe some error conditions, +like malformed header lines.) +.SH EXAMPLES +Unpack the green and z channels from a file with channels +.B rgbz... +.br +.ns +.IP +.EX +PICFILE *pf = picopen_r("file"); +extern char pixels[], green[][1000]; +extern float zdepth[][1000]; +for(i=0; picread(pf, pixels); i) + picunpack(pf, pixels, "_c_f", green[i], zdepth[i]); +.EE +.PP +Reflect a picture about its vertical midline. +.br +.ns +.IP +.EX +PICFILE *in = picopen_r("picture"); +PICFILE *out = picopen_w("OUT", PIC_SAMEARGS(in)); +int w = PIC_WIDTH(in); +int n = PIC_NCHAN(in); +char *buffer = malloc(w*n), *temp = malloc(n); +while (picread(in, buffer)) { + char *left = buffer; + char *right = buffer + n*(w - 1); + for( ; left<right; left+=n, right-=n) { + strncpy(temp, left, n); + strncpy(left, right, n); + strncpy(right, temp, n); + } + picwrite(out, buffer); +} +.EE +.SH SEE ALSO +.IR picfile (5), +.IR pico (1), +.IR bcp (1) +.SH DIAGNOSTICS +.I Picread +returns 1 on success, 0 on end of file or error. +.br +.I Picopen_r +and +.I picopen_w +return 0 for unopenable files. +.SH BUGS +.I Picpack +and +.I picunpack +store and retrieve floating point channels (types +.B f +and +.BR d ) +using native floating-point, rather than something +machine independent like IEEE format. diff --git a/static/unix-v10/man3/pipebuf.3 b/static/unix-v10/man3/pipebuf.3 new file mode 100644 index 00000000..fb7d6543 --- /dev/null +++ b/static/unix-v10/man3/pipebuf.3 @@ -0,0 +1,73 @@ +. \"ident "%W%" +. \"Copyright (c) 1984 AT&T +. \"All Rights Reserved +. \"THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +. \"The copyright notice above does not evidence any +. \"actual or intended publication of such source code. +.TH PIPEBUF 3I+ "C++ Stream Library" " " +.SH NAME +pipebuf \- streambuf specialized as circular queue +.SH SYNOPSIS +.nf +.ft B +.ta1i 2i +#include <iostream.h> +#include <pipestream.h> + +class pipebuf : streambuf { + pipebuf(); + int empty(); + int full(); + streambuf* setbuf(char* ptr, int len); +} ; +.ft R +.fi +.SH DESCRIPTION +A \f(CWpipebuf\fR +uses its reserve area to support a circular +queue of characters. +In terms of the abstract notion of buffer a \f(CWpipebuf\fR +is a potentially infinite sequence in which the put pointer +and get pointer move independently. +The put pointer is always at the end of the sequence, and +puts extend the sequence. +As long as the get pointer remains behind the put pointer, but +not too far behind, fetching and storing can continue indefinitely. +Seeks are not supported. +.PP +Assume +.br +\(em \fBpb\fR is a \f(CWpipebuf\fR. +.br +\(em \fBptr\fR is a \f(CWchar*\fR. +.br +\(em \fBi\fR and \fBlen\fR are an \f(CWint\fR. +.br +\(em \fBsb\fR is \f(CWstreambuf*\fR. +.PP +Constructor: +.TP +\fBpipebuf()\fR +Constructs an empty buffer. +.PP +Members: +.TP +\fBi=pb.empty()\fR +Returns non-zero if the get pointer is at the end of the sequence, +and attempts to get characters will therefore fail. +.TP +\fBi=pb.full()\fR +Returns non-zero if there is no more room for putting +characters. In the current implementation, the capacity of +the buffer is one less than the size of the reserve area. +.TP +\fBsb=pb.setbuf(ptr,len)\fR +Establishes the \fBlen\fR bytes starting at \fBptr\fR +as the reserve area. Normally it will return \fB&pb\fR. But +it will return a null pointer if it fails. Failure occurs +if \fBpb.empty()\fR is zero, or if \fBlen\fR is less than 2. +.SH CAVEATS +There ought to be a version with an unbounded capacity. +.SH SEE ALSO +streambuf(3C++) +pipestream(3C++) diff --git a/static/unix-v10/man3/pipestream.3 b/static/unix-v10/man3/pipestream.3 new file mode 100644 index 00000000..ef696712 --- /dev/null +++ b/static/unix-v10/man3/pipestream.3 @@ -0,0 +1,59 @@ +. \"ident "%W%" +. \"Copyright (c) 1984 AT&T +. \"All Rights Reserved +. \"THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +. \"The copyright notice above does not evidence any +. \"actual or intended publication of such source code. +.TH PIPESTREAM 3I+ "C++ Stream Library" " " +.SH NAME +pipestream \- iostream specialized as circular buffer +.SH SYNOPSIS +.ft B +.ta1i 2i +.nf +#include <iostream.h> +#include <pipestream.h> + +class pipestream : public iostream { +public: + pipestream(); + pipestream(char* ptr, int len); + pipebuf* rdbuf(); + } ; +.fi +.ft R +.SH DESCRIPTION +\f(CWpipestream\fR +specializes +\f(CWiostream\fR +to use a circular buffer (\f(CWpipebuf\fR). +.PP +Assume +.br +\(em \fBps\fR is a \f(CWpipestream\fR. +.br +\(em \fBptr\fR is a \f(CWchar*\fR. +.br +\(em \fBlen\fR is an \f(CWint\fR. +.br +\(em \fBpb\fR is a \f(CWpipebuf*\fR. +.PP +Constructors: +.TP +\fBpipestream()\fR +Constructs a \f(CWpipestream\fP with an empty \f(CWpipebuf\fR. +.TP +\fBpipestream(ptr,len)\fR +Constructs a \f(CWpipestream\fP with a \f(CWpipebuf\fR +that uses the \fBlen\fR bytes +at \fBptr\fR as a reserve area. +.PP +Members: +.TP +\fBpb=ps.rdbuf()\fR +Returns the associated \fBpipebuf\fR. \fBpipebuf::rdbuf\fR has +the same semantics as \fBstreambuf::rdbuf\fR, but the type of +the result is more precise. +.SH SEE ALSO +pipebuf(3C++) +ios(3C++) diff --git a/static/unix-v10/man3/plot.3 b/static/unix-v10/man3/plot.3 new file mode 100644 index 00000000..56d7b291 --- /dev/null +++ b/static/unix-v10/man3/plot.3 @@ -0,0 +1,161 @@ +.TH PLOT 3 +.CT 2 comm_term +.SH NAME +vec, move, etc. \(mi plot graphics interface +.SH SYNOPSIS +.nf +.2C +.B #include <plot.h> +.PP +.B openpl(s) +.B char *s; +.PP +.B closepl() +.PP +.B erase() +.PP +.B move(x, y) +.B double x, y; +.PP +.B rmove(dx, dy) +.B double dx, dy; +.PP +.B point(x, y) +.B double dx, dy; +.PP +.B vec(x, y) +.B double x, y; +.PP +.B rvec(dx, dy) +.B double dx, dy; +.PP +.B line(x1, y1, x2, y2) +.B double x1, y1, x2, y2; +.PP +.B "arc(x1, y1, x2, y2, x, y, r)" +.B "double x1, y1, x2, y2, x, y, r;" +.PP +.B circle(xc, yc, r) +.B double xc, yc, r; +.PP +.B box(x1, y1, x2, y2) +.B double x1, y1, x2, y2; +.PP +.B sbox(x1, y1, x2, y2) +.B double x1, y1, x2, y2; +.PP +.B "parabola(x1, y1, x2, y2, x3, y3)" +.B "double x1, y1, x2, y2, x3, y3;" +.PP +.B fill(n, arr) int n[]; +.B double *arr[]; +.PP +.B poly(n, arr) int n[]; +.B double *arr[]; +.PP +.B spline(n, arr) +.B int n[]; +.B double *arr[]; +.PP +.B cspline(n, arr) +.B int n[]; +.B double *arr[]; +.PP +.B fspline(n, arr) +.B int n[]; +.B double *arr[]; +.PP +.B lspline(n, arr) +.B int n[]; +.B double *arr[]; +.PP +.B dspline(n, arr) +.B int n[]; +.B double *arr[]; +.PP +.B text(s) +.B char *s; +.PP +.B color(s) +.B char *s; +.PP +.B cfill(s) +.B char *s; +.PP +.B pen(s) +.B char *s; +.PP +.B range(x1, y1, x2, y2) +.B double x1, y1, x2, y2; +.PP +.B frame(x1, y1, x2, y2) +.B double x1, y1, x2, y2; +.PP +.B grade(x) +.B double x; +.PP +.B save() +.PP +.B restore() +.PP +.B ppause() +.1C +.ft P +.SH DESCRIPTION +These functions generate either a device-independent +graphic stream (see +.IR plot (5)) +or device-dependent graphics commands. +The include file +.B <plot.h> +is used only for device-independent output. +An alternative include file, +.BR <iplot.h> , +supports device-independent output using identically named +functions of integer, instead of double, arguments. +.PP +Libraries for different devices are loaded with the following +.IR ld (1) +flags: +.TF -lblit +.TP +.B -lplot +general stream output +.TP +.B -l2621 +HP2621 terminal +.TP +.B -l4014 +Tektronix 4014 terminal +.TP +.B -ltr +Troff input, tuned for the Mergenthaler Linotron 202 phototypesetter +.TP +.B -lpen +HP7580 pen plotter +.TP +.B -l5620 +5620 terminal running +.I mux +.PD +.PP +String arguments are null-terminated and may not contain +embedded newlines. +For details on string arguments, see +.IR plot (5). +.I Poly, fill, +and the various spline functions +take an integer array and an array of pointers +to double floating point arrays. +The integers specify the number of vertices +.RI ( x-y +pairs) +in the floating point array. +The last integer entry should be 0. +.SH "SEE ALSO" +.IR plot (1), +.IR plot (5) +.SH BUGS +The +.B -ltr +library should be tuned for PostScript. diff --git a/static/unix-v10/man3/poly.3 b/static/unix-v10/man3/poly.3 new file mode 100644 index 00000000..f4ff7376 --- /dev/null +++ b/static/unix-v10/man3/poly.3 @@ -0,0 +1,50 @@ +.TH POLY 3 +.CT 2 graphics math +.SH NAME +poly_lk, poly_read \(mi polyhedron database routines +.SH SYNOPSIS +.nf +.B #include <poly.h> +.PP +.B int poly_lk(name) +.B char *name; +.PP +.B int poly_read(p, dir, n) +.B Polyhedron *p; +.B char *dir; +.fi +.SH DESCRIPTION +These routines access the +.IR poly (7) +database of polyhedra. +.PP +.I Poly_lk +tries to interpret +.I name +as a polyhedron reference. +If it is a number, it returns that number. +Otherwise, it returns the number of the first polyhedron +for which +.I name +is a prefix of the polyhedron's name. +.PP +.I Poly_read +forms an in-core description of the polyhedron number +.I n +in the directory +.IR dir . +If +.I dir +is 0, the normal directory +.RB ( /usr/lib/polyhedra ) +is used. +.SH "SEE ALSO" +.IR poly (5), +.IR poly (7) +.SH DIAGNOSTICS +.I Poly +returns \-1 on unknown names. +.PP +.I Poly_read +returns zero on success, +nonzero on error. diff --git a/static/unix-v10/man3/pool.3 b/static/unix-v10/man3/pool.3 new file mode 100644 index 00000000..10224c10 --- /dev/null +++ b/static/unix-v10/man3/pool.3 @@ -0,0 +1,85 @@ +.TH POOL 3+ +.CT 2 datatype +.SH NAME +pool \- fast memory allocation +.SH SYNOPSIS +.nf +.B #include <Pool.h> +.PP +.ft L +struct Pool { + Pool(unsigned); + ~Pool(); + void* alloc(); + void free(void*) +}; +.fi +.SH DESCRIPTION +.PP +Every +.L Pool +is a collection of +.IR elements , +each of which is an array of bytes. +All elements of a pool +are the same size. +Pool functions are +.nr xx \w'\fIp\fL.free(\fIep\fL)\ ' +.TP \n(xxu +.BI Pool( n ) +Construct a pool whose elements are of size +.I n. +.TP +.IB p .alloc() +Allocate a new element in pool +.LR p . +Return a pointer to the element. +.TP +.IB p .free( ep ) +Free the element of +.I p +pointed to by +.I ep. +The element must +have been allocated from +.I p. +.PP +Destroying a pool +frees all the memory occupied by its elements. +.PP +The memory in a pool element is aligned on +the same boundary as memory returned by +.IR malloc (3) +so that it may be used to contain an +object of any type. +In typical use, there would be one pool per class, with +the pool known only to the +.B new +and +.B delete +operators of that class. +.SS Performance +Pool memory is allocated in chunks that are typically +about 1,000 bytes each. +Once a chunk is allocated to a particular pool, +that chunk is only released when the pool itself +is destroyed. +.PP +Elements are allocated inline except when +a new chunk must be added to the pool. +Elements are always freed inline. +.SH EXAMPLES +.B #include <Pool.h> +.PP +.EX +struct Mytype { + static Pool mypool; + // constructors and members + void* operator new(unsigned) { return mypool.alloc(); } + void operator delete(void* p) { mypool.free(p); } +}; +.EE +.PP +.B Pool Mytype::mypool(sizeof(Mytype)); +.SH SEE ALSO +.IR malloc (3) diff --git a/static/unix-v10/man3/popen.3 b/static/unix-v10/man3/popen.3 new file mode 100644 index 00000000..5d3e0d24 --- /dev/null +++ b/static/unix-v10/man3/popen.3 @@ -0,0 +1,108 @@ +.TH POPEN 3S +.CT 2 comm_proc +.SH NAME +popen, ppopen, vepopen, pclose \(mi open a pipe to/from a process +.SH SYNOPSIS +.nf +.B #include <stdio.h> +.PP +.B FILE *popen(command, type) +.B char *command, *type; +.PP +.B FILE *ppopen(command, type) +.B char *command, *type; +.PP +.B FILE *vepopen(command, type, args, env) +.B char *command, *type, **args, **env; +.PP +.B int pclose(stream) +.B FILE *stream; +.fi +.SH DESCRIPTION +The first argument to +.I popen +is a pointer to a null-terminated string +containing a command line for +.IR sh (1). +.I Type +is as in +.IR fopen (3). +.I Popen +creates a pipe between +the calling process and +the command and returns +a stream pointer that +can be used to write to the standard input +of the command or to read from the standard output. +.PP +.I Ppopen +uses the +.B -p +shell flag to restrict the environment of the shell. +Both +.I popen +and +.I ppopen +set the effective userid to the real userid +before calling the shell. +.PP +.I Vepopen +has arguments akin to those of +.I execve +(see +.IR exec (2)): +a file to be executed, +a mode as above, +a null-terminated vector of argument strings, +and a null-terminated vector of environment strings. +The shell is not called, and the effective userid is preserved. +.PP +A stream opened by these routines +should be closed by +.I pclose, +which waits for the associated process to terminate +and returns the exit status of the command. +.PP +Because the +.I command +inherits open files, in particular standard input and output, a type +.L +"r" +call may be used to insert a filter in the input, and type +.L +"w" +in the output. +.SH "SEE ALSO" +.IR exec (2), +.IR pipe (2), +.IR fopen (3), +.IR stdio (3), +.IR system (3) +.SH DIAGNOSTICS +.I Popen +returns a null pointer +if files or processes cannot be created, or the Shell +cannot be accessed. +.PP +.I Pclose +returns \-1 +if there is +no process to wait for. +.SH BUGS +Buffered reading before opening an input filter +may leave the standard input of that filter mispositioned. +Similar problems with an output filter may be +forestalled by calling +.IR fflush ; +see +.IR fopen (3). +.br +The resetting of the userid +is probably gratuitous; +it is there as a defense against incautious use +of the routine by set-uid programs. +.br +I/O type +.L +"r+w" +exists but is not useful. diff --git a/static/unix-v10/man3/port.3 b/static/unix-v10/man3/port.3 new file mode 100644 index 00000000..57ac02cd --- /dev/null +++ b/static/unix-v10/man3/port.3 @@ -0,0 +1,31 @@ +.TH PORT 3X +.CT 2 math +.SH NAME +port \(mi mathematical library for Fortran +.SH DESCRIPTION +The Port library of hundreds of scientific subroutines +covers approximation, +ordinary differential equations, partial differential equations, +linear algebra, optimization and mathematical programming, +quadrature, differentiation, roots, special functions, and +transforms. +It is built upon a framework of service routines for +error handling, stack management, and machine constant parameterization. +.PP +The routines are loaded +by the +.IR ld (1) +option +.LR -lport . +.PP +The manual describes the software and gives examples. +.SH SEE ALSO +P. A. Fox, +.I The PORT Mathematical Subroutine Library, +AT&T Bell Laboratories, +May 8, 1984. +.br +P. A. Fox, +.I "The PORT Mathematical Subroutine Library Installation Manual," +AT&T Bell Laboratories, +September, 1984. diff --git a/static/unix-v10/man3/pow.3 b/static/unix-v10/man3/pow.3 new file mode 100644 index 00000000..528ddecf --- /dev/null +++ b/static/unix-v10/man3/pow.3 @@ -0,0 +1,36 @@ +.pa 1 +.he 'POW (III)'1/15/73'POW (III)' +.ti 0 +NAME pow -- floating exponentiation x^y +.sp +.ti 0 +SYNOPSIS movf x,fr0 +.br +movf y,fr1 +.br +jsr pc,pow +.br +movf fr0,... +.sp +.ti 0 +DESCRIPTION The +value of x^y (i.e. x\uy\d) is returned in fr0. + +0^x returns zero for all x. + +(-x)^y returns a result only if y is an integer. + +.ti 0 +FILES kept in /lib/liba.a +.sp +.ti 0 +SEE ALSO exp(III), log(III) +.sp +.ti 0 +DIAGNOSTICS The +carry bit is set on return in case of overflow or in case of +0^0 or +(-x)^y for y non-integer. +.sp +.ti 0 +BUGS -- diff --git a/static/unix-v10/man3/print.3 b/static/unix-v10/man3/print.3 new file mode 100644 index 00000000..b553e4f9 --- /dev/null +++ b/static/unix-v10/man3/print.3 @@ -0,0 +1,274 @@ +.TH PRINT 3 +.CT 2 file_io +.SH NAME +print, fprint, sprint, fmtinstall \(mi print formatted output +.SH SYNOPSIS +.nf +.BR "int print(format \fR[\fP , arg \fR]\fP ... )" +.B char \(**format; +.PP +.BR "int fprint(fildes, format \fR[\fP , arg \fR]\fP ... )" +.B int fildes; +.B char \(**format; +.PP +.BR "int sprint(s, format \fR[\fP , arg \fR]\fP ... )" +.B char \(**s, \(**format; +.PP +.B fmtinstall(c, fn) +.B char c; +.B int (*fn)(); +.PP +.B strconv(s, f1, f2) +.B char *s; +.PP +.B extern int printcol; +.fi +.SH DESCRIPTION +.I Print +places output on the standard output. +.I Fprint +places output on the named output +file descriptor; +a buffered form +is described in +.IR fio (3). +.I Sprint +places output +followed by the null character +.RB ( \e0 ) +in consecutive bytes starting at +.IR s ; +it is the user's responsibility to ensure that +enough storage is available. +Each function returns the number of characters +transmitted (not including the +.B \e0 +in the case of +.IR sprint ), +or +a negative value if an output error was encountered. +.PP +Each of these functions +converts, formats, and prints its +trailing arguments +under control of a +.IR format +string. +The +.I format +contains two types of objects: +plain characters, which are simply copied to the +output stream, +and conversion specifications, +each of which results in fetching of +zero or more +arguments. +The results are undefined if there are arguments of the +wrong type or too few +arguments for the format. +If the format is exhausted while +arguments remain, the excess +are ignored. +.PP +Each conversion specification has the following format +.PP +.B "% [flags] [[\(mi] digits [. digits]] verb +.PP +The +.I flags +modify the meaning of +the conversion verb. +The first (possibly negative) number is called +.IR f1 , +the second number is +.IR f2 . +The flags and numbers are arguments to +the +.I verb +described below. +.PP +The numeric verbs +.BR d , +.BR o , +and +.B x +format their arguments in decimal, +octal and hex respectively. +Each interprets the flags +.BR h , +.BR l , +.BR u , +to mean short, +long, +and unsigned. +If neither +short nor long is specified, +then the arg is an +.BR int . +If unsigned is specified, +then the arg is interpreted as a +positive number and no sign is output. +.I F1 +is the minimum field width and, +if negative, +means left justified rather than right justified; +in both cases, padding is done with blanks. +The converted number is padded with +.B 0 +on the left to at least +.I f2 +characters. +.PP +The floating point verbs +.BR f , +.BR e , +and +.B g +take a double argument. +No flags apply to floating point conversions. +.I F1 +is the minimum field width and, +if negative, +means left justified. +.I F2 +is the number of digits that are converted after the decimal place. +The first unconverted digit has suffered decimal rounding. +The +.B f +verb produces output of the form +.RB [ - ] digits [ .digits\fR]. +.B e +conversion appends an exponent +.BR e [ - ] digits . +The +.B g +verb will output the arg in either +.B e +or +.B f +with the goal of producing the smallest output. +.PP +The +.B s +verb copies a string +(pointer to character) +to the output. +The number of characters copied +.RI ( n ) +is the minimum +of the size of the string and +.IR f2 . +These +.I n +characters are justified within a field of +.I f1 +characters as described above. +.PP +The +.B c +verb copies a single character (int) +justified within a field of +.I f1 +characters as described above. +.PP +.I Fmtinstall +is used to install your own conversions and flags. +.I Fn +should be declared as +.EX + int fn(o, f1, f2, f3) + void *o; + int f1, f2, f3; +.EE +.I Fn +is passed a pointer +.I o +to whatever argument appears in +the list to +.IR print . +.I Fn +should return the size of the argument in bytes so +.I print +can skip over it. +.I F1 +and +.I f2 +are the decoded numbers in the conversion. +A missing +.I f1 +is denoted by the value zero. +A missing +.I f2 +is denoted by a negative number. +.I F3 +is the logical or of all the +flags seen in the conversion. +If +.I c +is a flag, +.I fn +should return a negative number +that is negated and then logically +.IR or ed +with any other flags +and ultimately +passed to a conversion routine. +All interpretation of +.IR f1 , +.IR f2 , +and +.I f3 +is left up to the conversion routine. +The standard flags are +.LR h (2), +.LR l (1), +and +.LR u (4). +.PP +.I Sprint +is designed to be recursive in order to +help prepare output in custom conversion routines. +.PP +The output of any conversion routine must be passed through +.IR strconv . +.I S +is the character string, +.I f1 +and +.I f2 +have the same meaning as above. +.PP +.I Printcol +indicates the position of the next output character. +Tabs, backspaces and carriage returns are interpreted appropriately. +.SH EXAMPLES +This adds a verb to print complex numbers. +.EX +typedef struct { + double r, i; +} complex; +complex x = { 1.5, -2.3 }; +int Xconv(); + +main() +{ + + fmtinstall('X', Xconv); + print("x = %X\en", x); +} + +Xconv(o, f1, f2, f3) + complex *o; +{ + char str[50]; + + sprint(str, "(%g,%g)", o->r, o->i); + strconv(str, f1, f2); + return(sizeof(complex)); +} +.EE +.SH SEE ALSO +.IR fio (3), +.IR printf (3) +.SH BUGS +There are internal buffers which may overflow silently. diff --git a/static/unix-v10/man3/printf.3 b/static/unix-v10/man3/printf.3 new file mode 100644 index 00000000..3fea3b05 --- /dev/null +++ b/static/unix-v10/man3/printf.3 @@ -0,0 +1,137 @@ +.th PRINTF III 9/17/73 +.sh NAME +printf \*- formatted print +.sh SYNOPSIS +.ft B +printf(format, arg\s6\d1\u\s10, ...); +.br +char *format; +.ft R +.sh DESCRIPTION +.it Printf +converts, formats, and prints its arguments after the first +under control of the first argument. +The first argument is a character string +which contains +two types of objects: +plain characters, which are simply copied to the +output stream, +and conversion specifications, +each of which causes conversion and printing +of the next successive argument to +.it printf. +.s3 +Each conversion specification is introduced by +the character \fB%\fR. +Following the \fB%\fR, there may be +.s3 +.lp +6 2 +\*- an optional minus sign `\*-' which specifies +.it "left adjustment" +of the converted argument +in the +indicated field; +.s3 +.lp +6 2 +\*- an optional digit string specifying a +.it "field width;" +if the converted argument has fewer characters +than the field width +it will be blank-padded on the left (or right, +if the left-adjustment indicator has been +given) to make up the field width; +.s3 +.lp +6 2 +\*- an optional period ``\fB.\fR'' which serves to +separate the field width from the +next digit string; +.s3 +.lp +6 2 +\*- an optional digit string +.it "(precision)" +which specifies +the number of digits to appear after the +decimal point, for e- and f-conversion, +or the maximum number of characters +to be printed from a string; +.s3 +.lp +6 2 +\*- a character which indicates the type of +conversion to be applied. +.s3 +.i0 +The conversion characters +and their meanings are +.s3 +.lp +6 3 +d The argument is converted to decimal notation. +.s3 +.lp +6 3 +o The argument is converted to octal notation. +``0'' will always appear as the first digit. +.s3 +.lp +6 3 +f The argument is converted to decimal notation +in the style ``[\fB\*-\fR]ddd.ddd'' +where the number of d's after the decimal point +is equal to the precision specification +for the argument. +If the precision +is missing, +6 digits are given; +if the precision is explicitly 0, no digits and +no decimal point are printed. +The argument should be +.it float +or +.it double. +.s3 +.lp +6 3 +e The argument is converted in the style +``[\fB\*-\fR]d\fB.\fRddd\fBe\fR\(+-dd'' +where there is one digit before the decimal point and +the number after is equal to the +precision specification for the argument; +when the precision is missing, +6 digits are produced. +The argument should be a +.it float +or +.it double +quantity. +.s3 +.lp +6 3 +c The argument character or character-pair is printed if non-null. +.s3 +.lp +6 3 +s The argument is taken to be a string (character pointer) +and characters from the string are printed until +a null character or until +the number of characters indicated by the precision +specification is reached; +however if the precision is 0 or missing +all characters up to a null are printed. +.s3 +.lp +6 3 +l The argument is taken to be an unsigned +integer which is converted to decimal +and printed (the result will be in the +range 0 to 65535). +.s3 +.i0 +If no recognizable character appears after the \fB%\fR, +that character is printed; +thus \fb%\fR may be printed by use of the +string \fB%%\fR. +In no case does a non-existent or small field width +cause truncation of a field; +padding takes place only if the specified field +width exceeds the actual width. +Characters generated by +.it printf +are printed by calling +.it putchar. +.sh "SEE ALSO" +putchar (III) +.sh BUGS +Very wide fields (>128 characters) fail. diff --git a/static/unix-v10/man3/proj.3 b/static/unix-v10/man3/proj.3 new file mode 100644 index 00000000..95a86ac7 --- /dev/null +++ b/static/unix-v10/man3/proj.3 @@ -0,0 +1,370 @@ +.TH PROJ 3X bowell +.CT 2 graphics math +.br +.SH NAME +orient, normalize \- map projections +.SH SYNOPSIS +.B orient(lat, lon, rot) +.br +.B float lat, lon, rot; +.PP +.B normalize(p) +.br +.B struct place *p; +.SH DESCRIPTION +Users of +.IR map (7) +may skip to the description of `Projection generators' +below. +.PP +The functions +.I orient +and +.I normalize +plus a collection of map projection generators +are loaded by +option +.BR -lmap +of +.IR ld (1). +Most of them +calculate maps for a spherical earth. +Each map projection is available in one standard +form, into which data must be normalized +for transverse +or nonpolar projections. +.PP +Each standard projection is displayed with the Prime +Meridian (longitude 0) being a straight vertical line, along which North +is up. +The orientation of nonstandard projections is specified by +.I orient. +Imagine a transparent gridded sphere around the globe. +First turn the overlay about the North Pole +so that the Prime Meridian (longitude 0) +of the overlay coincides with meridian +.I lon +on the globe. +Then tilt the North Pole of the +overlay along its Prime Meridian to latitude +.I lat +on the globe. +Finally again turn the +overlay about its `North Pole' so +that its Prime Meridian coincides with the previous position +of (the overlay's) meridian +.I rot. +Project the desired map in +the standard form appropriate to the overlay, but presenting +information from the underlying globe. +It is not useful to use +.I orient +without using +.IR normalize . +.PP +.I Normalize +converts latitude-longitude coordinates on the globe +to coordinates on the overlaid grid. +The coordinates and their sines and cosines +are input to +.I normalize +in a +.B place +structure. +Transformed coordinates and their sines and cosines +are returned in the same structure. +.PP +.EX +.nr xx \w'12345678' +.ta \n(xxu +\n(xxu +\n(xxu +\n(xxu +\n(xxu +\n(xxu + struct place { + float radianlat, sinlat, coslat; + float radianlon, sinlon, coslon; + }; +.EE +.PP +The projection generators +return a pointer to a function that converts normalized coordinates +to +.I x-y +coordinates for the desired map, or +0 if the required projection +is not available. +The returned function is exemplified by +.I proj +in this example: +.PP +.EX +.ta \n(xxu +\n(xxu +\n(xxu +\n(xxu +\n(xxu +\n(xxu + struct place pt; + int (*proj)() = mercator(); + float x, y; +.EE +.PP +.EX + orient(45.0, 30.0, 180.0); /* set coordinate rotation */ +.EE +.PP +.EX + . . . /* fill in the pt structure */ + normalize(&pt); /* rotate coordinates */ + if((*proj)(&pt, &x, &y) > 0) /* project onto x,y plane */ + plot(x, y); +.EE +.PP +The projection function +.B (*proj)() +returns 1 for a good point, +0 for a point on a wrong +sheet (e.g. the back of the world in a perspective +projection), and \-1 for a point that is deemed +unplottable (e.g. points near the poles on a Mercator projection). +.PP +Scaling may be determined from the +.I x-y +coordinates of +selected points. +Latitudes and longitudes are measured in degrees for +ease of specification for +.I orient +and the projection generators +but in radians for ease of calculation +for +.I normalize +and +.I proj. +In either case +latitude is measured positive north of the equator, +and longitude positive west of Greenwich. +Radian longitude should be limited to the range +.if t .I \-\(*p\(<=lon<\(*p. +.if n .I -pi <= lon < pi. +.SS Projection generators +Equatorial projections centered on the Prime Meridian +(longitude 0). +Parallels are straight horizontal lines. +.br +.ns +.IP +.B mercator() +equally spaced straight meridians, conformal, +straight compass courses +.br +.B sinusoidal() +equally spaced parallels, +equal-area, same as +.I bonne(0) +.br +.B cylequalarea(lat0) +equally spaced straight meridians, equal-area, +true scale on +.I lat0 +.br +.B cylindrical() +central projection on tangent cylinder +.br +.B rectangular(lat0) +equally spaced parallels, equally spaced straight meridians, true scale on +.I lat0 +.br +.B gall(lat0) +parallels spaced stereographically on prime meridian, equally spaced straight +meridians, true scale on +.I lat0 +.br +.B mollweide() +(homalographic) equal-area, hemisphere is a circle +.PP +Azimuthal projections centered on the North Pole. +Parallels are concentric circles. +Meridians are equally spaced radial lines. +.br +.ns +.IP +.B azequidistant() +equally spaced parallels, +true distances from pole +.br +.B azequalarea() +equal-area +.br +.B gnomonic() +central projection on tangent plane, +straight great circles +.br +.B perspective(dist) +viewed along earth's axis +.I dist +earth radii from center of earth +.br +.B orthographic() +viewed from infinity +.br +.B stereographic() +conformal, projected from opposite pole +.br +.B laue() +.IR radius " = tan(2\(mu" colatitude ), +used in xray crystallography +.br +.B fisheye(r) +.IR radius " = log(" colatitude / r ): +.I New Yorker +map from viewing pedestal of radius +.I r +degrees +.PP +Polar conic projections symmetric about the Prime Meridian. +Parallels are segments of concentric circles. +Except in the Bonne projection, +meridians are equally spaced radial +lines orthogonal to the parallels. +.br +.ns +.IP +.B conic(lat0) +central projection on cone tangent at +.I lat0 +.br +.B simpleconic(lat0,lat1) +equally spaced parallels, true scale on +.I lat0 +and +.I lat1 +.br +.B lambert(lat0,lat1) +conformal, true scale on +.I lat0 +and +.I lat1 +.br +.B albers(lat0,lat1) +equal-area, true scale on +.I lat0 +and +.I lat1 +.br +.B bonne(lat0) +equally spaced parallels, equal-area, +parallel +.I lat0 +developed from tangent cone +.PP +Projections with bilateral symmetry about +the Prime Meridian +and the equator. +.br +.ns +.IP +.B polyconic() +parallels developed from tangent cones, +equally spaced along Prime Meridian +.br +.B aitoff() +equal-area projection of globe onto 2-to-1 +ellipse, based on +.I azequalarea +.br +.B lagrange() +conformal, maps whole sphere into a circle +.br +.B bicentric(lon0) +points plotted at true azimuth from two +centers on the equator at longitudes +.I \(+-lon0, +great circles are straight lines +(a stretched gnomonic projection) +.br +.B elliptic(lon0) +points are plotted at true distance from +two centers on the equator at longitudes +.I \(+-lon0 +.br +.B globular() +hemisphere is circle, +circular arc meridians equally spaced on equator, +circular arc parallels equally spaced on 0- and 90-degree meridians +.br +.B vandergrinten() +sphere is circle, +meridians as in +.I globular, +circular arc parallels resemble +.I mercator +.PP +Doubly periodic conformal projections. +.br +.ns +.IP +.B guyou() +W and E hemispheres are square +.br +.B square() +world is square with Poles +at diagonally opposite corners +.br +.B tetra() +map on tetrahedron with edge +tangent to Prime Meridian at S Pole, +unfolded into equilateral triangle +.br +.B hex() +world is hexagon centered +on N Pole, N and S hemispheres are equilateral +triangles +.PP +Miscellaneous projections. +.br +.ns +.IP +.B harrison(dist,angle) +oblique perspective from above the North Pole, +.I dist +earth radii from center of earth, looking +along the Date Line +.I angle +degrees off vertical +.br +.B trapezoidal(lat0,lat1) +equally spaced parallels, +straight meridians equally spaced along parallels, +true scale at +.I lat0 +and +.I lat1 +on Prime Meridian +.PP +Retroazimuthal projections. +At every point the angle between vertical and a straight line to +`Mecca', latitude +.I lat0 +on the prime meridian, +is the true bearing of Mecca. +.br +.ns +.IP +.B mecca(lat0) +equally spaced vertical meridians +.br +.B homing(lat0) +distances to `Mecca' are true +.PP +Maps based on the spheroid. +Of geodetic quality, these projections do not make sense +for tilted orientations. +For descriptions, see corresponding maps above. +.br +.ns +.IP +.B sp_mercator() +.br +.B sp_albers(lat0,lat1) +.SH "SEE ALSO +.IR map (7), +.IR map (5), +.IR plot (3) +.SH BUGS +Only one projection and one orientation can be active at a time. +.br +The west-longitude-positive convention +betrays Yankee chauvinism. diff --git a/static/unix-v10/man3/ptime.3 b/static/unix-v10/man3/ptime.3 new file mode 100644 index 00000000..5f6c7f70 --- /dev/null +++ b/static/unix-v10/man3/ptime.3 @@ -0,0 +1,34 @@ +.pa 1 +.he 'PTIME (III)'3/15/72'PTIME (III)' +.ti 0 +NAME ptime -- print date and time +.sp +.ti 0 +SYNOPSIS sys time +.br +mov file,r2 +.br +jsr pc,ptime +.sp +.ti 0 +DESCRIPTION ptime_____ prints the date and time in the form +.sp + Oct 9 17:20:33\ +.sp +on the file whose file descriptor is in r2. +The string is 15 characters long. +The time to be printed +must be placed in the r0 and r1 registers +in the form returned by sys___ time____. +.sp +.ti 0 +FILES kept in /lib/liba.a +.sp +.ti 0 +SEE ALSO time(II), ctime(III) (used to do the conversion) +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS see ctime diff --git a/static/unix-v10/man3/putc.3 b/static/unix-v10/man3/putc.3 new file mode 100644 index 00000000..9a14bf8b --- /dev/null +++ b/static/unix-v10/man3/putc.3 @@ -0,0 +1,60 @@ +.pa 1 +.he 'PUTC,PUTW,FCREAT,FLUSH (III)'6/12/72'PUTC,PUTW,FCREAT,FLUSH (III)' +.ti 0 +NAME putc, putw, fcreat, flush -- buffered output +.sp +.ti 0 +SYNOPSIS mov $filename,r0 +.br +jsr r5,fcreat; iobuf + +(get byte in r0) +.br +jsr r5,putc; iobuf + +(get word in r0) +.br +jsr r5,putw; iobuf +.sp +jsr r5,flush; iobuf +.sp +.ti 0 +DESCRIPTION fcreat______ creates +the given file (mode 17) and sets up the buffer iobuf_____ (size 518(10) bytes); +putc____ and putw____ write a byte or word respectively +onto the file; +flush_____ forces the contents of the buffer to be written, but +does not close the file. +The format of the buffer is: +.sp +.nf +iobuf: .=.+2 / file descriptor + .=.+2 / characters unused in buffer + .=.+2 / ptr to next free character + .=.+512. / buffer +.sp +.fi +fcreat______ sets the error bit (c-bit) if the +file creation failed; none of the other routines +return error information. +.sp +Before terminating, a program should call +flush_____ to force out the last of the output. +.sp +The user must supply iobuf_____, which should begin on a word boundary. + +To write a new file using the same buffer, it +suffices to call flush_____, close the file, +and call fcreat______ again. +.sp +.ti 0 +FILES kept in /lib/liba.a +.sp +.ti 0 +SEE ALSO creat(II), write(II), getc(III) +.sp +.ti 0 +DIAGNOSTICS error bit possible on fcreat______ call +.sp +.ti 0 +BUGS -- diff --git a/static/unix-v10/man3/putchr.3 b/static/unix-v10/man3/putchr.3 new file mode 100644 index 00000000..20438640 --- /dev/null +++ b/static/unix-v10/man3/putchr.3 @@ -0,0 +1,49 @@ +.th PUTCHAR III 5/10/73 +.sh NAME +putchar \*- write character +.sh SYNOPSIS +.ft B +putchar(ch) +.s3 +flush( ) +.ft R +.sh DESCRIPTION +.it Putchar +writes out its argument and returns it unchanged. +The low-order byte of the +argument is always written; +the high-order byte is written only if it is +non-null. +Unless other arrangements have been made, +.it putchar +writes in +unbuffered fashion on the standard output file. +.s3 +Associated with this routine is an external variable +.it fout +which has the +structure of a buffer discussed under putc (III). +If the file descriptor part of this structure (first word) +is not 1, output via +.it putchar +is buffered. +To achieve buffered output one may say, for example, +.s3 +.nf + fout = dup(1); or + fout = fcreat(...); +.s3 +.fi +In such a case +.it flush +must be called +before the program terminates in order to flush out +the buffered output. +.it Flush +may be called at any time. +.sh "SEE ALSO" +putc(III) +.sh BUGS +The +.it fout +notion is kludgy. diff --git a/static/unix-v10/man3/putshares.3 b/static/unix-v10/man3/putshares.3 new file mode 100644 index 00000000..e54e2ed7 --- /dev/null +++ b/static/unix-v10/man3/putshares.3 @@ -0,0 +1,37 @@ +.TH PUTSHARES 3 SHARE +.SH NAME +putshares \- write shares file entry +.SH SYNOPSIS +.B "#include <shares.h>" +.br +.sp +.B "int putshares(lp, extime)" +.br +.B "struct lnode * lp;" +.br +.B "unsigned long extime;" +.SH DESCRIPTION +.I Putshares +writes the shares entry with the same uid as +.IR lp\->l_uid . +.I Putshares +returns -1 if any error occurs, +0 if +.I lp\->l_uid +is greater than +.SM MAXUID , +or the size of the entry if succesfully written. +.SH "SEE ALSO" +closeshares(3), +getshares(3), +getshput(3), +openshares(3), +sharesfile(3). +.SH DIAGNOSTICS +.I Putshares +returns 0 +if +.I lp\->l_uid +is greater than +.SM MAXUID , +or -1 on error. diff --git a/static/unix-v10/man3/pwquery.3 b/static/unix-v10/man3/pwquery.3 new file mode 100644 index 00000000..ab659335 --- /dev/null +++ b/static/unix-v10/man3/pwquery.3 @@ -0,0 +1,71 @@ +.TH PWQUERY 3X +.CT 2 sa secur +.SH NAME +pwquery, pexpw \(mi password services +.SH SYNOPSIS +.nf +.B pwquery(fd, name, param) +.B char *name; +.B char *param; +.PP +.B char *pexpw(fd, prompt) +.B char *prompt; +.fi +.SH DESCRIPTION +.I Pwquery +calls upon the password server, +.IR pwserv (8) +to cause a password to be demanded from file descriptor +.I fd +and checked against the password for the named user. +It is loaded by option +.BR -lipc +of +.IR ld (1). +.PP +Echoing is disabled during the transaction, +and the server is persnickety about when to use an +Atalla challenge/response dialogue and when to use +.IR crypt (3)-style +passwords. +A negative return value indicates a protocol error in +reaching the server or that the server is not trusted. +A zero return value indicates rejection of the password. +A positive return value indicates approval of the password. +.PP +The argument +.I param +may be zero (for vanilla password service) +or may point to a blank-separated list of one or more keywords. +Currently only one keyword is understood: +.TP +.B pex +Reject the password if the stream is unpexable. +.PP +.I Pexpw +reads a password from the indicated +file descriptor, +after prompting with the null-terminated string +.I prompt +and disabling echoing. +A pointer is returned to a null-terminated string +of at most 8 characters. +The dialogue is not attempted if it cannot be protected +from eavesdropping by the process-exclusive +mechanism of +.IR pex (4). +.SH FILES +.nf +.F /cs/pw +.F /etc/pwserv +.fi +.SH "SEE ALSO" +.IR ipc (3), +.IR getpass (3), +.IR pex (4) +.IR pwserv (8) +.SH BUGS +.I Pexpw +returns a pointer to static memory that is overwritten +at every call. + diff --git a/static/unix-v10/man3/qsort.3 b/static/unix-v10/man3/qsort.3 new file mode 100644 index 00000000..54ddebe1 --- /dev/null +++ b/static/unix-v10/man3/qsort.3 @@ -0,0 +1,42 @@ +.pa 1 +.he 'QSORT (III)'6/12/72'QSORT (III)' +.ti 0 +NAME qsort -- quicker sort +.sp +.ti 0 +SYNOPSIS (base of data in r1) +.br +(end+1 of data in r2) +.br +(element width in r3) +.br +jsr pc,qsort +.sp +.ti 0 +DESCRIPTION qsort_____ +is an implementation +of the quicker sort algorithm. +It is designed to sort equal length +elements. +Registers r1 and r2 delimit the region of +core containing the array of byte strings to be sorted: +r1 points to the start of the first string, r2 to the first +location above the last string. +Register r3 contains the length of each string. +r2-r1 should be a multiple of r3. +On return, r0, r1, r2, r3, r4 are destroyed. +.sp +The routine compar (q.v.) is called to compare elements +and may be replaced by the user. +.sp +.ti 0 +FILES kept in /lib/liba.a +.sp +.ti 0 +SEE ALSO compar(III) +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS It scribbles on r4. diff --git a/static/unix-v10/man3/rand.3 b/static/unix-v10/man3/rand.3 new file mode 100644 index 00000000..d502db75 --- /dev/null +++ b/static/unix-v10/man3/rand.3 @@ -0,0 +1,37 @@ +.pa 1 +.he 'RAND (III)'1/15/73'RAND (III)' +.ti 0 +NAME rand -- random number generator +.sp +.ti 0 +SYNOPSIS jsr pc,srand /to initialize +.br +jsr pc,rand /to get a random number +.sp +.ti 0 +DESCRIPTION The routine uses a multiplicative congruential +random number generator to return successive pseudo-random +numbers in r0 in the range from 1 to 2^15-1. +.sp +The generator is reinitialized by calling srand with 1 in r0. +.sp +It can be set to a random starting point by calling +srand with whatever you like in r0, +for example the result left in r1 from sys___ time____. +.sp +.ti 0 +FILES kept in /lib/liba.a +.sp +.ti 0 +SEE ALSO -- +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS -- +.sp +.ti 0 +WARNING The author of this routine has been writing +random-number generators for many years and has never been +known to write one that worked. diff --git a/static/unix-v10/man3/re.3 b/static/unix-v10/man3/re.3 new file mode 100644 index 00000000..a7dfafab --- /dev/null +++ b/static/unix-v10/man3/re.3 @@ -0,0 +1,178 @@ +.TH RE 3 +.SH NAME +recomp, reexec, resub, refree, reerror \(mi regular expression library +.SH SYNOPSIS +.B #include <re.h> +.PP +.L reprogram* recomp(char* pattern, int flags) +.PP +.L int reexec(reprogram* re, char* source) +.PP +.L void resub(reprogram* re, char* old, char* new, char* destination, int flags) +.PP +.L void reerror(char* message) +.PP +.L void refree(reprogram* re) +.SH DESCRIPTION +.I recomp +compiles a regular expression in +.B pattern +and returns a pointer to a compiled regular expression. +The space is allocated by +.IR malloc (3) +and may be released by +.IR refree . +Regular expressions are as in +.I egrep +(see +.IR grep (1)) +except that newlines are treated as ordinary +characters and +.B $ +matches the end of a null-terminated string. +.B flags +may be +.B RE_EDSTYLE +which specifies +.IR ed (1) +style special characters, +.BR \e( , +.BR \e) , +.BR \e? , +.B \e+ +and +.B \e| +for the +.IR egrep (1) +.BR ( , +.BR ) , +.BR ? , +.B + +and +.BR | , +respectively. +.PP +.I reexec +matches the null-terminated +.B source +string against the compiled regular expression +.I re +from a previous call to +.IR recomp . +If it matches, +.I reexec +returns a non-zero value. +If +.B flags +is +.B RE_MATCH +then the array +.B re\->match +is filled with character pointers to the substrings of +.B source +that correspond to the +parenthesized subexpressions of +.BR pattern : +.B re\->match[i].sp +points to the beginning and +.B re\->match[i].ep +points just beyond +the end of substring +.BR i . +(Subexpression +.B i +begins at the +.BR i th +matched left parenthesis, counting from 1.) +Pointers in +.B re\->match[0] +pick out the substring that corresponds to +the entire regular expression. +Unused elements of +.B re\->match +are filled with zeros. +Matches involving +.BR * , +.BR + , +and +.B ? +are extended as far as possible. +A maximum of 9 subexpressions will be matched. +The structure of elements of +.B re\->match +is: +.nf +.ta 8n + typedef struct + { + char* sp; + char* ep; + } rematch; +.fi +.LP +.I resub +places in +.I destination +a substitution instance of +.B old +to +.B new +in +.B source +in the context of the last +.I reexec +performed on +.IR re\->match . +Each instance of +.BI \e n , +where +.I n +is a digit, is replaced by the +string delimited by +.BI re\->match[ n ].sp +and +.BI re\->match[ n ].ep . +Each instance of +.B & +is replaced by the string delimited by +.B re\->match[0].sp +and +.BR re\->match[0].ep . +If +.B RE_ALL +is set in +.B flags +then all occurrences of +.B old +are replaced by +.IR new . +If +.B RE_LOWER +.RB [ RE_UPPER ] +is set in +.B flags +then +.B old +is converted to lower [upper] case. +.LP +.I reerror, +called whenever an error is detected in +.I recomp, +.I reexec, +or +.I resub, +writes the string +.B msg +on the standard error file and exits. +.I reerror +may be replaced to perform +special error processing. +.SH DIAGNOSTICS +.I recomp +returns 0 for an invalid expression or other failure. +.I reexec +returns 1 if +.B source +is accepted, 0 otherwise. +.SH "SEE ALSO" +ed(1), grep(1), expr(1) diff --git a/static/unix-v10/man3/regex.3 b/static/unix-v10/man3/regex.3 new file mode 100644 index 00000000..d063bca2 --- /dev/null +++ b/static/unix-v10/man3/regex.3 @@ -0,0 +1,66 @@ +.TH REGEX 3 deprecated +.SH NAME +re_comp, re_exec \(mi regular expression handler +.SH SYNOPSIS +.nf +.B char *re_comp(s) +.B char *s; +.PP +.B re_exec(s) +.B char *s; +.fi +.SH DESCRIPTION +.I Re_comp +compiles a regular expression into an internal form suitable for +pattern matching. +.I Re_exec +checks the argument string against the last string passed to +.I re_comp. +.PP +.I Re_comp +returns +.L 0 +if the string +.I s +was compiled successfully; otherwise a string containing an +error message is returned. If +.I re_comp +is passed +.L 0 +or a null string, it returns without changing the currently +compiled regular expression. +.PP +.I Re_exec +returns 1 if the string +.I s +matches the last compiled regular expression, +.L 0 +if the string +.I s +failed to match the last compiled regular expression, and +.L -1 +if the compiled regular expression was invalid (indicating an +internal error). +.PP +The strings passed to both +.I re_comp +and +.I re_exec +may have trailing or embedded newline characters; +they are terminated by nulls. +The regular expressions are otherwise as described for +.IR ed (1). +.SH "SEE ALSO" +.IR ed (1), +.IR expr (1), +.IR regexp (3) +.SH DIAGNOSTICS +.I Re_exec +returns +.L -1 +for an internal error. +.SH BUGS +These routines have been superseded by +the more general routines of +.IR regexp (3). +They have been retained only for compatibility. diff --git a/static/unix-v10/man3/regexp.3 b/static/unix-v10/man3/regexp.3 new file mode 100644 index 00000000..4796e706 --- /dev/null +++ b/static/unix-v10/man3/regexp.3 @@ -0,0 +1,145 @@ +.TH REGEXP 3 +.CT 2 data_man +.SH NAME +regcomp, regexec, regsub, regerror \(mi regular expression +.SH SYNOPSIS +.nf +.B #include <regexp.h> +.PP +.B regexp *regcomp(exp) +.B char *exp; +.PP +.B int regexec(prog, string, match, msize) +.B regexp *prog; +.B char *string; +.B regsubexp *match; +.B int msize; +.PP +.B void regsub(source, dest, match, msize) +.B char *source, *dest; +.B regsubexp *match; +.B int msize; +.PP +.B void regerror(msg) +.B char *msg; +.fi +.SH DESCRIPTION +.I Regcomp +compiles a +regular expression and returns +a pointer to a compiled regular expression. +The space is allocated by +.IR malloc (3) +and may be released by +.I free. +Regular expressions are as in +.IR re (3) +except that newlines are not operators and back-references (with +\fB\e\fIn\fR) are not supported. +.PP +.I Regexec +matches a null-terminated +.I string +against the compiled regular expression in +.I prog. +If it matches, +.I regexec +returns a non-zero value and fills in the array +.I match +with character pointers to the substrings of +.I string +that correspond to the +parenthesized subexpressions of +.IR exp : +.BI match[ i ].sp +points to the beginning and +.BI match[ i ].ep +points just beyond +the end of the +.IR i th +substring. +(Subexpression +.I i +begins at the +.IR i th +left parenthesis, counting from 1.) +Pointers in +.B match[0] +pick out the substring that corresponds to +the whole regular expression. +Unused elements of +.I match +are filled with zeros. +Matches involving +.LR * , +.LR + , +and +.L ? +are extended as far as possible. +The number of array elements in +.I match +is given by +.I msize. +The structure of elements of +.I match +is: +.IP +.EX +typedef struct { + char *sp; + char *ep; +} regsubexp; +.EE +.LP +.I Regsub +places in +.I dest +a substitution instance of +.I source +in the context of the last +.I regexec +performed using +.I match. +Each instance of +.BI \e n , +where +.I n +is a digit, is replaced by the +string delimited by +.BI match[ n ].sp +and +.BI match[ n ].ep . +Each instance of +.L & +is replaced by the string delimited by +.B match[0].sp +and +.BR match[0].ep . +.LP +.I Regerror, +called whenever an error is detected in +.I regcomp, +.I regexec, +or +.I regsub, +writes the string +.I msg +on the standard error file and exits. +.I Regerror +can be replaced to perform +special error processing. +.SH "SEE ALSO" +.IR gre (1), +.IR re (3), +.IR expr (1) +.SH DIAGNOSTICS +.I Regcomp +returns +.B (regexp *)0 +for an illegal expression +or other failure. +.I Regexec +returns 0 +if +.I string +is not accepted. diff --git a/static/unix-v10/man3/reset.3 b/static/unix-v10/man3/reset.3 new file mode 100644 index 00000000..8bd1ac2f --- /dev/null +++ b/static/unix-v10/man3/reset.3 @@ -0,0 +1,42 @@ +.th RESET III 5/10/73 +.sh NAME +reset \*- execute non-local goto +.sh SYNOPSIS +.ft B +setexit( ) +.s3 +reset( ) +.ft R +.sh DESCRIPTION +These routines are useful +for dealing with errors +discovered in a low-level subroutine +of a program. +.s3 +.it Setexit +is typically called just at the start of +the main loop of a processing program. +It stores certain parameters such as the call point and the stack +level. +.s3 +.it Reset +is typically called after diagnosing an error +in some subprocedure called from the main loop. +When +.it reset +is called, +it pops the stack appropriately +and generates a non-local return from +the last call to +.it setexit. +.s3 +It is erroneous, and generally +disastrous, +to call +.it reset +unless +.it setexit +has been called in a routine which is +an ancestor of +.it reset. +.sh BUGS diff --git a/static/unix-v10/man3/salloc.3 b/static/unix-v10/man3/salloc.3 new file mode 100644 index 00000000..39f9ff6d --- /dev/null +++ b/static/unix-v10/man3/salloc.3 @@ -0,0 +1,160 @@ +.pa 1 +.he 'SALLOC (III)'6/15/72'SALLOC (III)' +.ti 0 +.nf +NAME salloc -- string manipulation routines +.fi +.sp +.ti 0 +.nf +SYNOPSIS (get size in r0) +.br +jsr pc,allocate +.sp +(get source pointer in r0, +destination pointer in r1) +jsr pc,copy +.sp +jsr pc,wc +.sp +(all following instructions assume r1 contains pointer) + +jsr pc,release + +(get character in r0) +jsr pc,putchar +.sp +jsr pc,lookchar +(character in r0) + +jsr pc,getchar +(character in r0) + +(get character in r0) +jsr pc,alterchar + +(get position in r0) +jsr pc,seekchar + +jsr pc,backspace +(character in r0) + +(get word in r0) +jsr pc,putword + +jsr pc,lookword +(word in r0) + +jsr pc,getword +(word in r0) + +(get word in r0) +jsr pc,alterword + +jsr pc,backword +(word in r0) + +jsr pc,length +(length in r0) + +jsr pc,position +(position in r0) + +jsr pc,rewind + +jsr pc,create + +jsr pc,fsfile + +jsr pc,zero + +.fi +.ti 0 +DESCRIPTION This package is a complete set of routines +for dealing with almost arbitrary +length strings of words and bytes. +The strings are stored on a disk file, so the sum of +their lengths can be considerably larger than +the available core. + +For each string there is a header of four words, namely +a write pointer, a read pointer and pointers to the beginning and end of +the block containing the string. +Initially the read and write pointers point to the beginning of the string. +All routines that refer to a string require the header address in r1. +Unless the string is destroyed by the call, +upon return r1 will point to the same string, although +the string may have grown to the extent that it had to be +be moved. + +.ul +allocate +obtains a string of the requested size and returns +a pointer to its header in r1. +.sp +release_______ releases a string back to free storage. +.sp +putchar_______ and putword_______ write a byte or word respectively into the string +and advance the write pointer. + +.ul +lookchar +and +.ul +lookword +read +a byte or word respectively from the string but do not advance the read pointer. + +getchar_______ and getword_______ read a byte or word respectively from the string and advance the read pointer. + +alterchar_________ and alterword_________ write a byte or word respectively into the string where the read pointer +is pointing and advance the read pointer. + +backspace_________ and backword________ read the last byte or word written and decrement the write pointer. + +All write operations will automatically get a larger block if the current block is exceeded. +All read operations return with the error bit set if attempting to read beyond the write pointer. +.sp +seekchar________ moves the read pointer to the offset specified in r0. + +length______ returns the current length of the string (beginning pointer to write pointer) in r0. + +position________ returns the current offset of the read pointer in r0. + +rewind______ moves the read pointer to the beginning of the string. + +create______ returns the read and write pointers to the beginning of the string. + +fsfile______ moves the read pointer to the current position of the write pointer. + +zero____ zeros the whole string and sets the write pointer to the beginning of the string. + +copy____ copies the string whose header pointer is in r0 to the string whose header pointer is in +r1. +Care should be taken in using the copy instruction since r1 will be changed if the contents of the source string +is bigger than the destination string. + +wc__ forces the contents of the internal buffers and the header blocks to be written on disc. +.sp +.ti 0 +FILES The allocator is in +/lib/libs.a; +the -s__ option to ld__ will link edit +references to the allocator. + +alloc.d is the temporary file used to contain +the strings. + +.ti 0 +SEE ALSO -- +.sp +.ti 0 +DIAGNOSTICS "error in copy" if a disk write error occurs during the execution of the copy instruction. +"error in allocator" if any routine is called with a bad header pointer. +"Cannot open output file" if file alloc.d cannot be created or opened. +"Out of space" if there's no available block of the requested size or no headers available for a new block. +.sp +.fi +.in16 +.ti 0 +BUGS -- diff --git a/static/unix-v10/man3/sbuf.prot.3 b/static/unix-v10/man3/sbuf.prot.3 new file mode 100644 index 00000000..7125f362 --- /dev/null +++ b/static/unix-v10/man3/sbuf.prot.3 @@ -0,0 +1,410 @@ +. \"ident "%W%" +. \"Copyright (c) 1984 AT&T +. \"All Rights Reserved +. \"THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +. \"The copyright notice above does not evidence any +. \"actual or intended publication of such source code. +.TH SBUF.PROT 3I+ "C++ Stream Library" " " +.SH NAME +streambuf \- interface for derived classes +.SH SYNOPSIS +.nf +.ta1i 2i +.ft B +#include <iostream.h> + +typedef long streamoff, streampos; +class ios { +public: + enum seek_dir { beg, cur, end }; + enum open_mode { in, out, ate, app } ; + // \fIand lots of other stuff ... \fP + } ; + +class streambuf { +public: + streambuf() ; + streambuf(char* p, int len, int i=0); + + void dbp() ; +protected: + int allocate(); + char* base(); + int blen(); + char* eback(); + char* ebuf(); + char* egptr(); + char* epptr(); + void gbump(int n); + char* gptr(); + char* pbase(); + void pbump(int n); + char* pptr(); + void setg(char* eb,char* g, char* eg); + void setp(char* p, char* ep); + void setb(char* b, char* eb, int a = 0 ); + int unbuffered(); + void unbuffered(int); + + virtual int doallocate(); + virtual int pbackfail(int c); + virtual ~streambuf() ; +public: + virtual int overflow(int c=EOF); + virtual int underflow(); + virtual streambuf* + setbuf(char* p, int len); + virtual streampos + seekpos(streampos,open_mode=input|output); + virtual streampos + seekoff(streamoff,seek_dir,open_mode=input|output); + virtual int sync(); +}; +.fi +.ft R +.SH DESCRIPTION +\f(CWstreambuf\fRs implement the buffer abstraction described in +\fIsbuf.pub\fR(3C++). But the \f(CWstreambuf\fR class itself contains +only basic members for manipulating the characters and normally +a class derived from \f(CWstreambuf\fR will be used. This man page +describes the interface needed by programmers who are +coding a derived class. +Broadly speaking there are two kinds of members described here. +The non-virtual functions are provided for manipulating a \fBstreambuf\fR +in ways that are appropriate in a derived class. +Their descriptions reveal details of the implementation that would +be inappropriate in the public interface. +The virtual functions permit the derived class to specialize the +\fBstreambuf\fR class in ways appropriate to the specific sources +and sinks that it is implementing. +The descriptions of virtuals explain the obligations of the +virtuals of the derived class. If the virtuals behave as specified, +the \fBstreambuf\fR will behave as specified in the +public interface. However, if the virtuals do not behave as +specified, then the \f(CWstreambuf\fR may not behave properly, +and an \f(CWiostream\fR (or any other code) that relies on proper +behavior of the \f(CWstreambuf\fR may not behave properly either. +.PP +Assume +.br +\(em \fBsb\fR is a \f(CWstreambuf*\fR. +.br +\(em \fBi\fR and \fBn\fR are \f(CWint\fR. +.br +\(em \fBptr\fR, \fBb\fR, \fBeb\fR, \fBp\fR, \fBep\fR, \fBeb\fR, \fBg\fR, +and \fBeg\fR are \f(CWchar*\fR. +.br +\(em \fBc\fR is an \f(CWint\fR character (positive or \f(CWEOF\fR)). +.br +\(em \fBpos\fR is a \f(CWstreampos\fR. (See \fIiostream\fR(3C++).) +.br +\(em \fBoff\fR is a \f(CWstreamoff\fR. +.br +\(em \fBdir\fR is a \f(CWseekdir\fR. +.br +\(em \fBmode\fR is a \f(CWopen_mode\fR. +.PP +Constructors: +.TP +\fBstreambuf()\fR +Constructs +an empty buffer corresponding to an empty sequence. +.TP +\fBstreambuf(b,len,i)\fR +Constructs an empty buffer and then sets up the reserve area +to be the \fBlen\fR bytes starting at \fBb\fR. (\fBi\fR is present +for backward compatibility with the stream package\fR. The effect +if it is not 0 is undefined.) +.PP +The protected members of +\f(CWstreambuf\fR +present an interface to derived classes organized around +three areas (arrays of bytes) managed cooperatively by +the base and derived classes. +They are the get area, the put area, and the reserve area. +The get and the put area are normally disjoint, but they +may both overlap the reserve area, whose primary purpose is +to be a a resource in which +space for the put and get areas can be allocated. The get and +the put areas are changed as characters are put into and +gotten from the buffer, but the reserve area normally remains +fixed. +The areas are defined by a collection of \f(CWchar*\fR values. +The buffer abstraction is described in terms of pointers that point +between characters, but the \f(CWchar*\fR values must point at +\f(CWchar\fRs. +To establish a correspondence the \f(CWchar*\fR values should be thought +of as pointing just before the byte they really point at. +.PP +Functions to examine the pointers are: +.TP +\fBptr=sb->base()\fR +Returns a pointer to the first byte of the reserve area. + Space between \fBsb->base()\fR +and \fBsb->ebase()\fR is the reserve area. +.TP +\fBptr=sb->eback()\fR +Returns a pointer to a lower bound on +\fBsb->gptr()\fR. +Space between \fBsb->eback()\fR and \fBsb->gptr()\fR is available +for putback. +.TP +\fBptr=sb->ebuf()\fR +Returns a pointer to the byte after the last byte of the reserve area. +.TP +\fBptr=sb->egptr()\fR +Returns a pointer to the byte after the last byte of the get area. +.TP +\fBptr=sb->epptr()\fR +Returns a pointer to the byte after the last byte of the put area. +.TP +\fBptr=sb->gptr()\fR +Returns a pointer to the first byte of the get area. +The available characters are those between \fBsb->gptr()\fR +and \fBsb->egptr()\fR. The next character fetched will +be \fB*sb->gptr()\fR unless \fBsb->egptr()\fR is less than +or equal to \fBsb->gptr()\fR. +.TP +\fBptr=sb->pbase()\fR +Returns a pointer to the put area base. +Characters between \fBsb->pbase()\fR and \fBsb->pptr()\fR +have been storeded into the buffer and not yet consumed. +.TP +\fBptr=sb->pptr()\fR +Returns a pointer to the first byte of the put area. +The space between \fBsb->pptr()\fR +and \fBsb->epptr()\fR is the put area and characters will be storeed +here. +.PP +The member functions for setting the pointers: +.TP +\fBsb->setb(b,eb,i)\fR +Sets \fBbase\fR and \fBebase\fR to \fBb\fR and \fBeb\fR respectively. +\fBi\fR controls whether the area will be subject to +automatic deletion. +If \fBi\fR is non zero, then +\f(CWdelete\fB b\fR will be done when \fBbase\fR is changed by +another call of \fBsetb\fR, or when the destructor is called for +\fB*sb\fR. +If \fBb\fR and \fBeb\fR +are both null then we say that there is no reserve area. +If \fBb\fR is non-null, there is a reserve area even if +\fBeb\fR is less than \fBb\fR and so the reserve area +has zero length. +.TP +\fBsb->setp(p,ep)\fR +Sets \fBpptr\fR to \fBp\fR, \fBpbase\fR to \fBp\fR, and \fBepptr\R +to \fBep\fR. +.TP +\fBsb->setg(eb,g,eg)\fR +Sets \fBeback\fR to \fBeb\fR, \fBgptr\fR to \fBg\fR, and \fBegptr\fR +to \fBeg\fR. +.PP +Other non-virtual members: +.TP +\fBi=sb->allocate()\fR +Tries to set up a reserve area. +If a reserve area already exists or if \fBsb->unbuffered()\fR +is nonzero returns 0 without doing anything. +If the attempt to allocate space fails \fBallocate\fR +returns \f(CWEOF\fR. Otherwise (allocation succeeds) +\fBallocate\fR returns 1. \fBallocate\fR is not called by +any member of \f(CWstreambuf\fR except virtuals. +.TP +\fBi=sb->blen()\fR +Returns the current size (in chars) of the current reserve area. +.TP +\fBdbp()\fR +Writes directly on file descriptor 1 +information in ASCII about the state of the +buffer. It is intended for debugging and nothing +is specified about the form of the output. It is considered part +of the protected interface because the information it prints can +only be understood in relation to that interface, but it is a public +function so that it can be called anywhere during debugging. +.TP +\fBsb->gbump(n)\fR +Increments \fBgptr\fR by \fBn\fR +which may be positive or negative. +No checks are made on whether the new +value of \fBgptr\fR is in bounds. +.TP +\fBsb->pbump(n)\fR +Increments \fBpptr\fR by \fBn\fR +which may be positive or negative. +No checks are made on whether the new +value of \fBpptr\fR is in bounds. +.sp +.nf +.in -.5i +\fBsb->unbuffered(i)\fR +\fBi=sb->unbuffered()\fR +.in +.fi +There is a private variable known as \fBsb\fR's buffering state. +\fBsb->unbuffered(i)\fR sets the value of this variable +to \fBi\fR and \fBsb->unbuffered()\fR returns the current value. +This state is independent of the actual +allocation of a reserve area. Its primary purpose is to +control whether a reserve area is allocated automatically +by \fBallocate\fR. +.PP +Virtual functions must be redefined in +derived classes to specialize the behavior of \fBstreambuf\fRs: +.TP +\fBi=sb->doallocate()\fR +Is called when \fBallocate\fR determines +that space is needed. +\fBdoallocate\fR is required to call \fBsetb\fR to provide a reserve +area or to return \f(CWEOF\fR if it cannot. It is only called +if \fBsb->unbuffered()\fR is non-zero and \fBsb->base()\fR is non-zero. +.TP +\fBi=overflow(c)\fR +Is called to consume characters. If \fBc\fR is not \f(CWEOF\fR +it also must either save \fBc\fR or consume it. +Usually it is called when the put area is full and +an attempt is being made to store a new character, but +it can be called at other times. +The normal action is to consume the characters between \fBpbase\fR +and \fBpptr\fR, call \fBsetp\fR to establish a new put area, and +if \fBc\f(CW!=EOF\fR store it (using \fBsputc\fR). +If \fBsb->unbuffered()\fR is non-zero, +\fBoverflow\fR is not allowed to call \fBsetp\fR and +so must consume \fBn\fR +\fBsb->overflow\fR +should return \fBEOF\fR to indicate an error; otherwise it should +return something else. +.TP +\fBi=sb->pbackfail(c) +Is called when \fBeback\fR equals \fBgptr\fR and an attempt +has been made to putback \fBc\fR. +If this situation can be dealt with (e.g., by repositioning +an external file), \fBpbackfail\fR should return \fBc\fR; +otherwise it should return \f(CWEOF\fR. +.TP +\fBpos=sb->seekoff(off,dir,mode)\fR +Repositions the get and/or put pointers (i.e., the abstract +get and put pointers, not \fBpptr\fR and \fBgptr\fR). The +meanings of \fBoff\fR and \fBdir\fR +are discussed in +\fIsbuf.pub\fR(3C++). +\fBmode\fR specifies whether the put pointer (\fBoutput\fR bit set) or +the get pointer (\fBinput\fR bit set) is to be modified. Both bits +may be set in which case both pointers should be affected. +A class derived from \fBstreambuf\fR is not required to +support repositioning. \fBseekoff\fR should return \f(CWEOF\fR if +the class does not support repositioning. If the class does +support repositioning, \fBseekoff\fR should return the new +position or \f(CWEOF\fR on error. +.TP +\fBpos=sb->seekpos(pos,mode)\fR +Repositions the streambuf get and/or put pointer to \fBpos\fR. +\fBmode\fR specifies which pointers are affected as for \fBseekoff\fR. +Returns \fBpos\fR (the argument) or \f(CWEOF\fR if the class does +not support repositioning or an error occurs. +.TP +\fBsb=sb->setbuf(ptr,len)\fR +Offers the array at \fBptr\fR with \fBlen\fR bytes should +be used as a reserve +area. The normal interpretation is that +if \fBptr\fR or \fBlen\fR are zero then this is a request +to make the \fBsb\fR unbuffered. +The derived class may use this area or not as it chooses. +If may accept or ignore the request for unbuffered state as it +chooses. +\fBsetbuf\fR should return \fBsb\fR if it honors the request. +Otherwise it should return 0. +.TP +\fBi=sb->sync()\fR +Is called to give the derived class +a chance to +look at the state of the areas, and synchronize +them with any external representation. +Normally \fBsync\fR should +consume any characters that have been storeed into the put area, +and if possible give back to the source any characters in the get area +that have not been fetched. When \fBsync\fR returns there should not +be any unconsumed characters, and the get area should be empty. +\fBsync\fR should return \fBEOF\fR if some kind of failure occurs. +.TP +\fBi=sb->underflow()\fR +Is called to supply characters for fetching, i.e., +to create a condition in which the get area is not empty. +If it is called when there are characters in the get area +it should return the first character. If the get area is empty +it should create a nonempty get area +and return the next character (which it should also +leave in the get area). +If there are no more characters available +\fBunderflow\fR +should return \f(CWEOF\fR and leave an empty put area. +.PP +The default definitions of the virtual functions: +.TP +\fBi=sb->streambuf::doallocate()\fR +Attempts to allocate a reserve area using \f(CWoperator new\fR. +.TP +\fBi=sb->streambuf::overflow(n)\fR +Is compatible +with the old stream package, but that behavior is not +considered part of the specification of the iostream package. +So \fBstreambuf::overflow\fR should be treated as if +it had undefined behavior. That is, derived classes should +always define it. +.TP +\fBi=sb->streambuf::pbackfail(n) +Returns \f(CWEOF\fR. +.TP +\fBpos=sb->streambuf::seekpos(pos,mode)\fR +Returns \fBsb->seekoff(streamoff(pos),seek_beg,mode)\fR. +Thus to define seeking in a derived class, it is frequently +only necessary to define +\fBseekoff\fR and use the inherited \fBstreambuf::seekpos\fR. +.TP +\fBpos=sb->streambuf::seekoff(off,dir,mode)\fR +Returns \f(CWEOF\fR. +.TP +\fBsb=sb->streambuf::setbuf(ptr,len)\fR +Will honor the request when ever there is no reserve area. +.TP +\fBi=sb->streambuf::sync()\fR +Returns 0 if the get area is empty and there are no unconsumed +characters. Otherwise it returns \f(CWEOF\fR. +.TP +\fBi=sb->streambuf::underflow()\fR +Is compatible +with the old stream package, but that behavior is not +considered part of the specification of the iostream package. +So \fBstreambuf::underflow\fR should be treated as if +it had undefined behavior. That is, it should always be defined +in derived classes. +.SH CAVEATS +The constructors are public for compatibility with the +old stream package. +They ought to be protected. +.PP +The interface for unbuffered actions is awkward. +It's hard to write \fBunderflow\fR and \fBoverflow\fR +virtuals that behave properly +for unbuffered \f(CWstreambuf\fRs without special casing. +Also there is no way for the virtuals to react sensibly to +multi character gets or puts. +.PP +Although the public interface to \f(CWstreambuf\fRs +deals in characters and bytes, +the interface to derived classes deals in \f(CWchar\fRs. +Since a decision had to be made on the types of the real data +pointers, it seemed easier to reflect that choice in the +types of the protected members than to duplicate all +the members with both plain and unsigned char versions. +But perhaps all these uses of \f(CWchar*\fR ought to have been +with a typedef. +.PP +The implementation contains a variant +of \fBsetbuf\fR that accepts a third argument. +It is present only for compatibility +with the old stream package. +.SH SEE ALSO +sbuf.pub(3C++) +streambuf(3C++) +iostream(3C++) diff --git a/static/unix-v10/man3/sbuf.pub.3 b/static/unix-v10/man3/sbuf.pub.3 new file mode 100644 index 00000000..deb16530 --- /dev/null +++ b/static/unix-v10/man3/sbuf.pub.3 @@ -0,0 +1,254 @@ +. \"ident "%W%" +. \"Copyright (c) 1984 AT&T +. \"All Rights Reserved +. \"THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +. \"The copyright notice above does not evidence any +. \"actual or intended publication of such source code. +.TH SBUF.PUB 3I+ "C++ Stream Library" " " +.SH NAME +streambuf \- public interface of character buffering class +.SH SYNOPSIS +.ft B +.ta1i 2i +.nf +#include <iostream.h> + +typedef long streamoff, streampos; +class ios { +public: + enum seek_dir { beg, cur, end }; + enum open_mode { in, out, ate, app } ; + // \fIand lots of other stuff ... \fP + } ; + +class streambuf { +public : + + int in_avail(); + int out_waiting(); + int sbumpc(); + streambuf* setbuf(char* ptr, int len, int count=0); + streampos seekpos(streampos,open_mode); + streampos seekoff(streamoff,seek_dir,open_mode); + int sgetc(); + int sgetn(char* ptr,int n); + int snextc(); + int sputbackc(char c); + int sputc(int c); + int sputn(const char* s,int n); + void stossc(); + int sync(); + } +.fi +.SH DESCRIPTION +The \f(CWstreambuf\fR +class supports buffers into which +characters can be inserted (put) or from which characters can be +fetched (gotten). Abstractly such a buffer is a sequence of +characters together with one or +two pointers (a get and/or a put pointer) +that define +the location at which characters are to be inserted or fetched. +The pointers should be thought of as pointing between characters +rather than at them. This makes it easier to understand the +boundary conditions (a pointer before the first character or after +the last). +Some of the effects of getting and putting are defined +by this class but most of the details are left to specialized +classes derived from \f(CWstreambuf\fR. +.PP +Classes derived from \f(CWstreambuf\fR vary in their +treatments of the get and put pointers. +The simplest are unidirectional buffers which permit only gets or +only puts. Such classes serve as pure sources (producers) +or sinks (consumers) of characters. +Queuelike buffers have a put and a get pointer which +move independently +of each other. In such buffers characters that are stored are held +(i.e., queued) +until they are later fetched. +Filelike buffers permit both gets and puts but +have only a single pointer. +(An alternative description is that the get +and put pointers are tied together +so that when one moves so does the other.) +.PP +Most \f(CWstreambuf\fR member functions are +organized into two phases. +As far as possible, operations are performed inline by storing into +or fetching +from arrays (the get area and the put area). +From time to time, virtual functions are called to +deal with collections of characters. +Generally the user of a \f(CWstreambuf\fR does not have to know +anything about these +details, but some the public members pass back information +about the +state of the areas. +.PP +Assume: +.br +\(em \fBi\fR, \fBn\fR, and \fBlen\fR are \f(CWint\fR. +.br +\(em \fBc\fR is an \f(CWint\fR. It always holds a "character" +value or \f(CWEOF\fR. A "character" value is always positive +even when \f(CWchar\fR is normally sign extended. +.br +\(em \fBsb\fR and \fBsb1\fR are \f(CWstreambuf*\fR. +.br +\(em \fBptr\fR is a \f(CWchar*\fR. +.br +\(em \fBoff\fR is a \f(CWstreamoff\fR. +.br +\(em \fBpos\fR is a \f(CWstreampos\fR. +.br +\(em \fBdir\fR is a \f(CWseekdir\fR. +.br +\(em \fBmode\fR is a \f(CWopen_mode\fR. +.PP +Public member functions: +.TP +\fBi=sb->in_avail()\fR +Returns the number of characters +that are immediately available in the get area for +fetching. That many characters may be fetched with +a guarantee that no errors will be reported. +.TP +\fBi=sb->out_waiting()\fR +Returns the number of characters in the put area that have not +been consumed by virtuals. +.TP +\fBc=sb->sbumpc()\fR +Moves the get pointer forward one character and returns the +character moved over. +Returns \f(CWEOF\fR if the get pointer is +currently at the end of the sequence. +.TP +\fBpos=sb->seekoff(off,dir,mode)\fR +Repositions the get and/or put pointers. +\fBmode\fR specifies whether the put pointer (\fBoutput\fR bit set) or +the get pointer (\fBinput\fR bit set) is to be modified. Both bits +may be set in which case both pointers should be affected. +\fBoff\fR is interpreted as a byte offset. (Notice that it is a +signed quantity.) +The meaning of possible values of \fBdir\fR are +.RS +.TP +\f(CWbeg\fR +The beginning of the stream. +.TP +\f(CWcur\fR +The current position. +.TP +\f(CWend\fR +The end of the stream. (End of file.) +.RE +Not all classes derived from \fBstreambuf\fR +support repositioning. \fBseek\fR will return \f(CWEOF\fR if +the class does not support repositioning. If the class does +support repositioning, \fBseek\fR will return the new +position or \f(CWEOF\fR on error. +.TP +\fBpos=sb->seekpos(pos,mode)\fR +Repositions the streambuf get and/or put pointer to \fBpos\fR. +\fBmode\fR specifies which pointers are affected as for \fBseekoff\fR. +Returns \fBpos\fR (the argument) or \f(CWEOF\fR if the class does +not support repositioning or an error occurs. +In general a \f(CWstreampos\fR should be treated as a "magic cookie" +and no arithmetic should be performed on it. +But two particular values have special meaning: +.RS +.TP +\fBstreampos(0)\fR +The beginning of the file. +.TP +\fBstreampos(EOF)\fR +Used as an error indication. +.RE +.TP +\fBc=sb->sgetc()\fR +Returns the character after the get pointer. Contrary to what most +people expect from the name +\fIIT DOES NOT MOVE THE GET POINTER\fR. Returns \f(CWEOF\fR if there is +no character available. +.TP +\fBsb1=sb->setbuf(ptr,len,i) +Offers the \fBlen\fR +bytes starting at \fBptr\fR. +as the reserve area. +If \fBptr\fR is null or \fBlen\fR is zero or less, then an unbuffered +state is requested. +Whether the offered area is used, or a request for unbuffered +state is honored depends on details of the derived class. +\fBsetbuf\fR normally returns \fBsb\fR, but if it does not +accept the offer or honor the request, it returns 0. +.TP +\fBi=sb->sgetn(ptr,n)\fR +Fetches the \fBn\fR +characters following the get pointer and copies them to the area +starting at \fBptr\fR. +When there are less than \fBn\fR characters left before the +end of the sequence \fBsgetn\fR fetches whatever characters +remain. +\fBsgetn\fR repositions the get pointer following +the fetched characters and +returns the number of characters fetched. +.TP +\fBc=sb->snextc()\fR +Moves the get pointer forward one character +and returns the character following the new position. +It returns \f(CWEOF\fR if the pointer +is currently at the end of the sequence or is at the end of +the sequence after moving forward. +.TP +\fBi=sb->sputbackc(c) +Moves the get pointer back one character. +\fBc\fR must be +the current content of the sequence just before the get pointer. +The underlying mechanism may +simply back up the get pointer or may rearrange its internal +data structures so the \fBc\fR is saved. Thus the effect +of \fBsputbackc\fR is undefined if \fBc\fR is not the character +before the get pointer. +\fBputbackc\fR returns \f(CWEOF\fR when it fails. +The conditions under which it can fail depend on the details of +the derived +class. +.TP +\fBi=sb->sputc(c) +Stores \fBc\fR after the put pointer, and moves the +put pointer over the stored character. Usually this extends +the sequence. +It returns \fBEOF\fR when an error occurs. The conditions +that can cause errors depend on the derived class. +.TP +\fBi=sb->sputn(ptr,n)\fR +Stores the \fBn\fR +characters starting at \fBptr\fR +after the put pointer. Moves the put +pointer over them. +Returns the number of characters stored successfully. +Normally this is \fBn\fR, but it may be less when errors occur. +.TP +\fBsb->stossc()\fR +Moves the get pointer forward one character. If the pointer started at the +end of the sequence this function has no effect. +.TP +\fBi=sb->sync()\fR +Establishes consistency between the internal data structures and the +external source or sink. +The details of this function depend on the derived class. +Usually this "flushes" any characters that have been stored +but not yet consumed, and "gives back" any characters that +may have been produced but not yet fetched. +.SH CAVEATS +\fBsetbuf\fR +does not really belong in the public interface. +It is there for compatibility with the stream package. +.PP +Requiring the program to provide +the previously fetched character to +\f(CWsputback\fR is probably a botch. +.SH SEE ALSO +iostream(3C++), +sbuf.prot(3C++) diff --git a/static/unix-v10/man3/scanf.3 b/static/unix-v10/man3/scanf.3 new file mode 100644 index 00000000..2a432ff3 --- /dev/null +++ b/static/unix-v10/man3/scanf.3 @@ -0,0 +1,300 @@ +.TH SCANF 3S +.CT 2 file_io data_man +.SH NAME +scanf, fscanf, sscanf \(mi formatted input +.SH SYNOPSIS +.nf +.B #include <stdio.h> +.PP +.B +scanf(format [ , pointer ] ... ) +.B char *format; +.PP +.B +fscanf(stream, format [ , pointer ] ... ) +.B FILE *stream; +.B char *format; +.PP +.B +sscanf(s, format [ , pointer ] ... ) +.B char *s, *format; +.fi +.SH DESCRIPTION +.I Scanf +reads from the standard input stream +.IR stdin . +.I Fscanf +reads from the named input +.IR stream . +.I Sscanf +reads from the character string +.IR s . +Each function reads characters, interprets +them according to a format, and stores the results in its arguments. +Each expects as arguments +a control string +.I format, +described below, +and a set of +arguments, normally pointers, +indicating where the converted input should be stored. +.PP +The +control string +usually contains +conversion specifications, which are used to direct interpretation +of input sequences. +The control string may contain: +.TP 4 +1. +Blanks, tabs or newlines, +which match optional white space in the input. +.TP 4 +2. +An ordinary character (not +.LR % ) +which must match +the next character of the input stream. +.TP 4 +3. +Conversion specifications, consisting of the +character +.BR % , +an optional assignment suppressing character +.BR * , +an optional numerical maximum field width, and a conversion +character. +.PP +A conversion specification directs the conversion of the +next input field; the result +is placed in the variable pointed to by the corresponding argument, +unless assignment suppression was +indicated by +.BR * . +Conversions other than +.L c +and +.L [ +skip white space and consume +non-white-space characters up +to the next inappropriate character or until the field +width, if specified, is exhausted. +The field width is either an integer constant or +.LR ! . +In the latter case, the width is taken from an integer argument +that precedes the next pointer argument. +.PP +The conversion character indicates the interpretation of the +input field; the corresponding pointer argument must +usually be of a restricted type. +The following conversion characters are legal: +.TP 4 +.B % +A single +.L % +is expected +in the input at this point; +no assignment is done. +.TP 4 +.B d +A decimal integer is expected; +the corresponding argument should be an integer pointer. +.TP 4 +.B o +an octal integer is expected; +the corresponding argument should be an integer pointer. +.TP 4 +.B x +A hexadecimal integer is expected; +the corresponding argument should be an integer pointer. +.ti -0.2i +.TP 4 +.B s +A character string is expected; +the corresponding argument should be a character pointer +pointing to an array of characters large enough to accept the +string and a terminating +.LR \e0 , +which will be added. +The input field is terminated by a space character +or a newline. +.TP 4 +.B c +A character is expected; the +corresponding argument should be a character pointer. +If a field width is given, the corresponding argument +should refer to a character array, and the +indicated number of characters is read. +.ne3 +.TP 4 +.B e +.br +.ns +.TP +f +A +floating point number is expected; +the next field is converted accordingly and stored through the +corresponding argument, which should be a pointer to a +.IR float . +The input format for +floating point numbers is +an optionally signed +string of digits +possibly containing a decimal point, followed by an optional +exponent field consisting of an +.B E +or +.B e +followed by an optionally signed integer. +.ne 3 +.TP 4 +.B [ +.br +.ns +.TP +.B [^ +A character string is expected. +The left bracket (or bracket and circumflex) +is followed by a set of characters and a right +bracket. +When the set is introduced by +.B [ +(or +.BR [^ ), +the string consists only +of characters in (or not in) the set. +The corresponding argument must point to a character array. +.PP +The conversion characters +.BR d , +.B o +and +.B x +may be preceded by +.B l +to indicate that a pointer to +.B long +rather than to +.B int +is in the argument list. +Similarly, the conversion characters +.B e +or +.B f +may be preceded by +.B l +to indicate a pointer to +.B double +rather than to +.BR float . +The conversion characters +.BR d , +.B o +and +.B x +may be preceded by +.B h +to indicate a pointer to +.BR short . +.PP +The +.I scanf +functions return the number of successfully matched and assigned input +items. +This can be used to decide how many input items were found. +The constant +.SM +.B EOF +is returned upon end of input; note that this is different +from +.LR 0 , +which means that no conversion was done; +if conversion was intended, it was frustrated by an +inappropriate character in the input. +.PP +For example, the call +.nf +.ft L + int i; float x; char name[50]; + scanf("%d%f%s", &i, &x, name); +.fi +.ft P +.PP +with the input line +.IP +.L +25 54.32E\(mi1 thompson +.PP +will assign to +.I i +the value +.LR 25 , +.I x +the value +.LR 5.432 , +and +.I name +will contain +.LR thompson\e0 . +Or, +.nf +.ft L + int i; float x; char name[50]; + scanf("%2d%f%*d%[1234567890]", &i, &x, name); +.fi +.ft P +.PP +with input +.IP +\fL56789 0123 56a72\fP +.PP +will assign +.L 56 +to +.IR i , +.L 789.0 +to +.IR x , +skip +.LR 0123 , +and place the string +.L 56\e0 +in +.IR name . +The next call to +.I getchar +will return +.LR a . +.SH "SEE ALSO" +.IR atof (3), +.IR stdio (3) +.SH DIAGNOSTICS +The +.I scanf +functions return +.B EOF +on end of input, +and a short count for missing or illegal data items. +.SH BUGS +The success of literal matches and suppressed +assignments is not directly +determinable. +.br +There is no +.LR %# . +.br +When no maximum field width is given in a +.L %s +or +.L %[] +conversion specification, improper input can +overrun the output string and corrupt the program in +arbitrarily malicious ways. +The best alternative, +.LR %!s , +is nonstandard. +.br +A deprecated usage allows upper-case conversion characters +as equivalents for lower-case characters preceded by +.LR l . diff --git a/static/unix-v10/man3/setbuf.3 b/static/unix-v10/man3/setbuf.3 new file mode 100644 index 00000000..2e9c8aa6 --- /dev/null +++ b/static/unix-v10/man3/setbuf.3 @@ -0,0 +1,46 @@ +.TH SETBUF 3S +.CT 2 file_io +.SH NAME +setbuf \(mi assign buffering to a stream +.SH SYNOPSIS +.nf +.B #include <stdio.h> +.PP +.B setbuf(stream, buf) +.B FILE *stream; +.B char buf[BUFSIZ]; +.fi +.SH DESCRIPTION +.I Setbuf +is used after a stream has been opened but before it +is read or written. +It causes the character array +.I buf +to be used instead of an automatically allocated buffer. +If +.I buf +is the constant pointer +.LR NULL , +input/output will be completely unbuffered. +.PP +A buffer is normally obtained from +.IR malloc (3) +upon the first +.IR getc (3) +or +.IR putc +on the file. +Initially, +the standard stream +.I stderr +is unbuffered, +and the standard stream +.I stdout +is flushed automatically +whenever new data is read by +.IR getc . +The latter magic may be dissolved by a call to +.IR setbuf . +.SH "SEE ALSO" +.IR stdio (3), +.IR malloc (3) diff --git a/static/unix-v10/man3/setfil.3 b/static/unix-v10/man3/setfil.3 new file mode 100644 index 00000000..3bcbea96 --- /dev/null +++ b/static/unix-v10/man3/setfil.3 @@ -0,0 +1,34 @@ +.th SETFIL III 10/29/73 +.sh NAME +setfil \*- specify Fortran file name +.sh SYNOPSIS +.ft B +call setfil ( \fRunit\fB, \fRhollerith-string\fB ) +.ft R +.sh DESCRIPTION +.it Setfil +provides a primitive way to associate +an integer I/O +.it unit +number with a file named by the +.it hollerith-string. +The end of the file name is indicated by a blank. +Subsequent I/O on this unit number will refer to +file whose name is specified by +the string. +.s3 +.it Setfil +should be called only before any I/O has been done on the +.it unit, +or just after doing a +.bd rewind +or +.bd endfile. +It is ineffective for unit numbers 5 and 6. +.sh "SEE ALSO" +fc (I) +.sh BUGS +There is still no way to receive a file name +or other argument from the command line. +Also, the exclusion of units 5 and 6 is +unwarranted. diff --git a/static/unix-v10/man3/setjmp.3 b/static/unix-v10/man3/setjmp.3 new file mode 100644 index 00000000..e3bde1b9 --- /dev/null +++ b/static/unix-v10/man3/setjmp.3 @@ -0,0 +1,42 @@ +.TH SETJMP 3 +.CT 2 proc_man +.SH NAME +setjmp, longjmp \(mi non-local goto +.SH SYNOPSIS +.nf +.B #include <setjmp.h> +.PP +.B setjmp(env) +.B jmp_buf env; +.PP +.B longjmp(env, val) +.B jmp_buf env; +.fi +.SH DESCRIPTION +These routines are useful for dealing with errors +and interrupts encountered in +a low-level subroutine of a program. +.PP +.I Setjmp +saves its stack environment in +.I env +for later use by +.I longjmp. +It returns value 0. +.PP +.I Longjmp +restores the environment saved by the last call of +.IR setjmp . +It then causes execution to +continue as if the call of +.I setjmp +had just returned with value +.IR val . +The invoker of +.I setjmp +must not itself have returned in the interim. +All accessible data have values as of the time +.I longjmp +was called. +.SH "SEE ALSO" +.IR signal (2) diff --git a/static/unix-v10/man3/setlimits.3 b/static/unix-v10/man3/setlimits.3 new file mode 100644 index 00000000..b359357a --- /dev/null +++ b/static/unix-v10/man3/setlimits.3 @@ -0,0 +1,58 @@ +.TH SETLIMITS 3 SHARE +.SH NAME +setlimits \- set limits structure +.SH SYNOPSIS +.B #include <sys/types.h> +.br +.B #include <sys/lnode.h> +.P +.B setlimits(limits) +.br +.B struct lnode *limits; +.SH DESCRIPTION +This library routine sets an in\-core limits structure. +If necessary, it also sets any group limits structures. +.I Limits +points to an +.IR lnode . +.PP +The +.I lnode +pointed to by the argument +.I limits +is first examined to see if its scheduling group is +.IR root . +If not, +the +.I lnode +for the group is obtained (via +.IR getshares (3)) +and passed to a recursive call to +.IR setlimits . +Finally the original +.I lnode +is set with the +.SM L_SETLIM +call to the +.IR limits (2) +system call. +.PP +If the details for any group encountered cannot be found in the +.I limits +data-base, then the group is set to +.IR root . +.PP +Note that the +.I /etc/shares +file may be left open by this routine. +.SH DIAGNOSTICS +As for the +.IR limits (2) +system call. +.P +Any error cause a -1 to be returned. +.SH "SEE ALSO" +limits(2), +closeshares(3), +getshares(3), +setupshares(3). diff --git a/static/unix-v10/man3/setupgroups.3 b/static/unix-v10/man3/setupgroups.3 new file mode 100644 index 00000000..c58656bf --- /dev/null +++ b/static/unix-v10/man3/setupgroups.3 @@ -0,0 +1,30 @@ +.TH SETUPGROUPS 3 +.SH NAME +setupgroups \- set access group vector for invoker +.SH SYNOPSIS +.B setupgroups(name, gid) +.br +.B char *name; +.br +.B int gid; +.SH DESCRIPTION +This library routine sets up the invoker's access group vector +by searching the +.I /etc/group +file for groups matching +.IR name . +The invokers real group ID should be passed in +.IR gid , +as there is no need to load this into the vector. +.PP +.I Setgroups +returns 0 for success, or \-1 on error with +.I errno +set appropriately. +.PP +This routine is safe to use on systems +where the multiple access groups system calls have not been installed. +.SH "SEE ALSO" +setgroups(2), +getgrent(3), +login(8). diff --git a/static/unix-v10/man3/setupshares.3 b/static/unix-v10/man3/setupshares.3 new file mode 100644 index 00000000..0185279a --- /dev/null +++ b/static/unix-v10/man3/setupshares.3 @@ -0,0 +1,51 @@ +.TH SETUPSHARES 3 SHARE +.SH NAME +setupshares \- set kernel shares for a user +.SH SYNOPSIS +.B setupshares(uid, efp) +.br +.B int uid; +.br +.B void (*efp)(); +.SH DESCRIPTION +This library routine sets up a kernel shares structure +for the user represented by +.IR uid . +It extracts the share details for the user from the shares data-base, +decays the usage figure up to the current time, +and uses +.IR setlimits (3) +to install the shares in the kernel. +.PP +If the system is out of +.I lnode +structures, then the structure for the default user ``other'' is used. +If this also fails, then the structure for the super-user is used. +.PP +If there are any errors, and the second argument is non-NULL, +the function will be called with a +.IR printf (3) +format string and at most one extra argument. +A non-zero result is returned for un-recoverable errors. +Otherwise, +.I setupshares +returns \fB0\fP. +.PP +This routine is safe to use on systems +where the share scheduler has not been installed, +or is inactive. +.SH DIAGNOSTICS +.I Setupshares +returns a non-zero result if +.IR setlimits (3) +returns an error other than +.SM ETOOMANYU. +The optional error routine is called if +.IR setlimits (3) +returns any error, +or if no shares have been allocated to the user. +.SH "SEE ALSO" +getshares(3), +closeshares(3), +setlimits(3), +share(5). diff --git a/static/unix-v10/man3/sfio.3 b/static/unix-v10/man3/sfio.3 new file mode 100644 index 00000000..2477e875 --- /dev/null +++ b/static/unix-v10/man3/sfio.3 @@ -0,0 +1,628 @@ +.TH SFIO 3 "21 August 1990" +.SH NAME +\fBsfio\fR \- safe/fast string/file input/output +.SH SYNOPSIS +.ta .75i 1.5i 2.25i 3i 3.75i 4.5i 5.25i 6i +.PP +.nf +.ft 5 +#include <sfio.h> + +#define uchar unsigned char +#define uint unsigned int +#define ulong unsigned long + +Sfile_t* sfnew(Sfile_t* f, uchar* buf, int size, int fd, int flags); +Sfile_t* sfopen(Sfile_t* f, char* string, char* mode); +Sfile_t* sfdopen(int fd, char* mode); +Sfile_t* sfpopen(char* cmd, char* mode, Sfile_t** fcomp); +Sfile_t* sfstack(Sfile_t* base, Sfile_t* top); +Sfile_t* sfpushed(Sfile_t* f); +Sfile_t* sftmp(int size); + +int sfpool(Sfile_t* f, Sfile_t* poolf, int mode); +Sfdisc_t* sfsetdisc(Sfile_t* f, Sfdisc_t* disc); + +int sfclose(Sfile_t* f); +int sfsync(Sfile_t* f); + +int sfpeek(Sfile_t* f, uchar** bufp); + +int sfgetc(Sfile_t* f); +int sfungetc(Sfile_t* f, int c); +ulong sfgetu(Sfile_t* f); +long sfgetl(Sfile_t* f); +double sfgetd(Sfile_t* f); +char* sfgets(Sfile_t* f, char* buf, int size); +int sfread(Sfile_t* f, uchar* buf, int n); +int sfscanf(Sfile_t* f, char* format, ...); +int sfsscanf(char* s, char* format, ...); +int sfvscanf(Sfile_t* f, char* format, va_list args); + +int sfputc(Sfile_t* f, int c); +int sfnputc(Sfile_t* f, int c, int n); +int sfputu(Sfile_t* f, ulong v); +int sfputl(Sfile_t* f, long v); +int sfputd(Sfile_t* f, double v); +int sfputs(Sfile_t* f, char* s, int c); +int sfwrite(Sfile_t* f, uchar* buf, int n); +int sfmove(Sfile_t* fr, Sfile_t* fw, long n, char* seps); +int sfprintf(Sfile_t* f, char* format, ...); +int sfsprintf(char* s, int size, char* format, ...); +int sfvprintf(Sfile_t* f, char* format, va_list args); + +void sfnotice(void (*noticef)(Sfile_t* f, int type)); +int sfset(Sfile_t* f, int flags, int i); +uchar* sfsetbuf(Sfile_t* f, uchar* buf, int size); +int sffileno(Sfile_t* f); +int sfeof(Sfile_t* f); +int sferror(Sfile_t* f); +int sfclearerr(Sfile_t* f); +int sfclrlock(Sfile_t* f); +int sfslen(); +int sfulen(ulong v); +int sfllen(long v); +int sfdlen(double v); + +long sforigin(Sfile_t* f); +long sfseek(Sfile_t* f, long addr, int offset); +long sftell(Sfile_t* f); + +char* sfecvt(double v, int n, int* decpt, int* sign); +char* sffcvt(double v, int n, int* decpt, int* sign); +.fR +.fi +.SH DESCRIPTION +.PP +\fIsfio\fP is a library of functions to perform input/output on +objects called \fIsfio\fP streams. +Each \fIsfio\fP stream may correpond to some file descriptor (see \fIopen(2)\fP) +or some piece of primary memory. +A notion of stream stack is supported for +processing of data from complexes of streams. +Streams can be pooled so that their buffers can be synchronized +properly when switching streams for io. +It is also possible to change io disciplines by setting alternative +functions for read, write and seek. +.PP +A stream abstraction is represented by the type \f5Sfile_t\fP which +is defined in the header file \f5<sfio.h>\fP. A stream is locked while +it is being accessed by some \fIsfio\fP function. A locked stream +cannot be further accessed by operations that may change its internal states +(see \f5sfclrlock()\fP). Any such access fails and returns +an appropriate error code. +.PP +During an io request, if +a system call \f5read\fP or \f5write()\fP (or their +discipline counterparts) is interrupted, +unless a discipline function has been defined to process it, +the calling \fIsfio\fP function will resume the respective system call as necessary. +The interrupt condition is defined by \f5errno\ ==\ EINTR\fP (see \f5errno.h\fP). +To prevent infinite loops, this condition is always cleared before +the system call is resumed. +.PP +In general, \fIsfio\fP functions either return integer or pointer values. +In the event of an error, a function that returns integer value will +return \f5-1\fP while a function that returns a pointer value will return +\f5NULL\fP. +.PP +A number of bit flags define stream types and their operations. +Following are the flags: +.IP +\f5SF_READ\fP: +The stream is readable. +.IP +\f5SF_WRITE\fP: +The stream is writable. +.IP +\f5SF_STRING\fP: +The stream is a string (a byte array) that +is readable if \f5SF_READ\fP is specified or +writable if \f5SF_WRITE\fP is specified. +.IP +\f5SF_APPEND\fP: +The stream is a file opened for appending data. +This means that data written to the stream is always +appended at the end of the file. +On operating systems where there is no primitive to specify +at file opening time that a file is opened for append only, +\f5lseek()\fP (or its discipline replacement) will be used on +the file stream to approximate this behavior. +.IP +\f5SF_RELATIVE\fP: +If the stream corresponds to a file, +no seek is allowed backward beyond the starting point as defined +by \f5lseek(fd,0L,1)\fP (or its discipline replacement) +when the stream is initialized by \f5sfnew()\fP (below). +.IP +\f5SF_LINE\fP: +The stream is line-oriented. For write-streams, this means that the +buffer is flushed whenever a new-line character is output. +For read-streams, this means that \f5sfpeek()\fP (below) will return +a buffer of data which ends with a new-line. Note that the amount of +data that can be returned is limited by the buffer size. +.IP +\f5SF_KEEPFD\fP: +The file descriptor of the stream will be kept opened when the stream is closed. +.IP +\f5SF_MALLOC\fP: +To indicate that the stream buffer was obtained via \f5malloc()\fP +and can be reallocated or freed by the package. +.IP +\f5SF_REUSE\fP: +This flag can be set (\f5sfset()\fP so that when the stream is closed, +its data structure and associated information such as pool and discipline +is not destroyed. +It can also be used in a call to \f5sfnew()\fP (see below). +.IP +\f5SF_SHARE\fP: +This flag indicates that the associated stream is a file stream that may +be operated on by means beyond straightforward \fIsfio\fP usage (e.g., +by multiple processes). +In this case, each io system call (or its discipline replacement) will be +preceded by a \f5lseek()\fP (or its discipline replacement) to ensure that +the logical stream location corresponds to the physical file location. +.PP +\f5sfnew(f,buf,size,fd,flags)\fP +is the primitive for creating or renewing streams. +For file streams, a number of operations are performed to determine +seekability, optimal buffer sizes if not specified, etc. +Each stream has a origin. +The origin of a \f5SF_STRING\fP stream is always \f50L\fP. +If a file stream is not seekable, its origin is defined as \f5-1L\fP. +Otherwise, its origin is defined as either the current location or \f50L\fP +depending on whether or not the flag \f5SF_RELATIVE\fP is turned on. +\f5sfseek()\fP operations are relative to this location. +The argument \f5f\fP of \f5sfnew()\fP, if not \f5NULL\fP, is a stream to be modified. +If it is \f5NULL\fP, a new stream is created. +The argument \f5buf\fP, if not \f5NULL\fP, is a buffer to be used. +In this case, \f5size\fP should be positive. +If \f5size\fP is 0, the stream is unbuffered. +If \f5size\fP is negative, \fIsfio\fP will allocate a buffer. +The argument \f5fd\fP is a file descriptor (e.g., from \fIopen()\fP) +for io operations if the stream is not an \f5SF_STRING\fP stream. +The last argument \f5flags\fP is a bit vector composing from the flags described above. +The \f5SF_REUSE\fP flag, if given, indicates that the current attributes +of the stream \f5f\fP should be used instead of whatever else is defined by \f5flags\fP. +.PP +\f5sfopen(f,string,mode)\fP +is a high-level function based on \f5sfnew()\fP to create new streams from files +or strings. +The argument \f5f\fP for \f5sfopen()\fP, +if not \f5NULL\fP, is a currently opened stream to be +closed and replaced by a new stream corresponding to the object \f5string\fP. +The argument \f5mode\fP can be any one of: \f5"r"\fP, \f5"r+"\fP, +\f5"w"\fP, \f5"w+"\fP, \f5"a"\fP, \f5"a+"\fP, \f5s\fP and \f5s+\fP. +The \f5r\fP, \f5w\fP, and \f5a\fP specify read, write and append mode for file streams. +In these cases, the argument \f5string\fP defines a path name to a file. +The \f5s\fP specifies that \f5string\fP is a nul-terminated string to be opened for read. +The \f5+\fP means that the new stream will be opened for both reading and writing. +.PP +\f5sfdopen(fd,mode)\fP makes a stream using the file descriptor \f5fd\fP. +The \f5mode\fP argument is used in the same way as in \f5sfopen()\fP. +.PP +\f5sfpopen(cmd,mode,fcomp)\fP +opens a stream \f5f\fP which is a pipe to (from) the command \f5cmd\fP +if the mode is \f5"w"\fP (\f5"r"\fP). If the mode is \f5"w+"\fP or \f5"r+"\fP, +another stream for the opposite operation is created and returned in \f5fcomp\fP. +Note that if either of these streams is closed, the other is also closed. +.PP +\f5sfstack(base,top)\fP is used to push or pop stream stacks. +Each stream stack is identified by a \f5base\fP stream +via which all io operations are performed. +Other streams on the stack are locked so that operations that may change +their internal states are forbidden. +The type of operations that can be done on a stack is defined by +the top level stream. If an io operation is performed and the top level stream +reaches the end of file condition or an error condition other than interrupts, +it is automatically popped and closed (see also \f5sfsetdisc\fP for alternative +handling of these conditions). +The first argument of \f5sfstack()\fP specifies the \f5base\fP stream. +The second argument, \f5top\fP, if not \f5NULL\fP, +is pushed on top of the current top stream. +In this case, the \f5base\fP stream pointer is returned. +If \f5top\fP is \f5NULL\fP, the stack is popped and the pointer to +the popped stream is returned. +.PP +\f5sfpushed(f)\fP returns the pointer to the stream pushed below \f5f\fP. +.PP +\f5sftmp(size)\fP creates a stream for writing and reading temporary data. +If \f5size\fP is negative, the stream is a pure \f5SF_STRING\fP stream. +Otherwise, the stream is originally created as a \f5SF_STRING\fP stream +with a buffer of the given \f5size\fP. A discipline is set so that +when this buffer is exhausted, a real temporary file will be created. +Any attempt to change this discipline will also cause the temporary file +to be created. +.PP +\f5sfpool(f,poolf,mode)\fP manages pools of streams. +In a pool of streams, only one stream is current. +A stream becomes current when it is used for some io operation. +When a new stream is to become current, +the current stream is synchronized (see \f5sfsync()\fP) +if its type matches the type of the pool. +The first argument of \f5sfpool()\fP, \f5f\fP, is the stream to be manipulated. +The second argument, \f5poolf\fP, determines the operation to be done on \f5f\fP. +If \f5poolf\fP is \f5NULL\fP, \f5f\fP is deleted from its current pool. +Otherwise, \f5f\fP is put into the same pool with \f5poolf\fP. +If \f5poolf\fP is already in a pool, the third argument is ignored. +Otherwise, it determines the type of the new pool. +\f5mode\fP can be constructed by bitwise or-ing of \f5SF_READ\fP and \f5SF_WRITE\fP. +.PP +\f5sfsetdisc(f,disc)\fP changes +the io-discipline of the stream \f5f\fP, i.e., +to specify alternative functions for read, write, seek, and to handle exceptions. +The default discipline consists of the system calls \f5read()\fP, \f5write()\fP, +and \f5lseek()\fP. +The \f5disc\fP argument is either \f5NULL\fP to reset to the default discipline +or a pointer to a \f5Sfdisc_t\fP structure which contains the following fields: +.PP +.nf + \f5int (*readf)();\fP + \f5int (*writef)();\fP + \f5long (*seekf)();\fP + \f5int (*exceptf)();\fP + \f5void* handle;\fP +.fi +.PP +The first three fields of \f5Sfdisc_t\fP specify alternative io functions. +If any of them is \f5NULL\fP, the corresponding system call is used. +A discipline io function, say \f5(*readf)()\fP, +is called with 4 arguments. +The first argument is the stream pointer. +The second and third arguments correspond to the second and third arguments +of the respected system call. +The fourth argument is the \f5handle\fP field of \f5Sfdisc_t\fP. +The exception function, \f5(*exceptf)()\fP, if provided, is called +when an exception happens during a read/write operation, when a stream +is being closed, or when the discipline is being reset. +A read/write operation is said to cause an exception if its return value +is zero or negative. It is up to the exception function to determine +the type of exception (for example, by examining \f5errno\fP). +When \f5(*exceptf)()\fP is called, the stream will be opened for general operations. +However, \f5(*exceptf)()\fP should not attempt to close the stream. +\f5(*exceptf)()\fP is called as: +\f5(*exceptf)(f,type,handle)\fP. \f5type\fP is: +\f50\fP when the discipline is being reset, +\f5SF_EOF\fP when the stream is being closed, +\f5SF_READ\fP when an exception happens during a read operation, and +\f5SF_WRITE\fP when an exception happens during a write operation. +For the cases of \f5SF_READ\fP and \f5SF_WRITE\fP, +the executing \fIsfio\fP function will examine the return value of \f5(*exceptf)()\fP +for further actions: +\fInegative\fP for immediate return, +\fIzero\fP for executing default actions associated with the exception, +and \fIpositive\fP for resuming execution. +Note that a \f5SF_STRING\fP stream does not perform external io so the +io functions are not used. However, an exception occurs whenever +an io operation exceeds the stream buffer boundary and +\f5(*exceptf)()\fP, if defined, will be called as appropriate. +\f5sfsetdisc()\fP returns the pointer to the previous discipline +or \f5NULL\fP if an error happened. +Finally, it is the application's responsibility to manage the space used +by the \f5Sfdisc_t\fP structures. +.PP +\f5sfclose(f)\fP closes the given stream \f5f\fP and frees up its resources. +If \f5f\fP is \f5NULL\fP, all streams are closed. +If \f5f\fP is a stack of streams, all streams on the stack are closed. +If \f5f\fP is a \f5sfpopen\fP-stream, its companion stream, if any, is also closed. +Further, \f5sfclose()\fP will wait until the associated command terminates, +then return its exit status. +A few file flags affect the behavior of \f5sfclose()\fP. +If \f5SF_KEEPFD\fP is on, the underlying file descriptor is not closed. +If \f5SF_REUSE\fP is on, \f5sfclose()\fP will only synchronize the buffer +and close the file descriptor (subject to \f5SF_KEEPFD\fP). +The stream structure is left intact, including +pool (\f5sfpool()\fP) or discipline (\f5sfsetdisc()\fP) information. +.PP +\f5sfsync(f)\fP causes the physical file pointer of the stream +\f5f\fP to correspond to its logical position. +If \f5f\fP is the base of a stack of streams, all streams on the stack +are synchronized. Further, a stacked stream can only be synchronized +via its base stream. +.PP +\f5sfpeek(f,bufp)\fP provides a safe method for enquiring +information on the internal buffer of a stream. +If \f5bufp\fP is \f5NULL\fP, \f5sfpeek()\fP simply returns the amount of data +available in the buffer to read if \f5f\fP is in read mode +or the amount of buffer available to write if \f5f\fP is in write mode. +If \f5bufp\fP is not \f5NULL\fP, \f5sfpeek()\fP provides access to the buffer. +For a read stream, if the buffer is empty, it is filled and, +for a write-stream, if the buffer is full, it is flushed. +Then, for a read stream, \f5bufp\fP is set to the place in the buffer +where data is available and, for a write stream, +it is set to where data can be written. +The return value of \f5sfseek()\fP indicates how much data or space is available +in the buffer. However, if the stream is in \f5SF_LINE|SF_READ\fP mode, +the return value will be the data length up to and including the new-line character. +In this case, if there is not a new-line character in the buffered data, +more data may be read. +Note that the buffer location is not advanced by \f5sfpeek()\fP. +That must be done by a regular io call such as \f5sfread\fP or \f5sfwrite\fP on +the pointer returned in \f5bufp\fP. +Finally, \f5sfpeek()\fP treats a read/write-stream like a read-stream +(however, see also \f5sfset()\fP). +.PP +\f5sfgetc(f)\fP returns a byte from the stream \f5f\fP or -1 when an end-of-file +or error condition is encountered. +.PP +\f5sfungetc(f,c)\fP puts the byte \f5c\fP back into the stream \f5f\fP. +This is guaranteed to work only after a \f5sfgetc()\fP call. +.PP +\f5sfgetu(f)\fP, \f5sfgetl(f)\fP, and \f5sfgetd(f)\fP return +an \fIunsigned long\fP, a \fIlong\fP value, or a \fIdouble\fP value +that was coded in a portable fashion +(see \f5sfputu()\fP, \f5sfputl()\fP, and \f5sfputd()\fP). +If there is not enough data to decode a value, +these functions will return \f5-1\fP and the stream is set in an error state +(\f5see \f5sferror()\fP). +.PP +\f5sfgets(f,buf,size)\fP reads a line of input from the stream \f5f\fP. +If \f5buf\fP is not \f5NULL\fP and \f5size\fP is positive, \f5sfgets\fP +reads up to \f5size-1\fP characters into the buffer \f5buf\fP. +Otherwise, the characters are read into a static area that is dynamically +grown as necessary. Thus, in this case, there is no limit to line length. +A nul-character is appended after the input characters. +\f5sfgets()\fP returns the pointer to the new string or \f5NULL\fP when +no data was read due to end-of-file or an error condition. +After a string is read, its length can be found using \f5sfslen()\fP. +.PP +\f5sfread(f,buf,n)\fP reads up to \f5n\fP bytes from the stream \f5f\fP and +stores them in the given buffer \f5buf\fP. +It returns the number of bytes actually read. +.PP +\f5sfscanf(f,format,...)\fP scans a number of items from the stream \f5f\fP. +The item types are determined from the string \f5format\fP. +See \fIfscanf()\fP (UNIX User's Manual, Section 3) for details on predefined formats. +The standardly supported formats are: +\f5i, I, d, D, u, U, o, O, x, X, f, F, e, E, g, G, c, %, s,\fP and \f5[]\fP. +The \f5sfscanf()\fP interface also supports additional formats as described below. +.IP +The pattern \f5%&\fP indicates that the next argument in the argument list of +\f5sfscanf()\fP is a function, say \f5(*extf)()\fP, to process patterns that are not +predefined by the \f5sfscanf()\fP interface. +The prototype of \f5(*extf)()\fP is: +.nf + \f5int (*extf)(Sfile_t* f, int fmt, int length, char** rv);\fP +.fi +\f5f\fP is the same input stream passed to \f5sfvscanf\fP. +\f5fmt\fP is the pattern to be processed. +\f5length\fP, if non-negative, is the maximum number of input bytes +to be read in processing the pattern, +\f5rv\fP is used to return the ``address'' of the value to be assigned. +\f5(*extf)()\fP returns the size of the value to be assigned. +A negative return value from \f5(*extf)()\fP means that the specified pattern +cannot be handled. This pattern is treated as if it is not matched. +.IP +The pattern \f5%@\fP indicates that the next argument in the argument list \f5args\fP +is a function, say \f5(*argf)()\fP, to process the values of matched patterns. +The prototype of \f5(*argf)()\fP is: +.nf + \f5int (*argf)(int fmt, char* value, int n)\fP; +.fi +If the return value of \f5(*argf)()\fP is negative, the processing +of the current format string will be stopped (see \f5%$\fP below). +\f5fmt\fP determines the type of \f5value\fP: \f5f\fP for \fIfloat\fP, +\f5F\fP for \fIdouble\fP, \f5h\fP for \fIshort\fP, \f5d\fP for \fIint\fP, +\f5D\fP for \fIlong\fP, \f5s\fP for \fIchar*\fP. Any other value for \f5fmt\fP +means that it is an extended pattern and \f5value\fP contains an address +to the scanned value. \f5n\fP contains the size of the object if it is a +primitive type. If the object is \f5char*\fP or the address of the scanned +value of an extended format, \f5n\fP is the length of this object. +.IP +The pattern \f5%:\fP indicates that the next two arguments in the argument list +\f5args\fP define a new pair of format string and a list of arguments of +the type \f5va_list\fP (see \f5varargs.h\fP or \f5stdarg.h\fP). +The new pair is pushed on top of the stack and the scanning process continues with them. +The top pair of format string and argument list is popped when the processing +of the format string is stopped. When a new pair is stacked, +\f5(*argf)()\fP and \f5(*extf)()\fP are inherited. +They are reset when the stack is popped. +.PP +\f5sfsscanf(s,format,...)\fP is similar to \f5sfscanf()\fP +but it scans data from the string \f5s\fP. +.PP +\f5sfvscanf(f,format,args)\fP is the primitive underlying \f5sfscanf()\fP +and \f5sfscanf()\fP. It also provides a portable variable argument interface. +Programs that use \f5sfvscanf()\fP must include either of \f5varargs.h\fP +or \f5stdargs.h\fP as appropriate. +.PP +\f5sfputc(f,c)\fP writes the byte \f5c\fP to the stream \f5f\fP. +.PP +\f5sfnputc(f,c,n)\fP writes the byte \f5c\fP to the stream \f5f\fP \f5n\fP times. +It returns the number of bytes successfully written. +.PP +\f5sfputu(f,v)\fP, \f5sfputl(f,v)\fP write the \fIunsigned long\fP or \fIlong\fP +value \f5v\fP in a format that is byte-order transparent. +\f5sfputd(f,v)\fP writes the \fIdouble\fP value \f5v\fP in a portable format. +Portability across two different machines +requires that the bit order in a byte is the same on both machines. +\f5sfputd()\fP also relies on the functions \f5ldexp()\fP and \f5frexp()\fP +(See \fIfrexp.3\fP) for coding. +Upon success, \f5sfputu()\fP, \f5sfputl()\fP and \f5sfputd()\fP +return the number of bytes output. +.PP +\f5sfputs(f,s,c)\fP writes the null-terminated string \f5s\fP to the stream \f5f\fP. +If \f5c\fP is not 0, it is a character to be appended after the string has been output. +\f5sfputs()\fP returns the number of bytes written. +.PP +\f5sfwrite(f,buf,n)\fP writes out \f5n\fP bytes from the buffer \f5buf\fP to the +stream \f5f\fP. It returns the number of bytes written. +.PP +\f5sfmove(fr,fw,n,seps)\fP moves \f5n\fP objects +from the stream \f5fr\fP to the stream \f5fw\fP. +If either \f5fr\fP or \f5fw\fP is \f5NULL\fP, it acts +as if it is a stream corresponding to \fI/dev/null\fP. +If \f5n\fP is \f5<0\fP, all of \f5fr\fP is moved. +If \f5seps\fP is \f5NULL\fP or an empty string, the objects to be moved are bytes. +Otherwise, the moved objects are records separated by bytes defined in \f5seps\fP. +In \f5seps\fP, if the first two bytes is \f5\e0\fP, it is mapped to the zero byte. +All other cases map a byte to itself. +\f5sfmove()\fP returns the number of objects moved. +.PP +\f5sfprintf(f,format,...)\fP writes out data in +a format as defined by the string \f5format\fP. +See \fIfprintf()\fP (UNIX User's Manual, Section 3) for details on predefined +conversion formats. +The standardly supported formats are: +\f5n, s, c, %, h, i, d, p, u, o, x, X, g, G, e, E, f,\fP and \f5F\fP. +\f5sfprintf()\fP also supports additional formats as described below. +.IP +The pattern \f5%&\fP indicates that the next argument +is a function, say \f5(*extf)()\fP, to interpret patterns not yet defined +by \f5sfprintf()\fP. +The prototype of \f5(*extf)()\fP is: +.nf + \f5int (*extf)(void* value, int fmt, int precis, char** sp);\fP +.fi +\f5value\fP is the value to be formatted. +\f5fmt\fP is the pattern to format the value. +\f5precis\fP is the amount of precision required. +\f5sp\fP is used to return the address of a string containing the formatted value. +If upon returning from \f5(*extf)()\fP, \f5*sp\fP is \f5NULL\fP, the pattern \f5fmt\fP +is treated as if it is not matched. +Otherwise, the return value of \f5(*extf)()\fP, if nonnegative, is taken as the length +of the string returned in \f5sp\fP. If not, the string is considered null-terminated. +The string \f5*sp\fP is processed as if the pattern \f5`s'\fP was specified. +.IP +The pattern \f5%@\fP indicates that the next argument is a function, say \f5(*argf)()\fP, +to get arguments. As long as \f5(*argf)()\fP is defined, the argument list is ignored. +The prototype of \f5(*argf)()\fP is: +.nf + \f5int (*argf)(int fmt, char* val)\fP; +.fi +\f5fmt\fP is the pattern to be processed. +Following are ASCII characters and corresponding types: +\f5@\fP for getting a new \f5(*argf)()\fP, +\f5&\fP for getting a new \f5(*extf)()\fP, +\f51\fP for getting a new format string for stacking, +\f52\fP for getting a new argument list for stacking, +\f5d\fP for \fIint\fP, +\f5D\fP for \fIlong\fP, +\f5f\fP for \fIfloat\fP, +\f5F\fP for \f5double\fP, and +\f5s\fP for \fIchar*\fP. +If \f5(*extf)()\fP is defined, and an undefined pattern is encountered, +\f5(*argf)()\fP will be called with this pattern. +\f5val\fP is an address to store the value to be formatted. +The return value of \f5(*argf)()\fP, if negative, stops the processing +of the current format (see below). +.IP +The pattern \f5%:\fP indicates that the next two arguments define +a pair of format string and argument list of the type \f5va_list\fP. +If the argument getting function \f5(*argf)()\fP is already defined, +it is called with the argument \f5fmt\fP being the characters +\f51\fP and \fP2\fP for the new format string and argument list respectively. +The new pair is stacked on top and processing continue from there. +The top pair of format string and argument is popped when the format string +is exhausted. When a new pair is pushed, \f5(*argf)()\fP and \f5(*extf)()\fP +are inherited. When a pair is popped, these functions will be reset. +.PP +\f5sfsprintf(s,size,format,...)\fP is similar to \f5sfprintf()\fP +but it is used to format +the character array \f5s\fP which is of size \f5size\fP. +The length of the resulting string can be gotten via \f5sfslen()\fP. +.PP +\f5sfvprintf(f,format,args)\fP is the primitive underlying \f5sfprintf()\fP +and \f5sfsprintf()\fP. It provides a portable variable argument interface. +Programs that use \f5sfvprintf()\fP must include either of \f5varargs.h\fP +or \f5stdargs.h\fP as appropriate. +.PP +\f5sfnotice(noticef)\fP sets a function \f5(*noticef)()\fP which will +be called whenever a stream is created or closed. +\f5(*noticef)()\fP is called with two arguments. +The first argument is the stream pointer and +the second argument is either \f50\fP or \f5SF_EOF\fP to indicate +whether the stream is being opened or being closed. +.PP +\f5sfset(f,flags,i)\fP sets flags or file descriptor for the stream \f5f\fP. +If \f5flags\fP is the value \f5SF_EOF\fP, the file descriptor of the stream +is changed to the value in \f5i\fP. In this case, \f5sfset()\fP returns \f5-1\fP +on error or \f5i\fP on success. +If \f5flags\fP is not \f5SF_EOF\fP, it defines a collection of flags to be +turned on or off depending on whether \f5i\fP is non-zero or zero. +The flags that can be turned on or off are: +\f5SF_READ\fP, \f5SF_WRITE\fP, +\f5SF_LINE\fP, \f5SF_KEEPFD\fP, \f5SF_REUSE\fP, \f5SF_MALLOC\fP and \f5SF_SHARE\fP. +The flags \f5SF_READ\fP and \f5SF_WRITE\fP can be used in a call to \f5sfset()\fP +only if the stream \f5f\fP was opened for both read and write. +Turning off one of these flags means that the stream is to be treated as +if it was opened with the other flag exclusively (see \f5sfpeek()\fP). +In this case, \f5sfset()\fP returns the entire set of flags controlling the stream. +Thus, the current set of flags can be found by \f5sfset(f,0,0)\fP. +.PP +\f5sfsetbuf(f,buf,size)\fP changes the current buffer of the stream \f5f\fP to +the new buffer \f5buf\fP. If the stream is a \f5SF_WRITE\fP stream, +any data still in the current buffer is thrown away. +Thus, if an application desires to preserve such data, it should +call \f5sfsync()\fP before trying to switch buffers. +If \f5size\fP is positive, \f5buf\fP is taken as a buffer of the given size. +If \f5size\fP is zero, the stream will be unbuffered. +If \f5size\fP is negative, an internal buffer is allocated. +\f5sfsetbuf()\fP returns the address of the old buffer. +.PP +\f5sffileno(f)\fP returns the file descriptor of the stream \f5f\fP. +.PP +\f5sfeof(f)\fP tells whether there is any more data in the stream \f5f\fP. +.PP +\f5sforigin(f)\fP returns the origin location in the stream \f5f\fP (see \f5sfnew()\fP). +If this location is \f5-1L\fP, the stream is not seekable. +Note that the standard streams \f5sfstdin\fP, \f5sfstdout\fP, and \f5sfstderr\fP, +though statically allocated, are not initialized until an operation that may +affect its internal structure. Thus, the return value \f50L\fP of \f5sforigin()\fP +on such an initialized stream is not reliable. +.PP +\f5sferror(f)\fP and \f5sfclearerr(f)\fP returns or clears the error condition +of the stream \f5f\fP. Note that the error condition of a stream does not prevent +further io operations to be performed on them. +.PP +\f5sfclrlock(f)\fP clears the lock on a locked stream. +Though this is unsafe, it is useful for emergency access +to a locked stream or to clear a stream left locked because +of non-local jumps (e.g., \f5longjmp()\fP). +.PP +\f5sfslen()\fP returns the length of the string most recently obtained +via a \f5sfgets()\fP, \f5sfsprintf()\fP, \f5sfecvt()\fP or \f5sffcvt()\fP call. +.PP +\f5sfulen(v)\fP, \f5sfllen(v)\fP and \f5sfdlen(v)\fP +return the number of bytes required to code the +\fIunsigned long\fP, \fIlong\fP or \fIdouble\fP value \f5v\fP. +.PP +\f5sfseek(f,addr,offset)\fP sets the next read/write location for the stream \f5f\fP +at a new address defined by the combination of \f5addr\fP and \f5offset\fP. +If \f5offset\fP is 0, \f5addr\fP is offset from the origin of the stream +(see \f5sfnew()\fP). +If \f5offset\fP is 1, \f5addr\fP is offset from the current location. +Note that if \f5f\fP was opened for appending (\f5SF_APPEND\fP) and the last operation +done on it was a write operation, the \fIcurrent location\fP is at the physical +end of file. +If \f5offset\fP is 2, \f5addr\fP is offset from the \fIphysical\fP end of the stream. +In all cases, \f5sfseek()\fP is not allowed to seek backward beyond the stream origin. +.PP +\f5sftell(f)\fP returns the current location in the stream \f5f\fP relative +to the stream origin (see \f5sfnew()\fP). +As with \f5sfseek()\fP, if \f5f\fP was opened for appending (\f5SF_APPEND\fP) +and the last operation done on it was a write operation, +the \fIcurrent location\fP is at the physical end of file. +If the stream \f5f\fP is unseekable, \f5sftell\fP returns the number of bytes +read from or written to \f5f\fP. +.PP +\f5sfecvt(v,n,decpt,sign)\fP and +\f5sffcvt(v,n,decpt,sign)\fP are functions to convert floating values to ASCII. +They corresponds to the standard functions \f5ecvt()\fP and \f5fcvt()\fP. +The length of the conversion string most recently done by +\f5sfecvt()\fP or \f5sffcvt()\fP can be found by \f5sfslen()\fP. +.PP +.SH HISTORY AND FUTURE CONSIDERATIONS +\fIsfio\fP has similar functionality, but is more general +than the \fIstdio\fP package. +It grows from our dissatisfaction with the awkwardness, fragility +and inefficiency in \fIstdio\fP. +An example of \fIstdio\fP awkwardness is that +even if a stream was opened for read and write, +the application code cannot arbitrarily mix read and write operations. +An earlier attempt was made at rewriting \fIstdio\fP. +This failed due to problems that arise when linking with code based on \fIstdio\fP. +Changing the name space reduces this type of problems. +It also allows us to both stream-line and extend the interface as appropriate. +.SH AUTHORS +Kiem-Phong Vo (att!ulysses!kpv) and David G. Korn (att!ulysses!dgk). diff --git a/static/unix-v10/man3/sharesfile.3 b/static/unix-v10/man3/sharesfile.3 new file mode 100644 index 00000000..7fa62b1a --- /dev/null +++ b/static/unix-v10/man3/sharesfile.3 @@ -0,0 +1,17 @@ +.TH SHARESFILE 3 SHARE +.SH NAME +sharesfile \- change name of shares file +.SH SYNOPSIS +.B "int sharesfile(s)" +.br +.B "char * s;" +.SH DESCRIPTION +This routine +closes the old shares file (if open) +and resets its name to the string passed. +.SH "SEE ALSO" +closeshares(3), +getshares(3), +getshput(3), +openshares(3), +putshares(3). diff --git a/static/unix-v10/man3/sin.3 b/static/unix-v10/man3/sin.3 new file mode 100644 index 00000000..80bdddb9 --- /dev/null +++ b/static/unix-v10/man3/sin.3 @@ -0,0 +1,27 @@ +.pa 1 +.he 'SIN, COS (III)'3/15/72'SIN, COS (III)' +.ti 0 +NAME sin, cos -- sine cosine +.sp +.ti 0 +SYNOPSIS jsr r5,sin (cos) +.sp +.ti 0 +DESCRIPTION The +sine (cosine) of fr0 in radians +is returned in fr0. +.sp +The magnitude of the argument should be checked +by the caller to make sure the result is meaningful. +.sp +.ti 0 +FILES kept in /lib/liba.a +.sp +.ti 0 +SEE ALSO -- +.sp +.ti 0 +DIAGNOSTICS there are none +.sp +.ti 0 +BUGS -- diff --git a/static/unix-v10/man3/sinh.3 b/static/unix-v10/man3/sinh.3 new file mode 100644 index 00000000..3e6d3b48 --- /dev/null +++ b/static/unix-v10/man3/sinh.3 @@ -0,0 +1,31 @@ +.TH SINH 3M +.CT 2 math +.SH NAME +sinh, cosh, tanh \(mi hyperbolic functions +.SH SYNOPSIS +.nf +.B #include <math.h> +.PP +.B double sinh(x) +.br +.B double x; +.PP +.B double cosh(x) +.B double x; +.PP +.B double tanh(x) +.B double x; +.fi +.SH DESCRIPTION +These functions compute the designated hyperbolic functions +for real arguments. +.SH DIAGNOSTICS +.I Sinh +and +.I cosh +return a huge value of appropriate sign +when the correct value would overflow +and set +.I errno +to +.LR EDOM . diff --git a/static/unix-v10/man3/sleep.3 b/static/unix-v10/man3/sleep.3 new file mode 100644 index 00000000..98e6e438 --- /dev/null +++ b/static/unix-v10/man3/sleep.3 @@ -0,0 +1,29 @@ +.TH SLEEP 3 +.CT 2 time_man +.SH NAME +sleep \(mi suspend execution for an interval +.SH SYNOPSIS +.nf +.B sleep(seconds) +.B unsigned seconds; +.fi +.SH DESCRIPTION +The current process is suspended from execution for the number +of seconds specified by the argument. +The actual suspension time may be up to +one +second less than +that requested, because scheduled wakeups occur at fixed +second +intervals, +and an arbitrary amount longer because of other activity +in the system. +.PP +The routine is implemented by setting an alarm clock signal +and pausing until it occurs. +The previous state of this signal is saved and restored. +If the sleep time exceeds the time to the alarm signal, +the process sleeps only until the signal would have occurred, and the +signal is sent one second later. +.SH "SEE ALSO" +.IR alarm (2) diff --git a/static/unix-v10/man3/sqrt.3 b/static/unix-v10/man3/sqrt.3 new file mode 100644 index 00000000..425886cb --- /dev/null +++ b/static/unix-v10/man3/sqrt.3 @@ -0,0 +1,24 @@ +.pa 1 +.he 'SQRT (III)'3/15/72'SQRT (III)' +.ti 0 +NAME sqrt -- square root function +.sp +.ti 0 +SYNOPSIS jsr r5,sqrt +.sp +.ti 0 +DESCRIPTION The +square root of fr0 is returned in fr0. +.sp +.ti 0 +FILES kept in /lib/liba.a +.sp +.ti 0 +SEE ALSO -- +.sp +.ti 0 +DIAGNOSTICS The c-bit is +set on negative arguments and 0 is returned. +.sp +.ti 0 +BUGS -- diff --git a/static/unix-v10/man3/ssbuf.3 b/static/unix-v10/man3/ssbuf.3 new file mode 100644 index 00000000..1056700b --- /dev/null +++ b/static/unix-v10/man3/ssbuf.3 @@ -0,0 +1,130 @@ +. \"ident "%W%" +. \"Copyright (c) 1984 AT&T +. \"All Rights Reserved +. \"THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +. \"The copyright notice above does not evidence any +. \"actual or intended publication of such source code. +.TH SSBUF 3I+ "C++ Stream Library" " " +.SH NAME +strstreambuf \- streambuf specialized to arrays +.SH SYNOPSIS +.ta1i 2i 4i +.ft B +.nf +#include <iostream.h> +#include <strstream.h> + +class strstreambuf : streambuf { +public: + strstreambuf() ; + strstreambuf(char*,int,char*); + strstreambuf(int); + strstreambuf(unsigned char*, int, unsigned char*); + strstreambuf(void* (*a)(long), void(*f)(void*)); + + void freeze(int n=1) ; + char* str(); + streambuf* setbuf(char*,int) +}; +.fi +.ft R +.SH DESCRIPTION +A \f(CWstrstreambuf\fR +is a \f(CWstreambuf\fR that uses an array of bytes (a string) to hold +the sequence of characters. +Given the convention that a \f(CWchar*\fR should be interpreted as +pointing just before the \f(CWchar\fR it really points at, the mapping +between the abstract get/put pointers and \f(CWchar*\fR pointers +is direct. Moving the pointers corresponds exactly to incrementing +and decrementing the \f(CWchar*\fR values. +.PP +To accommodate the need for arbitrary length strings +\f(CWstrstreambuf\fRs +supports an automatic mode. +When a \fBstrstreambuf\fR is in automatic mode, space for +the character sequence is +allocated as needed. +When the sequence is extended too far, it will be copied +to a new array. +.PP +Assume +.br +\(em \fBssb\fR is a \f(CWstrstreambuf*\fR. +.br +\(em \fBn\fR is an \f(CWint\fR. +.br +\(em \fBptr\fR and \fBpstart\fR are \f(CWchar*\fR or \f(CWunsigned char*\fR. +.br +\(em \fBa\fR is \f(CWvoid* (*)(long)\fR. +.br +\(em \fBf\fR is \f(CWvoid* (*)(void*)\fR. +.PP +The constructors: +.TP +\fBstrstreambuf()\fR +Constructs an empty buffer in dynamic mode. This means that +space will be automatically allocated to accomodate the +characters that are put into the buffer (using operators \f(CWnew\fR +and \f(CWdelete\fR). Because this may require copying the +original characters, it is recommended that when large strings +will be used that \fBsetbuf\fR be used (as described below) to +inform the \f(CWstrstreambuf\fR. +.TP +\fBstrstreambuf(a,f)\fR +Constructs an empty buffer in dynamic mode. +\fBa\fR is used as the allocator function +in dynamic mode. If it is null, \f(CWoperator new\fR will be used. +\fBf\fR is used to free (or delete) areas returned by \fBa\fR. +If it is null \f(CWoperator delete\fR is used. +.TP +\fBstrstreambuf(n)\fR +Constructs an empty buffer in dynamic mode. The initial allocation +of space will be at least \fBn\fR bytes. +.TP +\fBstrstreambuf(ptr,n,pstart)\fR +Constructs a buffer to use the bytes starting at +\fBptr\fR. If \fBn\fR is positive and the \fBn\fR bytes starting +at \fBptr\fR are used. If \fBn\fR is zero, \fBptr\fR is assumed +to point to the beginning of a null terminated strings and +the bytes of that string (not including the terminating null character) +will constitute the buffer. If \fBn\fR is negative the buffer is +assumed to continue indefinitely. +The get pointer is initialized to \fBptr\fR. The +put pointer is initialized to \fBpstart\fR. If \fBpstart\fR is +null then stores will be treated as errors. If \fBpstart\fR +is non null then the initial sequence (for fetching) consists +of the bytes between \fBptr\fR and \fBpstart\fR. If \fBpstart\fR +is null then the initial sequence consists of the entire array. +.PP +Member functions: +.TP +\fBssb->freeze(n)\fR +Inhibits (\fBn\fR nonzero) or permits (\fBn\fR zero) automatic +deletion +of the current array. +Deletion normally occurs when more space is needed +or when \fBssb\fR is being destroyed. Only +space obtained dynamic allocation is ever freed. +It is an error (and the effect is undefined) to store characters +into a buffer that was in automatic allocation mode and is now +frozen. +It is possible, however, to thaw (unfreeze) such a buffer and +resume storing characters. +.TP +\fBptr=ssb->str()\fR +Returns a pointer to the first char of the current array and freezes +\fBssb\fR. If \fBssb\fR was constructed with an explicit array +\fBinit\fR, +\fBptr\fR will point to that array. +If \fBssb\fR is in automatic +allocation mode, but nothing has yet been stored, \fBptr\fR may +be null. +\fBstr\fR freezes \fBssb\fR. +.TP +\Bssb->setbuf(0,n)\fR +\fBssb\fR remembers \fBn\fR and the next time it does a dynamic +mode allocation, it makes sure that at least \fBn\fR bytes +are allocated. +.SH SEE ALSO +sbuf.pub(3C++) +strstream(3C++) diff --git a/static/unix-v10/man3/stak.3 b/static/unix-v10/man3/stak.3 new file mode 100644 index 00000000..903443b7 --- /dev/null +++ b/static/unix-v10/man3/stak.3 @@ -0,0 +1,163 @@ +.TH STAK 3 +.SH NAME +\fBstak\fR \- data stack storage library +.SH SYNOPSIS +.ta .75i 1.5i 2.25i 3i 3.75i 4.5i 5.25i 6i +.PP +.nf +\f5 +#include <stak.h> + +Stak_t *stakcreate(int \fIflags\fP); +Stak_t *stakinstall(Stak_t *\fIstack\fP, char *(\fIoverflow\fP)(int)); +int stakdelete(Stak_t *\fIstack\fP); +void staklink(Stak_t *\fIstack\fP) + +char *stakalloc(unsigned \fIsize\fP); +char *stakcopy(const char *\fIstring\fP); +char *stakset(char *\fIaddress\fP, unsigned \fIoffset\fP); + +char *stakseek(unsigned \fIoffset\fP); +int stakputc(int \fIc\fP); +int stakputs(const char *\fIstring\fP); +int staktell(void); +char *stakptr(unsigned \fIoffset\fP); +char *stakfreeze(unsigned \fIextra\fP); +\fR +.fi +.SH DESCRIPTION +.PP +\f5stak\fP is a package of routines designed to provide efficient +stack oriented dynamic storage. +A stack abstraction consists of an ordered list of contiguous +memory regions, called stack frames, that can hold objects of +arbitrary size. +A stack is represented by the type \f5Stak_t\fP +defined in header \f5<stak.h>\fP. +At any instant there is one active stack. +Variable size objects can be +added to the active stack +and programs can reference these objects directly with pointers. +In addition, the last object on the stack +(referred to here as the current object) +can be built incrementally. +The current object has an associated offset that determines its +current size. +While the current object is being built incrementally, +its location might +change so that it is necessary to reference the object with +relative offsets ranging from zero to the current offset of the object. +.PP +There is a preset initial active stack. +To use an additional stack, it is necessary to create it and to +install it as the active stack. +A stack is created with the \f5stakcreate\fP() function. +A \fIflags\fP argument of \f5STAK_SMALL\fP indicates that unused +space on the stack should be freed whenever this stack ceases +to be the active stack. +If successful, +\f5stakcreate\fP() returns a pointer to a stack whose reference +count is 1. +Otherwise, \f5stakcreate\fP() returns a null pointer. +The \f5staklink\fP() function increases the reference count for the +given \fIstack\fP. +The \f5stakinstall\fP() function +makes the specified \fIstack\fP the active stack and returns a pointer +to the previous active stack. +When the \fIoverflow\fP argument is not null, +it specifies a function that will +be called whenever \f5malloc\fP(3) fails while trying to grow the +stack. +The \fIoverflow\fP function will be called with the size that was passed +to \f5malloc\fP(3). +The \fIoverflow\fP function can call \f5exit\fP(3), call \f5longjmp\fP(3) +or return. +If the \f5overflow\fP function returns, +it must return a pointer to a memory region of the given size. +The default action is to write an error to standard error and to +call \f5exit\fP(2) with a non-zero exit value. +When \fIstack\fP is a null pointer, +the active stack is not changed +but the \fIoverflow\fP function for the active stack can be changed +and a pointer to the active stack is returned. +The \f5stakdelete\fP() function decrements the reference count and +frees the memory associated with +the specified stack +when the reference count is zero. +The effect of subsequent references to objects +on the stack are undefined. +.PP +The +\f5stakalloc\fP() function returns an aligned pointer to space on the +active stack that can be used to hold any object of the given \fIsize\fP. +\f5stakalloc\fP() is similar to \f5malloc\fP(3) except that individual +items returned by \f5stakalloc\fP() can not be freed. +\f5stakalloc\fP() causes the offset of the current object to be set to +zero. +.PP +The +\f5stakcopy\fP() function copies the given string onto the stack +and returns a pointer to the \fIstring\fP on the stack. +\f5stakcopy\fP() causes the offset of the current object to be set to +zero. +.PP +The \f5stakset\fP() function finds the frame containing the given +\fIaddress\fP, frees all frames that were created after the one containing +the given \fIaddress\fP, and sets the current object to the given +\fIaddress\fP. +The top of the current object is set to \fIoffset\fP bytes from +current object. +If \fIaddress\fP is not the address of an object on the +stack the result is undefined. +.PP +The remaining functions are used to build the current object incrementally. +An object that is built incrementally on the stack will +always occupy contiguous memory within a stack frame but +until \f5stakfreeze\fP() is called, +the location in memory for the object can change. +There is a current offset associated with the current object that +determines where subsequent operations apply. +Initially, this offset is zero, and the offset changes as a result +of the operations you specify. +The \f5stakseek\fP() function is used set the offset for the +current object. +The \fIoffset\fP argument to \f5stakseek\fP() specifies the new +offset for the current object. +The frame will be extended or moved +if \f5offset\fP causes the new current offset to extend beyond the +current frame. +\f5stakseek\fP() returns a pointer to the beginning of the current object. +The \f5staktell\fP() function gives the offset of the current object. +.PP +The \f5stakputc\fP() function adds a given character to the current object +on the stack. +The current offset is advanced by 1. +The \f5stakputs\fP() appends the given \fIstring\fP onto the current +object in the stack and returns the length of the string. +The current offset is advanced by the length of the string. +.PP +The \f5stakptr\fP() function converts the given \f5offset\fP +for the current object into a memory address on the stack. +This address is only valid until another stack operation is given. +The result is not defined if \fIoffset\fP exceeds the size of the current +object. +The \f5stakfreeze\fP() +function terminates the current object on the +stack and returns a pointer to the beginning of this object. +If \fIextra\fP is non-zero, \fIextra\fP bytes are added to the stack +before the current object is terminated. The first added byte will +contain zero and the contents of the remaining bytes are undefined. +.PP +.SH HISTORY +The +\f5stak\fP +interface was derived from similar routines in the KornShell code +that is used for building parse trees and carrying out expansions. +It provides an efficient mechanism for grouping dynamically allocated +objects so that they can be freed all at once rather than individually. +.SH AUTHOR + David Korn +.SH SEE ALSO +\f5exit(2)\fP +\f5longjmp(3)\fP +\f5malloc(3)\fP diff --git a/static/unix-v10/man3/stdio.3 b/static/unix-v10/man3/stdio.3 new file mode 100644 index 00000000..027de3a2 --- /dev/null +++ b/static/unix-v10/man3/stdio.3 @@ -0,0 +1,123 @@ +.TH STDIO 3S +.CT 2 file_io +.SH NAME +stdio \(mi standard buffered input/output package +.SH SYNOPSIS +.nf +.B #include <stdio.h> +.PP +.B FILE *stdin; +.B FILE *stdout; +.B FILE *stderr; +.fi +.SH DESCRIPTION +The functions described in Sections 3S constitute an efficient +user-level buffering scheme. +The in-line macros +.IR getc (3) +and +.IR putc +handle characters quickly. +The higher level routines +.I "fgets, scanf, fscanf, fread," +.I "puts, fputs, printf, fprintf, fwrite" +all use +.I getc +and +.I putc; +they can be freely intermixed. +.PP +A file with associated buffering is called a +.I stream, +and is declared to be a pointer to a defined type +.BR FILE . +.IR Fopen (3) +creates certain descriptive data for a stream +and returns a pointer to designate the stream in all +further transactions. +There are three normally open streams with constant +pointers declared in +the include file and associated with the standard open files: +.TP 10n +.BR stdin +standard input file +.br +.ns +.TP +.B stdout +standard output file +.br +.ns +.TP +.BR stderr +standard error file +.PP +A constant pointer +.L +NULL +designates no stream at all. +.PP +An integer constant +.B EOF +is returned +upon end of file or error by integer functions that +deal with streams. +.PP +Any routine that uses the standard input/output package +must include the header file +.F <stdio.h> +of pertinent +macro definitions. +The functions and constants mentioned in sections labeled 3S +are declared in the include file +and need no further declaration. +The constants, and the following `functions' are +implemented as macros: +.I getc, +.I getchar, +.I putc, +.I putchar, +.I feof, +.I ferror, +.IR fileno . +.SH "SEE ALSO" +.IR printf (3), +.IR scanf (3), +.IR fopen (3), +.IR getc (3), +.IR fgets (3), +.IR fread (3), +.IR fseek (3), +.IR ungetc (3), +.IR popen (3), +.IR setbuf (3), +.IR ferror (3) +.br +.IR open (2), +.IR read (2), +.IR fio (3) +.SH DIAGNOSTICS +The value +.B EOF +is returned uniformly to indicate that a +.B FILE +pointer has not been initialized with +.I fopen, +input (output) has been attempted on an output (input) stream, +or a +.B FILE +pointer designates corrupt or otherwise unintelligible +.B FILE +data. +.SH BUGS +Buffering of output can prevent output data +from being seen until long after it is computed \- perhaps +never, as when an abort occurs between buffer filling and flushing. +.br +Buffering of input can cause a process to consume +more input than it actually uses. +This can cause trouble across +.IR exec (2) +or +.IR system (3) +calls. diff --git a/static/unix-v10/man3/stdiobuf.3 b/static/unix-v10/man3/stdiobuf.3 new file mode 100644 index 00000000..eb35226d --- /dev/null +++ b/static/unix-v10/man3/stdiobuf.3 @@ -0,0 +1,39 @@ +. \"ident "%W%" +. \"Copyright (c) 1984 AT&T +. \"All Rights Reserved +. \"THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +. \"The copyright notice above does not evidence any +. \"actual or intended publication of such source code. +.TH STDIOBUF 3I+ "C++ Stream Library" " " +.SH NAME +stdiobuf \- iostream specialized to stdio FILE +.SH SYNOPSIS +.ft B +.ta1i 2i +.nf +#include <iostream.h> +#include <strstream.h> +#include <stdio.h> + +class stdiobuf : streambuf { + stdiobuf(FILE* f); + FILE* stdiofile(); +} +.fi +.ft R +.SH DESCRIPTION +Operations on a +\f(CWstdiobuf\fR +are reflected on +the underlying +\f(CWFILE\fR. +A \f(CWstdiobuf\fR is constructed in unbuffered mode, which causes all operations +to be immediately reflected in the \f(CWFILE\fR. +\fBseek\fRs are translated into \fBfseek\fRs. +\fBsetbuf\fR has its usual meaning. If it supplies a reserve +area buffering will be turned back on. +.SH SEE ALSO +filebuf(3C++) +istream(3C++) +ostream(3C++) +ssbuf.pub(3C++) diff --git a/static/unix-v10/man3/string.3 b/static/unix-v10/man3/string.3 new file mode 100644 index 00000000..8c6e1286 --- /dev/null +++ b/static/unix-v10/man3/string.3 @@ -0,0 +1,205 @@ +.TH STRING 3 +.CT 2 data_man +.SH NAME +strcat, strncat, strcmp, strncmp, strcpy, strncpy, strlen, +strchr, strrchr, strpbrk, strspn, strcspn, strtok, strdup \(mi string operations +.SH SYNOPSIS +.nf +.2C +.B #include <libc.h> +.PP +.B char *strcat(s1, s2) +.B char *s1, *s2; +.PP +.B char *strncat(s1, s2, n) +.B char *s1, *s2; +.B int n; +.PP +.B int strcmp(s1, s2) +.B char *s1, *s2; +.PP +.B int strncmp(s1, s2, n) +.B char *s1, *s2; +.B int n; +.PP +.B char *strcpy(s1, s2) +.B char *s1, *s2; +.PP +.B char *strncpy(s1, s2, n) +.B char *s1, *s2; +.B int n; +.PP +.B int strlen(s) +.B char *s; +.PP +.B char *strchr(s, c) +.B char *s; +.B int c; +.PP +.B char *strrchr(s, c) +.B char *s; +.B int c; +.PP +.B char *strpbrk(s1, s2) +.B char *s1, *s2; +.PP +.B int strspn(s1, s2) +.B char *s1, *s2; +.PP +.B int strcspn(s1, s2) +.B char *s1, *s2; +.PP +.B char *strtok(s1, s2) +.B char *s1, *s2; +.PP +.B char *strdup(s) +.B char *s; +.sp +.1C +.SH DESCRIPTION +The arguments +.I s1, s2 +and +.I s +point to null-terminated strings. +The functions +.IR strcat , +.IR strncat , +.IR strcpy , +and +.I strncpy +all alter +.IR s1 . +These functions do not check for overflow of +the array pointed to by +.IR s1 . +.PP +.I Strcat +appends a copy of string +.I s2 +to the end of string +.IR s1 . +.I Strncat +appends at most +.I n +characters. +Each returns a pointer to the null-terminated result. +.PP +.I Strcmp +compares its arguments and returns an integer +less than, equal to, or greater than 0, +according as +.I s1 +is lexicographically less than, equal to, or +greater than +.IR s2 . +.I Strncmp +makes the same comparison but looks at at most +.I n +characters. +.PP +.I Strcpy +copies string +.I s2 +to +.IR s1 , +stopping after the null character has been copied. +.I Strncpy +copies exactly +.I n +characters, +truncating +.I s2 +or adding +null characters to +.I s1 +if necessary. +The result will not be null-terminated if the length +of +.I s2 +is +.I n +or more. +Each function returns +.IR s1 . +.PP +.I Strlen +returns the number of characters in +.IR s , +not including the terminating null character. +.PP +.I Strchr +.RI ( strrchr ) +returns a pointer to the first (last) +occurrence of character +.I c +in string +.IR s , +or +.L (char *)0 +if +.I c +does not occur in the string. +The null character terminating a string is considered to +be part of the string. +.PP +.I Strpbrk +returns a pointer to the first occurrence in string +.I s1 +of any character from string +.IR s2 , +.L (char *)0 +if no character from +.I s2 +exists in +.IR s1 . +.PP +.I Strspn +.RI ( strcspn ) +returns the length of the initial segment of string +.I s1 +which consists entirely of characters from (not from) string +.IR s2 . +.PP +.I Strtok +considers the string +.I s1 +to consist of a sequence of zero or more text tokens separated +by spans of one or more characters from the separator string +.IR s2 . +The first call, with pointer +.I s1 +specified, returns a pointer to the first character of the first +token, having replaced the character after the token by 0. +Subsequent calls, +signified by +.I s1 +being +.LR "(char *)0" , +will scan from where the preceding call left off. +The separator string +.I s2 +may be different from call to call. +When no token remains in +.IR s1 , +.L (char *)0 +is returned. +.PP +.I Strdup +returns a pointer to a distinct copy of the null-terminated string +.I s +in space obtained from +.IR malloc (3) +or +.L (char *)0 +if no space can be obtained. +.SH SEE ALSO +.IR memory (3) +.SH BUGS +.I Strcmp +and +.I strncmp +use native character comparison, which may +be signed or unsigned. +.br +The outcome of overlapping moves varies among implementations. diff --git a/static/unix-v10/man3/strstream.3 b/static/unix-v10/man3/strstream.3 new file mode 100644 index 00000000..1854db05 --- /dev/null +++ b/static/unix-v10/man3/strstream.3 @@ -0,0 +1,110 @@ +. \"ident "%W%" +. \"Copyright (c) 1984 AT&T +. \"All Rights Reserved +. \"THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T +. \"The copyright notice above does not evidence any +. \"actual or intended publication of such source code. +.TH STRSTREAM 3I+ "C++ Stream Library" " " +.SH NAME +strstream \- iostream specialized to arrays +.SH SYNOPSIS +.ta 1i 2i +.ft B +.nf + +#include <strstream.h> + +class ios { +public: + enum open_mode { in, out, ate, app } ; + // \fIand lots of other stuff ... \fP + } ; + +class istrstream : public istream { +public: + istrstream(char*) ; + istrstream(char*, int) ; + strstreambuf* rdbuf() ; +} ; + +class ostrstream : public ostream { +public: + ostrstream(); + ostrstream(char*, int, open_mode = 0) ; + int pcount() ; + char* str(); + strstreambuf* rdbuf() ; +}; + +.fi +.ft R +.SH DESCRIPTION +\f(CWstrstream\fR specializes \f(CWiostream\fR +for "incore" operations, that is, storing and fetching +from arrays of bytes. The \f(CWstreambuf\fR associated with a +\f(CWstrstream\fR is a \f(CWstrstreambuf\fR. +.PP +Assume +.br +\(em \fBiss\fR is a \f(CWistrstream\fR. +.br +\(em \fBoss\fR is a \f(CWostrstream\fR. +.br +\(em \fBcp\fR is a \f(CWchar*\fR. +.br +\(em \fBmode\fR is an \f(CWopen_mode\fR. +.br +\(em \fBi\fR and \fBlen\fR are \f(CWint\fR. +.br +\(em \fBssb\fR is a \f(CWstrstreambuf*\fR. +.br +\(em \fBa\fR is a \f(CWvoid* (*)(long)\fR. +.br +\(em \fBf\fR is a \f(CWvoid (*)(void*)\fR. +.PP +The constructors: +.TP +\fBistrsteam(cp)\fR +Characters will be fetched from the (null terminated) string +\fBcp\R. The terminating null character will not be part of +the sequence. Seeks are allowed within that space. +.TP +\fBistrstream(cp,len) +Characters will be fetched from the array beginning at \fBcp\fR +and extending for \fBlen\fR bytes. +Seeks are allowed anywhere +within that array. +.TP +\fBostrstream()\fR +Space will be dynamically allocated to hold stored characters. +.TP +\fBostrstream(cp,n,mode)\fR +Characters will be stored into the array starting at \fBcp\fR +and continuing for \fBn\fR bytes. If \f(CWios::ate\fR or +\f(CWios::append\fR is set in \fBmode\fR, \fBcp\fR is assumed +to be a null terminated string and storing will begin at the +null character. Otherwise storing will begin at \fBcp\fR. +Seeks are allowed anywhere in the array. +Members: +.TP +\fBcp=oss.str()\fR +Returns a pointer to the array being used. +If \fBoss\fR was constructed with an explicit array, +\fBcp\fR is just a pointer to the array. Otherwise, +\fBcp\fR points +to a dynamically allocated area. +Until \fBstr\fR is called, deleting the dynamically allocated area is +the responsibility of \fBss\fR. +After \fBstr\fR returns, the array becomes the responsibility +of the user program. +Once \fBstr\fR has been called the effect of storing +more characters into \fBss\fR is undefined. +.TP +\fBi=ss.pcount()\fR +The number of bytes that have been stored into the buffer. +This is mainly of use when binary data has been +stored and \fBss.str()\fR does not point to +a null terminated string. +.SH SEE ALSO +strstreambuf(3C++), +iostream(3C++) diff --git a/static/unix-v10/man3/swab.3 b/static/unix-v10/man3/swab.3 new file mode 100644 index 00000000..d84df35e --- /dev/null +++ b/static/unix-v10/man3/swab.3 @@ -0,0 +1,22 @@ +.TH SWAB 3 +.CT 2 data_man +.SH NAME +swab \(mi swap bytes +.SH SYNOPSIS +.nf +.B swab(from, to, nbytes) +.B char *from, *to; +.fi +.SH DESCRIPTION +.I Swab +copies +.I nbytes +bytes pointed to by +.I from +to the position pointed to by +.I to, +exchanging adjacent even and odd bytes. +It is useful for carrying binary data between +machines with different byte orders. +.I Nbytes +should be even. diff --git a/static/unix-v10/man3/switch.3 b/static/unix-v10/man3/switch.3 new file mode 100644 index 00000000..c6ccccbc --- /dev/null +++ b/static/unix-v10/man3/switch.3 @@ -0,0 +1,44 @@ +.pa 1 +.he 'SWITCH (III)'3/15/72'SWITCH (III)' +.ti 0 +NAME switch -- switch on value +.sp +.ti 0 +SYNOPSIS (switch value in r0) +.br +jsr r5,switch; swtab +.br +(not-found return) +.br +.li +... +.ti -7 +swtab: val1; lab1; +.br +.li +... +.br +valn; labn +.br +.li +..; 0 +.sp +.ti 0 +DESCRIPTION switch______ +compares the value of r0 against each of the val\di\u; if +a match is found, control is transferred to the corresponding +lab\di\u (after popping the stack once). +If no match has been found by the time a null lab\di\u +occurs, switch______ returns. +.sp +.ti 0 +FILES kept in /lib/liba.a +.sp +.ti 0 +SEE ALSO -- +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS -- diff --git a/static/unix-v10/man3/system.3 b/static/unix-v10/man3/system.3 new file mode 100644 index 00000000..0287f22f --- /dev/null +++ b/static/unix-v10/man3/system.3 @@ -0,0 +1,22 @@ +.TH SYSTEM 3 +.CT 2 proc_man +.SH NAME +system \(mi issue a shell command +.SH SYNOPSIS +.nf +.B system(string) +.B char *string; +.fi +.SH DESCRIPTION +.I System +causes the command +\fLsh -c \fIstring\fR +to be executed. +The current process waits until the shell has +completed, then returns the exit status of the shell. +.SH "SEE ALSO" +.IR popen (3), +.IR exec (2), +.IR fork (2) +.SH DIAGNOSTICS +Exit status 127 indicates the shell couldn't be executed. diff --git a/static/unix-v10/man3/tcp.3 b/static/unix-v10/man3/tcp.3 new file mode 100644 index 00000000..2b857ded --- /dev/null +++ b/static/unix-v10/man3/tcp.3 @@ -0,0 +1,181 @@ +.TH TCP 3X +.CT 2 comm_mach +.SH NAME +tcp_sock, tcp_connect, tcp_listen, tcp_accept, tcp_rcmd \(mi tcp networking functions +.SH SYNOPSIS +.nf +.B #include <sys/inet/tcp_user.h> +.PP +.B int tcp_sock(); +.PP +.B int tcp_connect(fd, tp) +.B int fd; +.B struct tcpuser *tp; +.PP +.B int tcp_listen(fd, tp) +.B int fd; +.B struct tcpuser *tp; +.PP +.B int tcp_accept(fd, tp) +.B int fd; +.B struct tcpuser *tp; +.PP +.B "int tcp_rcmd(host, port, locuser, remuser, cmd, fd2p)" +.B char *host, *port, *locuser, *remuser, *cmd; +.B int *fd2p; +.PP +.SH DESCRIPTION +These routines are loaded by the +.B -lin +option of +.IR ld (1). +.PP +TCP is a protocol layered +upon IP (internet protocol). +It provides full-duplex byte stream connections between +end points called sockets. +The address of a socket is composed of the internet address +of its host and the port number to which +the socket is bound. +.PP +.I Tcp_sock +returns the file descriptor of an unbound socket. +Once opened, a socket may be bound to a port number within the +host and set up as the active or passive end of a connection. +.PP +Addresses and parameters are passed in +.B tcpuser +structures: +.PP +.nf +.ft L +.ta 8n +struct tcpuser { + int code; + tcp_port lport, fport; + in_addr laddr, faddr; + int param; +}; +.fi +.ft R +.PP +.I Lport +and +.I laddr +refer to the port and address numbers of the local end of a connection. +.I Fport +and +.I faddr +refer to the port and address numbers of the foreign end of a connection. +.PP +.I Tcp_connect +binds socket +.I fd +to port +.IB tp ->lport +and attempts to set up a connection to +the socket bound to port +.IB tp ->fport +on host +.IB tp ->faddr. +If +.IB tp ->lport +is 0, a local port number is automatically +chosen. +.I Tcp_connect +returns 0 +if the connection is established, \-1 otherwise. +.IB Tp ->lport +and +.IB tp ->laddr +are filled in to reflect the local port and address numbers for the connection. +Communication proceeds by performing +.IR read (2) +and +.IR write +on +.IR fd . +If +.IB tp ->param +is non-zero, it specifies options to set for the connection. +The only option supported is +.B SO_KEEPALIVE +which causes empty messages to be sent periodically to +detect dead connections. +.PP +.I Tcp_listen +binds socket +.I fd +to port +.IB tp ->lport +and configures the socket to listen for connection requests to that port. +If +.IB tp ->faddr +and +.IB tp ->fport +are non-zero, only connections coming from sockets on machine +.I faddr +and bound to port +.I fport +are listened for. +.I Tcp_listen +returns 0 +on success, \-1 +otherwise. +.IB tp ->laddr +is filled in to reflect the local address number for the connection. +.IR Select (2) +can be used with a listening socket to provide asynchronous polling of +connection requests by selecting for pending input on the socket. +.PP +.I Tcp_accept +waits for and accepts a connection request sent to the listening socket +.I fd. +When a connection arrives, +.I tcp_accept +returns a new file descriptor over which communications can proceed. +.IB Tp ->faddr, +.IB tp ->fport, +.IB tp ->laddr, +and +.IB tp ->lport +are filled in to identify the two ends of the connection. +.IB Tp ->param +is filled in with the minor device number of the +tcp device used for the new connection. +.I Fd +is left open and continues listening for connections. +.PP +.I Tcp_rcmd +remotely executes a +.I cmd +on +.I host +as user +.I remuser. +Standard input is attached to +.I cmd's +standard input and +.I cmd's +standard output is attached to standard output. +If +.I fd2p +is non-zero, it is filled with the file descriptor of a new TCP connection attached +to +.I cmd's +standard error. +Otherwise, +.I cmd's +standard error is attached to its standard output. +.SH FILES +.TP 12 +.F /dev/tcp* +the socket devices +.SH SEE ALSO +.IR ipc (3), +.IR internet (3), +.IR udp (3) +.SH DIAGNOSTICS +.I Tcp_sock +returns \-1 +if no sockets are available. diff --git a/static/unix-v10/man3/termcap.3 b/static/unix-v10/man3/termcap.3 new file mode 100644 index 00000000..6df764a1 --- /dev/null +++ b/static/unix-v10/man3/termcap.3 @@ -0,0 +1,175 @@ +.TH TERMCAP 3X +.CT 2 comm_term +.SH NAME +tgetent, tgetnum, tgetflag, tgetstr, tgoto, tputs \(mi device-independent terminal screen control +.SH SYNOPSIS +.2C +.nf +.B char PC; +.B char *BC; +.B char *UP; +.B short ospeed; +.PP +.B tgetent(bp, name) +.B char bp[1024], *name; +.PP +.B tgetnum(id) +.B char *id; +.PP +.B tgetflag(id) +.B char *id; +.PP +.B char * +.B tgetstr(id, area) +.B char *id, **area; +.PP +.B char * +.B tgoto(cm, destcol, destline) +.B char *cm; +.PP +.B tputs(cp, affcnt, outc) +.B char *cp; +.B int (*outc)(); +.fi +.1C +.SH DESCRIPTION +These functions are loaded by option +.B -ltermcap +of +.IR ld (1). +They extract and use capabilities from the terminal capability data +base +.IR termcap (5). +These are low level routines; +see +.IR curses (3) +for a higher level package. +.PP +.I Tgetent +extracts the entry for terminal +.I name +into the buffer at +.I bp. +.I Bp +should be a character buffer of size +1024 and must be retained through all subsequent calls +to +.I tgetnum, +.I tgetflag, +and +.I tgetstr. +.I Tgetent +returns \-1 +if it cannot open the +.I termcap +file, +0 +if the terminal name given does not have an entry, +and 1 +if all goes well. +It will look in the environment for a +.L TERMCAP +variable. +If found, and the value does not begin with a slash, +and the terminal type +.I name +is the same as the value of the environment variable +.LR TERM , +the +.L TERMCAP +string is used instead of reading the termcap file. +If it does begin with a slash, the string is used as a path name rather than +.FR /etc/termcap . +.PP +.I Tgetnum +gets the numeric value of capability +.I id, +returning \-1 +if is not given for the terminal. +.I Tgetflag +returns 1 +if the specified capability is present in +the terminal's entry, +0 +if it is not. +.I Tgetstr +gets the string value of capability +.I id, +placing it in the buffer at +.I *area, +advancing the +.I area +pointer. +It decodes the abbreviations for this field described in +.IR termcap (5), +except for cursor addressing and padding information. +.PP +.I Tgoto +returns a cursor addressing string decoded from +.B cm +to go to column +.I destcol +in line +.I destline. +It uses the external variables +.B UP +(from the +.L up +capability) +and +.B BC +(if +.L bc +is given rather than +.LR bs ) +if necessary to avoid placing +.LR en , +.LR ^D , +or +.L ^@ +in the returned string. +(Programs which call +.I tgoto +should be sure to turn off the +.B XTABS +bit(s), +since +.I tgoto +may now output a tab. +Note that programs using termcap should in general turn off +.B XTABS +anyway since some terminals use \fL^I\fP for other functions, +such as nondestructive space.) +If a +.B % +sequence is given which is not understood, then +.I tgoto +returns +.LR `OOPS' . +.PP +.I Tputs +decodes the leading padding information of the string +.I cp; +.I affcnt +gives the number of lines affected by the operation, or 1 if this is +not applicable; +.I outc +is a routine which is called with each character in turn. +The external variable +.I ospeed +should contain the output speed of the terminal as in +.IR tty (4). +The external variable +.B PC +should contain a pad character to be used (from the +.L pc +capability) +if a null +.RB ( ^@ ) +is inappropriate. +.SH FILES +.F /etc/termcap +.SH SEE ALSO +.IR vi (1), +.IR curses (3), +.IR termcap (5) diff --git a/static/unix-v10/man3/timec.3 b/static/unix-v10/man3/timec.3 new file mode 100644 index 00000000..b7dec4b8 --- /dev/null +++ b/static/unix-v10/man3/timec.3 @@ -0,0 +1,109 @@ +.TH TIMEC 3 +.CT 2 data_man time_man +.SH NAME +timec, timegm, timelocal \- convert ASCII to time +.SH SYNOPSIS +.nf +.B #include <time.h> +.PP +.B long timec(string) +.B char *string; +.PP +.B long timegm(timep) +.B struct tm *timep; +.PP +.B long timelocal(timep, zone) +.B struct tm *timep; +.B char *zone; +.fi +.SH DESCRIPTION +These routines are inverse to +.IR ctime (3) +and its relatives. +See +.IR ctime (3) +for data layouts. +.PP +.I Timec +converts to system format a date +.I string +as produced by +.I ctime, +.IR date (1), +or +.IR ls (1). +An optional day of the week is ignored. +A month name and day are required. +A missing hour:min[:sec] field is taken to be +.BR 00:00:00 . +An optional time zone (local time by default) +may appear before or after the year. +A missing year is assumed to be the past 12-month interval. +.PP +.I Timegm +returns the system-format time corresponding to +the broken-down GMT time +pointed to by +.IR timep . +In a copy of the broken-down time +.BR tm_mon +is reduced mod 12 by carrying (positively or negatively) to +.BR tm_year . +Next +.B tm_mon +and +.B tm_mday +are added to +.B tm_yday +appropriately for +.BR tm_year . +Then +.BR tm_sec , +.BR tm_min , +.BR tm_hour , +.BR tm_yday , +and +.B tm_year +are adjusted by carrying. +Finally the system-format date +is calculated from these 5 fields. +.PP +.I Timelocal +is like +.I timegm, +except that the broken-down time belongs to the specified time +.I zone, +or is local time if +.I zone +is zero. +.PP +Time zones and months are recognized by the first three +characters, regardless of case. +.I Strings +for +.I ctime +may contain names longer than three characters +and may contain extra white space and commas. +.SH EXAMPLES +.TP +Set a date ahead one month: +.EX +struct tm brk_out = *localtime(&date); +brk_out.tm_yday = 0; +brk_out.tm_mon++; +date = timelocal(&brk_out,0); +.EE +.HP +Convert a +.IR date (1) +string to system format: +.EX +date = timec("Sat Sep 27 20:59:11 EDT 1986"); +.EE +.SH SEE ALSO +.IR ctime (3), +.IR time (2) +.SH BUGS +Unknown time zone names are taken to be GMT. +.br +Times before the epoch yield nonsense. diff --git a/static/unix-v10/man3/tm.3 b/static/unix-v10/man3/tm.3 new file mode 100644 index 00000000..33cb2e5f --- /dev/null +++ b/static/unix-v10/man3/tm.3 @@ -0,0 +1,550 @@ +.de L \" literal font +.ft 5 +.it 1 }N +.if !\\$1 \&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6 +.. +.de LR +.}S 5 1 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" +.. +.de RL +.}S 1 5 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" +.. +.de EX \" start example +.ta 1i 2i 3i 4i 5i 6i +.PP +.RS +.PD 0 +.ft 5 +.nf +.. +.de EE \" end example +.fi +.ft +.PD +.RE +.PP +.. +.TH TM 3 +.SH NAME +tm \- time conversion support +.SH SYNOPSIS +.L "#include <tm.h>" +.SH DESCRIPTION +The +.I tm +library supports conversion between +string date specifications, +.L time_t +clock values and +.L "struct tm" +values. +.L localtime() +and +.L gmtime() +(see +.IR ctime (3)) +are used to determine local time zone information. +.PP +.L time_t +values are the number of seconds since the epoch, +.BR "Jan 1 00:00:00 GMT 1970" , +with leap seconds omitted. +.PP +The global variable +.L "int tm_info.flags" +contains flags that allow all programs using the library +to be controlled in a consistent manner. +.L tm_info.flags +is initialized by the +.L tminit() +routine described below, and may be explicitly reset after +.L tminit() +is called. +The flags are: +.TP +.L TM_ADJUST +Set by +.L tminit() +if +.L localtime() +and +.L gmtime() +do not compensate for leap seconds. +.TP +.L TM_LEAP +.L time_t +values are interpreted as if they include leap seconds. +Set by +.L tminit() +if the +.L leap +option is set in the +.L TM_OPTIONS +environment variable. +.TP +.L TM_UTC +Times are relative to +.B UTC +(universal coordinated time, i.e., +.BR GMT ). +Otherwise times are relative to the local time zone. +Set by +.L tminit() +if the time zone name matches one of +.L tm_info.format[43] +through +.L tm_info.format[46] +described below. +If the time zone name is not determined by +.L localtime() +then the environment variables +.L TZNAME +(as described in BSD 4.3) and +.L TZ +(as described in System V) +are checked, in order. +If this fails then the time zone name is constructed using +the local time zone offset. +.PP +The routines are: +.TP +.L "time_t tmdate(char* date, char** end, time_t* clock)" +Parses the date specification +.L date +using the +.L tm_info.format +string table (described below) +and returns the equivalent +.L time_t +value. +If +.RL non- NULL , +.L end +is set to the position of the first unrecognized character in +.LR date . +.L clock +is used to provide default values for omitted components in +.LR date . +If +.L clock +is +.L NULL +then the current time is used. +.TP +.L "struct tm* tmfix(struct tm* tp)" +Corrects any out of bounds fields in +.L tp +and returns +.L tp +as its value. +The corrections start with +.L tp->tm_sec +and propagate down to +.LR tp->tm_year . +For example, if +.L tp->tm_sec +were 61 then it would change to 1 and +.L tp->tm_min +would be incremented by 1, and so on. +.LR tp->tm_wday , +.LR tp->tm_yday +and +.L tp->tm_isdst +are not changed as these can be computed from the other fields. +.TP +.L "char* tmform(char* buf, char* format, time_t* clock)" +Formats the date pointed to by +.L clock +into the buffer +.L buf +according to the format specification +.LR format . +If +.L format +is +.L NULL +or empty then the string +.L tm_info.format[40] +is used. +If +.L clock +is +.L NULL +then the current time is used. +A pointer to the end of +.L buf +(i.e., the terminating +.LR "'\e0'" ) +is returned. +.RS +.PP +.L format +is in the style of +.IR printf (3), +where +.BI % field +causes the corresponding fixed size field to be placed in +.LR buf , +zero padded if necessary, and \e\fIc\fP and \e\fInnn\fP +sequences are interpreted as in the C language. +Otherwise invalid +.BI % field +specifications and all other characters in +.L format +are copied into +.L buf +without change. +String field values are taken from the +.L tm_info.format +string table. +The +.I fields +are: +.TP +.PD 0 +.B % +.B % +character. +.TP +.B a +Abbreviated weekday name. +.TP +.B A +Full weekday name. +.TP +.B b +Abbreviated month name. +.TP +.B c +.IR ctime (3) +style date without the trailing +.BR newline . +.TP +.B C +.IR date (1) +style date. +.TP +.B d +Day of month number. +.TP +.B D +Date as +.IR mm / dd / yy . +.TP +.B e +Blank padded day of month number. +.TP +.B E +Unpadded day of month number. +.TP +.B h +Abbreviated month name. +.TP +.B H +24-hour clock hour. +.TP +.B i +International +.IR date (1) +date that includes the time zone type name. +.TP +.B I +12-hour clock hour. +.TP +.B j +1-offset Julian date. +.TP +.B J +0-offset Julian date. +.TP +.B l +.IR ls (1) +.B \-l +date that lists recent dates with +.IR hh : mm +and distant dates with +.IR yyyy . +.TP +.B m +Month number. +.TP +.B M +Minutes. +.TP +.B n +.B newline +character. +.TP +.B p +Meridian (e.g., +.B AM +or +.BR PM ). +.TP +.B r +12-hour time as +.IR hh : mm : ss +.IR meridian . +.TP +.B R +24-hour time as +.IR hh : mm . +.TP +.B S +Seconds. +.TP +.B t +.B tab +character. +.TP +.B T +24-hour time as +.IR hh : mm : ss . +.TP +.B U +Week number with Sunday as the first day. +.TP +.B w +Weekday number. +.TP +.B W +Week number with Monday as the first day. +.TP +.B x +Local date style, using +.LR tm_info.format[39] , +that includes the month, day and year. +.TP +.B X +Local time style, using +.LR tm_info.format[38] , +that includes the hours and minutes. +.TP +.B y +2-digit year. +.TP +.B Y +4-digit year. +.TP +.B z +Time zone type name. +.TP +.B Z +Time zone name. +.TP +.BI + flag +.TP +.BI \- flag +Temporarily (until +.L tmform() +returns) sets (+) or clears (\-) the +.L tm_info.flags +flags specified by +.IR flag : +.RS +.TP +.B l +.L TM_LEAP +.TP +.B u +.L TM_UTC +.RE +.TP +.B # +Number of seconds since the epoch. +.PD +.RE +.TP +.L "void tminit()" +Implicitly called by the other +.I tm +library routines to initialize global data, including the +.L tm_info.format +table and the +.L tm_info.flags +global flags. +Global data should only be modified after an explicit call to +.LR tminit() . +.TP +.L "time_t tmleap(time_t* clock)" +Returns a +.L time_t +value for the time pointed to by +.L clock +with leap seconds adjusted for external +routines that do not handle leap seconds. +If +.L clock +is +.L NULL +then the current time is used. +Adjustments are only done if the +.L TM_ADJUST +flag is set in +.LR tm_info.flags . +.TP +.L "struct tm* tmmake(time_t* clock)" +Returns a pointer to the +.L tm +struct corresponding to the time pointed to by +.LR clock . +If +.L clock +is +.L NULL +then the current time is used. +.TP +.L "time_t tmtime(struct tm* tp, int west)" +Returns the +.L time_t +value corresponding to +.LR tp . +If +.L west +is +.L TM_LOCALZONE +then +.L tm +is relative to the local time zone, +otherwise +.L west +is the number of minutes west of +.B UTC +with daylight savings time taken into account. +.LR tp->tm_wday , +.LR tp->tm_yday +and +.L tp->tm_isdst +are ignored in the conversion. +.PP +The library routines use a table of date strings pointed to by +.LR "char** tm_info.format" . +The indices in +.L tm_info.format +are fixed by category. +.L tm_info.format +may be changed to point to other tables +according to local language and date conventions. +The contents by index (showing the USA English values) are: +.RS +.TP +.PD 0 +.B 0-11 +3-character abbreviated month names. +.TP +.B 12-23 +Full month names. +.TP +.B 24-30 +3-character abbreviated weekday names. +.TP +.B 31-37 +Full weekday names. +.TP +.B 38 +.L tmform() +local time format used by the +.B %X +field. +.TP +.B 39 +.L tmform() +local date format used by the +.B %x +field. +.TP +.B 40 +.L tmform() +format used if the +.L format +argument is +.L NULL +or empty. +.TP +.B 41-42 +Meridian names: AM, PM. +.TP +.B 43-46 +.B UTC +time zone names: GMT, UTC, UCT, CUT. +.TP +.B 47-50 +Daylight savings time suffix names: DST. +.TP +.B 51-54 +Suffixes to be ignored when matching strings in +.LR tmform() . +.TP +.B 55-61 +Time part names: second, hour, minute, day, week, month, year. +.TP +.B 62-65 +Hours of the day names: midnight, morning, noon, evening. +.TP +.B 66-68 +Relative day names: yesterday, today, tomorrow. +.TP +.B 69-71 +Past relative time references: last, ago, past. +.TP +.B 72-75 +Current relative time references: this, now, current. +.TP +.B 75-77 +Future relative time references: next, hence, coming. +.TP +.B 78-80 +Exact relative time references: exactly. +.TP +.B 81-85 +Noise words to be ignored: at, in, on. +.PD +.RE +.PP +Low level support functions and data are described in +.LR <tm.h> . +.SH EXAMPLES +.EX +#include <tm.h> +main() { + int i; + time_t t; + char buf[128]; + struct { + char* date; + char* format; + } x[] = { + "now", "%i", + "2 months ago", "%C", + "this Wednesday noon", "%x %I:%M %p", + "last December 25", "%A", + 0, 0 + }; + for (i = 0; x[i].date; i++) { + t = tmdate(x[i].date, (char*)0, (time_t*)0); + (void)tmform(buf, x[i].format, &t); + puts(buf); + } +} +.EE +produces +.EX +Fri Sep 30 12:10:14 USA EDT 1988 +Fri Jul 1 00:00:00 EDT 1988 +10/05/88 12:00 PM +Friday +.EE +.SH "SEE ALSO" +date(1), time(2), ctime(3) +.SH BUGS +.L "struct tm" +values may get clobbered by the +.I tm +library routines as the +.IR ctime (3) +routines typically return pointers to a single static +.L "struct tm" +area. +.L tmdate() +uses an internal international time zone name table that will +probably always be incomplete. diff --git a/static/unix-v10/man3/tolower.3 b/static/unix-v10/man3/tolower.3 new file mode 100644 index 00000000..4a28affe --- /dev/null +++ b/static/unix-v10/man3/tolower.3 @@ -0,0 +1,20 @@ +.TH TOLOWER 3 +.CT 2 data_man +.SH NAME +tolower, toupper \(mi force upper or lower case +.SH SYNOPSIS +.B tolower(character) +.PP +.B toupper(character) +.SH DESCRIPTION +If +.I character +is an upper case letter, +.I tolower +returns the same lower case letter, otherwise +it returns the original character. +.PP +.I Toupper +does the reverse. +.SH SEE ALSO +.IR ctype (3) diff --git a/static/unix-v10/man3/ttyn.3 b/static/unix-v10/man3/ttyn.3 new file mode 100644 index 00000000..9c9d2399 --- /dev/null +++ b/static/unix-v10/man3/ttyn.3 @@ -0,0 +1,26 @@ +.pa 1 +.he 'TTYN (III)'1/15/73'TTYN (III)' +.ti 0 +NAME ttyn -- return name of current tty +.sp +.ti 0 +SYNOPSIS jsr pc,ttyn +.sp +.ti 0 +DESCRIPTION The routine hunts up the name of the +input tty attached to the process (one byte from the set +{012345678abc} at present) and returns it in r0. +.sp +"x" is returned if no genuine input tty is attached to the process. +.sp +.ti 0 +FILES kept in /lib/liba.a +.sp +.ti 0 +SEE ALSO fstat(II) +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS -- diff --git a/static/unix-v10/man3/ttyname.3 b/static/unix-v10/man3/ttyname.3 new file mode 100644 index 00000000..9dcbca0a --- /dev/null +++ b/static/unix-v10/man3/ttyname.3 @@ -0,0 +1,84 @@ +.TH TTYNAME 3 +.CT 2 comm_term +.SH NAME +ttyname, isatty, nametty \(mi find or set name of a terminal +.SH SYNOPSIS +.B char *ttyname(fildes) +.PP +.B isatty(fildes) +.PP +.B nametty(fildes, file) +.br +.B char *file; +.SH DESCRIPTION +.I Ttyname +returns a pointer to the null-terminated path name +of the terminal device associated with file descriptor +.IR fildes . +.PP +.I Isatty +returns 1 if +.I fildes +is associated with a terminal device, +0 otherwise. +.PP +.I Nametty +arranges that future opens of +.I file +will refer to +the stream opened on +.IR fildes . +.I File +must exist before +.I nametty +is called. +The arrangement is terminated +when the other end of the stream +is closed or hung up. +.SH FILES +.F /lib/ttydevs + list of tty directories for +.I ttyname +.SH SEE ALSO +.IR fmount (2), +.IR ioctl (2) +.SH DIAGNOSTICS +.I Ttyname +returns +.L NULL +if +.I fildes +does not describe an entry in any of the directories +listed in +.FR /lib/ttydevs . +.PP +.I Nametty +returns 1 for success, +0 for failure +.RI ( file +does not exist, +.I fildes +is not a stream). +.SH BUGS +The return value of +.I ttyname +points to static data +whose content is overwritten by each call. +.br +If +.I fildes +connects to a remote machine, as when serving +.I dcon +or +.I rx +(see +.IR con (1)), +.I isatty +answers no, regardless of whether the stream +leads ultimately to a terminal on the remote machine. +Similarly, when serving +.I ndcon +or +.I nrx, +it always answers yes. + diff --git a/static/unix-v10/man3/udp.3 b/static/unix-v10/man3/udp.3 new file mode 100644 index 00000000..a449c974 --- /dev/null +++ b/static/unix-v10/man3/udp.3 @@ -0,0 +1,83 @@ +.TH UDP 3X +.CT 2 comm_mach +.SH NAME +udp_connect, udp_listen, udp_datagram \(mi udp networking functions +.SH SYNOPSIS +.nf +.B #include <sys/inet/udp_user.h> +.PP +.B int udp_connect(sport, dhost, dport) +.B in_addr dhost; +.B udp_port sport, dport; +.PP +.B int udp_listen(sport, reply) +.B udp_port sport; +.B struct udpreply *reply; +.PP +.B int udp_datagram(sport) +.B udp_port sport; +.PP +.SH DESCRIPTION +These routines are loaded by the +.B -lin +option of +.IR ld (1). +.PP +UDP (universal datagram protocol) is a protocol layered +upon IP (internet protocol). +It provides datagram service between end points called sockets. +A socket address is composed of the internet address +of its host and the port number to which +the socket is bound. +.PP +.I Udp_connect +returns the file descriptor of a UDP socket bound to port +.I sport. +Each +.IR read (2) +from this file descriptor will only accept datagrams from the UDP +socket at host +.I dhost, +port +.IR dport ; +a +.IR write +on this file descriptor will be sent to that socket. +.PP +.I Udp_listen +returns the file descriptor of a UDP socket bound to port +.I sport +and waits for a datagram to be sent to that port. +Once a message has been received from another socket, +all writes +will go to that socket and +reads will only accept data from that socket. +.PP +.I Udp_datagram +returns the file descriptor of a UDP socket bound to port +.I sport. +Messages written to the file descriptor must start with a +.B struct udpaddr +which contains the destination of the message. +.IP +.EX +.ta \w'struct 'u +\w'updaddr 'u +struct udpaddr { + in_addr host; + int port; +}; +.EE +.PP +Messages read from the file descriptor also start with a +.B struct udpaddr +and contain the address of the source socket. +.SH FILES +.TP 12 +.F /dev/udp* +the socket devices +.SH SEE ALSO +.IR internet (3), +.IR tcp (3) +.SH DIAGNOSTICS +All these routines +returns \-1 on failure. diff --git a/static/unix-v10/man3/uname.3 b/static/unix-v10/man3/uname.3 new file mode 100644 index 00000000..64cc8230 --- /dev/null +++ b/static/unix-v10/man3/uname.3 @@ -0,0 +1,54 @@ +.TH UNAME 3 +.CT 2 sa +.SH NAME +uname \- identify machine and kernel +.SH SYNOPSIS +.nf +.B #include <utsname.h> +.PP +.B int uname(name) +.B struct utsname *name; +.fi +.SH DESCRIPTION +.I Uname +stores information identifying the current UNIX system in the +structure pointed to by +.I name. +.nf +.ft L +.ta 8n 16n +struct utsname { + char sysname[32]; + char nodename[32]; + char release[32]; + char version[32]; +}; +.fi +.ft R +.PP +.I Uname +returns a null-terminated character string naming the current UNIX system +in the character array +.I sysname. +Similarly, +.I nodename +contains the name that the system is known by on some communications network. +.I Release +and +.I version +further identify the operating system. +.SH FILES +.TP +.F /etc/whoami +.SH BUGS +Since a machine can have different names on different networks, +.I nodename +is pretty useless. +.PP +This call is a partial simulation of one appearing in other systems. +.I Sysname +and +.I nodename +are copied from +.FR /etc/whoami ; +the other fields are meaningless. diff --git a/static/unix-v10/man3/ungetc.3 b/static/unix-v10/man3/ungetc.3 new file mode 100644 index 00000000..8250c121 --- /dev/null +++ b/static/unix-v10/man3/ungetc.3 @@ -0,0 +1,39 @@ +.TH UNGETC 3S +.CT 2 file_io +.SH NAME +ungetc \(mi push character back into input stream +.SH SYNOPSIS +.B #include <stdio.h> +.PP +.B ungetc(c, stream) +.br +.SM +.B FILE +.B *stream; +.SH DESCRIPTION +.I Ungetc +pushes the character +.I c +back on an input stream. +That character will be returned by the next +.I getc +call on that stream. +.I Ungetc +returns +.IR c . +.PP +One character of pushback is guaranteed provided +something has been read from the stream and the stream is +actually buffered. +Attempts to push +.B EOF +are rejected. +.SH "SEE ALSO" +.IR getc (3), +.IR stdio (3), +.IR fseek (3) +.SH DIAGNOSTICS +.I Ungetc +returns +.B EOF +if it can't push a character back. diff --git a/static/unix-v10/man3/valloc.3 b/static/unix-v10/man3/valloc.3 new file mode 100644 index 00000000..e079a052 --- /dev/null +++ b/static/unix-v10/man3/valloc.3 @@ -0,0 +1,27 @@ +.UC +.TH VALLOC 3 +.SH NAME +valloc \- aligned memory allocator +.SH SYNOPSIS +.nf +.B char *valloc(size) +.B unsigned size; +.fi +.SH DESCRIPTION +.I Valloc +allocates +.I size +bytes aligned on a boundary adequate for +.IR vread (2)). +It is implemented by calling +.IR malloc (3) +with a slightly larger request, saving the true beginning of the block +allocated, and returning a properly aligned pointer. +.SH DIAGNOSTICS +.I Valloc +returns a null pointer (0) if there is no available memory +or if the arena has been detectably corrupted by storing outside the bounds +of a block. +.SH BUGS +.I Vfree +isn't implemented. diff --git a/static/unix-v10/man3/varargs.3 b/static/unix-v10/man3/varargs.3 new file mode 100644 index 00000000..1bd46763 --- /dev/null +++ b/static/unix-v10/man3/varargs.3 @@ -0,0 +1,89 @@ +.TH VARARGS 3 +.CT 2 data_man +.SH NAME +varargs \(mi variable argument list +.SH SYNOPSIS +.nf +.B #include <varargs.h> +.IB function (va_alist) +.B va_dcl +.PP +.B va_list pvar; +.PP +.B va_start(pvar); +.PP +.B va_arg(pvar, type); +.PP +.B va_end(pvar); +.fi +.SH DESCRIPTION +This set of macros allows portable procedures that accept variable +argument lists to be written. +Routines which have variable argument lists (such as +.IR printf (3)) +that do not use varargs are inherently nonportable, since different +machines use different argument passing conventions. +.PP +The literal identifier +.I va_alist +is used in a function header to declare a variable argument list. +It is declared by +.I va_dcl. +Note that there is no semicolon after +.I va_dcl. +.PP +.B Va_list +is the type of the variable +.I pvar, +which is used to traverse the list. +One variable of this type must always be declared. +.PP +.I Va_start +initializes +.I pvar +to the beginning of the list. +.PP +.I Va_arg +returns the next argument in the list +pointed to by +.IR pvar . +.I Type +is the type the argument is expected to be. +Different types can be mixed, but it is up +to the routine to know what type is +expected, since it cannot be determined at runtime. +.PP +.I Va_end +is used to finish up. +.PP +Multiple traversals, each bracketed by +.I va_start +and +.I va_end, +are possible. +.SH EXAMPLES +How to define +.I execl +in terms of +.IR execv ; +see +.IR exec (2): +.IP +.nf +.ft L +#include <varargs.h> +execl(va_alist) +va_dcl +{ + va_list ap; + char *file; + char *args[100]; + int argno = 0; + va_start(ap); + file = va_arg(ap, char*); + while(args[argno++] = va_arg(ap, char*)); + va_end(ap); + execv(file, args); +} +.fi +.ft P diff --git a/static/unix-v10/man3/view2d.3 b/static/unix-v10/man3/view2d.3 new file mode 100644 index 00000000..14f545ec --- /dev/null +++ b/static/unix-v10/man3/view2d.3 @@ -0,0 +1,93 @@ +.TH VIEW2D 3X +.CT 2 graphics +.SH NAME +view2d, moviefil \(mi movie of a function f(x, y, t) +.SH SYNOPSIS +.nf +.B "view2d(fd, nx, ny, time, u, v, fixuv, pmin, pmax, p)" +.B short "p[];" +.B double time; +.PP +.B "moviefil(fd, nx, ny, time, outside, f)" +.B float "time, outside, f[];" +.fi +.SH DESCRIPTION +.I View2d +writes a frame in the format +.IR view2d (5) +onto the file specified by file descriptor +.I fd. +To load these routines, use the +.IR ld (1) +option +.BR -lview2d . +.I Nx, ny +give the grid size. +.I Time +is a (nondecreasing) frame index, typically set to simulation time +or iteration count. +.I U +and +.I v +describe the relation between pixel values and user function values: +.IP +.I p += +.I u ++ +\fIf\|\fR\(mu\|2\u\s7\-\fIv\fR\s0\d. +.LP +.I U +and +.I v +may vary from one frame to the next. +When the global scaling is known beforehand, +put +.I fixuv += 1 and set +.I pmin +and +.I pmax +to the limits of the data. +(Otherwise put +.IR fixuv =0; +.I pmin +and +.I pmax +will be ignored.) +.PP +.I P +is the +.I nx +by +.I ny +array of pixel values, +with the +.I x +index running fastest. +There is a threshold for describing nonrectangular regions: +any pixel value less than or equal to +.L \%-32766 +is treated as an +out-of-bounds marker and will appear as black. +Other pixel values should lie in the range +.L +\%-32765..32765 +inclusive. +.PP +.I Moviefil +is an alternate version that +is somewhat less flexible +but easier to use. +It takes floats +and scales automatically to shorts. +An element of +.I f +less than +.I outside +is treated as undefined and will appear as black. +.SH "SEE ALSO" +.IR view2d (1), +.IR view2d (5) +.SH BUGS +The array arguments are 2-D Fortran arrays. diff --git a/static/unix-v10/man3/vt.3 b/static/unix-v10/man3/vt.3 new file mode 100644 index 00000000..3770ff48 --- /dev/null +++ b/static/unix-v10/man3/vt.3 @@ -0,0 +1,37 @@ +.th VT III 6/4/73 +.sh NAME +vt \*- display (vt01) interface +.sh SYNOPSIS +.nf +.ft B +openvt() +.s3 +erase() +.s3 +label(s) +char s[ ]; +.s3 +line(x,y) +.s3 +circle(x,y,r) +.s3 +arc(x,y,x0,y0,x1,y1) +.s3 +dot(x,y,dx,n,pattern) +int pattern[ ]; +.s3 +move(x,y) +.fi +.s3 +.ft R +.sh DESCRIPTION +C interface routines to perform similarly named functions +described in vt(IV). +.it Openvt +must be used before any of the others to open the +storage scope for writing. +.sh FILES +/dev/vt0, found in /lib/libp.a +.sh "SEE ALSO" +vt (IV) +.sh BUGS |
