! "W N D=    @ #D  D ҃RR \ B ы e@W 0 , & 7    " 7 -  X e5PߋRTV`RߋR RT `Re `R7 t*p ȋ@E A Ze   ?    7? eEman]?=man0/ptxX]@>man0/toce]A5man0/naa ]Cman0/taa]Eman0/tocrc]Gjman0/basinf6/]Ifman0/intro!]akman1/pfe.1]reman1/sleep.1]snman1/nohup.1]tpman1/nice.1]uman1/file.1]vman1/proof.1m]wYpman1/tp.1]y8man1/tr.1>]>man1/type.1]!man1/grep.1]man1/sno.1]:man1/speak.1]9Kman1/catsim.1"] xman1/du.1t]Sman1/ps.1]DEman1/typo.1]man1/passwd.1]^man1/size.1b]Dman1/fc.1]2man1/dc.1 ]nJman1/man.1]man1/cdb.1k]man1/tss.1]Pman1/wc.1]LAman1/opr.1]Uman1/sort.1]man1/stty.1"]Dman1/plot.1]man1/ar.1]Rman1/as.1k]nSman1/bas.1]Hman1/cat.1];man1/chdir.1]o|man1/chmod.1"]Aman1/chown.1]euman1/cmp.1]man1/cp.1]Uman1/date.1]man1/db.1 ]%man1/merge.1]nman1/dsw.1]man1/cc.1].Rman1/split.1M]aman1/ed.1=4] uman1/time.1]$>man1/ln.1]&Jman1/ls.1e ](Dman1/mail.1T].man1/mesg.1]1man1/mkdir.1 ]3sman1/mv.1`]4Jman1/nm.1]6Gman1/od.1d]9Fman1/pr.1]<xFman1/rew.1{]>man1/form.1 ]?&man1/fed.1]Dman1/rm.1q]ICman1/rmdir.1]L8mman1/roff.1 ]Mman1/sh.1#]Vman1/troff.1[]hhman1/strip.1]k`man1/cref.1 ]lman1/sum.1]qman1/wait.1z]rZman1/kill.1E]tman1/tty.1J]vman1/uniq.1G]w~man1/ld.1 ]z*Bman1/who.1]man1/write.1]kman1/comm.1]man1/shift.10]dman1/login.1!]pman1/if.1]Lman1/goto.1r];man1/exit.1X]Iman1/echo.1:]man1/nroff.1h]JRman2/introP][tman2/getgid.22]qman2/nice.2R]+man2/times.2]]man2/dup.2]man2/signal.2]vman2/break.28]:~man2/chdir.2 ]Qyman2/chmod.2y]|man2/chown.2]qman2/close.2]zman2/creat.2K]sman2/exec.2 ]man2/exit.2]@man2/fork.2]man2/fstat.2R]dman2/getuid.2]qman2/gtty.2q]man2/pipe.2]jman2/link.2]man2/mount.25][man2/open.2_]man2/read.21] man2/mknod.2\]qman2/seek.2]man2/setuid.2]eman2/sync.2]Cman2/stat.28]man2/stime.2]qman2/stty.2 ]Uman2/time.2]man2/umount.2#]cman2/unlink.2]Beman2/wait.2]man2/write.2y]kman2/indir.2]sman2/sleep.2S]jman2/kill.2h]man2/csw.2]man2/setgid.2]eman3/getarg.3Twpman3/getchr.3GM-Sman3/vt.3<eman3/reset.3<dman3/putchr.34!v man3/nargs.34v man3/ldiv.3g;)b man3/hmul.3<_@man3/getpw.3<_man3/setfil.3 MR.kFman3/ttyn.3<dtman3/rand.37M3#man3/pow.3+<+bJxman3/compar.34v"man3/crypt.3<]man3/atof.3<[man3/ctime.3M&-]man3/exp.3<K^!man3/fptrap.3/M,?"?Kman3/putc.3</c$zman3/perror.3;<d(man3/log.3<ha+cman3/mesg.3.<a,vman3/ierror.34v-+man3/printf.3F <_b0 man3/sin.3s<d7|man3/switch.3`<d8!man3/gerts.3MS-:Gman3/getc.3<^<aman3/qsort.3^<c@"man3/nlist.3<aCcman3/sqrt.3g4uFkman3/ecvt.3<@^G(man3/atan.3"<]Jman3/hypot.3}<_Lxman4/vs.4<}gMman4/tiu.4<SgN\oman4/da.4<eOman4/cat.4<ePman4/rp.4MgQman4/tm.4p4HvSman4/tc.4VM,kUman4/mem.4{4EvVnman4/rf.4bMlXman4/pc.4<{fYNman4/dc.4q>[2Fman4/vt.4>Mrhhman4/kl.46Mdrman4/dn.48tman4/dp.4Mcvman4/rk.4"M kxman5/tp.5]z:man5/ar.5]~Oman5/a.out.5 ]Eman5/core.5P]9man5/dir.5C]man5/fs.5]%man5/passwd.5]Vman5/utmp.5A]#man5/wtmp.5 ]Wman6/sfs.6]man6/wump.6]hman6/hyphen.6] -> .ds | de i0 .in \n(in .. .de lp .i0 .ta \\$2+1 .in \\$1 .tc | .tr | .ti -\\$2 .. .de s1 .sp 1 .ne 4 .. .de s2 .sp 1 .. .de s3 .sp 1 .. .de fo 'sp 2 'tl ''- % -'' 'bp .. .de th .de x1 'sp 2 'tl '\\$1(\\$2)'\\$3'\\$1(\\$2)' 'sp 2 \\.. .wh -5 fo .wh 0 x1 .in \n(in .. .de sh .s1 .ne 5 .ti 0 \\$1 .br .. .de bd .tr __ .ul \\$1 .. .de bn .tr __ .ul \\$1\\t .. .de it .tr __ .ul \\$1 .. .de dt .ta 8 16 24 32 40 48 56 64 .. .ds b B .ds a ' .ds - - .ds _ _ .ds v | .ds p J .ds r .ds g ` .ds X X .ds u u .ds > .nr in .5i .de i0 .in \n(inu .. .de lp .tc | .tr | .i0 .ta \\$2/2u .in \\$1/2u .ti -\\$2/2u .. .de s1 .sp .10i .ne 2 .. .de s2 .sp .07i .. .de s3 .sp .07i .ne 1 .. .de fo 'ft R 'ps 10 'sp .50i 'tl ''- % -'' 'ft 'ps 'bp .. .de th .de x1 .tl '-''' 'ft R 'ps 10 'sp .50i 'tl '\\$1\|(\|\\$2\|)'\\$3'\\$1\|(\|\\$2\|)' 'ft 'ps 'sp .50i \\.. .wh -1i fo .wh 0 x1 .ft R .ps 10 .vs 11p .in \n(inu .. .wh 0 x1 .de sh .s1 .ft B .ps 8 .ti 0 \\$1 .ft .ps .br .. .de it 'ft I \\$1 'ft .. .de bd 'ft B \\$1 'ft .. .de bn 'ft B \\$1 \\fR\\ .. .ds b \(*b .ds _ \(ul .ds - \(mi .ds a \(aa .ds v \(bv .ds p \(*p .ds r \(rg .ds g \(ga .ds | \| .ds X \(mu .ds u \(*m .ds > \(-> .de dt .ta .5i 1i 1.5i 2i 2.5i 3i 3.5i 4i 4.5i 6i .. .lg % -'' 'ft 'ps 'bp .. .de th .de x1 .tl '-''' 'ft R 'ps 10 'sp .50i 'tl '\\$1\|(\|\\$2\|)'\\$3'\\$1\|(\|\\$2\|)' 'ft 'ps 'sp .50i \\.. .wh -1i fo .wh 0 x1 .ft R .ps 10 .vs 11p .in \n(inu .. .wh 0 x1 .de sh .s1 .ft B .ps 8 .ti 0 \\$1 .ft .ps .br .. .de it 'ft I \\$1 'ft .. .de bd 'ft B \\$1 'ft .. .de bn 'ft B \if $2x != x goto both goto $1x : allx sh $0 1 I sh $0 2 II sh $0 3 III sh $0 4 IV sh $0 5 V sh $0 6 VI sh $0 7 VII sh $0 8 VIII cat tocx? >gorp ptx -t gorp ptxx rm gorp ed - tocx1 1,$s/([IV]*) /" "/ 1,$s/.*/.xx "&"/ w e tocx2 1,$s/([IV]*) /" "/ 1,$s/.*/.xx "&"/ w e tocx3 1,$s/([IV]*) /" "/ 1,$s/.*/.xx "&"/ w e tocx4 1,$s/([IV]*) /" "/ 1,$s/.*/.xx "&"/ w e tocx5 1,$s/([IV]*) /" "/ 1,$s/.*/.xx "&"/ w e tocx6 1,$s/([IV]*) /" "/ 1,$s/.*/.xx "&"/ w e tocx7 1,$s/([IV]*) /" "/ 1,$s/.*/.xx "&"/ w e tocx8 1,$s/([IV]*) /" "/ 1,$s/.*/.xx "&"/ w q exit : 1x sh $0 1 I exit : 2x sh $0 2 II exit : 3x sh $0 3 III exit : 4x sh $0 4 IV exit : 5x sh $0 5 V exit : 6x sh $0 6 VI exit : 7x sh $0 7 VII exit : 8x sh $0 8 VIII exit : x echo usage: sh tocrc "[12345678]" exit : both chdir /usr/man/man$1 ls >xa ed - xa v/\.[12345678]$/d g/^/s//e /\ .a\ /NAME/1p w q ed - xb echo "1,$s/ *\\\*- */("$2") /" >xa echo w /usr/man/man0/tocx$1 >>xa ed - xb file2 .sh "SEE ALSO" sh(I), ed(I), ascii(VII) .sh BUGS Won't handle ascii NUL. .br Also, Kernighan's Lemma can really bite you; try looking for strings which have \\ and * in them. e following example creates a list of all the words in `file1' one per line in `file2', where a word is taken to be a maximal string of alphabetics. The strings are quoted to protect the special characters from interpretation by the Shell; 012 is the ascii code for newline. .s3 .ti +8 tr \*-cs "[A\*-Z][a\*-z]" "[\\012*]" file2 .sh "SEE ALSO" sh(I), ed(I), ascii(VII) .sh BUGS Won't handle ascii NUL. .br Also, Kernighan's Lemma can really b.th TYPE I 6/12/72 .sh NAME type \*- type on 2741 .sh SYNOPSIS .bd type file ... .sh DESCRIPTION .it Type copies its input files to the fixed output port .bd ttyc converting to 2741 EBCDIC output code. Before each new page (66 lines) and before each new file, .it type stops and reads the 2741 before continuing. This allows time for insertion of single sheet paper. To continue, push the ATTN key on the 2741. .sh FILES /dev/ttyc .sh BUGS Since it is impossible to second guess a 2741, quite often it is necessary to print a # to put this device in a state it might already be in. .br The value of padding out a page with up to 66 carriage returns is doubtful. ort .bd ttyc converting to 2741 EBCDIC output code. Before each new page (66 lines) and before each new file, .it type stops and reads the 2741 before continuing. This allows time for insertion of single sheet paper. To continue, push the ATTN key on the 2741. .sh FILES /dev/ttyc .sh BUGS Since it is impossible to second guess a 2741, quite often it is necessa.th GREP I 3/3/73 .sh NAME grep \*- search a file for a pattern .sh SYNOPSIS .bd grep [ .bd \*-v ] [ .bd \*-l ] [ .bd \*-n ] expression [input] [output] .sh DESCRIPTION .it Grep will search the input file (standard input default) for each line containing the regular expression. Normally, each line found is printed on the output file (standard output default). If the .bd \*-v flag is used, all lines but those matching are printed. If the .bd \*-l flag is used, each line printed is preceded by its line number. If the .bd \*-n flag is used, no lines are printed, but the number of lines that would normally have been printed is reported. If interrupt is hit, the number of lines searched is printed. .s3 For a complete description of the regular expression, see ed(I). Care should be taken when using the characters $ * [ ^ | ( ) and \\ in the regular expression as they are also meaningful to the shell. (Precede them by \\) .sh "SEE ALSO" ed(I), sh(I) .sh BUGS Lines are limited to 512 characters; longer lines are truncated. e .bd \*-n flag is used, no lines are printed, but the number of lines that would normally have been printed is reported. If interrupt is hit, the number of lines searched is printed. .s3 For a complete description of the regular expression, see ed(I). Care should be taken when using the characters $ * [ ^ | ( ) and \\ in the regular expression as they are also meaningful to the shell. (Precede them by \\) .sh "SEE ALSO" ed(I), sh(I) .sh BUGS Lines are limited to 512 characters; longer lines are trun.th SNO I 2/9/73 .sh NAME sno \*- Snobol interpreter .sh SYNOPSIS .bd sno [ file ] .sh DESCRIPTION .it Sno is a Snobol III (with slight differences) compiler and interpreter. .it Sno obtains input from the concatenation of .it file and the standard input. All input through a statement containing the label `end' is considered program and is compiled. The rest is available to `syspit'. .s3 .it Sno differs from Snobol III in the following ways. .s3 There are no unanchored searches. To get the same effect: .s3  a ** b unanchored search for b .br a *x* b = x c unanchored assignment .s3 There is no back referencing. .s3 x = "abc" .br a *x* x is an unanchored search for `abc' .s3 .i0 Function declaration is different. The function declaration is done at compile time by the use of the label `define'. Thus there is no ability to define functions at run time and the use of the name `define' is preempted. There is also no provision for automatic variables other than the parameters. For example: .s3 .lp +5 5 .bd "define f( )" .s3 .i0 or .s3 .lp +5 5 .bd "define f(a,b,c)" .s3 .i0 All labels except `define' (even `end') must have a non-empty statement. .s3 If `start' is a label in the program, program execution will start there. If not, execution begins with the first executable statement. `define' is not an executable statement. .s3 There are no builtin functions. .s3 Parentheses for arithmetic are not needed. Normal precedence applies. Because of this, the arithmetic operators `/' and `*' must be set off by space. .s3 The right side of assignments must be non-empty. .s3 Either \*a or " may be used for literal quotes. .s3 The pseudo-variable `sysppt' is not available. .sh "SEE ALSO" Snobol III manual. (JACM; Vol. 11 No. 1; Jan 1964; pp 21) .sh BUGS egins with the first executable statement. `define' is not an executable statement. .s3 There are no builtin functions. .s3 Parentheses for arithmetic are not needed. Normal precedence applies. Because of this, the arithmetic operators `/' and `*' must be set off by space. .s3.th SPEAK I 8/15/73 .if t .ds A \o"a\(ga" .if n .ds A a` .if t .ds v \|\(bv .sh NAME speak \*- word to voice translator .sh SYNOPSIS .bd speak [ .bd \*-epsv ] [ vocabulary [ output ] ] .sh DESCRIPTION .it Speak turns a stream of words into utterances and outputs them to a voice synthesizer, or to a specified output file. It has facilities for maintaining a vocabulary. It receives, from the standard input .s3 .lp +5 3 \*- working lines: text of words separated by blanks .lp +5 3 \*- phonetic lines: strings of phonemes for one word preceded and separated by commas. The phonemes may be followed by comma-percent then a `replacement part' \*- an ASCII string with no spaces. The phonetic code is given in vsp(VII). .lp +5 3 \*- empty lines .lp +5 3 \*- command lines: beginning with .bd !. The following command lines are recognized: .s3 .lp +15 10 \fB!r\fR file replace coded vocabulary from file .lp +15 10 \fB!w\fR file write coded vocabulary on file .lp +15 10 \fB!p\fR print parsing for working word .lp +15 10 \fB!l\fR list vocabulary on standard output with phonetics .lp +15 10 \fB!c\fR word copy phonetics from working word to specified word .lp +15 10 \fB!d\fR print phonetics for working word .s3 .i0 Each working line replaces its predecessor. Its first word is the `working word'. Each phonetic line replaces the phonetics stored for the working word. In particular, a phonetic line of comma only deletes the entry for the working word. Each working line, phonetic line or empty line causes the working line to be uttered. The process terminates at the end of input. .s3 Unknown words are pronounced by rules, and failing that, are spelled. Spelling is done by taking each character of the word, prefixing it with *, and looking it up. Unspellable words burp. .s3 .it Speak is initialized with a coded vocabulary stored in file /usr/lib/speak.m. The vocabulary option substitutes a different file for /usr/lib/speak.m. .s3 A set of single letter options may appear in any order preceded by .bd \*-. Their meanings are: .s3 .lp +8 4 \fB\*-e\fR suppress English steps (4\*-8) below .lp +8 4 \fB\*-p\fR suppress pronunciation by rule .lp +8 4 \fB\*-s\fR suppress spelling .lp +8 4 \fB\*-v\fR suppress voice output .s3 .i0 .ne4 The steps of pronunciation by rule are: .s3 .lp +5 5 (1) If there were no lower case letters in the working line, fold all upper case letters to lower. .lp +5 5 (2) Fold an initial cap to lower case, and try again. .lp +5 5 (3) If word has only one letter, or has no lower case vowels, quit. .lp +5 5 (4) If there is a final .it s, strip it. .lp +5 5 (5) Replace final \*-ie by \*-y. .lp +5 5 (6) If any changes have been made, try whole word again. .lp +5 5 (7) Locate probable long vowels and capitalize them. Mark probable silent \fIe\fR's. .lp +5 5 (8) Put back the .it s stripped in (4), if any. .lp +5 5 (9) Place # before and after word. .lp +5 5 (10) Prefix word with .it %, and look up longest initial match in the stored table of words; if none, quit. .lp +5 5 (11) Use phonemes from the stored phonetic string as pronunciation, and replace the matched stuff by the replacement part of the phonetic string. .lp +5 5 (12) If anything remains, go to (10). .s3 .i0 Long vowels are located this way in step (7): .s3 .lp +5 5 (1) A \fIu\fR appearing in context [^aeiou]u[^aeiouwxy][aieouy]. (The notation is just a regular expression \*A la ed(I).) .ft I (pustUlous) .ft R .lp +5 5 (2) One of [aeo] appearing in the context [aeo][^aehiouwxy][ie][aou] or in the context [aeo][^aehiouwxy]ien is assumed long. The digram \fIth\fR behaves as a single letter in this test. .ft I (rAdium, facEtious, quOtient, carpAthian) .ft R .lp +5 5 (3) If the first vowel in the word is \fIi\fR followed by one of \fIaou,\fR it is assumed long. .ft I (Iodine, dIameter, trIumph) .ft R .lp +5 5 (4) If the only vowel in the word is final \fIe,\fR the vowel is assumed long. .ft I (bE, shE) .ft R .lp +5 5 (5) If the only vowels in the word appear in the pattern [aeiouy][^aeiouwxy]S, where S is one of the suffixes .br .dt \*-al \*-le \*-re \*-y .br .lp +5 0 then the first vowel is assumed long. .ft I (glObal, tAble, lUcre, lAdy) .ft R .lp +5 5 (6) If no suffix was found in (5), as many of these suffixes as possible are isolated from right to left. Stripping stops when \fIe\fR has been stripped, nor is \fIe\fR stripped before a suffix beginning with \fIe\fR. Each suffix is marked by inserting \*v just before the first letter, or just after \fIe\fR in those suffixes that begin with \fIe\fR. .br .dt \*-able \*-ably \*-e \*-ed \*-en .br \*-er \*-ery \*-est \*-ful \*-ly .br \*-ing \*-less \*-ment \*-ness \*-or .lp +5 0 .ft I (care\*vful\*vly, maj\*vor, fine\*vry, state\*v, caree\*vr) .ft R .lp +5 5 (7) If the word, exclusive of suffixes, ends in \fIi\fR or \fIy\fR, and contains no earlier vowel, then \fIi\fR or \fIy\fR is assumed long. .ft I (pY \fR(from pie),\fI crY\*ving, lIe\*vd) .ft R .lp +5 5 (8) If the first suffix begins with one of [aeio], then the vowel [aeiouy] in an immediately preceding pattern [^aeo][aeiouy][^aeiouwxy] is assumed long. The digram \fIth\fR behaves as a single letter in this test. .ft I (cAre\*vful\*vly, bAthe\*vd, mAj\*vor, pOt\*vable, port\*vable) .ft R .lp +5 5 (9) In these exceptional cases no long letter is assumed in the preceding step: .lp +10 5 (i) before \fIg\fR, if there are any earlier vowels .ft I (postage\*v, stAge\*v, college\*v) .ft R .lp +10 5 (ii) \fIe\fR is not long before \fIl\fR .ft I (travele\*vd) .ft R .lp +5 5 (10) If the first suffix begins with one of [aeio], and the word exclusive of suffixes ends in [aeiouyAEIOUY]th, then digram \fIth\fR is capitalized. .ft I (breaTH\*ving, blITHe\*vly) .ft R .lp +5 5 (11) An attempt is made to recognize silent \fIe\fR in the middle of compound words. Such an \fIe\fR is marked by a following \*v, and preceding vowels, other than \fIe\fR, are assumed long as in step (8). Silent \fIe\fR is marked in the context [bdgmnprst][bdgpt]le[^aeioruy\*v]S, where S is any string that contains [aeiouy] but does not contain \*v or the end of the word. Silent \fIe\fR is also marked in the context [^aeiu][aiou][^aeiouwxy]e[^aeinoruy]S. .ft I (simple\*vton, fAce\*vguard, cAve\*vman, cavernous) .ft R .s0 .sh FILES /usr/lib/speak.m .sh "SEE ALSO" vs(VII), vs(IV) .sh DIAGNOSTICS `?' for unknown command with .bd !, or for unreadable or unwritable vocabulary file .sh BUGS Vocabulary overflow is unchecked. Excessively long words cause dumps. Space is not reclaimed from deleted entries. ring that contains [aeiouy] but does not contain \*v or the end of the word. Silent \fIe\fR is also marked in the context [.th CATSIM I 11/1/73 .sh NAME catsim \*- phototypesetter simulator .sh SYNOPSIS .bd catsim .sh DESCRIPTION .it Catsim will interpret its standard input as codes for the phototypesetter (cat). The output of .it catsim is output to the display (vt). .s3 About the only use of .it catsim is to save time and paper on the phototypesetter by the following command: .s3 troff \*-t files | catsim .sh FILES /dev/vt0 .sh "SEE ALSO" troff(I), cat(IV), vt(IV) .sh BUGS Point sizes are not correct. The vt character set is restricted to one font of ASCII. im \*- phototypesetter simulator .sh SYNOPSIS .bd catsim .sh DESCRIPTION .it Catsim will interpret its standard input as codes for the phototypesetter (cat). The output of .it catsim is output to the display (vt). .s3 About the only use of .it catsim is to save time and paper on the phototypesetter by the following command: .s3 troff \*-t files | catsim .sh FILES /dev/vt0 .sh "SEE ALSO" troff(I), cat(IV), vt(IV) .sh BUGS Point sizes are not correct. The vt character set is.th DU I 1/20/73 .sh NAME du \*- summarize disk usage .sh SYNOPSIS .bd du [ .bd \*-s ] [ .bd \*-a ] [ name ... ] .sh DESCRIPTION .it Du gives the number of blocks contained in all files and (recursively) directories within each specified directory or file .it name. If .it name is missing, `\fB.\fR' is used. .s3 The optional argument .bd \*-s causes only the grand total to be given. The optional argument .bd \*-a causes an entry to be generated for each file. Absence of either causes an entry to be generated for each directory only. .s3 A file which has two links to it is only counted once. .sh BUGS Non-directories given as arguments (not under .bd \*-a option) are not listed. .s3 Removable file systems do not work correctly since i-numbers may be repeated while the corresponding files are distinct. .it Du should maintain an i-number list per root directory encountered. l to be given. The optional argument .bd \*-a causes an entry to be generated for each file. Absence of either causes an entry to be generat.th PS I 10/15/73 .sh NAME ps \*- process status .sh SYNOPSIS .bd ps [ .bd alx ] .sh DESCRIPTION .it Ps prints certain indicia about active processes. The .bd a flag asks for information about all processes with teletypes (ordinarily only one's own processes are displayed); .bd x asks even about processes with no typewriter; .bd l asks for a long listing. Ordinarily only the typewriter number (if not one's own) and the process number are given. .s3 The long listing is columnar and contains .s3 .lp +5 0 A number encoding the state (last digit) and flags (first 1 or 2 digits) of the process. .s3 The priority of the process; high numbers mean low priority. .s3 A number related in some unknown way to the scheduling heuristic. .s3 The last character of the control typewriter of the process. .s3 The process unique number (as in certain cults it is possible to kill a process if you know its true name). .s3 The size in blocks of the core image of the process. .s3 The last column if non-blank tells the core address in the system of the event which the process is waiting for; if blank, the process is running. .s3 .i0 .dt Unfortunately if you have forgotten the number of a process you will have to guess which one it is. Plain .it ps will tell you only a list of numbers. .sh FILES /usr/sys/unix system namelist .br /dev/mem resident system .sh "SEE ALSO" kill(I) .sh BUGS The ability to see, even if dimly, the name by which the process was invoked would be welcome. . .s3 The last column if non-blank tells the core address in.th TYPO I 1/15/73 .sh NAME typo \*- find possible typos .sh SYNOPSIS .bd typo [ \*- ] file\d1\u ... .sh DESCRIPTION .it Typo hunts through a document for unusual words, typographic errors, and .it "hapax legomena" and prints them on the standard output. .s3 The words used in the document are printed out in decreasing order of peculiarity along with an index of peculiarity. An index of 10 or more is considered peculiar. Printing of certain very common English words is suppressed. .s3 The statistics for judging words are taken from the document itself, with some help from known statistics of English. The `\*-' option suppresses the help from English and should be used if the document is written in, for example, Urdu. .s3 .it Roff and .it nroff control lines are ignored. Upper case is mapped into lower case. Quote marks, vertical bars, hyphens, and ampersands are stripped from within words. Words hyphenated across lines are put back together. .sh FILES /tmp/ttmp??, /usr/lib/salt, /usr/lib/w2006 .sh BUGS Because of the mapping into lower case and the stripping of special characters, words may be hard to locate in the original text. .s3 The expanded escape sequences of .it troff are not correctly recognized. xample, Urdu. .s3 .it Roff and .it nroff control lines are ignored. Upper case is mapped into lower case. Quote marks, vertical bars, hyphens, and ampersands are stripped from within words. Words hyphenated across lines are put back together. .sh FILES /tmp/ttmp??, /usr/lib/salt, /usr/lib/w2006 .sh BUGS Beca.th PASSWD I 9/1/72 .sh NAME passwd \*- set login password .sh SYNOPSIS .bd passwd name password .sh DESCRIPTION The .it password is placed on the given login name. This can only be done by the person corresponding to the login name or by the super-user. An explicit null argument ("") for the password argument will remove any password from the login name. .sh FILES /etc/passwd .sh "SEE ALSO" login(I), passwd(V), crypt(III) .sh BUGS together. .sh FILES /tmp/ttmp??, /usr/lib/salt, /usr/lib/w2006 .sh BUGS Beca.th SIZE I 9/2/72 .sh NAME size \*- size of an object file .sh SYNOPSIS .bd size [ object ... ] .sh DESCRIPTION The size, in bytes, of the object files are printed. If no file is given, .bd a.out is default. The size is printed in decimal for the text, data, and bss portions of each file. The sum of these is also printed in octal and decimal. .sh BUGS me. .sh FILES /etc/passwd .sh "SEE ALSO" login(I), passwd(V), crypt(III) .sh BUGS together. .sh FILES /tmp/ttmp??, /usr/lib/salt, /usr/lib/w2006 .sh BUGS Beca.th FC I 8/20/73 .sh NAME fc \*- fortran compiler .sh SYNOPSIS .bd fc [ .bd \*-c ] sfile1.f ... ofile1 ... .sh DESCRIPTION .it Fc is the UNIX Fortran compiler. It accepts three types of arguments: .s3 Arguments whose names end with `.f' are assumed to be Fortran source program units; they are compiled, and the object program is left on the file sfile1.o (i.e. the file whose name is that of the source with `.o' substituted for `.f'). .s3 Other arguments (except for \fB\*-c\fR) are assumed to be either loader flags, or object programs, typically produced by an earlier .it fc run, or perhaps libraries of Fortran-compatible routines. These programs, together with the results of any compilations specified, are loaded (in the order given) to produce an executable program with name .bd a.out. .s3 The .bd \*-c argument suppresses the loading phase, as does any syntax error in any of the routines being compiled. .s3 The following is a list of differences between .it fc and ANSI standard Fortran (also see the BUGS section): .s3 .lp +4 4 1. Arbitrary combination of types is allowed in expressions. Not all combinations are expected to be supported at runtime. All of the normal conversions involving integer, real, double precision and complex are allowed. .s3 .lp +4 4 2. DEC's \fBimplicit\fR statement is recognized. E.g.: .bd "implicit integer /i\*-n/". .s3 .lp +4 4 3. The types doublecomplex, logical*1, integer*1, integer*2 and real*8 (double precision) are supported. .s3 .lp +4 4 4. \fB&\fR as the first character of a line signals a continuation card. .s3 .lp +4 4 5. \fBc\fR as the first character of a line signals a comment. .s3 .lp +4 4 6. All keywords are recognized in lower case. .s3 .lp +4 4 7. The notion of `column 7' is not implemented. .s3 .lp +4 4 8. G-format input is free form\*- leading blanks are ignored, the first blank after the start of the number terminates the field. .s3 .lp +4 4 9. A comma in any numeric or logical input field terminates the field. .s3 .lp +4 4 10. There is no carriage control on output. .s3 .lp +4 4 11. A sequence of .it n characters in double quotes `"' is equivalent to .it n .bd h followed by those characters. .s3 .lp +4 4 12. In .bd data statements, a hollerith string may initialize an array or a sequence of array elements. .s3 .lp +4 4 13. The number of storage units requested by a binary .bd read must be identical to the number contained in the record being read. .s3 .i0 In I/O statements, only unit numbers 0-19 are supported. Unit number .it n refers to file fort\fInn;\fR (e.g. unit 9 is file `fort09'). For input, the file must exist; for output, it will be created. Unit 5 is permanently associated with the standard input file; unit 6 with the standard output file. Also see .it setfil (III) for a way to associate unit numbers with named files. .sh FILES .ta 1.5i file.f input file .nf a.out loaded output f.tmp[123] temporary (deleted) /usr/fort/fc1 compiler proper /lib/fr0.o runtime startoff /lib/filib.a interpreter library /lib/libf.a builtin functions, etc. /lib/liba.a system library .fi .sh "SEE ALSO" ANSI standard, ld(I) for loader flags .br Also see the writeups on the precious few non-standard Fortran subroutines, ierror and setfil (III) .sh DIAGNOSTICS Compile-time diagnostics are given in English, accompanied if possible with the offending line number and source line with an underscore where the error occurred. Runtime diagnostics are given by number as follows: .s3 .lp +5 5 1 invalid log argument .lp +5 5 2 bad arg count to amod .lp +5 5 3 bad arg count to atan2 .lp +5 5 4 excessive argument to cabs .lp +5 5 5 exp too large in cexp .lp +5 5 6 bad arg count to cmplx .lp +5 5 7 bad arg count to dim .lp +5 5 8 excessive argument to exp .lp +5 5 9 bad arg count to idim .lp +5 5 10 bad arg count to isign .lp +5 5 11 bad arg count to mod .lp +5 5 12 bad arg count to sign .lp +5 5 13 illegal argument to sqrt .lp +5 5 14 assigned/computed goto out of range .lp +5 5 15 subscript out of range .lp +5 5 16 real**real overflow .lp +5 5 17 (negative real)**real .s3 .lp +5 5 100 illegal I/O unit number .lp +5 5 101 inconsistent use of I/O unit .lp +5 5 102 cannot create output file .lp +5 5 103 cannot open input file .lp +5 5 104 EOF on input file .lp +5 5 105 illegal character in format .lp +5 5 106 format does not begin with ( .lp +5 5 107 no conversion in format but non-empty list .lp +5 5 108 excessive parenthesis depth in format .lp +5 5 109 illegal format specification .lp +5 5 110 illegal character in input field .lp +5 5 111 end of format in hollerith specification .lp +5 5 999 unimplemented input conversion .i0 Any of these errors can be caught by the program; see .it ierror (III). .sh BUGS The following is a list of those features not yet implemented: .s3 .br arithmetic statement functions .br scale factors on input .s3 .bd Backspace statement. on in format but non-empty list .lp +5 5 108 excessive parenthesis depth in format .lp +5 5 109 illegal format specification .lp +5 5 110 illegal character in input field .lp +5 5 111 end of format in hollerith specification .lp +5 5 999 unimplemente.th DC I 1/15/73 .sh NAME dc \*- desk calculator .sh SYNOPSIS .bd dc [ file ] .sh DESCRIPTION .it Dc is an arbitrary precision integer arithmetic package. The overall structure of .it dc is a stacking (reverse Polish) calculator. The following constructions are recognized by the calculator: .s3 .lp +10 10 number The value of the number is pushed on the stack. A number is an unbroken string of the digits 0-9. It may be preceded by an underscore \*_ to input a negative number. .s3 .lp +10 10 +|\*-|*|/|%|^ The top two values on the stack are added (+), subtracted (\*-), multiplied (*), divided (/), remaindered (%), or exponentiated (^). The two entries are popped off the stack; the result is pushed on the stack in their place. .s3 .lp +10 10 \fBs\fIx\fR The top of the stack is popped and stored into a register named .it x, where .it x may be any character. .s3 .lp +10 10 \fBl\fIx\fR The value in register .it x is pushed on the stack. The register .it x is not altered. All registers start with zero value. .s3 .lp +10 10 \fBd\fR The top value on the stack is pushed on the stack. Thus the top value is duplicated. .s3 .lp +10 10 \fBp\fR The top value on the stack is printed. The top value remains unchanged. .s3 .lp +10 10 \fBf\fR All values on the stack and in registers are printed. .s3 .lp +10 10 \fBq\fR exits the program. If executing a string, the nesting level is popped by two. .s3 .lp +10 10 \fBx\fR treats the top element of the stack as a character string and executes it as a string of dc commands. .s3 .lp +10 10 \fB[|...|]\fR puts the bracketed ascii string onto the top of the stack. .s3 .lp +10 10 \fIx\fR The top two elements of the stack are popped and compared. Register .it x is executed if they obey the stated relation. .s3 .lp +10 10 \fBv\fR replaces the top element on the stack by its square root. .s3 .lp +10 10 \fB!\fR interprets the rest of the line as a UNIX command. .s3 .lp +10 10 \fBc\fR All values on the stack are popped. .s3 .lp +10 10 \fBi\fR The top value on the stack is popped and used as the number radix for further input. .s3 .lp +10 10 \fBo\fR The top value on the stack is popped and used as the number radix for further output. .s3 .lp +10 10 \fBz\fR The stack level is pushed onto the stack. .s3 .lp +10 10 \fB?\fR A line of input is taken from the input source (usually the console) and executed. .s3 .lp +10 10 new-line ignored except as the name of a register or to end the response to a .bd ?. .s3 .lp +10 10 space ignored except as the name of a register or to terminate a number. .s3 .i0 If a file name is given, input is taken from that file until end-of-file, then input is taken from the console. An example which prints the first ten values of n! is .nf .s3 .in +3 .bd "[la1+dsa*pla10>x]sx" .bd "0sa1" .bd lxx .s3 .fi .in -3 .sh FILES /etc/msh to implement `!' .sh DIAGNOSTICS (x) ? for unrecognized character x. .br (x) ? for not enough elements on the stack to do what was asked by command x. .br `Out of space' when the free list is exhausted (too many digits). .br `Out of headers' for too many numbers being kept around. .br `Out of pushdown' for too many items on the stack. .br `Nesting Depth' for too many levels of nested execution. .sh BUGS s of n! is .nf .s3 .in +3 .bd "[la1+dsa*pla10>x]sx" .bd "0sa1" .bd lxx .s3 .fi .in -3 .sh FILES /etc/msh to implement `!' .sh DIAGNOSTICS (x) ? for unrecognized character x. .br (x) ? for not enough elements on the stack to do what was asked by command x. .br `Out of space' when the free list is exhausted (too many digits). .br `Out of headers' for too m.th MAN I 8/20/73 .sh NAME man \*- run off section of UNIX manual .sh SYNOPSIS .bd man [ section ] [ title ... ] .sh DESCRIPTION .it Man is a shell command file that will locate and run off one or more sections of this manual. .it Section is the section number of the manual, as an Arabic not Roman numeral, and is optional. .it Title is one or more section names; these names bear a generally simple relation to the page captions in the manual. If the .it section is missing, .bd 1 is assumed. For example, .s3 .bd " man man" .s3 would reproduce this page. .sh FILES /usr/man/man?/* .sh BUGS The manual is supposed to be reproducible either on the phototypesetter or on a typewriter. However, on a typewriter some information is necessarily lost. on is the section number of the manual, as an Arabic not Roman numeral, and is optional. .it Title is one or more section names; these names bear a generally simple relation to the page captions in the manual. If the .it section is missing, .bd 1 is assumed. For example, .s3 .th CDB I 8/15/73 .sh NAME cdb \*- C debugger .sh SYNOPSIS .bd cdb [ core [ a.out ]] .sh DESCRIPTION .it Cdb is a debugging program for use with C programs. It is by no means completed, and this section is essentially only a placeholder for the actual description. .s3 Even the present .it cdb has one useful feature: the command .s3 .bd " $" .s3 will give a stack trace of the core image of a terminated C program. The calls are listed in the order made; the actual arguments to each routine are given in octal. .sh "SEE ALSO" cc(I), db(I), C Reference Manual .sh BUGS It has to be fixed to work with the new system. b is a debugging program for use with C programs. It is by no means completed, and this section is essentially only a placeholder for the actual description. .s3 Even the present .it cdb has one useful feature: the command .s3 .bd " $" .s3 will give a stack trace of the core image of a terminated C program. The calls are listed in the order made; the actual arguments to each routine are given in octal.th TSS I 3/15/72 .sh NAME tss \*- interface to MH-TSS .sh SYNOPSIS .bd tss .sh DESCRIPTION .it Tss will call the Honeywell 6070 on the 201 data phone. It will then go into direct access with MH-TSS. Output generated by MH-TSS is typed on the standard output and input requested by MH-TSS is read from the standard input with UNIX typing conventions. .s3 An interrupt signal is transmitted as a `break' to MH-TSS. .s3 Input lines beginning with `!' are interpreted as UNIX commands. Input lines beginning with `~' are interpreted as commands to the interface routine. .s3 .lp +15 10 ~file deliver tss output to named UNIX file .lp +15 10 ~p pop the output file .lp +15 10 ~q disconnect from tss (quit) .lp +15 10 ~r file receive from HIS routine csr/daccopy .lp +15 10 ~s file send file to HIS routine csr/daccopy .s3 .i0 Ascii files may be most efficiently transmitted using the HIS routine csr/daccopy in this fashion. Bold face text comes from MH-TSS. .it Aftname is the 6070 file to be dealt with; .it file is the UNIX file. .s3 .bd SYSTEM? csr/daccopy (s) .it aftname .br .bd "Send Encoded File" ~s .it file .s3 .bd SYSTEM? csr/daccopy (r) .it aftname .br .bd "Receive Encoded File" ~r .it file .sh FILES /dev/dn0, /dev/dp0, /etc/msh .sh DIAGNOSTICS Most often, `Transmission error on last message.' .sh BUGS When problems occur, and they often do, .it tss exits rather abruptly. ng the HIS routine csr/daccopy in this fashion. Bold face text comes from MH-TSS. .it Aftname is t.th WC I 3/15/72 .sh NAME wc \*- get (English) word count .sh SYNOPSIS .bd wc files .sh DESCRIPTION .it Wc provides a count of the words, text lines, and control lines for each argument file. If no files are provided, .it wc reads the standard input. .s3 A text line is a sequence of characters not beginning with `\fB.\fR', `!' or `\*a' and ended by a new-line. A control line is a line beginning with `\fB.\fR', `!' or `\*a'. A word is a sequence of characters bounded by the beginning of a line, by the end of a line, or by a blank or a tab. .s3 When there is more than one input file, a grand total is also printed. .sh DIAGNOSTICS none; arguments not found are ignored. .sh BUGS each argument file. If no files are provided, .it wc reads the standard input. .s3 A text line is a sequence of characters not beginning with `\fB.\fR', `!' or `\*a' and ended by a new-line. A control line is a line beginning with `\fB.\fR', `!' or `\*a'. A word is a sequence of characters bounded by the beginning of a line, by the end of.th OPR I 1/15/73 .sh NAME opr \*- off line print .sh SYNOPSIS .bd opr [ .bd \*-\*- ] [ .bd \*- ] [ .bd + ] [ .bd +\*- ]file ... .sh DESCRIPTION .it Opr will arrange to have the 201 data phone daemon submit a job to the Honeywell 6070 to print the file arguments. Normally, the output appears at the GCOS central site. If the first argument is .bd \*-\*-, the output is remoted to station R1, which has an IBM 1403 printer. .s3 Normally, each file is printed in the state it is found when the data phone daemon reads it. If a particular file argument is preceded by .bd +, or a preceding argument of .bd + has been encountered, then .it opr will make a copy for the daemon to print. If the file argument is preceded by .bd \*-, or a preceding argument of .bd \*- has been encountered, then .it opr will unlink (remove) the file. .s3 If there are no arguments except for the optional .bd \*-\*-, then the standard input is read and off-line printed. Thus .it opr may be used as a filter. .sh FILES /usr/dpd/* spool area .br /etc/passwd personal ident cards .br /etc/dpd daemon .sh "SEE ALSO" dpd(I), passwd(V) .sh BUGS There should be a way to specify a general remote site. he daemon to print. If the file argument is preceded by .bd \*-, or a preceding argument of .bd \*- has been encountered, then .it opr will unlink (remove) the file. .s3 If there are no arguments except for the optional .bd \*-\*-, then the standard input is read and off-line printed. Thus .it opr may be used as a filter. .sh FILES /usr/dpd/* spool area .br /.th SORT I 5/7/73 .sh NAME sort \*- sort a file .sh SYNOPSIS .bd sort [ .bd \*-anr ] [ \fB+\fIn\fR ] [ \fB\*-\fIn\fR ] [ input [ output ] ] .sh DESCRIPTION .it Sort sorts .it input and writes the result on .it output. If the output file is not given, the standard output is used. If the input file is missing, the standard input is used. Thus .it sort may be used as a filter. The input and output file may be the same. .s3 The sort is line-by-line in increasing ASCII collating sequence, except that upper-case letters are considered the same as the corresponding lower-case letters. .s3 .it Sort understands several flag arguments. .s3 .lp +4 4 \fB\*-a\fR Use strict ASCII collating sequence. .s3 .lp +4 4 \fB\*-n\fR An initial numeric string is sorted by numerical value. .s3 .lp +4 4 \fB\*-r\fR Output is in reverse order. .s3 .lp +4 4 \fB\*-\fIn\fR The first \fIn\fR fields in each line are ignored. A field is defined as a string of non-space, non-tab characters separated by tabs and spaces from its neighbors. .s3 .lp +4 4 \fB+\fIn\fR The first \fIn\fR characters are ignored in the sort. Fields (with \fB\*-\fIn\fR) are skipped before characters. .s3 .i0 .sh FILES /tmp/stm? .sh BUGS The largest file that can be sorted is about 128K bytes. tring is sorted by numerical value. .s3 .lp +4 4 \fB\*-r\fR Output is in reverse order. .s3 .lp +4 4 \fB\*-\fIn\fR The first \fIn\fR fields in each line are ignored. A field is defined as a string of non-space, non-tab characters separated by tabs and spaces from its neighbors. .s3 ..th STTY I 6/12/72 .sh NAME stty \*- set teletype options .sh SYNOPSIS .bd stty option ... .sh DESCRIPTION .it Stty will set certain I/O options on the current output teletype. The option strings are selected from the following set: .s3 .lp +10 10 \fBeven\fR allow even parity .lp +10 10 \fB\*-even\fR disallow even parity .lp +10 10 \fBodd\fR allow odd parity .lp +10 10 \fB\*-odd\fR disallow odd parity .lp +10 10 \fBraw\fR raw mode input (no erase, kill, interrupt, quit, EOT; parity bit passed back) .lp +10 10 \fB\*-raw\fR negate raw mode .lp +10 10 \fB\*-nl\fR allow carriage return for new-line, and output CR-LF for carriage return or new-line .lp +10 10 \fBnl\fR accept only new-line to end lines .lp +10 10 \fBecho\fR echo back every character typed .lp +10 10 \fB\*-echo\fR do not echo characters .lp +10 10 \fBlcase\fR map upper case to lower case .lp +10 10 \fB\*-lcase\fR do not map case .lp +10 10 \fB\*-tabs\fR replace tabs by spaces in output .lp +10 10 \fBtabs\fR preserve tabs .lp +10 10 \fBdelay\fR calculate cr, tab, and form-feed delays .lp +10 10 \fB\*-delay\fR no cr/tab/ff delays .lp +10 10 \fBtdelay\fR calculate tab delays .lp +10 10 \fB\*-tdelay\fR no tab delays .s3 .i0 .sh "SEE ALSO" stty(II) .sh BUGS There should be `package' options such as .bd execuport, .bd 33, or .bd terminet. cters .lp +10 10 \fBlcase\fR map upper case to lower case .lp +10 10 \fB\*-lcase\fR do not map case .lp +10 10 \fB\*-tabs\fR replace tabs by spaces in output .lp +10 10 \fBtabs\fR preserve tabs .lp +10 10 \fBdelay\fR calcu.th PLOT I 6/4/73 .sh NAME plot \*- make a graph .sh SYNOPSIS .bd plot [ option ] ... .sh DESCRIPTION .it Plot takes pairs of numbers from the standard input as abscissas and ordinates of a graph. The graph is plotted on the storage scope, /dev/vt0. .s3 The following options are recognized, each as a separate argument. .s3 .lp +5 5 \fBa\fR Supply abscissas automatically (they are missing from the input); spacing is given by the next argument, or is assumed to be 1 if next argument is not a number. .s3 .lp +5 5 \fBc\fR Place character string given by next argument at each point. .s3 .lp +5 5 \fBd\fR Omit connections between points. (Disconnect.) .s3 .lp +5 5 \fBg\fIn\fR Grid style: .lp +5 0 \fIn\fR=0, no grid .lp +5 0 \fIn\fR=1, axes only .lp +5 0 \fIn\fR=2, complete grid (default). .s3 .lp +5 5 \fBs\fR Save screen, don't erase before plotting. .s3 .lp +5 5 \fBx\fR Next 1 (or 2) arguments are lower (and upper) \fIx\fR limits. .s3 .lp +5 5 \fBy\fR Next 1 (or 2) arguments are lower (and upper) \fIy\fR limits. .s3 .i0 Points are connected by straight line segments in the order they appear in input. If a specified lower limit exceeds the upper limit, or if the automatic increment is negative, the graph is plotted upside down. Automatic abscissas begin with the lower \fIx\fR limit, or with 0 if no limit is specified. Grid lines and automatically determined limits fall on round values, however roundness may be subverted by giving an inappropriately rounded lower limit. Plotting symbols specified by .bd c are placed so that a small initial letter, such as + o x, will fall approximately on the plotting point. .sh FILES /dev/vt0 .sh "SEE ALSO" spline(VI) .sh BUGS A limit of 1000 points is enforced silently. h is plotted upside down. Automatic abscissas begin with the lower \fIx\fR limit, or with 0 if no limit is specified. Grid lines and automatically determined limits fall on round values, however roundness may be subverted by giving an inappropriately rounded lower limit. Plotting symbols specified by .bd c are placed so.th AR I 3/15/72 .sh NAME ar \*- archive and library maintainer .sh SYNOPSIS .bd ar key afile name ... .sh DESCRIPTION .it Ar maintains groups of files combined into a single archive file. Its main use is to create and update library files as used by the loader. It can be used, though, for any similar purpose. .s3 .it Key is one character from the set .bd drtux, optionally concatenated with .bd v. .it Afile is the archive file. The .it names are constituent files in the archive file. The meanings of the .it key characters are: .s3 .bd d means delete the named files from the archive file. .s3 .bd r means replace the named files in the archive file. If the archive file does not exist, .bd r will create it. If the named files are not in the archive file, they are appended. .s3 .bd t prints a table of contents of the archive file. If no names are given, all files in the archive are tabled. If names are given, only those files are tabled. .s3 .bd u is similar to .bd r except that only those files that have been modified are replaced. If no names are given, all files in the archive that have been modified will be replaced by the modified version. .s3 .bd x will extract the named files. If no names are given, all files in the archive are extracted. In neither case does .bd x alter the archive file. .s3 .bd v means verbose. Under the verbose option, .it ar gives a file-by-file description of the making of a new archive file from the old archive and the constituent files. The following abbreviations are used: .s3 .bd "  c" copy .bd " a" append .bd " d" delete .bd " r" replace .bd " x" extract .sh FILES /tmp/vtm? temporary .sh "SEE ALSO" ld(I), archive(V) .sh BUGS Option .bd tv should be implemented as a table with more information. .s3 There should be a way to specify the placement of a new file in an archive. Currently, it is placed at the end. .s3 Since .it ar has not been rewritten to deal properly with the new file system modes, extracted files have mode 666. . The following abbreviations are used: .s3 .bd " .th AS I 1/15/73 .sh NAME as \*- assembler .sh SYNOPSIS .bd as [ .bd \*- ] name ... .sh DESCRIPTION .it As assembles the concatenation of the named files. If the optional first argument .bd \*- is used, all undefined symbols in the assembly are treated as global. .s3 The output of the assembly is left on the file .bd "a.out." It is executable if no errors occurred during the assembly, and if there were no unresolved external references. .sh FILES /etc/as2 pass 2 of the assembler .br /tmp/atm[1-4]? temporary .br a.out object .sh "SEE ALSO" ld(I), nm(I), db(I), a.out(V), `UNIX Assembler Manual'. .sh DIAGNOSTICS When an input file cannot be read, its name followed by a question mark is typed and assembly ceases. When syntactic or semantic errors occur, a single-character diagnostic is typed out together with the line number and the file name in which it occurred. Errors in pass 1 cause cancellation of pass 2. The possible errors are: .s3 .ta 3 ) Parentheses error .br ] Parentheses error .br < String not terminated properly .br * Indirection used illegally .br .li \fB.\fR Illegal assignment to `\fB.\fR' .br A Error in address .br B Branch instruction is odd or too remote .br E Error in expression .br F Error in local (`f' or `b') type symbol .br G Garbage (unknown) character .br I End of file inside an if .br M Multiply defined symbol as label .br O Word quantity assembled at odd address .br P `\fB.\fR' different in pass 1 and 2 .br R Relocation error .br U Undefined symbol .br X Syntax error .br .sh BUGS Symbol table overflow is not checked. \fBx\fR errors can cause incorrect line numbers in following diagnostics. r in address .br B Branch instruction is odd or too remote .br E Error in expression .br F Error in local (`f' or `b') type symbol .br G Garbage (unknown) character .br I End of file inside an if .br M Multiply defined symbol as label .br O Word quantity assembled at odd address .br P `\fB.\fR' different in pass 1 and 2 .br R Relocation error .br U Undefined symbol .br X Syntax error .br .sh BUGS Symbo.th BAS I 1/15/73 .sh NAME bas \*- basic .sh SYNOPSIS .bd bas [ file ] .sh DESCRIPTION .it Bas is a dialect of Basic. If a file argument is provided, the file is used for input before the console is read. .it Bas accepts lines of the form: .s3 statement integer statement .s3 Integer numbered statements (known as internal statements) are stored for later execution. They are stored in sorted ascending order. Non-numbered statements are immediately executed. The result of an immediate expression statement (that does not have `=' as its highest operator) is printed. .s3 Statements have the following syntax: .s3 .lp +5 5 expression .br The expression is executed for its side effects (assignment or function call) or for printing as described above. .s3 .lp +5 5 .bd done .br Return to system level. .s3 .lp +5 5 .bd draw expression expression expression .br A line is drawn on the Tektronix 611 display `/dev/vt0' from the current display position to the XY co-ordinates specified by the first two expressions. The scale is zero to one in both X and Y directions. If the third expression is zero, the line is invisible. The current display position is set to the end point. .s3 .lp +5 5 .bd display list .br The list of expressions and strings is concatenated and displayed (i.e. printed) on the 611 starting at the current display position. The current display position is not changed. .s3 .lp +5 5 .bd erase .br The 611 screen is erased. .s3 .lp +5 5 .bd for name .bd = expression expression statement .br .lp +5 5 .bd for name .bd = expression expression .br .li ... .lp +5 5 .bd next .br The .it for statement repetitively executes a statement (first form) or a group of statements (second form) under control of a named variable. The variable takes on the value of the first expression, then is incremented by one on each loop, not to exceed the value of the second expression. .s3 .lp +5 5 .bd goto expression .br The expression is evaluated, truncated to an integer and execution goes to the corresponding integer numbered statment. If executed from immediate mode, the internal statements are compiled first. .s3 .lp +5 5 .bd if expression statement .br The statement is executed if the expression evaluates to non-zero. .s3 .lp +5 5 .bd list [expression [expression]] .br .br list is used to print out the stored internal statements. If no arguments are given, all internal statements are printed. If one argument is given, only that internal statement is listed. If two arguments are given, all internal statements inclusively between the arguments are printed. .s3 .lp +5 5 .bd print list .br The list of expressions and strings are concatenated and printed. (A string is delimited by " characters.) .s3 .lp +5 5 .bd return [expression] .br The expression is evaluated and the result is passed back as the value of a function call. If no expression is given, zero is returned. .s3 .lp +5 5 .bd run .br The internal statements are compiled. The symbol table is re-initialized. The random number generator is reset. Control is passed to the lowest numbered internal statement. .s3 .i0 Expressions have the following syntax: .s3 .lp +5 5 name .br A name is used to specify a variable. Names are composed of a letter followed by letters and digits. The first four characters of a name are significant. .s3 .lp +5 5 number .br A number is used to represent a constant value. A number is written in Fortran style, and contains digits, an optional decimal point, and possibly a scale factor consisting of an \fBe\fR followed by a possibly signed exponent. .s3 .lp +5 5 .bd ( expression .bd ) .br Parentheses are used to alter normal order of evaluation. .s3 .lp +5 5 expression operator expression .br Common functions of two arguments are abbreviated by the two arguments separated by an operator denoting the function. A complete list of operators is given below. .s3 .lp +5 5 expression .bd ( [expression [ .bd , expression] ... ] .bd ) .br Functions of an arbitrary number of arguments can be called by an expression followed by the arguments in parentheses separated by commas. The expression evaluates to the line number of the entry of the function in the internally stored statements. This causes the internal statements to be compiled. If the expression evaluates negative, a builtin function is called. The list of builtin functions appears below. .s3 .lp +5 5 name .bd [ expression [ .bd , expression ] ... .bd ] .br Each expression is truncated to an integer and used as a specifier for the name. The result is syntactically identical to a name. .bd a[1,2] is the same as .bd a[1][2]. The truncated expressions are restricted to values between 0 and 32767. .s3 .i0 The following is the list of operators: .s3 .lp +5 5 = .br = is the assignment operator. The left operand must be a name or an array element. The result is the right operand. Assignment binds right to left, all other operators bind left to right. .s3 .lp +5 5 & \*v .br & (logical and) has result zero if either of its arguments are zero. It has result one if both its arguments are non-zero. \*v (logical or) has result zero if both of its arguments are zero. It has result one if either of its arguments are non-zero. .s3 .lp +5 5 < <= > >= == <> .br The relational operators (< less than, <= less than or equal, > greater than, >= greater than or equal, == equal to, <> not equal to) return one if their arguments are in the specified relation. They return zero otherwise. Relational operators at the same level extend as follows: a>b>c is the same as a>b&b>c. .s3 .lp +5 5 + \*- .br Add and subtract. .s3 .lp +5 5 * / .br Multiply and divide. .s3 .lp +5 5 ^ .br Exponentiation. .s3 .i0 The following is a list of builtin functions: .s3 .lp +5 5 .bd arg(i) .br is the value of the \fIi\fR|-th actual parameter on the current level of function call. .s3 .lp +5 5 .bd exp(x) .br is the exponential function of \fIx\fR. .s3 .lp +5 5 .bd log(x) .br is the natural logarithm of \fIx\fR. .s3 .lp +5 5 .bd sin(x) .br is the sine of \fIx\fR (radians). .s3 .lp +5 5 .bd cos(x) .br is the cosine of \fIx\fR (radians). .s3 .lp +5 5 .bd atn(x) .br is the arctangent of \fIx\fR . its value is between \*-\(*p/2 and \(*p/2. .s3 .lp +5 5 .bd "rnd( )" .br is a uniformly distributed random number between zero and one. .s3 .lp +5 5 .bd "expr( )" .br is the only form of program input. A line is read from the input and evaluated as an expression. The resultant value is returned. .s3 .lp +5 5 .bd int(x) .br returns \fIx\fR truncated to an integer. .i0 .sh FILES .dt /tmp/btm? temporary .sh DIAGNOSTICS Syntax errors cause the incorrect line to be typed with an underscore where the parse failed. All other diagnostics are self explanatory. .sh BUGS Has been known to give core images. Needs a way to .it list a program onto a file. 3 .lp +5 5 .bd "expr( )" .br is the only form of program input. A line is read from the input and evaluated as an expression. The resultant value is returned. .s3 .lp +5 5 .bd int(x) .br returns \fIx\fR truncated to an integer. .i0 .sh FILES .dt /tmp/btm? temporary .sh DIAGNOSTICS Syntax errors cause the incorrect line to be typed with an underscor.th CAT I 1/15/73 .sh NAME cat \*- concatenate and print .sh SYNOPSIS .bd cat file ... .sh DESCRIPTION .it Cat reads each file in sequence and writes it on the standard output. Thus: .s3 .bd " cat file" .s3 is about the easiest way to print a file. Also: .s3 .bd " cat file1 file2 >file3" .s3 is about the easiest way to concatenate files. .s3 If no input file is given .it cat reads from the standard input file. .s3 If the argument \fB\*-\fR is encountered, .it cat reads from the standard input file. .s3 .sh "SEE ALSO" pr(I), cp(I) .sh DIAGNOSTICS none; if a file cannot be found it is ignored. .sh BUGS .bd "cat x y >x" and .bd "cat x y >y" cause strange results. tandard output. Thus: .s3 .bd " cat file" .s3 is about the easiest way to print a file. Also: .s3 .bd " cat file1 file2 >file3" .s3 is about the easiest way to concatenate files. .s3 If no input file is given .it cat reads from the standard input file. .s3 If the argument \fB\*-\fR is encountered, .it cat reads from the standard input file. .s3 .th CHDIR I 3/15/72 .sh NAME chdir \*- change working directory .sh SYNOPSIS .bd chdir directory .sh DESCRIPTION .it Directory becomes the new working directory. The process must have execute permission on the directory. The process must have execute (search) permission in .it directory. .s3 Because a new process is created to execute each command, .it chdir would be ineffective if it were written as a normal command. It is therefore recognized and executed by the Shell. .sh "SEE ALSO" sh(I) .sh BUGS .s3 .th CHMOD I 8/20/73 .sh NAME chmod \*- change mode .sh SYNOPSIS .bd chmod octal file ... .sh DESCRIPTION The octal mode replaces the mode of each of the files. The mode is constructed from the OR of the following modes: .s3 .in +3 4000 set user ID on execution 2000 set group ID on execution 0400 read by owner 0200 write by owner 0100 execute by owner 0070 read, write, execute by group 0007 read, write, execute by others .s3 .in -3 Only the owner of a file (or the super-user) may change its mode. .s3 .sh "SEE ALSO" ls(I) .s3 .sh BUGS \*- change mode .sh SYNOPSIS .bd chmod octal file ... .sh DESCRIPTION The octal mode replaces the mode of each of the files. The mode is constructed from the OR of the following modes: .s3 .in +3 4000 set user ID on execution 2000 set group ID on execution 0400 read by owner 0200 write by owner 0100 execute by owner 0070 read, write, execute by group 0007 read, write, execute by others .s3 .in -3 Only the owner of a file (or the super-user) may change its mode. .s3 .th CHOWN I 3/15/72 .sh NAME chown \*- change owner .sh SYNOPSIS .bd chown owner file ... .sh DESCRIPTION .it Owner becomes the new owner of the files. The owner may be either a decimal UID or a login name found in the password file. .s3 Only the owner of a file (or the super-user) is allowed to change the owner. Unless it is done by the super-user or the real user ID of the new owner, the set-user-ID permission bit is turned off as the owner of a file is changed. .sh FILES /etc/passwd .sh BUGS s mode. .s3 .th CMP I 1/15/73 .sh NAME cmp \*- compare two files .sh SYNOPSIS .bd cmp file1 file2 .sh DESCRIPTION The two files are compared for identical contents. Discrepancies are noted by giving the offset and the differing words, all in octal. .sh "SEE ALSO" proof (I), comm (I) .sh BUGS If the shorter of the two files is of odd length, .it cmp acts as if a null byte had been appended to it. The .it offset is only a single-precision number. the owner of a file is changed. .sh FILES /etc/passwd .sh BUGS s mode. .s3 .th CP I 1/24/73 .sh NAME cp \*- copy .sh SYNOPSIS .bd cp file1 file2 .sh DESCRIPTION The first file is copied onto the second. The mode and owner of the target file are preserved if it already existed; the mode of the source file is used otherwise. .s3 If .it file2 is a directory, then the target file is a file in that directory with the file-name of .it file1. .sh "SEE ALSO" cat(I), pr(I), mv(I) .sh BUGS Copying a file onto itself destroys its contents. anged. .sh FILES /etc/passwd .sh BUGS s mode. .s3 .th DATE I 11/1/73 .sh NAME date \*- print and set the date .sh SYNOPSIS .bd date [ mmddhhmm[yy] ] .sh DESCRIPTION If no argument is given, the current date is printed to the second. If an argument is given, the current date is set. The first .it mm is the month number; .it dd is the day number in the month; .it hh is the hour number (24 hour system); the second .it mm is the minute number; .it yy is the last 2 digits of the year number and is optional. For example: .s3 .bd" date 10080045" .s3 sets the date to Oct 8, 12:45 AM. The current year is the default if no year is mentioned. The system operates in GMT. .it Date takes care of the conversion to and from local standard and daylight time. .sh BUGS en, the current date is set. The first .it mm is the month number; .it dd is the day number in the month; .it hh is the hour number (24 hour system); the second .it mm is the minute number; .it yy is the last 2 digits of the year number and is optional. For example: .s3 .bd" date 10080045" .s3 sets the.th DB I 8/20/73 .sh NAME db \*- debug .sh SYNOPSIS .bd db [ core [ namelist ] ] [ .bd \*- ] .sh DESCRIPTION Unlike many debugging packages (including DEC's ODT, on which .it db is loosely based), .it db is not loaded as part of the core image which it is used to examine; instead it examines files. Typically, the file will be either a core image produced after a fault or the binary output of the assembler. .it Core is the file being debugged; if omitted \fBcore\fR is assumed. .it Namelist is a file containing a symbol table. If it is omitted, the symbol table is obtained from the file being debugged, or if not there from .bd a.out. If no appropriate name list file can be found, .it db can still be used but some of its symbolic facilities become unavailable. .s3 For the meaning of the optional third argument, see the last paragraph below. .s3 The format for most .it db requests is an address followed by a one character command. Addresses are expressions built up as follows: .s3 .lp +4 3 1. A name has the value assigned to it when the input file was assembled. It may be relocatable or not depending on the use of the name during the assembly. .s3 .lp +4 3 2. An octal number is an absolute quantity with the appropriate value. .s3 .lp +4 3 3. A decimal number immediately followed by `\fB.\fR' is an absolute quantity with the appropriate value. .s3 .lp +4 3 4. An octal number immediately followed by \fBr\fR is a relocatable quantity with the appropriate value. .s3 .lp +4 3 5. The symbol \fB.\fR indicates the current pointer of \fIdb\fR. The current pointer is set by many \fIdb\fR requests. .s3 .lp +4 3 6. A \fB*\fR before an expression forms an expression whose value is the number in the word addressed by the first expression. A \fB*\fR alone is equivalent to `\fB*.\fR'. .s3 .lp +4 3 7. Expressions separated by \fB+\fR or blank are expressions with value equal to the sum of the components. At most one of the components may be relocatable. .s3 .lp +4 3 8. Expressions separated by \fB\*-\fR form an expression with value equal to the difference to the components. If the right component is relocatable, the left component must be relocatable. .s3 .lp +4 3 9. Expressions are evaluated left to right. .s3 .in \n(inu Names for registers are built in: .s3 .bd " r0 ... r5" .bd " sp" .bd " pc" .bd " fr0 ... fr5" .s3 These may be examined. Their values are deduced from the contents of the stack in a core image file. They are meaningless in a file that is not a core image. .s3 If no address is given for a command, the current address (also specified by ``\fB.\fR'') is assumed. In general, ``\fB.\fR'' points to the last word or byte printed by .it db. .s3 There are .it db commands for examining locations interpreted as numbers, machine instructions, ASCII characters, and addresses. For numbers and characters, either bytes or words may be examined. The following commands are used to examine the specified file. .s3 .lp +4 3 / The addressed word is printed in octal. .s3 .lp +4 3 \\ The addressed byte is printed in octal. .s3 .lp +4 3 " The addressed word is printed as two ASCII characters. .s3 .if t .tr '\(aa\`\(ga .lp +4 3 .li ' The addressed byte is printed as an ASCII character. .s3 .lp +4 3 ` The addressed word is printed in decimal. .s3 .lp +4 3 ? The addressed word is interpreted as a machine instruction and a symbolic form of the instruction, including symbolic addresses, is printed. Often, the result will appear exactly as it was written in the source program. .s3 .lp +4 3 & The addressed word is interpreted as a symbolic address and is printed as the name of the symbol whose value is closest to the addressed word, possibly followed by a signed offset. .s3 .tr ''`` .lp +4 3 (i. e., the character ``new line'') This command advances the current location counter ``\fB.\fR'' and prints the resulting location in the mode last specified by one of the above requests. .s3 .lp +4 3 ^ This character decrements ``\fB.\fR'' and prints the resulting location in the mode last selected one of the above requests. It is a converse to <nl>. .s3 .lp +4 3 % Exit. .s3 .in \n(inu Odd addresses to word-oriented commands are rounded down. The incrementing and decrementing of ``\fB.\fR'' done by the .bd and .bd ^ requests is by one or two depending on whether the last command was word or byte oriented. .s3 The address portion of any of the above commands may be followed by a comma and then by an expression. In this case that number of sequential words or bytes specified by the expression is printed. ``\fB.\fR'' is advanced so that it points at the last thing printed. .s3 There are two commands to interpret the value of expressions. .s3 .lp +4 3 = When preceded by an expression, the value of the expression is typed in octal. When not preceded by an expression, the value of ``\fB.\fR'' is indicated. This command does not change the value of ``\fB.\fR''. .s3 .lp +4 3 : An attempt is made to print the given expression as a symbolic address. If the expression is relocatable, that symbol is found whose value is nearest that of the expression, and the symbol is typed, followed by a sign and the appropriate offset. If the value of the expression is absolute, a symbol with exactly the indicated value is sought and printed if found; if no matching symbol is discovered, the octal value of the expression is given. .s3 .in \n(inu The following command may be used to patch the file being debugged. .s3 .lp +4 3 ! This command must be preceded by an expression. The value of the expression is stored at the location addressed by the current value of ``\fB.\fR''. The opcodes do not appear in the symbol table, so the user must assemble them by hand. .s3 .in \n(inu The following command is used after a fault has caused a core image file to be produced. .s3 .lp +4 3 $ causes the fault type and the contents of the general registers and several other registers to be printed both in octal and symbolic format. The values are as they were at the time of the fault. .s3 .in \n(inu For some purposes, it is important to know how addresses typed by the user correspond with locations in the file being debugged. The mapping algorithm employed by .it db is non-trivial for two reasons: First, in an .bd a.out file, there is a 20(8) byte header which will not appear when the file is loaded into core for execution. Therefore, apparent location 0 should correspond with actual file offset 20. Second, addresses in core images do not correspond with the addresses used by the program because in a core image there is a 512-byte header containing the system's per-process data for the dumped process, and also because the stack is stored contiguously with the text and data part of the core image rather than at the highest possible locations. .it Db obeys the following rules: .s3 If exactly one argument is given, and if it appears to be an .bd a.out file, the 20-byte header is skipped during addressing, i.e., 20 is added to all addresses typed. As a consequence, the header can be examined beginning at location \*-20. .s3 If exactly one argument is given and if the file does not appear to be an .bd a.out file, no mapping is done. .s3 If zero or two arguments are given, the mapping appropriate to a core image file is employed. This means that locations above the program break and below the stack effectively do not exist (and are not, in fact, recorded in the core file). Locations above the user's stack pointer are mapped, in looking at the core file, to the place where they are really stored. The per-process data kept by the system, which is stored in the first 512(10) bytes of the core file, cannot currently be examined (except by \fB$\fR). .s3 If one wants to examine a file which has an associated name list, but is not a core image file, the last argument ``\fB\*-\fR'' can be used (actually the only purpose of the last argument is to make the number of arguments not equal to two). This feature is used most frequently in examining the memory file /dev/mem. .sh "SEE ALSO" as(I), core(V), a.out(V), od(I) .sh DIAGNOSTICS ``File not found'' if the first argument cannot be read; otherwise ``\fB?\fR''. .sh BUGS There should be some way to examine the registers and other per-process data in a core image; also there should be some way of specifying double-precision addresses. It does not know yet about shared text segments. last argument is to make the number of arguments not equal to two). This feature is used most frequently in examining the memory file /dev/mem. .sh "SEE ALSO" as(I), core(V), a.out(V), od(I) .sh DIAGNOSTICS ``File not found'' if the first argument cannot be read; otherwise ``\fB?\fR''. .sh .th MERGE I 11/7/73 .sh NAME merge \*- merge several files .sh SYNOPSIS .bd merge [ .bd \*-anr ] [ \fB\*-\fIn\fR ] [ \fB+\fIn\fR ] [ name ... ] .sh DESCRIPTION .it Merge merges several files together and writes the result on the standard output. If a file is designated by an unadorned `\*-', the standard input is understood. .s3 The merge is line-by-line in increasing ASCII collating sequence, except that upper-case letters are considered the same as the corresponding lower-case letters. .s3 .it Merge understands several flag arguments. .s3 .lp +4 4 \fB\*-a\fR Use strict ASCII collating sequence. .s3 .lp +4 4 \fB\*-n\fR An initial numeric string, possibly preceded by '\*-', is sorted by numerical value. .s3 .lp +4 4 \fB\*-r\fR Data is in reverse order. .s3 .lp +4 4 \fB\*-\fIn\fR The first \fIn\fR fields in each line are ignored. A field is defined as a string of non-space, non-tab characters separated by tabs and spaces from its neighbors. .s3 .lp +4 4 \fB+\fIn\fR The first \fIn\fR characters are ignored. Fields (with \fB\*-\fIn\fR) are skipped before characters. .i0 .sh "SEE ALSO" sort(I) .sh BUGS Only 8 files can be handled; any further files are ignored. receded by '\*-', is sorted by numerical value. .s3 .lp +4 4 \fB\*-r\fR Data is in reverse order. .s3 .lp +4 4 \fB\*-\fIn\fR The first \fIn\fR fields in each line are ignored. A field is defined as a string of non-space, non-tab characters separated by tabs and spaces from its neighbors. .s3 .lp +4 4 \fB+\fIn\fR The first \fIn\fR characters are ignored. Fi.th DSW I 3/15/72 .sh NAME dsw \*- delete interactively .sh SYNOPSIS .bd dsw [ directory ] .sh DESCRIPTION For each file in the given directory (`\fB.\fR' if not specified) .it dsw types its name. If .bd y is typed, the file is deleted; if .bd x, .it dsw exits; if new-line, the file is not deleted; if anything else, .it dsw asks again. .sh "SEE ALSO" rm(I) .sh BUGS The name .it dsw is a carryover from the ancient past. Its etymology is amusing. 4 4 \fB+\fIn\fR The first \fIn\fR characters are ignored. Fi.th CC I 3/15/72 .sh NAME cc \*- C compiler .sh SYNOPSIS .bd cc [ .bd \*-c ] [ .bd \*-p ] file ... .sh DESCRIPTION .it Cc is the UNIX C compiler. It accepts three types of arguments: .s3 Arguments whose names end with `.c' are assumed to be C source programs; they are compiled, and the object program is left on the file whose name is that of the source with `.o' substituted for `.c'. .s3 Other arguments (except for \fB\*-c\fR) are assumed to be either loader flag arguments, or C-compatible object programs, typically produced by an earlier .it cc run, or perhaps libraries of C-compatible routines. These programs, together with the results of any compilations specified, are loaded (in the order given) to produce an executable program with name .bd a.out. .s3 The .bd \*-c argument suppresses the loading phase, as does any syntax error in any of the routines being compiled. .s3 If the .bd \*-p flag is used, only the macro prepass is run on all files whose name ends in \fB.c\fR. The expanded source is left on the file whose name is that of the source with \fB.i\fR substituted for \fB.c\fR. .sh FILES file.c input file .br file.o object file .br a.out loaded output .br /tmp/ctm? temporary .br /lib/c[01] compiler .br /lib/crt0.o runtime startoff .br /lib/libc.a builtin functions, etc. .br /lib/liba.a system library .sh "SEE ALSO" `C reference manual', cdb(I), ld(I) for other flag arguments. .sh BUGS g is used, only the macro prepass is run on all files whose name ends in \fB.c\fR. The expanded source is left on the .th SPLIT I 1/15/73 .sh NAME split \*- split a file into pieces .sh SYNOPSIS .bd split [ file1 [ file2 ] ] .sh DESCRIPTION .it Split reads file1 and writes it in 1000-line pieces, as many as are necessary, onto a set of output files. The name of the first output file is file2 with an `a' appended, and so on through the alphabet and beyond. If no output name is given, `x' is default. .s3 If no input file is given, or the first argument is `\*-', then the standard input file is used. .sh BUGS Watch out for 14-character file names. The number of lines per file should be an argument. .bd split [ file1 [ file2 ] ] .sh DESCRIPTION .it Split reads file1 and writes it in 1000-line pieces, as many as are necessary, onto a set of output files. The name of the first output file is file2 with an `a' appended, and so on through the alphabet and beyond. If no output name is given, `x' is default. .s3 If no input file is given, or the first argument is `\*-', then the standard input file is used. .sh BUGS Watch out for .th ED I 1/15/73 .if t .ds q \(aa .if n .ds q ' .sh NAME ed \*- editor .sh SYNOPSIS .bd ed [ .bd \*- ] [ name ] .sh DESCRIPTION .it Ed is the standard text editor. .s3 If a .it name argument is given, .it ed simulates an .it e command (see below)\| on the named file; that is to say, the file is read into .it ed's buffer so that it can be edited. The optional .bd \*- simulates an .bd os command (see below)\| which suppresses the printing of characters counts by .it e, .it r, and .it w commands. .s is suppressed. .s3 .it Ed operates on a copy of any file it is editing; changes made in the copy have no effect on the file until a \fIw\fR (write)\| command is given. The copy of the text being edited resides in a temporary file called the .it buffer. There is only one buffer. .s3 Commands to .it ed have a simple and regular structure: zero or more .it addresses followed by a single character .it command, possibly followed by parameters to the command. These addresses specify one or more lines in the buffer. Every command which requires addresses has default addresses, so that the addresses can often be omitted. .s3 In general, only one command may appear on a line. Certain commands allow the input of text. This text is placed in the appropriate place in the buffer. While .it ed is accepting text, it is said to be in \fIinput mode.\fR In this mode, no commands are recognized; all input is merely collected. Input mode is left by typing a period `\fB.\fR' alone at the beginning of a line. .s3 .it Ed supports a limited form of .it "regular expression" notation. A regular expression is an expression which specifies a set of strings of characters. A member of this set of strings is said to be .it matched by the regular expression. The regular expressions allowed by .it ed are constructed as follows: .s3 .lp +6 3 1. An ordinary character (not one of those discussed below)\| is a regular expression and matches that character. .s3 .lp +6 3 2. A circumflex `^' at the beginning of a regular expression matches the null character at the beginning of a line. .s3 .lp +6 3 3. A currency symbol `$' at the end of a regular expression matches the null character at the end of a line. .s3 .lp +6 3 4. A period `\fB.\fR' matches any character but a new-line character. .s3 .lp +6 3 5. A regular expression followed by an asterisk `*' matches any number of adjacent occurrences (including zero)\| of the regular expression it follows. .s3 .lp +6 3 6. A string of characters enclosed in square brackets `[ ]' matches any character in the string but no others. If, however, the first character of the string is a circumflex `^' the regular expression matches any character but new-line and the characters in the string. .s3 .lp +6 3 7. The concatenation of regular expressions is a regular expression which matches the concatenation of the strings matched by the components of the regular expression. .s3 .lp +6 3 8. The null regular expression standing alone is equivalent to the last regular expression encountered. .s3 .i0 Regular expressions are used in addresses to specify lines and in one command (see .it s below)\| to specify a portion of a line which is to be replaced. .s3 If it is desired to use one of the regular expression metacharacters as an ordinary character, that character may be preceded by `\\'. This also applies to the character bounding the regular expression (often `/')\| and to `\\' itself. .s3 Addresses are constructed as follows. To understand addressing in .it ed it is necessary to know that at any time there is a \fIcurrent line.\fR Generally speaking, the current line is the last line affected by a command; however, the exact effect on the current line by each command is discussed under the description of the command. .s3 .lp +6 3 1. The character `\fB.\fR' addresses the current line. .s3 .lp +6 3 2. The character `^' addresses the line immediately before the current line. .s3 .lp +6 3 3. The character `$' addresses the last line of the buffer. .s3 .lp +6 3 4. A decimal number .it n addresses the \fIn\fR-th line of the buffer. .s3 .lp +6 3 5. `\*q\fIx\fR' addresses the line associated (marked)\| with the mark name character \fIx\fR which must be a printable character. Lines are marked with the .it k command described below. .s3 .lp +6 3 6. A regular expression enclosed in slashes `/' addresses the first line found by searching toward the end of the buffer and stopping at the first line containing a string matching the regular expression. If necessary the search wraps around to the beginning of the buffer. .s3 .lp +6 3 7. A regular expression enclosed in queries `?' addresses the first line found by searching toward the beginning of the buffer and stopping at the first line found containing a string matching the regular expression. If necessary the search wraps around to the end of the buffer. .s3 .lp +6 3 8. An address followed by a plus sign `+' or a minus sign `\*-' followed by a decimal number specifies that address plus (resp. minus)\| the indicated number of lines. The plus sign may be omitted. .s3 .i0 Commands may require zero, one, or two addresses. Commands which require no addresses regard the presence of an address as an error. Commands which accept one or two addresses assume default addresses when insufficient are given. If more addresses are given than such a command requires, the last one or two (depending on what is accepted)\| are used. .s3 Addresses are separated from each other typically by a comma `\fB,\fR'. They may also be separated by a semicolon `\fB;\fR'. In this case the current line `\fB.\fR' is set to the previous address before the next address is interpreted. This feature can be used to determine the starting line for forward and backward searches (`/', `?')\|. The second address of any two-address sequence must correspond to a line following the line corresponding to the first address. .s3 In the following list of .it ed commands, the default addresses are shown in parentheses. The parentheses are not part of the address, but are used to show that the given addresses are the default. .s3 As mentioned, it is generally illegal for more than one command to appear on a line. However, any command may be suffixed by `p' (for `print')\|. In that case, the current line is printed after the command is complete. .ne 6 .s3 .lp +10 5 ( \fB. \fR)\|a .lp +10 5 .lp +10 5 .li \fB.\fR .lp +10 5 The append command reads the given text and appends it after the addressed line. `\fB.\fR' is left on the last line input, if there were any, otherwise at the addressed line. Address `0' is legal for this command; text is placed at the beginning of the buffer. .s3 .lp +10 5 ( \fB. \fR, \fB. \fR)\|c .lp +10 5 .lp +10 5 .li \fB.\fR .lp +10 5 The change command deletes the addressed lines, then accepts input text which replaces these lines. `\fB.\fR' is left at the last line input; if there were none, it is left at the first line not changed. .s3 .lp +10 5 ( \fB. \fR, \fB. \fR)\| d .br The delete command deletes the addressed lines from the buffer. The line originally after the last line deleted becomes the current line; if the lines deleted were originally at the end, the new last line becomes the current line. .s3 .lp +10 5 e filename .br The edit command causes the entire contents of the buffer to be deleted, and then the named file to be read in. `\fB.\fR' is set to the last line of the buffer. The number of characters read is typed. `filename' is remembered for possible use as a default file name in a subsequent .it r or .it w command. .s3 .lp +10 5 f filename .br The filename command prints the currently remembered file name. If `filename' is given, the currently remembered file name is changed to `filename'. .s3 .lp +10 5 (1,$)\|g/regular expression/command list .br In the global command, the first step is to mark every line which matches the given regular expression. Then for every such line, the given command list is executed with `\fB.\fR' initially set to that line. A single command or the first of multiple commands appears on the same line with the global command. All lines of a multi-line list except the last line must be ended with `\\'. .it A, .it i, and .it c commands and associated input are permitted; the `\fB.\fR' terminating input mode may be omitted if it would be on the last line of the command list. The (global)\| commands, .it g, and .it v, are not permitted in the command list. .s3 .lp +10 5 ( \fB. \fR)\|i .lp +10 5 .lp +10 5 .li . .br This command inserts the given text before the addressed line. `\fB.\fR' is left at the last line input; if there were none, at the addressed line. This command differs from the .it a command only in the placement of the text. .s3 .lp +10 5 ( \fB. \fR)\|k\fIx\fR .br The mark command associates or marks the addressed line with the single character mark name .it x. The ten most recent mark names are remembered. The current mark names may be printed with the .it n command. .s3 .lp +10 5 ( \fB. \fR, \fB. \fR)\|m\fIa\fR .br The move command will reposition the addressed lines after the line addressed by .it a. The last of the moved lines becomes the current line. .s3 .lp +10 5 n .br The \fIn\fR command will print the current mark names. .s3 .lp +10 5 os .lp +10 5 ov .br After .it os character counts printed by .it "e, r," and .it w are suppressed. .it Ov turns them back on. .s3 .lp +10 5 ( \fB. \fR, \fB. \fR)\|p .br The print command prints the addressed lines. `\fB.\fR' is left at the last line printed. The .it p command .it may be placed on the same line after any command. .s3 .lp +10 5 q .br The quit command causes .it ed to exit. No automatic write of a file is done. .s3 .lp +10 5 ($)\|r filename .br The read command reads in the given file after the addressed line. If no file name is given, the remembered file name, if any, is used (see .it e and .it f commands)\|. The remembered file name is not changed unless `filename' is the very first file name mentioned. Address `0' is legal for .it r and causes the file to be read at the beginning of the buffer. If the read is successful, the number of characters read is typed. `\fB.\fR' is left at the last line read in from the file. .s3 .lp +10 5 ( \fB. \fR, \fB. \fR)\|s/regular expression/replacement/ or, .lp +10 5 ( \fB. \fR, \fB. \fR)\|s/regular expression/replacement/g .br The substitute command searches each addressed line for an occurrence of the specified regular expression. On each line in which a match is found, all matched strings are replaced by the replacement specified, if the global replacement indicator `g' appears after the command. If the global indicator does not appear, only the first occurrence of the matched string is replaced. It is an error for the substitution to fail on all addressed lines. Any character other than space or new-line may be used instead of `/' to delimit the regular expression and the replacement. `\fB.\fR' is left at the last line substituted. .s3 An ampersand `&' appearing in the replacement is replaced by the regular expression that was matched. The special meaning of `&' in this context may be suppressed by preceding it by `\\'. .s3 .lp +10 5 (1,$)\|v/regular expression/command list .br This command is the same as the global command except that the command list is executed with `\fB.\fR' initially set to every line .it except those matching the regular expression. .s3 .lp +10 5 (1,$)\|w filename .br The write command writes the addressed lines onto the given file. If the file does not exist, it is created mode 666 (readable and writeable by everyone)\|. The remembered file name is .it not changed unless `filename' is the very first file name mentioned. If no file name is given, the remembered file name, if any, is used (see .it e and .it f commands)\|. `\fB.\fR' is unchanged. If the command is successful, the number of characters written is typed. .s3 .lp +10 5 ($)\|= .br The line number of the addressed line is typed. `\fB.\fR' is unchanged by this command. .s3 .lp +10 5 !UNIX command .br The remainder of the line after the `!' is sent to UNIX to be interpreted as a command. `\fB.\fR' is unchanged. The entire shell syntax is not recognized. See msh(VII) for the restrictions. .s3 .lp +10 5 ( \fB.\fR+1 )\| .br An address alone on a line causes the addressed line to be printed. A blank line alone is equivalent to `.+1p'; it is useful for stepping through text. .s3 .i0 If an interrupt signal (ASCII DEL)\| is sent, .it ed will print a `?' and return to its command level. .s3 If invoked with the command name `\*-', (see init(VII)\|)\| .it ed will sign on with the message `Editing system' and print `*' as the command level prompt character. .s3 .it Ed has size limitations on the maximum number of lines that can be edited, on the maximum number of characters in a line, in a global's command list, in a remembered file name, and in the size of the temporary file. The current sizes are: 4000 lines per file, 512 characters per line, 256 characters per global command list, 64 characters per file name, and 64K characters in the temporary file (see BUGS)\|. .sh FILES /tmp/etm?, temporary .br /etc/msh, to implement the `!' command. .sh DIAGNOSTICS `?' for errors in commands; `TMP' for temporary file overflow. .sh BUGS The temporary file can grow to no more than 64K bytes. line, in a global's command list, in a remembered file name, and in the size of the temporary file. The current sizes are: 4000 lines per file, 512 characters per line, 256 characters per global command list, 64 characters per file name, and 64K characters in the temporary file (see BUGS)\|. .sh FILES /tmp/etm?, temporary .br /etc/msh, to implement the `!' command. .sh DIAGNOSTICS `?' for errors in commands; `TMP' for temporary file overflow. .sh.th TIME I 8/16/73 .sh NAME time \*- time a command .sh SYNOPSIS .bd time command .sh DESCRIPTION The given command is executed; after it is complete, .it time prints the elapsed time during the command, the time spent in the system, and the time spent in execution of the command. .s3 The execution time can depend on what kind of memory the program happens to land in; the user time in MOS is often half what it is in core. .sh BUGS Notice that .bd "time x >y" puts the timing information into .it y. One can get around this by .bd "time sh" followed by .bd "x >y." .br Elapsed time is accurate to the second, while the CPU times are measured to the 60th second. Thus the sum of the CPU times can be up to a second larger than the elapsed time. nd the time spent in execution of the command. .s3 The execution time can depend on what kind of memory the program happens to land in; the user time in MOS is often half what it is in core. .sh BUGS Notice that .bd "time x >y" puts the timing information into .it y. One can g.th LN I 3/15/72 .sh NAME ln \*- make a link .sh SYNOPSIS .bd ln name1 [ name2 ] .sh DESCRIPTION A link is a directory entry referring to a file; the same file (together with its size, all its protection information, etc) may have several links to it. There is no way to distinguish a link to a file from its original directory entry; any changes in the file are effective independently of the name by which the file is known. .s3 .it Ln creates a link to an existing file .it name1. If .it name2 is given, the link has that name; otherwise it is placed in the current directory and its name is the last component of .it name1. .s3 It is forbidden to link to a directory or to link across file systems. .sh "SEE ALSO" rm(I) .sh BUGS There is nothing particularly wrong with .it ln, but .it tp doesn't understand about links and makes one copy for each name by which a file is known; thus if the tape is extracted several copies are restored and the information that links were involved is lost. If .it name2 is given, the.th LS I 8/20/73 .sh NAME ls \*- list contents of directory .sh SYNOPSIS .bd ls [ .bd \*-ltasdru ] name ... .sh DESCRIPTION For each directory argument, .it ls lists the contents of the directory; for each file argument, .it ls repeats its name and any other information requested. The output is sorted alphabetically by default. When no argument is given, the current directory is listed. When several arguments are given, the arguments are first sorted appropriately, but file arguments appear before directories and their contents. There are several options: .s3 .lp +4 4 \fB\*-l\fR list in long format, giving mode, number of links, owner, size in bytes, and time of last modification for each file. (See below.) .s3 .lp +4 4 \fB\*-t\fR sort by time modified (latest first) instead of by name, as is normal .s3 .lp +4 4 \fB\*-a\fR list all entries; usually those beginning with `\fB.\fR' are suppressed .s3 .lp +4 4 \fB\*-s\fR give size in blocks for each entry .s3 .lp +4 4 \fB\*-d\fR if argument is a directory, list only its name, not its contents (mostly used with .bd \*-l to get status on directory) .s3 .lp +4 4 \fB\*-r\fR reverse the order of sort to get reverse alphabetic or oldest first as appropriate .s3 .lp +4 4 \fB\*-u\fR use time of last access instead of last modification for sorting (\fB\*-t\fR) or printing (\fB\*-l\fR) .s3 .i0 The mode printed under the .bd \*-l option contains 10 characters which are interpreted as follows: the first character is .s3 .lp +3 3 \fBd\fR if the entry is a directory; .lp +3 3 \fBb\fR if the entry is a block-type special file; .lp +3 3 \fBc\fR if the entry is a character-type special file; .lp +3 3 \fB\*-\fR if the entry is a plain file. .s3 .i0 The next 9 characters are interpreted as three sets of three bits each. The first set refers to owner permissions; the next to permissions to others in the same user-group; and the last to all others. Within each set the three characters indicate permission respectively to read, to write, or to execute the file as a program. For a directory, `execute' permission is interpreted to mean permission to search the directory for a specified file. The permissions are indicated as follows: .s3 .lp +3 3 \fBr\fR if the file is readable .lp +3 3 \fBw\fR if the file is writable .lp +3 3 \fBx\fR if the file is executable .lp +3 3 \fB\*-\fR if the indicated permission is not granted .s3 .i0 Finally, the group-execute permission character is given as .bd s if the file has set-group-ID mode; likewise the user-execute permission character is given as .bd s if the file has set-user-ID mode. .sh FILES /etc/passwd to get user ID's for \fBls \*-l\fR. .sh BUGS le. The permissions are indicated as follows: .s3 .lp +3 3 \fBr\fR if the file is readable .lp +3 3 \fBw\fR if the file is writable .lp +3 3 \fBx\fR if the file is executable .lp +3 3 \fB\*-\fR if the indicated permission is not granted .s3 .i0 Finally, the group-execute permission character is given as .bd s if the file has set-group-ID mode; likewise the user-execute permission character is given as .bd s .th MAIL I 10/25/72 .sh NAME mail \*- send mail to another user .sh SYNOPSIS .bd mail [ .bd \*-yn ] .br .bd mail letter person ... .br .bd mail person .sh DESCRIPTION .it Mail without an argument searches for a file called .it mailbox, prints it if present, and asks if it should be saved. If the answer is .bd y, the mail is renamed .it mbox, otherwise it is deleted. .it Mail with a .bd \*-y or .bd \*-n argument works the same way, except that the answer to the question is supplied by the argument. .s3 When followed by the names of a letter and one or more people, the letter is appended to each person's .it mailbox. When a .it person is specified without a .it letter, the letter is taken from the sender's standard input up to an EOT. Each letter is preceded by the sender's name and a postmark. .s3 A .it person is either a user name recognized by .bd login, in which case the mail is sent to the default working directory of that user, or the path name of a directory, in which case .it mailbox in that directory is used. .s3 When a user logs in he is informed of the presence of mail. .sh FILES /etc/passwd to identify sender and locate persons .br mailbox input mail .br mbox saved mail .sh "SEE ALSO" login(I) .sh BUGS The mail should be prepended rather than appended to the mailbox. The old mbox should not be destroyed when new mail is saved. ized by .bd login, in which case the mail is sent to the default working directory of that user, or the path name of a directory, in which case .it mailbox in that director.th MESG I 3/15/72 .sh NAME mesg \*- permit or deny messages .sh SYNOPSIS .bd mesg [ .bd n ] [ .bd y ] .sh DESCRIPTION .it Mesg with argument .bd n forbids messages via .it write by revoking non-user write permission on the user's typewriter. .it Mesg with argument .bd y reinstates permission. All by itself, .it mesg reverses the current permission. In all cases the previous state is reported. .sh FILES /dev/tty? .sh "SEE ALSO" write(I) .sh DIAGNOSTICS `?' if the standard input file is not a typewriter .sh BUGS G I 3/15/72 .sh NAME mesg \*- permit or deny messages .sh SYNOPSIS .bd mesg [ .bd n ] [ .bd y ] .sh DESCRIPTION .it Mesg with argument .bd n forbids messages via .it write by revoking non-user write permission on the user's typewriter. .it Mesg with argument .bd y reinstates permission. All by itself, .it mesg reverses the current permission. In all cases the previous state is reported. .sh FILES /dev/tty? .sh "SEE ALSO" write(I) .sh DIAGNOSTICS `?' if the standard input file is not a typewriter .s.th MKDIR I 3/15/72 .sh NAME mkdir \*- make a directory .sh SYNOPSIS .bd mkdir dirname ... .sh DESCRIPTION .it Mkdir creates specified directories in mode 777. The standard entries `\fB.\fR' and `\fB..\fR' are made automatically. .sh "SEE ALSO" rmdir(I) .sh BUGS nt .bd y reinstates permission. All by itself, .it mesg reverses the current permission. In all cases the previous state is reported. .sh FILES /dev/tty? .sh "SEE ALSO" write(I) .sh DIAGNOSTICS `?' if the standard input file is not a typewriter .s.th MV I 8/20/73 .sh NAME mv \*- move or rename a file .sh SYNOPSIS .bd mv name1 name2 .sh DESCRIPTION .it Mv changes the name of .it name1 to .it name2. If .it name2 is a directory, .it name1 is moved to that directory with its original file-name. Directories may only be moved within the same parent directory (just renamed). .s3 If .it name2 already exists, it is removed before .it name1 is renamed. If .it name2 has a mode which forbids writing, .it mv prints the mode and reads the standard input to obtain a line; if the line begins with .bd y, the move takes place; if not, .it mv exits. .s3 If .it name2 would lie on a different file system, so that a simple rename is impossible, .it mv copies the file and deletes the original. .sh BUGS It should take a .bd "\*-f" flag, like .it rm, to suppress the question if the target exists and is not writable. dy exists, it is removed before .it name1 is renamed. If .it name2 has a mode which forbids writing, .it mv prints the mode and reads the standard input to obta.th NM I 8/20/73 .sh NAME nm \*- print name list .sh SYNOPSIS .bd nm [ .bd \*-cjnru ] [ name ] .sh DESCRIPTION .it Nm prints the symbol table from the output file of an assembler or loader run. Each symbol name is preceded by its value (blanks if undefined) and one of the letters \fBU\fR (undefined) \fBA\fR (absolute) \fBT\fR (text segment symbol), \fBD\fR (data segment symbol), \fBB\fR (bss segment symbol), or \fBC\fR (common symbol). Global symbols have their first character underlined. Normally, the output is sorted alphabetically and symbols consisting of a letter followed by one or more digits are not printed (that is, symbols which look like C internal symbols). .s3 If no file is given, the symbols in .bd a.out are listed. .s3 Options are: .s3 .lp +4 4 \fB\*-c\fR list only C-style external symbols, that is those beginning with underscore `\*_'. .s3 .lp +4 4 \fB\*-j\fR list symbols consisting of a letter followed by digits, which are normally suppressed. .s3 .lp +4 4 \fB\*-n\fR sort by value instead of by name .s3 .lp +4 4 \fB\*-r\fR sort in reverse order .s3 .lp +4 4 \fB\*-u\fR print only undefined symbols. .i0 .sh FILES a.out .sh BUGS ok like C internal symbols). .s3 If no file is given, the symbols in .bd a.out are listed. .s3 Options are: .s3 .lp +4 4 \fB\*-c\fR list only C-style external symbols, that is those beginning with underscore `\*_'. .s3 .lp +4 4 \fB\*-j\fR list symbols consisting of a letter followed by digits, which are normally suppressed. .s3 .lp +4 4 \fB\*-n\fR sort by value instead of.th OD I 1/15/73 .sh NAME od \*- octal dump .sh SYNOPSIS .bd od [ .bd \*-abcdho ] [ file ] [ [ .bd + ] offset[ \fB. \fR][ \fBb\fR ] ] .sh DESCRIPTION .it Od dumps .it file in one or more formats as selected by the first argument. If the first argument is missing .bd \*-o is default. The meanings of the format argument characters are: .s3 .lp +3 3 \fBa\fR interprets words as PDP-11 instructions and dis-assembles the operation code. Unknown operation codes print as ???. .s3 .lp +3 3 \fBb\fR interprets bytes in octal. .s3 .lp +3 3 \fBc\fR interprets bytes in ascii. Unknown ascii characters are printed as \\?. .s3 .lp +3 3 \fBd\fR interprets words in decimal. .s3 .lp +3 3 \fBh\fR interprets words in hex. .s3 .lp +3 3 \fBo\fR interprets words in octal. .s3 .s3 .i0 The \fIfile\fR argument specifies which file is to be dumped. If no file argument is specified, the standard input is used. Thus .it od can be used as a filter. .s3 The offset argument specifies the offset in the file where dumping is to commence. This argument is normally interpreted as octal bytes. If `\fB.\fR' is appended, the offset is interpreted in decimal. If `\fBb\fR' is appended, the offset is interpreted in blocks. (A block is 512 bytes.) If the file argument is omitted, the offset argument must be preceded by `\fB+\fR'. .s3 Dumping continues until end-of-file. .sh "SEE ALSO" db(I) .sh BUGS the standard input is used. Thus .it od can be used as a filter. .s3 The offset argument specifies the offset in the file where dumping is to commence. This.th PR I 1/15/73 .sh NAME pr \*- print file .sh SYNOPSIS .bd pr [ .bd \*-h name ] [ \fB\*-\fIn\fR ] [ \fB+\fIn\fR ] [ file ... ] .sh DESCRIPTION .it Pr produces a printed listing of one or more files. The output is separated into pages headed by a date, the name of the file or a header (if any), and the page number. If there are no file arguments, .it pr prints the standard input file, and is thus usable as a filter. .s3 Options apply to all following files but may be reset between files: .s3 .lp +5 5 \fB\*-\fIn\fR produce \fIn\fR-column output .s3 .lp +5 5 \fB+\fIn\fR begin printing with page \fIn\fR. .s3 .lp +5 5 \fB\*-h\fR treat the next argument as a header .s3 .i0 If there is a header in force, it is printed in place of the file name. Interconsole messages via write(I) are forbidden during a .it pr. .sh FILES /dev/tty? to suspend messages. .sh "SEE ALSO" cat(I), cp(I) .sh DIAGNOSTICS none (files not found are ignored) .sh BUGS It would be nice to be able to set the number of lines per page. lp +5 5 \fB.th REW I 1/15/73 .sh NAME rew \*- rewind tape .sh SYNOPSIS .bd rew [ [ .bd m ]digit ] .sh DESCRIPTION .it Rew rewinds DECtape or magtape drives. The digit is the logical tape number, and should range from 0 to 7. if the digit is preceded by \fBm\fR, .it rew applies to magtape rather than DECtape. A missing digit indicates drive 0. .sh FILES /dev/tap? .br /dev/mt? .sh BUGS DIAGNOSTICS none (files not found are ignored) .sh BUGS It would be nice to be able to set the number of lines per page. lp +5 5 \fB.th FORM I 6/15/72 .sh NAME form \*- form letter generator .sh SYNOPSIS .bd form proto arg ... .sh DESCRIPTION .it Form generates a form letter from a prototype letter, an associative memory, arguments and in a special case, the current date. .s3 If .it form is invoked with the .it proto argument \fIx\fR, the associative memory is searched for an entry with name \fIx\fR and the contents filed under that name are used as the prototype. If the search fails, the message `[\fIx\fR]:' is typed on the console and whatever text is typed in from the console, terminated by two new lines, is used as the prototype. If the prototype argument is missing, `{letter}' is assumed. .s3 Basically, .it form is a copy process from the prototype to the output file. If an element of the form [\fIn\fR] (where \fIn\fR is a digit from 1 to 9) is encountered, the \fIn\fR-th argument is inserted in its place, and that argument is then rescanned. If [0] is encountered, the current date is inserted. If the desired argument has not been given, a message of the form `[\fIn\fR]:' is typed. The response typed in then is used for that argument. .s3 If an element of the form [\fIname\fR] or {\fIname\fR} is encountered, the \fIname\fR is looked up in the associative memory. If it is found, the contents of the memory under this \fIname\fR replaces the original element (again rescanned). If the \fIname\fR is not found, a message of the form `[\fIname\fR]:' is typed. The response typed in is used for that element. The response is entered in the memory under the name if the name is enclosed in [ ]. The response is not entered in the memory but is remembered for the duration of the letter if the name is enclosed in {}. .s3 In both of the above cases, the response is typed in by entering arbitrary text terminated by two new lines. Only the first of the two new lines is passed with the text. .s3 If one of the special characters [{]}\\ is preceded by a \\, it loses its special character. .s3 If a file named `forma' already exists in the user's directory, `formb' is used as the output file and so forth to `formz'. .s3 The file `form.m' is created if none exists. Because form.m is operated on by the disc allocator, it should only be changed by using .it fed, the form letter editor, or .it form. .s3 .sh FILES form.m associative memory .br form? output file (read only) .sh "SEE ALSO" fed(I), type(I), roff(I) .sh BUGS An unbalanced ] or } acts as an end of file but may add a few strange entries to the associative memory. already exists in the user's direc.th FED I 1/15/73 .sh NAME fed \*- edit associative memory for form letter .sh SYNOPSIS .bd fed .sh DESCRIPTION .it Fed is used to edit a form letter associative memory file, .bd form.m, which consists of named strings. Commands consist of single letters followed by a list of string names separated by a single space and ending with a new line. The conventions of the Shell with respect to `*' and `?' hold for all commands but \fBm\fR. The commands are: .s3 .lp +3 3 \fBe\fR name ... .br .it Fed writes the string whose name is .it name onto a temporary file and executes .it ed. On exit from the \fIed\fR the temporary file is copied back into the associative memory. Each argument is operated on separately. Be sure to give an .it "ed w" command (without a filename) to rewrite .it fed's temporary file before quitting out of .it ed. .s3 .lp +3 3 .bd d [ name ... ] .br deletes a string and its name from the memory. When called with no arguments .bd d operates in a verbose mode typing each string name and deleting only if a .bd y is typed. A .bd q response returns to \fIfed\fR's command level. Any other response does nothing. .s3 .lp +3 3 .bd m name1 name2 ... .br (move) changes the name of name1 to name2 and removes previous string name2 if one exists. Several pairs of arguments may be given. Literal strings are expected for the names. .s3 .lp +3 3 .bd n [ name ... ] .br (names) lists the string names in the memory. If called with the optional arguments, it just lists those requested. .s3 .lp +3 3 .bd p name ... .br prints the contents of the strings with names given by the arguments. .s3 .lp +3 3 .bd q .br returns to the system. .s3 .lp +3 3 .bd c [ .bd p ] [ .bd f ] .br checks the associative memory file for consistency and reports the number of free headers and blocks. The optional arguments do the following: .s3 .lp +6 3 \fBp\fR causes any unaccounted-for string to be printed. .s3 .lp +6 3 \fBf\fR fixes broken memories by adding unaccounted-for headers to free storage and removing references to released headers from associative memory. .br .i0 .dt .sh FILES /tmp/ftmp? temporary .br form.m associative memory .sh "SEE ALSO" form(I), ed(I), sh(I) .sh WARNING It is legal but unwise to have string names with blanks, `:' or `?' in them. .sh BUGS of free headers and blocks. The optional arguments do the following: .s3 .lp +6 3 \fBp\fR causes any unaccounted-for string to be printed. .s3 .lp +6 3 \fBf\fR fixes broken memories by adding unaccounted-for headers to free storage and removing references to released header.th RM I 1/20/73 .sh NAME rm \*- remove (unlink) files .sh SYNOPSIS .bd rm [ .bd \*-f ] [ .bd \*-r ] name ... .sh DESCRIPTION .it Rm removes the entries for one or more files from a directory. If an entry was the last link to the file, the file is destroyed. Removal of a file requires write permission in its directory, but neither read nor write permission on the file itself. .s3 If there is no write permission to a file designated to be removed, .it rm will print the file name, its mode and then read a line from the standard input. If the line begins with \fBy\fR, the file is removed, otherwise it is not. The optional argument .bd \*-f prevents this interaction. .s3 If a designated file is a directory, an error comment is printed unless the optional argument .bd \*-r has been used. In that case, .it rm recursively deletes the entire contents of the specified directory. To remove directories \fIper se\fR see rmdir(I). .sh FILES /etc/glob to implement the .bd \*-r flag .sh "SEE ALSO" rmdir(I) .sh BUGS When .it rm removes the contents of a directory under the .bd \*-r flag, full pathnames are not printed in diagnostics. al argument .bd \*-f prevents this interaction. .s3 If a designated file is a directory, an error comment is printed unless the optional argument .bd \*-r has been used. In that case, .it rm recursively deletes the entire contents of the specified directory. To remove directories \fIper se\fR see rmdir(I). .sh FILES /etc/glob to implement the .bd \*-r flag .sh "SEE ALSO" rmdir(I) .sh BUGS When .i.th RMDIR I 3/15/72 .sh NAME rmdir \*- remove directory .sh SYNOPSIS .bd rmdir dir ... .sh DESCRIPTION .it Rmdir removes (deletes) directories. The directory must be empty (except for the standard entries `\fB.\fR' and `\fB..\fR', which .it rmdir itself removes). Write permission is required in the directory in which the directory appears. .sh BUGS Needs a \fB\*-r\fR flag. Actually, write permission in the directory's parent is .it not required. t the .bd \*-r flag .sh "SEE ALSO" rmdir(I) .sh BUGS When .i.th ROFF I 6/12/72 .sh NAME roff \*- format text .sh SYNOPSIS .bd roff [ \fB+\fIn\fR ] [ \fB\*-\fIn\fR ] [ .bd \*-s ] [ .bd \*-h ] file ... .sh DESCRIPTION .it Roff formats text according to control lines embedded in the text in the given files. Encountering a nonexistent file terminates printing. Incoming interconsole messages are turned off during printing. The optional flag arguments mean: .s3 .lp +5 5 \fB+\fIn\fR Start printing at the first page with number \fIn\fR. .s3 .lp +5 5 \fB\*-\fIn\fR Stop printing at the first page numbered higher than \fIn\fR. .s3 .lp +5 5 \fB\*-s\fR Stop before each page (including the first) to allow paper manipulation; resume on receipt of an interrupt signal. .s3 .lp +5 5 \fB\*-h\fR Insert tabs in the output stream to replace spaces whenever appropriate. .s3 .i0 A Request Summary is attached. .sh FILES /usr/lib/suftab suffix hyphenation tables .br /tmp/rtm? temporary .br .sh "SEE ALSO" nroff (I), troff (I) .sh BUGS .it Roff is the simplest of the runoff programs, but is virtually undocumented. .bp .tc | .tr | .in 0 .ce REQUEST SUMMARY .s3 .ul .if t .ta .75i 1.5i 2.25i .if n .ta 8 16 24 32 Request Break Initial Meaning .if t .in2.25i .if n .in24 .na .ti 0 .li .ad yes yes Begin adjusting right margins. .ti 0 .li .ar no arabic Arabic page numbers. .ti 0 .li .br yes - Causes a line break \*- the filling of the current line is stopped. .ti 0 .li .bl|n yes - Insert of n blank lines, on new page if necessary. .ti 0 .li .bp|+n yes n=1 Begin new page and number it n; no n means `+1'. .ti 0 .li .cc|c no c=. Control character becomes `c'. .ti 0 .li .ce|n yes - Center the next n input lines, without filling. .ti 0 .li .de|xx no - Define macro named `xx' (definition ends on line beginning `\fB..\fR'). .ti 0 .li .ds yes no Double space; same as `.ls 2'. .ti 0 .li .ef|t no t=\*a\*a\*a\*a Even foot title becomes t. .ti 0 .li .eh|t no t=\*a\*a\*a\*a Even head title becomes t. .ti 0 .li .fi yes yes Begin filling output lines. .ti 0 .li .fo no t=\*a\*a\*a\*a All foot titles are t. .ti 0 .li .hc|c no none Hyphenation character set to `c'. .ti 0 .li .he|t no t=\*a\*a\*a\*a All head titles are t. .ti 0 .li .hx no - Title lines are suppressed. .ti 0 .li .hy|n no n=1 Hyphenation is done, if n=1; and is not done, if n=0. .ti 0 .li .ig no - Ignore input lines through a line beginning with `\fB..\fR'. .ti 0 .li .in|+n yes - Indent n spaces from left margin. .ti 0 .li .ix +n no - Same as `.in' but without break. .ti 0 .li .li|n no - Literal, treat next n lines as text. .ti 0 .li .ll|+n no n=65 Line length including indent is n characters. .ti 0 .li .ls|+n yes n=1 Line spacing set to n lines per output line. .ti 0 .li .m1|n no n=2 Put n blank lines between the top of page and head title. .ti 0 .li .m2|n no n=2 n blank lines put between head title and beginning of text on page. .ti 0 .li .m3|n no n=1 n blank lines put between end of text and foot title. .ti 0 .li .m4|n no n=3 n blank lines put between the foot title and the bottom of page. .ti 0 .li .na yes no Stop adjusting the right margin. .ti 0 .li .ne|n no - Begin new page, if n output lines cannot fit on present page. .ti 0 .li .nn|+n no - The next n output lines are not numbered. .ti 0 .li .n1 no no Number output lines; start with 1 each page .ti 0 .li .n2|n no no Number output lines; stop numbering if n=0. .ti 0 .li .ni|+n no n=0 Line numbers are indented n. .ti 0 .li .nf yes no Stop filling output lines. .ti 0 .li .nx|filename - Change to input file `filename'. .ti 0 .li .of|t no t=\*a\*a\*a\*a Odd foot title becomes t. .ti 0 .li .oh|t no t=\*a\*a\*a\*a Odd head title becomes t. .ti 0 .li .pa|+n yes n=1 Same as `.bp'. .ti 0 .li .pl|+n no n=66 Total paper length taken to be n lines. .ti 0 .li .po|+n no n=0 Page offset. All lines are preceded by N spaces. .ti 0 .li .ro no arabic Roman page numbers. .ti 0 .li .sk|n no - Produce n blank pages starting next page. .ti 0 .li .sp|n yes - Insert block of n blank lines. .ti 0 .li .ss yes yes Single space output lines, equivalent to `.ls 1'. .ti 0 .li .ta|N|M|... - Pseudotab settings. Initial tab settings are columns 9,17,25,... .ti 0 .li .tc|c no c=`|' Tab replacement character becomes `c'. .ti 0 .li .ti|+n yes - Temporarily indent next output line n space. .ti0 .li .tr|abcd.. no - Translate a into b, c into d, etc. .ti0 .li .ul|n no - Underline the letters and numbers in the next n input lines. ges starting next page. .ti 0 .li .sp|n yes - Insert block of n blank lines. .ti 0 .li .ss yes yes Single space output lines, equivalent to `.ls 1'. .ti 0 .li .ta|N|M|... - Pseudotab settings. Initial tab settings are colum.th SH I 4/18/73 .hc  .sh NAME sh \*- shell (command interpreter) .sh SYNOPSIS .bd sh [ name [ arg1 ... [ arg9 ] ] ] .sh DESCRIPTION .it Sh is the standard command interpreter. It is the program which reads and arranges the execution of the command lines typed by most users. It may itself be called as a command to interpret files of commands. Before discussing the arguments to the Shell used as a command, the structure of command lines themselves will be given. .s3 .bd "Commands." Each command is a sequence of non-blank command arguments separated by blanks. The first argument specifies the name of a command to be executed. Except for certain types of special arguments discussed below, the arguments other than the command name are passed without interpretation to the invoked command. .s3 If the first argument is the name of an executable file, it is invoked; otherwise the string `/bin/' is prepended to the argument. (In this way most standard commands, which reside in `/bin', are found.) If no such command is found, the string `/usr' is further prepended (to give `/usr/bin/command') and another attempt is made to execute the resulting file. (Certain lesser-used commands live in `/usr/bin'.) If the `/usr/bin' file exists, but is not executable, it is used by the Shell as a command file. That is to say it is executed as though it were typed from the console. If all attempts fail, a diagnostic is printed. .s3 .bd "Command lines." One or more commands separated by `\*v' or `^' constitute a .it pipeline. The standard output of each command but the last in a pipeline is taken as the standard input of the next command. Each command is run as a separate process, connected by pipes (see pipe(II)) to its neighbors. A command line contained in parentheses `( )' may appear in place of a simple command as an element of a pipeline. .s3 A .it "command line" consists of one or more pipelines separated, and perhaps terminated by `\fB;\fR' or `&'. The semicolon designates sequential execution. The ampersand causes the preceding pipeline to be executed without waiting for it to finish. The process id of such a pipeline is reported, so that it may be used if necessary for a subsequent .it wait or .it kill. .s3 .bd "Termination Reporting." If a command (not followed by `&') terminates abnormally, a message is printed. (All terminations other than exit and interrupt are considered abnormal.) Termination reports for commands followed by `&' are given upon receipt of the first command subsequent to the termination of the command, or when a .it wait is executed. The following is a list of the abnormal termination messages: .s3 .nf Bus error Trace/BPT trap Illegal instruction IOT trap EMT trap Bad system call Quit Floating exception Memory violation Killed .s3 .fi If a core image is produced, `\*- Core dumped' is appended to the appropriate message. .s3 .bd "Redirection of I/O." There are three character sequences that cause the immediately following string to be interpreted as a special argument to the Shell itself. Such an argument may appear anywhere among the arguments of a simple command, or before or after a parenthesized command list, and is associated with that command or command list. .s3 An argument of the form `arg' causes file `arg' to be used as the standard output file for the associated command. `Arg' is created if it did not exist, and in any case is truncated at the outset. .s3 An argument of the form `>>arg' causes file `arg' to be used as the standard output for the associated command. If `arg' did not exist, it is created; if it did exist, the command output is appended to the file. .s3 For example, either of the command lines .s3 ls >junk; cat tail >>junk .br ( ls; cat tail ) >junk .s3 creates, on file `junk', a listing of the working directory, followed immediately by the contents of file `tail'. .s3 Either of the constructs `>arg' or `>>arg' associated with any but the last command of a pipeline is ineffectual, as is `', and other characters meaningful to the Shell may be passed as part of arguments. A special case of this feature allows the continuation of commands onto more than one line: a new-line preceded by `\\' is translated into a blank. .s3 Sequences of characters enclosed in double (") or single (\*a) quotes are also taken literally. For example: .s3 ls \*v pr \*-h "My directory" .s3 causes a directory listing to be produced by .it ls, and passed on to .it pr to be printed with the heading `My directory'. Quotes permit the inclusion of blanks in the heading, which is a single argument to .it pr. .s3 .bd "Argument passing." When the Shell is invoked as a command, it has additional string processing capabilities. Recall that the form in which the Shell is invoked is .s3 sh [ name [ arg1 ... [ arg9 ] ] ] .s3 The .it name is the name of a file which will be read and interpreted. If not given, this subinstance of the Shell will continue to read the standard input file. .s3 In command lines in the file (not in command input), character sequences of the form `$n', where .it n is a digit, are replaced by the \fIn\fRth argument to the invocation of the Shell (argn). `$0' is replaced by .it name. .s3 .bd "End of file." An end-of-file in the Shell's input causes it to exit. A side effect of this fact means that the way to log out from UNIX is to type an EOT. .s3 .bd "Special commands." The following commands are treated specially by the Shell. .s3 .it chdir is done without spawning a new process by executing .it "sys chdir" (II). .s3 .it login is done by executing /bin/login without creating a new process. .s3 .it wait is done without spawning a new process by executing .it "sys wait" (II). .s3 .it shift is done by manipulating the arguments to the Shell. .s3 `\fB:\fR' is simply ignored. .s3 .bd "Command file errors; interrupts." Any Shell-detected error, or an interrupt signal, during the execution of a command file causes the Shell to cease execution of that file. .s3 Process that are created with a `&' ignore interrupts. Also if such a process has not redirected its input with a `<', its input is automatically redirected to the zero length file /dev/null. .sh FILES /etc/glob, which interprets `*', `?', and `['. .br /dev/null as a source of end-of-file. .sh "SEE ALSO" `The UNIX Time-sharing System', which gives the theory of operation of the Shell. .br chdir(I), login(I), wait(I), shift(I) .sh BUGS When output is redirected, particularly to make a multicommand pipeline, diagnostics tend to be sent down the pipe and are sometimes lost altogether. Not all components of a pipeline swawned with `&' ignore interrupts. redirected to the zero length file /dev/null.tc | .tr | .th TROFF I 1/15/73 .sh NAME troff \*- format text .sh SYNOPSIS .bd troff [ \fB+\fIn\fR ] [ \fB\*-\fIn\fR ] [ .bd \*-t ] [ .bd \*-f ] [ .bd \*-w ] [ .bd \*-i ] [ .bd \*-a ] files .sh DESCRIPTION .it Troff formats text for a Graphic Systems phototypesetter according to control lines embedded in the text files. .it Troff is based on nroff(I). The non-file option arguments are interpreted as follows: .s3 .lp +10 5 \fB+\fIn\fR Commence typesetting at the first page numbered \fIn\fR or larger. .s3 .lp +10 5 \fB\*-\fIn\fR Stop after page .it n. .s3 .lp +10 5 \fB\*-t\fR Place output on standard output instead of the phototypesetter. .s3 .lp +10 5 \fB\*-f\fR Refrain from feeding out paper and stopping the phototypesetter at the end. .s3 .lp +10 5 \fB\*-w\fR Wait until phototypsetter is available, if currently busy. .s3 .lp +10 5 \fB\*-i\fR Read from standard input after the files have been exhausted. .s3 .lp +10 5 \fB\*-a\fR Send a printable approximation of the results to the standard output. .s3 .i0 A TROFF Guide is available [1] which can be used in conjunction with an NROFF Manual [2]. .sh FILES /usr/lib/suftab suffix hyphenation tables .br /tmp/rtm? temporary .br .sh "SEE ALSO" [1] Preliminary TROFF Guide (unpublished). .br [2] NROFF User's Manual (internal memorandum). .br TROFF Made Trivial (unpublished). .br nroff(I), roff(I) .sh BUGS ead from standard input after the files have been exhausted. .s3 .lp +10 5 \fB\*-a\fR Send a printable approximation of the results to the standard output. .s3 .i0 A.th STRIP I 3/15/72 .sh NAME strip \*- remove symbols and relocation bits .sh SYNOPSIS .bd strip name ... .sh DESCRIPTION .it Strip removes the symbol table and relocation bits ordinarily attached to the output of the assembler and loader. This is useful to save space after a program has been debugged. .s3 The effect of .it strip is the the same as use of the .bd \*-s option of .it ld. .sh FILES /tmp/stm? temporary file .sh "SEE ALSO" ld(I), as(I) .sh BUGS of the results to the standard output. .s3 .i0 A.th CREF I 2/5/73 .sh NAME cref \*- make cross reference listing .sh SYNOPSIS .bd cref [ .bd \*-acilostux123 ] name ... .sh DESCRIPTION .it Cref makes a cross reference listing of program files in assembler or C format. The files named as arguments in the command line are searched for symbols in the appropriate syntax. .s3 The output report is in four columns: .nf .s3 (1) (2) (3) (4) symbol file see text as it appears in file below .s3 .fi .it Cref uses either an .it ignore file or an .it only file. If the .bd \*-i option is given, it will take the next available argument to be an .it ignore file name; if the .bd \*-o option is given, the next available argument will be taken as an .it only file name. .it Ignore and .it only files should be lists of symbols separated by new lines. If an .it ignore file is given, all the symbols in that file will be ignored in columns (1) and (3) of the output. If an .it only file is given, only symbols appearing in that file will appear in column (1). Only one of the options .bd \*-i or .bd \*-o may be used. The default setting is .bd \*-i. Assembler predefined symbols or C keywords are ignored. .s3 The .bd \*-s option causes current symbols to be put in column 3. In the assembler, the current symbol is the most recent name symbol; in C, the current function name. The .bd \*-l option causes the line number within the file to be put in column 3. .s3 The .bd \*-t option causes the next available argument to be used as the name of the intermediate temporary file (instead of /tmp/crt??). The file is created and is not removed at the end of the process. .s3 Options: .s3 .lp +5 3 \fBa\fR assembler format (default) .lp +5 3 \fBc\fR C format input .lp +5 3 \fBi\fR use .it ignore file (see above) .lp +5 3 \fBl\fR put line number in col. 3 (instead of current symbol) .lp +5 3 \fBo\fR use .it only file (see above) .lp +5 3 \fBs\fR current symbol in col. 3 (default) .lp +5 3 \fBt\fR user supplied temoprary file .lp +5 3 \fBu\fR print only symbols that occur exactly once .lp +5 3 \fBx\fR print only C external symbols .lp +5 3 \fB1\fR sort output on column 1 (default) .lp +5 3 \fB2\fR sort output on column 2 .lp +5 3 \fB3\fR sort output on column 3 .s3 .i0 .sh FILES .dt /tmp/crt?? temporaries .br /usr/lib/aign default assembler .it ignore file .br /usr/lib/cign default C .it ignore file .br /usr/bin/crpost post processor .br /usr/bin/upost post processor for .bd \*-u option .br /bin/sort used to sort temporaries .br .s3 .fi .sh "SEE ALSO" as(I), cc(I), sort(I) .sh BUGS nce .lp +5 3 \fBx\fR.th SUM I 3/15/72 .sh NAME sum \*- sum file .sh SYNOPSIS .bd sum name ... .sh DESCRIPTION .it Sum sums the contents of the bytes (mod 2^16) of one or more files and prints the answer in octal. A separate sum is printed for each file specified, along with the number of whole or partial 512-byte blocks read. .s3 In practice, .it sum is often used to verify that all of a special file can be read without error. .sh BUGS temporaries .br .s3 .fi .sh "SEE ALSO" as(I), cc(I), sort(I) .sh BUGS nce .lp +5 3 \fBx\fR.th WAIT I 4/9/73 .sh NAME wait \*- await completion of process .sh SYNOPSIS .bd wait .sh DESCRIPTION Wait until all processes started with .bd & have completed, and report on abnormal terminations. .s3 Because .it "sys wait" must be executed in the parent process, the shell itself executes .it wait, without creating a new process .sh "SEE ALSO" sh(I) .sh BUGS After executing .it wait there is no way to interrupt the processes waited on. This is because interrupts were set to be ignored when the process was created. The only out (if the process does not terminate) is to .it kill the process from another terminal or to hangup. sses started with .bd & have completed, and report on abnormal terminations. .s3 Because .it "sys wait" must be executed in the parent process, the shell itself executes .it wait, without creating a new process .sh "SEE ALSO" sh(I) .sh BUGS After executing .it wait there is no way to interrupt the processes waited on. This is because interrupts were set to be ignored when the process was.th KILL I 8/18/73 .sh NAME kill \*- do in an unwanted process .sh SYNOPSIS .bd kill processid ... .sh DESCRIPTION Kills the specified processes. The processid of each asynchronous process started with `&' is reported by the shell. Processid's can also be found by using \fIps\fR (I). .s3 The killed process must have been started from the same typewriter as the current user, unless he is the superuser. .sh "SEE ALSO" ps(I), sh(I) .sh BUGS Clearly people should only be allowed to kill processes owned by them, and having the same typewriter is neither necessary nor sufficient. NOPSIS .bd kill processid ... .sh DESCRIPTION Kills the specified processes. The processid of each asynchronous process started with `&' is reported by the shell. Processid's can also be found by using \fIps\fR (I). .s3 The killed process must have been started from the same typewriter as the current user, unless he is the superuser. .sh "SEE ALSO" ps(I), sh(I) .sh BUGS Clearly people should only be allowed to kill processes owned by them,.th TTY I 3/15/72 .sh NAME tty \*- get typewriter name .sh SYNOPSIS .bd tty .sh DESCRIPTION .it Tty gives the name of the user's typewriter in the form `tty\fIn\fR' for \fIn\fR a digit or letter. The actual path name is then `/dev/tty\fIn\fR'. .sh DIAGNOSTICS `not a tty' if the standard input file is not a typewriter. .sh BUGS from the same typewriter as the current user, unless he is the superuser. .sh "SEE ALSO" ps(I), sh(I) .sh BUGS Clearly people should only be allowed to kill processes owned by them,.th UNIQ I 12/1/72 .sh NAME uniq \*- report repeated lines in a file .sh SYNOPSIS .bd uniq [ .bd \*-udc [ \fB+\fRn ] [ \fB\*-\fRn ] ] [ input [ output ] ] .sh DESCRIPTION .it Uniq reads the input file comparing adjacent lines. In the normal case, the second and succeeding copies of repeated lines are removed; the remainder is written on the output file. Note that repeated lines must be adjacent in order to be found; see sort(I). If the .bd \*-u flag is used, just the lines that are not repeated in the original file are output. The .bd \*-d option specifies that one copy of just the repeated lines is to be written. The normal mode output is the union of the .bd \*-u and .bd \*-d mode outputs. .s3 The .bd \*-c option supersedes .bd \*-u and .bd \*-d and generates an output report in the style of .bd \*-ud but with each line preceded by a count of the number of times it occurred. .s3 The .it n arguments specify skipping an initial portion of each line in the comparison: .s3 .lp +8 4 \fB\*-\fIn\fR The first \fIn\fR fields together with any blanks before each are ignored. A field is defined as a string of non-space, non-tab characters separated by tabs and spaces from its neighbors. .s3 .lp +8 4 \fB+\fIn\fR The first \fIn\fR characters are ignored. Fields are skipped before characters. .i0 .s3 .sh "SEE ALSO" sort(I), comm(I) .sh BUGS ded by a count of the number of times it occurred. .s3 The .it n arguments specify skipping an initial portion of each line in the comparison: .s3 .lp +8 4 \fB\*-\fIn\fR The first \fIn\.th LD I 8/16/73 .sh NAME ld \*- link editor .sh SYNOPSIS .bd ld [ .bd \*-sulxrnd ] name ... .sh DESCRIPTION .it Ld combines several object programs into one; resolves external references; and searches libraries. In the simplest case the names of several object programs are given, and .it d combines them, producing an object module which can be either executed or become the input for a further .it ld run. (In the latter case, the .bd \*-r option must be given to preserve the relocation bits.) The output of .it ld is left on .bd a.out. This file is executable only if no errors occurred during the load. .s3 The argument routines are concatenated in the order specified. The entry point of the output is the beginning of the first routine. .s3 If any argument is a library, it is searched exactly once at the point it is encountered in the argument list. Only those routines defining an unresolved external reference are loaded. If a routine from a library references another routine in the library, the referenced routine must appear after the referencing routine in the library. Thus the order of programs within libraries is important. .s3 .it Ld understands several flag arguments which are written preceded by a `\*-'. Except for \fB\*-l\fR, they should appear before the file names. .s3 .lp +4 4 \fB\*-s\fR `squash' the output, that is, remove the symbol table and relocation bits to save space (but impair the usefulness of the debugger). This information can also be removed by .it strip. .s3 .lp +4 4 \fB\*-u\fR take the following argument as a symbol and enter it as undefined in the symbol table. This is useful for loading wholly from a library, since initially the symbol table is empty and an unresolved reference is needed to force the loading of the first routine. .s3 .lp +4 4 \fB\*-l\fR This option is an abbreviation for a library name. \fB\*-l\fR alone stands for `/lib/liba.a', which is the standard system library for assembly language programs. \fB\*-l\fIx\fR stands for `/lib/lib\fIx\fR.a' where \fIx\fR is any character. There are libraries for Fortran (\fIx\fR = \fBf\fR), and C (\fIx\fR = \fBc\fR). A library is searched when its name is encountered, so the placement of a \fB\*-l\fR is significant. .s3 .lp +4 4 \fB\*-x\fR do not preserve local (non-.globl) symbols in the output symbol table; only enter external symbols. This option saves some space in the output file. .s3 .lp +4 4 \fB\*-r\fR generate relocation bits in the output file so that it can be the subject of another .it ld run. This flag also prevents final definitions from being given to common symbols. .s3 .lp +4 4 \fB\*-d\fR force definition of common storage even if the .bd \*-r flag is present (used for reloc (VIII)). .s3 .lp +4 4 \fB\*-n\fR Arrange that when the output file is executed, the text portion will be read-only and shared among all users executing the file. This involves moving the data areas up the the first possible 4K word boundary following the end of the text. .i0 .sh FILES /lib/lib?.a libraries .br a.out output file .sh "SEE ALSO" as(I), ar(I) .sh BUGS ing given to common symbols. .s3 .lp +4 4 \fB\*-d\fR force definition of common storage even if the .bd \*-r flag is present (used for reloc (VIII)). .s3 .lp +4 4 \fB\*-n\fR Arrange that when the output file is executed, the text portion will be read-only and shared among all users executing the file. This involves moving the data areas up the the first possible 4K word boundary following the end of the text. .i0 .sh FILES /lib/lib?.a libraries .br a.out output file .sh "SEE ALSO" as(.th WHO I 3/15/72 .sh NAME who \*- who is on the system .sh SYNOPSIS .bd who [ who-file ] .sh DESCRIPTION .it Who, without an argument, lists the name, typewriter channel, and login time for each current UNIX user. .s3 Without an argument, .it who examines the /tmp/utmp file to obtain its information. If a file is given, that file is examined. Typically the given file will be /tmp/wtmp, which contains a record of all the logins since it was created. Then .it who will list logins, logouts, and crashes since the creation of the wtmp file. .s3 Each login is listed with user name, typewriter name (with `/dev/' suppressed), and date and time. When an argument is given, logouts produce a similar line without a user name. Reboots produce a line with `x' in the place of the device name, and a fossil time indicative of when the system went down. .sh FILES /tmp/utmp .sh "SEE ALSO" login(I), init(VII) .sh BUGS ins a record of all the logins since it was created. Then .it who will list logins, logouts, and crashes sinc.th WRITE I 8/5/73 .sh NAME write \*- write to another user .sh SYNOPSIS .bd write user [ ttyno ] .sh DESCRIPTION .it Write copies lines from your typewriter to that of another user. When first called, it sends the message .s3 message from yourname... .s3 The recipient of the message should write back at this point. Communication continues until an end of file is read from the typewriter or an interrupt is sent. At that point .it write writes `EOT' on the other terminal and exits. .s3 If you want to write to a user who is logged in more than once, the .it ttyno argument may be used to indicate the last character of the appropriate typewriter name. .s3 Permission to write may be denied or granted by use of the .it mesg command. At the outset writing is allowed. Certain commands, in particular .it roff and .it pr, disallow messages in order to prevent messy output. .s3 If the character `!' is found at the beginning of a line, .it write calls the mini-shell .it msh to execute the rest of the line as a command. .s3 The following protocol is suggested for using .it write: when you first write to another user, wait for him to write back before starting to send. Each party should end each message with a distinctive signal ( .bd (o) for `over' is conventional) that the other may reply. .bd (oo) (for `over and out') is suggested when conversation is about to be terminated. .sh FILES /tmp/utmp to find user .br /etc/msh to execute `!' .sh "SEE ALSO" mesg(I), who(I) .sh BUGS to execute the rest of the line as a com.th COMM I 8/21/73 .sh NAME comm \*- print lines common to two files .sh SYNOPSIS .bd comm [ .bd \*- [ .bd 123 ] ] file1 file2 [ file3 ] .sh DESCRIPTION .it Comm reads .it file1 and .it file2, which should be in sort, and produces a three column output: lines only in .it file1; lines only in .it file2; and lines in both files. .s3 If .it file3 is given, the output will be placed there; otherwise it will be written on the standard output. .s3 Flags 1, 2, or 3 suppress printing of the corresponding column. Thus .bd comm .bd \*-12 prints only the lines common to the two files; .bd comm .bd \*-23 prints only lines in the first file but not in the second; .bd comm .bd \*-123 is a no-op. .s3 .sh "SEE ALSO" uniq(\|I\|), proof(\|I\|), cmp(\|I\|) .sh BUGS output: lines only in .it file1; lines only in .it file2; and lines in both files. .s3 If .it file3 is given, the output will be placed there; otherwise it will be written on the standard output. .s3 Flags 1, 2, or 3 suppress printing of the corresponding column. Th.th SHIFT I 8/21/73 .sh NAME shift \*- adjust Shell arguments .sh SYNOPSIS .bd shift .sh DESCRIPTION .it Shift is used in Shell command files to shift the argument list left by 1, so that old .bd $2 can now be referred to by .bd $1 and so forth. .it Shift is useful to iterate over several arguments to a command file. For example, the command file .s3 .lp +5 0 : loop .br if $1x = x exit .br pr \*-3 $1 .br shift .br goto loop .s3 .i0 prints each of its arguments in 3-column format. .s3 .it Shift is executed within the Shell. .sh "SEE ALSO" sh (I) .sh BUGS ell arguments .sh SYNOPSIS .bd shift .sh DESCRIPTION .it Shift is used in Shell command files to shift the argument list left by 1, so that old .bd $2 can now be referred to by .bd $1 and so forth. .it Shift is useful to iterate over several arguments to a command file. For example, the command file .s3 .lp +5 0 : loop .br if $1x = x exit .br pr \*-3 $1 .br shift .br goto loop .s3 .i0 prints each of its arguments in 3-column format. .s3 .it Shift is executed w.th LOGIN I 3/15/72 .sh NAME login \*- sign onto UNIX .sh SYNOPSIS .bd login [ username ] .sh DESCRIPTION The .it login command is used when a user initially signs onto UNIX, or it may be used at any time to change from one user to another. The latter case is the one summarized above and described here. See `How to Get Started' for how to dial up initially. .s3 If .it login is invoked without an argument, it will ask for a user name, and, if appropriate, a password. Echoing is turned off (if possible) during the typing of the password, so it will not appear on the written record of the session. .s3 After a successful login, accounting files are updated and the user is informed of the existence of .it mailbox and message-of-the-day files. .s3 Login is recognized by the Shell and executed directly (without forking). .sh FILES /tmp/utmp accounting .br /tmp/wtmp accounting .br mailbox mail .br /etc/motd message-of-the-day .br /etc/passwd password file .sh "SEE ALSO" init(VII), getty(VII), mail(I) .sh DIAGNOSTICS `login incorrect,' if the name or the password is bad. `No Shell,', `cannot open password file,' `no directory': consult a UNIX programming councilor. .sh BUGS If the first login is unsuccessful, it tends to go into a state where it won't accept a correct login. Hit EOT and try again. irectly (without forking). .sh FILES /tmp/utmp accounting .br /tmp/wtmp accounting .br mailbox mail .br /etc/motd message-of-the-day .br /etc/passwd password file .sh "SEE ALSO" init(VII), getty(VII), mail(I) .sh DIAGNOSTI.th IF I 3/15/72 .sh NAME if \*- conditional command .sh SYNOPSIS .bd if expr command [ arg ... ] .sh DESCRIPTION .it If evaluates the expression .it expr, and if its value is true, executes the given .it command with the given arguments. .s3 The following primitives are used to construct the .it expr: .s3 .lp +10 10 \fB\*-r\fR|file true if the file exists and is readable. .s3 .lp +10 10 \fB\*-w|\fRfile true if the file exists and is writable .s3 .lp +10 10 s1|\fB=|\fRs2 true if the strings .it s1 and .it s2 are equal. .s3 .lp +10 10 s1|\fB!=|\fRs2 true if the strings .it s1 and .it s2 are not equal. .s3 .i0 These primaries may be combined with the following operators: .s3 .lp +10 10 \fB!\fR unary negation operator .s3 .lp +10 10 \fB\*-a\fR binary .it and operator .s3 .lp +10 10 \fB\*-o\fR binary .it or operator .s3 .lp +10 10 \fB(|\fRexpr\fB|)\fR parentheses for grouping. .s3 .i0 .bd \*-a has higher precedence than .bd \*-o. Notice that all the operators and flags are separate arguments to .it if and hence must be surrounded by spaces. Notice also that parentheses are meaningful to the Shell and must be escaped. .sh "SEE ALSO" sh(I) .sh BUGS ith the following operators: .s3 .lp +10 10 \fB!\fR unary negation operator .s3 .lp +10 10 \fB\*-a\fR binary .it and operator .s3 .lp +10 10 \fB\*-o\fR binary .it or operator .s3 .lp +10 10 \fB(|\fRexpr\fB|)\fR parentheses for grouping. .s3 .i0 .bd \*-a has higher precedence than .bd \*-o. Notice that all the operators and flags are separate arguments to .it if and hence .th GOTO I 3/15/72 .sh NAME goto \*- command transfer .sh SYNOPSIS .bd goto label .sh DESCRIPTION .it Goto is only allowed when the Shell is taking commands from a file. The file is searched from the beginning for a line beginning with `:' followed by one or more spaces followed by the .it label. If such a line is found, the .it goto command returns. Since the read pointer in the command file points to the line after the label, the effect is to cause the Shell to transfer to the labelled line. .s3 `:' is a do-nothing command that is ignored by the Shell and only serves to place a label. .sh "SEE ALSO" sh(I) .sh BUGS ly allowed when the Shell is taking commands from a file. The file is searched from the beginning for a line beginning with `:' followed by one or more spaces followed by the .it label. If such a line is found, the .it goto command returns. Since the read pointer in the command file points to the line after the label, the effect is to cause the Shell to transfer to the labelled line. .s3 `:' is .th EXIT I 3/15/72 .sh NAME exit \*- terminate command file .sh SYNOPSIS .bd exit .sh DESCRIPTION .it Exit performs a .bd seek to the end of its standard input file. Thus, if it is invoked inside a file of commands, upon return from .bd exit the shell will discover an end-of-file and terminate. .sh "SEE ALSO" if(I), goto(I), sh(I) .sh BUGS d returns. Since the read pointer in the command file points to the line after the label, the effect is to cause the Shell to transfer to the labelled line. .s3 `:' is .th ECHO I 3/15/72 .sh NAME echo \*- echo arguments .sh SYNOPSIS .bd echo [ arg ... ] .sh DESCRIPTION .it Echo writes all its arguments in order as a line on the standard output file. It is mainly useful for producing diagnostics in command files. .sh BUGS .it Echo with no arguments does not print a blank line. f(I), goto(I), sh(I) .sh BUGS d returns. Since the read pointer in the command file points to the line after the label, the effect is to cause the Shell to transfer to the labelled line. .s3 `:' is .tc | .tr | .de x .in \\n(inu .if t .ta \\$2 .if n .ta \\$2+1 .in \\$1 .ti -\\$2 \fB\\$3\fP\t\\ .. .th NROFF I 1/15/73 .sh NAME nroff \*- format text .sh SYNOPSIS .bd nroff [ \fB+\fIn\fR ] [ \fB\*-\fIn\fR ] [ .bd \*-s ] [ .bd \*-h ] [ .bd \*-q ] [ .bd \*-i ] files .sh DESCRIPTION .it Nroff formats text according to control lines embedded in the text files. .it Nroff will read the standard input if no file arguments are given. The non-file option arguments are interpreted as follows: .s3 .lp +4 4 \fB+\fIn\fR Output will commence at the first page whose page number is .it n or larger .s3 .lp +4 4 \fB\*-\fIn\fR will cause printing to stop after page .it n. .s3 .lp +4 4 \fB\*-s\fR Stop prior to each page to permit paper loading. Printing is restarted by typing a `newline' character. .s3 .lp +4 4 \fB\*-h\fR Spaces are replaced where possible with tabs to speed up output (or reduce the size of the output file). .s3 .lp +4 4 \fB\*-q\fR Prompt names for insertions are not printed and the bell character is sent instead; the insertion is not echoed. .s3 .lp +4 4 \fB\*-i\fR Causes the standard input to be read after the files. .s3 .i0 .it Nroff is more completely described in [1]. A condensed Request Summary is included here. .sh FILES .dt /usr/lib/suftab suffix hyphenation tables .br /tmp/rtm? temporary .br .sh "SEE ALSO" [1] NROFF User's Manual, internal memorandum. .sh BUGS .in 0 .bp .nf .tr &. .if t .ta .75i 1.5i 2.25i 2.75i .if n 10 18 28 34 .ce REQUEST REFERENCE AND INDEX .s3 Request Initial If no Cause Form Value Argument Break Explanation .s3 I. Page Control .s3 &pl +N N=66 N=66 no Page Length. &bp +N N=1 - yes Begin Page. &pn +N N=1 ignored no Page Number. &po +N N=0 N=prev no Page Offset. &ne N - N=1 no NEed N lines. .s3 II. Text Filling, Adjusting, and Centering .s3 &br - - yes BReak. &fi fill - yes FIll output lines. &nf fill - yes NoFill. &ad c adj,norm adjust no ADjust mode on. &na adjust - no NoAdjust. &ce N off N=1 yes CEnter N input text lines. .s3 III. Line Spacing and Blank Lines .s3 &ls +N N=1 N=prev no Line Spacing. &sp N - N=1 yes SPace N lines &lv N - N=1 no LeaVe N lines &sv N - N=1 no SaVe N lines. &os - - no Output Saved lines. &ns space - no No-Space mode on. &rs - - no Restore Spacing. &xh off - no EXtra-Half-line mode on. .s3 IV. Line Length and Indenting .s3 &ll +N N=65 N=prev no Line Length. &in +N N=0 N=prev yes INdent. &ti +N - N=1 yes Temporary Indent. .s3 V. Macros, Diversion, and Line Traps .s3 &de xx - ignored no DEfine or redefine a macro. &ds xx - ignored no Define or redefine String. &rm xx - - no ReMove macro name. &di xx - end no DIvert output to macro "xx". &wh -N xx - - no WHen; set a line trap. &ch xx y - - no CHange trap line. &ch -N -M - - no " &ch xx -M - - no " &ch -N y - - no " .s3 VI. Number Registers .s3 &nr ab +N -M - no Number Register. &nr a +N -M - no " &nc c \\n \\n no Number Character. &ar arabic - no Arabic numbers. &ro arabic - no Roman numbers. &RO arabic - no ROMAN numbers. .s3 VII. Input and Output Conventions and Character Translations .s3 &ta N,M,... - none no PseudoTAbs setting. &tc c space space no Tab replacement Character. &lc c . . no Leader replacement Character. &ul N - N=1 no UNderline input text lines. &cc c \fB.\fR \fB.\fR no Basic Control Character. .if t .tr '\(fm &c2 c ' ' no Nobreak control character. &ec c - \\ no Escape Character. &li N - N=1 no Accept input lines LIterally. &tr abcd.... - - no TRanslate on output. .s3 VIII. Hyphenation. .s3 &nh on - no No Hyphen. &hy on - no HYphenate. &hc c none none no Hyphenation indicator Character. .s3 IX. Three Part Titles. .s3 &tl 'left'center'right' - no TitLe. < N N=65 N=prev no Length of Title. .s3 X. Output Line Numbering. .s3 &nm +N M S I off no Number Mode on or off, set parameters. &np M S I - reset no Number Parameters set or reset. .s3 XI. Conditional Input Line Acceptance .s3 &if !N anything - no IF true accept line of "anything". &if c anything - no " &if !c anything - no " &if N anything - no " .s3 XII. Environment Switching. .s3 &ev N N=0 N=prev no EnVironment switched. .s3 XIII. Insertions from the Standard Input Stream .s3 &rd prompt - bell no ReaD insert. &ex - - no EXit. .s3 XIV. Input File Switching .s3 &so filename - - no Switch SOurce file (push down). &nx filename - no NeXt file. .s3 XV. Miscellaneous .s3 &tm mesg - - no Typewriter Message &ig - - no IGnore. &fl - - no FLush output buffer. &ab - - no ABort. .fi .tr && f c anything - no " &if !c anything - no " &if N anything - no " .s3 XII. Environment Switching. .s3 &ev N N=0 N=prev no EnVironment switched. .s3 X.th INTRO II 11/5/73 .de pg .sp .. .de en .pg .in 3 .ti 0 \\$1\t\\$2\t\\$3 .br .. .sp 2 .in 0 .if t .ta 3 10 .ce INTRODUCTION TO SYSTEM CALLS .sp Section II of this manual lists all the entries into the system. In most cases two calling sequences are specified, one of which is usable from assembly language, and the other from C. Most of these calls have an error return. From assembly language an erroneous call is always indicated by turning on the c-bit of the condition codes. The presence of an error is most easily tested by the instructions .it bes and .it bec (``branch on error set (or clear)''). These are synonyms for the .it bcs and .it bcc instructions. .pg From C, an error condition is indicated by an otherwise impossible returned value. Almost always this is \(mi1; the individual sections specify the details. .pg In both cases an error number is also available. In assembly language, this number is returned in r0 on erroneous calls. From C, the external variable .it errno is set to the error number. .it Errno is not cleared on succesful calls, so it should be tested only after an error has occurred. There is a table of messages associated with each error, and a routine for printing the message. See .it "perror (III)." .pg The possible error numbers are not recited with each writeup in section II, since many errors are possible for most of the calls. Here is a list of the error numbers, their names inside the system (for the benefit of system-readers), and the messages available using .it perror. A short explanation is also provided. .en 0 \(mi (unused) .en 1 EPERM "Not owner and not super-user" Typically this error indicates an attempt to modify a file in some way forbidden except to its owner. It is also returned for attempts by ordinary users to do things allowed only to the super-user. .en 2 ENOENT "No such file or directory" This error occurs when a file name is specified and the file should exist but doesn't, or when one of the directories in a path name does not exist. .en 3 ESRCH "No such process" The process whose number was given to .it signal does not exist, or is already dead. .en 4 \(mi (unused) .en 5 EIO "I/O error" Some physical I/O error occurred during a .it read or .it write. This error may in some cases occur on a call following the one to which it actually applies. .en 6 ENXIO "No such device or address" I/O on a special file refers to a subdevice which does not exist, or beyond the limits of the device. It may also occur when, for example, a tape drive is not dialled in or no disk pack is loaded on a drive. .en 7 E2BIG "Arg list too long" An argument list longer than 512 bytes (counting the null at the end of each argument) is presented to .it exec. .en 8 ENOEXEC "Exec format error" A request is made to execute a file which, although it has the appropriate permissions, does not start with one of the magic numbers 407 or 410. .en 9 EBADF "Bad file number" Either a file descriptor refers to no open file, or a read (resp. write) request is made to a file which is open only for writing (resp. reading). .en 10 ECHILD "No children" .it Wait and the process has no living or unwaited-for children. .en 11 EAGAIN "No more processes" In a .it fork, the system's process table is full and no more processes can for the moment be created. .en 12 ENOMEM "Not enough core" During an .it exec or .it break, a program asks for more core than the system is able to supply. This is not a temporary condition; the maximum core size is a system parameter. The error may also occur if the arrangement of text, data, and stack segments is such as to require more than the existing 8 segmentation registers. .en 13 EACCES "Permission denied" An attempt was made to access a file in a way forbidden by the protection system. .en 14 \(mi (unused) .en 15 ENOTBLK "Block device required" A plain file was mentioned where a block device was required, e.g. in .it mount. .en 16 EBUSY "Mount device busy" An attempt was made to dismount a device on which there is an open file or some process's current directory. .en 17 EEXIST "File exists" In existing file was mentioned in a context in which it should not have, e.g. .it link. .en 18 EXDEV "Cross-device link" A link to a file on another device was attempted. .en 19 ENODEV "No such device" An attempt was made to apply an inappropriate system call to a device; e.g. read a write-only device. .en 20 ENOTDIR "Not a directory" A non-directory was specified where a directory is required, for example in a path name or as an argument to .it chdir. .en 21 EISDIR "Is a directory" An attempt to write on a directory. .en 22 EINVAL "Invalid argument" Some invalid argument: currently, dismounting a non-mounted device, mentioning an unknown signal in .it signal, and giving an unknown request in .it stty to the TIU special file. .en 23 ENFILE "File table overflow" The system's table of open files is full, and temporarily no more .it opens can be accepted. .en 24 EMFILE "Too many open files" Only 10 files can be open per process; this error occurs when the eleventh is opened. .en 25 ENOTTY "Not a typewriter" The file mentioned in .it stty or .it gtty is not a typewriter or one of the other devices to which these calls apply. .en 26 ETXTBSY "Text file busy" An attempt to execute a pure-procedure program which is currently open for writing (or reading!). .en 27 EFBIG "File too large" An attempt to make a file larger than the maximum of 2048 blocks. .en 28 ENOSPC "No space left on device" During a .it write to an ordinary file, there is no free space left on the device. .en 29 ESPIPE "Seek on pipe" A .it seek was issued to a pipe. This error should also be issued for other non-seekable devices. devices to which these calls apply. .en 26 ETXTBSY "Text file busy" An attempt to execute a pure-procedure program which is currently open for writing (or reading!). .en 27 EFBIG "File too large" An attempt to make a file larger than the maximum of 2048 blocks. .en 28 ENOSPC "No space left on device" During a .it write to an ordinary file, there is no free space left on the device. .en 29 ESPIPE "Seek on pipe" A .it seek was iss.th GETGID II 8/5/73 .sh NAME getgid \*- get group identification .sh SYNOPSIS (getgid = 47.; not in assembler) .br .ft B sys getgid .s3 getgid( ) .ft R .sh DESCRIPTION .it Getgid returns the real group ID of the current process. The real group ID identifies the group of the person who is logged in, in contradistinction to the effective group ID, which determines his access permission at the moment. It is thus useful to programs which operate using the ``set group ID'' mode, to find out who invoked them. .sh "SEE ALSO" setgid(II) .sh DIAGNOSTICS \*- up identification .sh SYNOPSIS (getgid = 47.; not in assembler) .br .ft B sys getgid .s3 getgid( ) .ft R .sh DESCRIPTION .it Getgid returns the real group ID of the current process. The real group ID identifies the group of the person who is logged in, in contradistinction to the effective group ID, which determines his access permission at the moment. It is thus useful to programs which operate using the ``set group ID'' mode, to find out who invoked th.th NICE II 8/5/73 .sh NAME nice \*- set program priority .sh SYNOPSIS (nice = 34.) .br (priority in r0) .br .ft B sys nice .s3 nice(priority) .ft R .sh DESCRIPTION The scheduling .it priority of the process is changed to the argument. Positive priorities get less service than normal; 0 is default. Only the super-user may specify a negative priority. The valid range of .it priority is 20 to \*-220. The value of 16 is recommended to users who wish to execute long-running programs without flak from the administration. .s3 The effect of this call is passed to a child process by the .it fork system call. The effect can be cancelled by another call to .it nice with a .it priority of 0. .sh "SEE ALSO" nice(I) .sh DIAGNOSTICS The error bit (c-bit) is set if the user requests a .it priority outside the range of 0 to 20 and is not the super-user. tive priority. The valid range of .it priority is 20 to \*-220. The value of 16 is recommended to users who wish to execute long-running programs without flak from the admini.th TIMES II 8/5/73 .sh NAME times \*- get process times .sh SYNOPSIS (times = 43.; not in assembler) .br .ft B sys times; buffer .s3 times(buffer) .br struct tbuffer *buffer; .ft R .sh DESCRIPTION .it Times returns time-accounting information for the current process and for the terminated child processes of the current process. All times are in 1/60 seconds. .s3 After the call, the buffer will appear as follows: .s3 .nf struct tbuffer { int proc\*_user\*_time; int proc\*_system\*_time; int child\*_user\*_time[2]; int child\*_system\*_time[2]; }; .s3 .fi The children times are the sum of the children's process times and their children's times. .sh "SEE ALSO" time(I) .sh DIAGNOSTICS \*- .sh BUGS The process times should be 32 bits as well. on for the current process and for the terminated child processes of the current process. All times are in 1/60 seconds. .s3 After the call, the buffer will appear as follows: .s3 .nf struct tbuffer { int proc\*_user\*_time; int proc\*_system\*_time; int child\*_user.th DUP II 8/5/73 .sh NAME dup \*- duplicate an open file descriptor .sh SYNOPSIS (dup = 41.; not in assembler) .br (file descriptor in r0) .br .ft B sys dup .s3 dup(fildes) .br int fildes; .ft R .sh DESCRIPTION Given a file descriptor returned from an .it open, .it pipe, or .it creat call, .it dup will allocate another file descriptor synonymous with the original. The new file descriptor is returned in r0. .s3 .it Dup is used more to reassign the value of file descriptors than to genuinely duplicate a file descriptor. Since the algorithm to allocate file descriptors returns the lowest available value between 0 and 9, combinations of .it dup and .it close can be used to manipulate file descriptors in a general way. This is handy for manipulating standard input and/or standard output. .sh "SEE ALSO" creat(II), open(II), close(II), pipe(II) .sh DIAGNOSTICS The error bit (c-bit) is set if: the given file descriptor is invalid; there are already 10 open files. From C, a \*-1 returned value indicates an error. ile.th SIGNAL II 8/5/73 .sh NAME signal \*- catch or ignore signals .sh SYNOPSIS (signal = 48.) .br .ft B sys signal; sig; value .s3 signal(sig, func) .br int (*func)(); .ft R .sh DESCRIPTION When the signal defined by .it sig is sent to the current process, it is to be treated according to .it value. The following is the list of signals: .s3 .lp +10 5 1 hangup .lp +10 5 2 interrupt .lp +10 5 3* quit .lp +10 5 4* illegal instruction .lp +10 5 5* trace trap .lp +10 5 6* IOT instruction .lp +10 5 7* EMT instruction .lp +10 5 8* floating point exception .lp +10 5 9 kill (cannot be caught or ignored) .lp +10 5 10* bus error .lp +10 5 11* segmentation violation .lp +10 5 12* bad argument to sys call .s3 .i0 If .it value is 0, the default system action applies to the signal. This is processes termination with or without a core dump. If .it value is odd, the signal is ignored. Any other even .it value specifies an address in the process where an interrupt is simulated. An RTI instruction will return from the interrupt. As a signal is caught, it is reset to 0. Thus if it is desired to catch every such signal, the catching routine must issue another .it signal call. .s3 The starred signals in the list above cause core images if not caught and not ignored. In C, if .it func is 0 or 1, the action is as described above. If .it func is even, it is assumed to be the address of a function entry point. When the signal occurs, the function will be called. A return from the function will simulate the RTI. .s3 After a .it fork, the child inherits all signals. The .it exec call resets all caught signals to default action. .sh "SEE ALSO" kill (I, II) .sh DIAGNOSTICS The error bit (c-bit) is set if the given signal is out of range. In C, a \*-1 indicates an error; 0 indicates success. nc is 0 or 1, the action is as described above. If .it func is even, it is assumed to be the address of a function entry point. When the signal occurs, the function will be called. A return from the function will simulate the RTI. .s3 After a .it fork, the.th BREAK II 8/5/73 .sh NAME break \*- set program break .sh SYNOPSIS (break = 17.) .br .ft B sys break; addr .s3 char *sbrk(incr) .ft R .sh DESCRIPTION .it Break sets the system's idea of the lowest location not used by the program to .it addr (rounded up to the next multiple of 64 bytes). Locations not less than .it addr and below the stack pointer are not in the address space and will thus cause a memory violation if accessed. .s3 From C, the calling sequence is different; .it incr more bytes are added to the program's data space and a pointer to the start of the new area is returned. .s3 When a program begins execution via .it exec the break is set at the highest location defined by the program and data storage areas. Ordinarily, therefore, only programs with growing data areas need to use .it break. .sh "SEE ALSO" exec(II) .sh DIAGNOSTICS The c-bit is set if the program requests more memory than the system limit (currently 20K words), or if more than 8 segmentation registers would be required to implement the break. From C, \*-1 is returned for these errors. the new area is returned. .s3 When a program begins execution via .it exec the break is set at the highest location defined by the program and data storage areas. Ordinarily, therefore, only programs with growing data areas need to use .it break. .sh "SEE ALSO" exec(II) .sh DIAGNOSTICS The c-bit is set if the program requests more memory than the system limit (currently 20K words), or if more than 8 segmentation registers would be required to implemen.th CHDIR II 8/5/73 .sh NAME chdir \*- change working directory .sh SYNOPSIS (chdir = 12.) .br .ft B sys chdir; dirname .s3 chdir(dirname) .br char *dirname; .ft R .sh DESCRIPTION .it Dirname is the address of the pathname of a directory, terminated by a null byte. .it Chdir causes this directory to become the current working directory. .sh "SEE ALSO" chdir(I) .sh DIAGNOSTICS The error bit (c-bit) is set if the given name is not that of a directory or is not readable. From C, a \*-1 returned value indicates an error, 0 indicates success. ir \*- change working directory .sh SYNOPSIS (chdir = 12.) .br .ft B sys chdir; dirname .s3 chdir(dirname) .br char *dirname; .ft R .sh DESCRIPTION .it Dirname is the address of the pathname of a directory, terminated by a null byte. .it Chdir causes this directory to become the current working directory. .sh "SEE ALSO" chdir(I) .sh DIAGNOSTICS The error bit (c-bit) is set if the given name is not that of a directory or is not readable. From C, a \*-1 returned value indicates.th CHMOD II 8/5/73 .sh NAME chmod \*- change mode of file .sh SYNOPSIS (chmod = 15.) .br .ft B sys chmod; name; mode .s3 chmod(name, mode) .br char *name; .ft R .sh DESCRIPTION The file whose name is given as the null-terminated string pointed to by .it name has its mode changed to .it mode. Modes are constructed by ORing together some combination of the following: .s3 .in +3 4000 set user ID on execution 2000 set group ID on execution 0400 read by owner 0200 write by owner 0100 execute by owner 0070 read, write, execute by group 0007 read, write, execute by others .in -3 .s3 Only the owner of a file (or the super-user) may change the mode. .sh "SEE ALSO" chmod(I) .sh DIAGNOSTIC Error bit (c-bit) set if .it name cannot be found or if current user is neither the owner of the file nor the super-user. From C, a \*-1 returned value indicates an error, 0 indicates success. +3 4000 set user ID on execution 2000 set group ID on execution 0400 read by owner 0200 write by owner 0100 execute by owner 0070.th CHOWN II 8/5/73 .sh NAME chown \*- change owner .sh SYNOPSIS (chmod = 16.) .br .ft B sys chown; name; owner .s3 chown(name, owner) .br char *name; .ft R .sh DESCRIPTION The file whose name is given by the null-terminated string pointed to by .it name has its owner changed to .it owner (a numerical user ID). Only the present owner of a file (or the super-user) may donate the file to another user. Changing the owner of a file removes the set-user-ID protection bit unless it is done by the super user or the real user ID is the new owner. .sh "SEE ALSO" chown(I), uids(V) .sh DIAGNOSTICS The error bit (c-bit) is set on illegal owner changes. From C a \*-1 returned value indicates error, 0 indicates success. the null-terminated string pointed to by .it name has its owner changed to .it owner (a numerical user ID). Only the present owner of a file (or the super-user) may donate the file to another user. Changing the owner of a file removes the set-user-ID protection bit unless it is done by the super user or th.th CLOSE II 8/5/73 .sh NAME close \*- close a file .sh SYNOPSIS (close = 6.) .br (file descriptor in r0) .br .ft B sys close .s3 close(fildes) .s3 .ft R .sh DESCRIPTION Given a file descriptor such as returned from an .it open, .it creat, or .it pipe call, .it close closes the associated file. A close of all files is automatic on .it exit, but since processes are limited to 10 simultaneously open files, .it close is necessary for programs which deal with many files. .sh "SEE ALSO" creat(II), open(II), pipe(II) .sh DIAGNOSTICS The error bit (c-bit) is set for an unknown file descriptor. From C a \*-1 indicates an error, 0 indicates success. ildes) .s3 .ft R .sh DESCRIPTION Given a file descriptor such as returned from an .it open, .it creat, or .it pipe call, .it close closes the associated file. A close of all files is automatic on .it exit, but since processes are limited to 10 simultaneously open files, .it close is necessary for programs which deal with many files. .sh "SEE ALSO" creat(II), open(II), pi.th CREAT II 8/5/73 .sh NAME creat \*- create a new file .sh SYNOPSIS (creat = 8.) .br .ft B sys creat; name; mode .br (file descriptor in r0) .s3 creat(name, mode) .br char *name; .ft R .sh DESCRIPTION .it Creat creates a new file or prepares to rewrite an existing file called .it name, given as the address of a null-terminated string. If the file did not exist, it is given mode .it mode. See chmod(II) for the construction of the .it mode argument. .s3 If the file did exist, its mode and owner remain unchanged but it is truncated to 0 length. .s3 The file is also opened for writing, and its file descriptor is returned (in r0). .s3 The .it mode given is arbitrary; it need not allow writing. This feature is used by programs which deal with temporary files of fixed names. The creation is done with a mode that forbids writing. Then if a second instance of the program attempts a .it creat, an error is returned and the program knows that the name is unusable for the moment. .sh "SEE ALSO" write(II), close(II), stat(II) .sh DIAGNOSTICS The error bit (c-bit) may be set if: a needed directory is not searchable; the file does not exist and the directory in which it is to be created is not writable; the file does exist and is unwritable; the file is a directory; there are already 10 files open. .s3 From C, a \*-1 return indicates an error. if a second instance of the program attempts a .it creat, an error is returned and the program knows that the name is unusable for the moment. .sh "SEE ALSO" write(II), close(II), .th EXEC II 8/5/73 .sh NAME exec \*- execute a file .sh SYNOPSIS (exec = 11. .br .ft B sys exec; name; args .br .li ... .br name: <...\\0> .br .li ... .br args: arg1; arg2; ...; 0 .br arg1: <...\\0> .br arg2: <...\\0> .br ... .s3 execl(name, arg1, arg2, ..., argn, 0) .br char *name, *arg1, *arg2, ..., *argn; .s3 execv(name, argv) .br char *name; .br char *argv[ ]; .ft R .sh DESCRIPTION .it Exec overlays the calling process with the named file, then transfers to the beginning of the core image of the file. There can be no return from the file; the calling core image is lost. .s3 Files remain open across .it exec calls. Ignored signals remain ignored across .it exec, but signals that are caught are reset to their default values. .s3 Each user has a .it real user ID and group ID and an .it effective user ID and group ID (The real ID identifies the person using the system; the effective ID determines his access privileges.) .it Exec changes the effective user and group ID to the owner of the executed file if the file has the ``set-user-ID'' or ``set-group-ID'' modes. The real user ID is not affected. .s3 The form of this call differs somewhat depending on whether it is called from assembly language or C; see below for the C version. .s3 The first argument to .it exec is a pointer to the name of the file to be executed. The second is the address of a null-terminated list of pointers to arguments to be passed to the file. Conventionally, the first argument is the name of the file. Each pointer addresses a string terminated by a null byte. .s3 Once the called file starts execution, the arguments are available as follows. The stack pointer points to a word containing the number of arguments. Just above this number is a list of pointers to the argument strings. The arguments are placed as high as possible in core. .s3 sp\*> nargs .br arg1 .br ... .br argn .s3 arg1: .br ... .br argn: .s3 From C, two intefaces are available. .it execl is useful when a known file with known arguments is being called; the arguments to .it execl are the character strings constituting the file and the arguments; as in the basic call, the first argument is conventionally the same as the file name (or its last component). A 0 argument must end the argument list. .s3 The .it execv version is useful when the number of arguments is unknown in advance; the arguments to .it execv are the name of the file to be executed and a vector of strings containing the arguments. The last argument string must be followed by a 0 pointer. .s3 When a C program is executed, it is called as follows: .s3 main(argc, argv) .br int argc; .br char *argv[]; .s3 where \fIargc\fR is the argument count and \fIargv\fR is an array of character pointers to the arguments themselves. As indicated, \fIargc\fR is conventionally at least one and the first member of the array points to a string containing the name of the file. .s3 .it Argv is not directly usable in another .it execv, since .it argv[argc] is \*-1 and not 0. .sh "SEE ALSO" fork(II) .sh DIAGNOSTICS If the file cannot be found, if it is not executable, if it does not have a valid header (407 or 410 octal as first word), if maximum memory is exceeded, or if the arguments require more than 512 bytes a return from .it exec constitutes the diagnostic; the error bit (c-bit) is set. From C the returned value is \*-1. .sh BUGS Only 512 characters of arguments are allowed. .s3 .it Argv is not directly usable in another .it execv, since .it argv[argc] is \*-1 and not 0. .sh "SEE ALSO" fork(II) .sh DI.th EXIT II 8/5/73 .sh NAME exit \*- terminate process .s3 .sh SYNOPSIS (exit = 1.) .br (status in r0) .br .ft B sys exit .s3 exit(status) .br int status; .ft R .sh DESCRIPTION .it Exit is the normal means of terminating a process. .it Exit closes all the process' files and notifies the parent process if it is executing a .it wait. The low byte of r0 (resp. the argument to \fIexit\fR) is available as status to the parent process. .s3 This call can never return. .sh "SEE ALSO" wait(II) .sh DIAGNOSTICS None. .th FORK II 8/5/73 .sh NAME fork \*- spawn new process .sh SYNOPSIS (fork = 2.) .br .ft B sys fork .br .ft R (new process return) .br (old process return) .s3 .ft B fork( ) .ft R .sh DESCRIPTION .it Fork is the only way new processes are created. The new process's core image is a copy of that of the caller of .it fork. The only distinction is the return location and the fact that r0 in the old (parent) process contains the process ID of the new (child) process. This process ID is used by .it wait. .s3 From C, the returned value is 0 in the child process, non-zero in the parent process; however, a return of \*-1 indicates inability to create a new process. .sh "SEE ALSO" wait(II), exec(II) .sh DIAGNOSTICS The error bit (c-bit) is set in the old process if a new process could not be created because of lack of process space. From C, a return of \*-1 (not just negative) indicates an error. n the old (parent) process contains the process ID of the new (child) process. This process ID is used by .it wait. .s3 Fro.th FSTAT II 8/5/73 .sh NAME fstat \*- get status of open file .s3 .sh SYNOPSIS (fstat = 28.) .br (file descriptor in r0) .ft B .br sys fstat; buf .s3 fstat(fildes, buf) .br struct inode buf; .ft R .sh DESCRIPTION This call is identical to .it stat, except that it operates on open files instead of files given by name. It is most often used to get the status of the standard input and output files, whose names are unknown. .sh "SEE ALSO" stat(II) .sh DIAGNOSTICS The error bit (c-bit) is set if the file descriptor is unknown; from C, a \*-1 return indicates an error, 0 indicates success. (fstat = 28.) .br (file descriptor in r0) .ft B .br sys fstat; buf .s3 fstat(fildes, buf) .br struct inode buf; .ft R .sh DESCRIPTION This call is identical to .it stat, except that it operates on open files instead of files given by name. It is most often used to get the status of the standard input and output files, whose names are unknown. .sh "SEE ALSO" stat(II) .sh DIAGNOSTICS The error bit (c-bit) is set if the file desc.th GETUID II 8/5/73 .sh NAME getuid \*- get user identification .sh SYNOPSIS (getuid = 24.) .br .ft B sys getuid .s3 getuid( ) .ft R .sh DESCRIPTION .it Getuid returns the real user ID of the current process. The real user ID identifies the person who is logged in, in contradistinction to the effective user ID, which determines his access permission at the moment. It is thus useful to programs which operate using the ``set user ID'' mode, to find out who invoked them. .sh "SEE ALSO" setuid(II) .sh DIAGNOSTICS \*- 8/5/73 .sh NAME getuid \*- get user identification .sh SYNOPSIS (getuid = 24.) .br .ft B sys getuid .s3 getuid( ) .ft R .sh DESCRIPTION .it Getuid returns the real user ID of the current process. The real user ID identifies the person who is logged in, in contradistinction to the effective user ID, which determines his access permission at the moment. It is thus useful to programs which operate using the ``set user ID'' mode, to find out who invoked them. .sh "SEE ALSO" setuid(II) .sh DI.th GTTY II 8/5/73 .sh NAME gtty \*- get typewriter status .sh SYNOPSIS (gtty = 32.) .br (file descriptor in r0) .ft B .br sys gtty; arg .br .li ... arg: .=.+6 .s3 gtty(fildes, arg) .br int arg[3]; .ft R .sh DESCRIPTION .it Gtty stores in the three words addressed by .it arg the status of the typewriter whose file descriptor is given in r0 (resp. given as the first argument). The format is the same as that passed by .it stty. .sh "SEE ALSO" stty(II) .sh DIAGNOSTICS Error bit (c-bit) is set if the file descriptor does not refer to a typewriter. From C, a \*-1 value is returned for an error, 0, for a successful call. ) .ft B .br sys gtty; arg .br .li ... arg: .=.+6 .s3 gtty(fildes, arg) .br int arg[3]; .ft R .sh DESCRIPTION .it Gtty stores in the three words addressed by .it arg the status of the typewriter whose file descriptor is given in r0 (resp. given as the first argument). The format is the same as that passed by .it stty. .sh "SEE ALSO" stty(II) .sh DIAGNOSTICS Error bit (c-bit) is set if the file des.th PIPE II 8/5/73 .sh NAME pipe \*- create a pipe .sh SYNOPSIS (pipe = 42.) .br .ft B sys pipe .br .ft R (read file descriptor in r0) .br (write file descriptor in r1) .s3 .ft B pipe(fildes) .br int fildes[2]; .ft R .sh DESCRIPTION The .it pipe system call creates an I/O mechanism called a pipe. The file descriptors returned can be used in read and write operations. When the pipe is written using the descriptor returned in r1 (resp. fildes[1]), up to 4096 bytes of data are buffered before the writing process is suspended. A read using the descriptor returned in r0 (resp. fildes[0]) will pick up the data. .s3 It is assumed that after the pipe has been set up, two (or more) cooperating processes (created by subsequent .it fork calls) will pass data through the pipe with .it read and .it write calls. .s3 The shell has a syntax to set up a linear array of processes connected by pipes. .s3 Read calls on an empty pipe (no buffered data) with only one end (all write file descriptors closed) return an end-of-file. Write calls under similar conditions are ignored. .sh "SEE ALSO" sh(I), read(II), write(II), fork(II) .sh DIAGNOSTICS The error bit (c-bit) is set if more than 8 files are already open. From C, a \*-1 returned value indicates an error. pass data through the pipe with .it read and .it write calls. .s3 The shell has a syntax to set up a linear array of processes connected by pipes. .s3 Read calls on an empty pipe (no buffered data) with only one end (all write file descriptors closed) return an end-of-file. W.th LINK II 8/5/73 .sh NAME link \*- link to a file .sh SYNOPSIS (link = 9.) .br .ft B sys link; name1; name2 .s3 link(name1, name2) .br char *name1, *name2; .ft R .sh DESCRIPTION A link to .it name1 is created; the link has the name .it name2. Either name may be an arbitrary path name. .sh "SEE ALSO" link(I), unlink(II) .sh DIAGNOSTICS The error bit (c-bit) is set when .it name1 cannot be found; when .it name2 already exists; when the directory of .it name2 cannot be written; when an attempt is made to link to a directory by a user other than the super-user; when an attempt is made to link to a file on another file system. From C, a \*-1 return indicates an error, a 0 return indicates success. t name1 is created; the link has the name .it name2. Either name may be an arbitrary path name. .sh "SEE ALSO" link(I), unlink(II) .sh DIAGNOSTICS The error bit (c-bit) is set when .it name1 cannot be found; when .it name2 already exists; when the directory of .it name2 cannot be written; when an attempt is made to lin.th MOUNT II 8/5/73 .sh NAME mount \*- mount file system .sh SYNOPSIS (mount = 21.) .br .ft B sys mount; special; name .ft R .sh DESCRIPTION .it Mount announces to the system that a removable file system has been mounted on the block-structured special file .it special; from now on, references to file .it name will refer to the root file on the newly mounted file system. .it Special and .it name are pointers to null-terminated strings containing the appropriate path names. .s3 .it Name must exist already.  Its old contents are inaccessible while the file system is mounted. .sh "SEE ALSO" mount(I), umount(II) .sh DIAGNOSTICS Error bit (c-bit) set if: .it special is inaccessible or not an appropriate file; .it name does not exist; .it special is already mounted; there are already too many file systems mounted. ame will refer to the root file on the newly mounted file system. .it Special and .it name are pointers to null-terminated strings containing the appropriate path names. .s3 .it Name must exist already. .th OPEN II 8/5/73 .sh NAME open \*- open for reading or writing .sh SYNOPSIS (open = 5.) .br .ft B sys open; name; mode .s3 open(name, mode) .br char *name; .ft R .sh DESCRIPTION .it Open opens the file .it name for reading (if .it mode is 0), writing (if .it mode is 1) or for both reading and writing (if .it mode is 2). .it Name is the address of a string of ASCII characters representing a path name, terminated by a null character. .s3 The returned file descriptor should be saved for subsequent calls to .it read, .it write, and .it close. .sh "SEE ALSO" creat(II), read(II), write(II), close(II) .sh DIAGNOSTICS The error bit (c-bit) is set if the file does not exist, if one of the necessary directories does not exist or is unreadable, if the file is not readable (resp. writable), or if 10 files are open. From C, a \*-1 value is returned on an error. a string of ASCII characters representing a path name, terminated by a null character. .s3 The returned file descriptor should be saved for subsequent calls to ..th READ II 8/5/73 .sh NAME read \*- read from file .sh SYNOPSIS (read = 3.) .br (file descriptor in r0) .ft B .br sys read; buffer; nbytes .br .s3 read(fildes, buffer, nbytes) .br char *buffer; .ft R .sh DESCRIPTION A file descriptor is a word returned from a successful .it open, .it creat, or .it pipe call. .it Buffer is the location of .it nbytes contiguous bytes into which the input will be placed. It is not guaranteed that all .it nbytes bytes will be read; for example if the file refers to a typewriter at most one line will be returned. In any event the number of characters read is returned (in r0). .s3 If the returned value is 0, then end-of-file has been reached. .sh "SEE ALSO" open(II), creat(II), pipe(II) .sh DIAGNOSTICS As mentioned, 0 is returned when the end of the file has been reached. If the read was otherwise unsuccessful the error bit (c-bit) is set. Many conditions can generate an error: physical I/O errors, bad buffer address, preposterous .it nbytes, file descriptor not that of an input file. From C, a \*-1 return indicates the error. the number of characters read is returned (in r0). .s3 If the returned value is 0, then end-of-file has been reached. .sh "SEE ALSO" open(II), creat(II), pipe(II) .sh DIAGNOSTICS As mentioned, 0 is returned when the end of the file has been reached. If the read was otherwise unsuccessful the error bit (c-bit) is set. Many conditions can generate an error: physical I/O errors, bad buffer address, preposterous .it nbytes, file descriptor not that of an input .th MKNOD II 8/5/73 .sh NAME mknod \*- make a directory or a special file .sh SYNOPSIS (mknod = 14.; not in assembler) .br .ft B sys mknod; name; mode; addr .s3 mknod(name, mode, addr) .br char *name; .ft R .sh DESCRIPTION .it Mknod creates a new file whose name is the null-terminated string pointed to by .it name. The mode of the new file (including directory and special file bits) is initialized from .it mode. The first physical address of the file is initialized from .it addr. Note that in the case of a directory, .it addr should be zero. In the case of a special file, .it addr specifies which special file. .s3 .it Mknod may be invoked only by the super-user. .sh "SEE ALSO" mkdir(I), mknod(I), fs(V) .sh DIAGNOSTICS Error bit (c-bit) is set if the file already exists or if the user is not the super-user. From C, a \*-1 value indicates an error. uding directory and special file bits) is initialized from .it mode. The first physical address of the file is initialized from .it addr. Note that in the case of a.th SEEK II 8/5/73 .sh NAME seek \*- move read/write pointer .sh SYNOPSIS (seek = 19.) .br (file descriptor in r0) .ft B .br sys seek; offset; ptrname .s3 seek(fildes, offset, ptrname) .ft R .sh DESCRIPTION The file descriptor refers to a file open for reading or writing. The read (resp. write) pointer for the file is set as follows: .s3 .lp +6 3 if .it ptrname is 0, the pointer is set to .it offset. .s3 .lp +6 3 if .it ptrname is 1, the pointer is set to its current location plus .it offset. .s3 .lp +6 3 if .it ptrname is 2, the pointer is set to the size of the file plus .it offset. .s3 .lp +6 3 if .it ptrname is 3, 4 or 5, the meaning is as above for 0, 1 and 2 except that the offset is multiplied by 512. .s3 .i0 If .it ptrname is 0 or 3, .it offset is unsigned, otherwise it is signed. .sh "SEE ALSO" open(II), creat(II) .sh DIAGNOSTICS The error bit (c-bit) is set for an undefined file descriptor. From C, a \*-1 return indicates an error. inter is set to its current location plus .it offset. .s3 .lp +6 3 i.th SETUID II 8/5/73 .sh NAME setuid \*- set process user ID .sh SYNOPSIS (setuid = 23.) .br (user ID in r0) .ft B .br sys setuid .s3 setuid(uid) .ft R .sh DESCRIPTION The user ID of the current process is set to the argument. Both the effective and the real user ID are set. This call is only permitted to the super-user or if the argument is the real user ID. .sh "SEE ALSO" getuid(II) .sh DIAGNOSTICS Error bit (c-bit) is set as indicated; from C, a \*-1 value is returned. ion plus .it offset. .s3 .lp +6 3 i.th SYNC II 8/5/73 .sh NAME sync \*- update super-block .sh SYNOPSIS (sync = 36.; not in assembler) .br .ft B sys sync .ft R .sh DESCRIPTION .it Sync causes all information in core memory that should be on disk to be written out. This includes modified super blocks, modified i-nodes, and delayed block I/O. .s3 It should be used by programs which examine a file system, for example .it "check, df," etc. It is mandatory before a boot. .sh "SEE ALSO" sync (VIII), update (VIII) .sh DIAGNOSTICS \*- s3 .lp +6 3 i.th STAT II 8/5/73 .sh NAME stat \*- get file status .sh SYNOPSIS (stat = 18.) .br .ft B sys stat; name; buf .s3 stat(name, buf) .br char *name; .br struct inode *buf; .ft R .sh DESCRIPTION .it Name points to a null-terminated string naming a file; .it buf is the address of a 36(10) byte buffer into which information is placed concerning the file. It is unnecessary to have any permissions at all with respect to the file, but all directories leading to the file must be readable. After .it stat, .it buf has the following structure (starting offset given in bytes): .s3 .if t .ta .5 1i 2.5i .if n .ta 3 9 24 .nf struct { char minor; /* +0: minor device of i-node */ char major; /* +1: major device */ int inumber /* +2 */ int flags; /* +4: see below */ char nlinks; /* +6: number of links to file */ char uid; /* +7: user ID of owner */ char gid; /* +8: group ID of owner */ char size0; /* +9: high byte of 24-bit size */ int size1; /* +10: low word of 24-bit size */ int addr[8]; /* +12: block numbers or device number */ int actime[2]; /* +28: time of last access */ int modtime[2]; /* +32: time of last modification */ }; .fi .s3 The flags are as follows: .s3 .lp +10 9 100000 i-node is allocated .lp +10 9 060000 2-bit file type: .lp +15 9 000000 plain file .lp +15 9 040000 directory .lp +15 9 020000 character-type special file .lp +15 9 060000 block-type special file. .lp +10 9 010000 large file .lp +10 9 004000 set user-ID on execution .lp +10 9 002000 set group-ID on execution .lp +10 9 000400 read (owner) .lp +10 9 000200 write (owner) .lp +10 9 000100 execute (owner) .lp +10 9 000070 read, write, execute (group) .lp +10 9 000007 read, write, execute (others) .i0 .sh "SEE ALSO" stat(I), fstat(II), fs(V) .sh DIAGNOSTICS Error bit (c-bit) is set if the file cannot be found. From C, a \*-1 return indicates an error. special file .lp +15 9 060000 block-type special file. .lp +10 9 010000 large file .lp +10 9 004000 set user-ID on execution .lp +10 9 002000 set group-ID on execution .lp +10 9 000400 read (owner) .l.th STIME II 8/5/73 .sh NAME stime \*- set time .sh SYNOPSIS (stime = 25.) (time in r0-r1) .br .ft B sys stime .s3 stime(tbuf) .br int tbuf[2]; .ft R .sh DESCRIPTION .it Stime sets the system's idea of the time and date. Time is measured in seconds from 0000 GMT Jan 1 1970. Only the super-user may use this call. .sh "SEE ALSO" date(I), time(II), ctime(III) .sh DIAGNOSTICS Error bit (c-bit) set if user is not the super-user. xecution .lp +10 9 002000 set group-ID on execution .lp +10 9 000400 read (owner) .l.th STTY II 8/5/73 .sh NAME stty \*- set mode of typewriter .sh SYNOPSIS (stty = 31.) .br (file descriptor in r0) .br .ft B sys stty; arg .br .li ... .br arg: speed; 0; mode .s3 .nf stty(fildes, arg) int arg[3]; .fi .ft R .s3 .sh DESCRIPTION .it Stty sets mode bits and character speeds for the typewriter whose file descriptor is passed in r0 (resp. is the first argument to the call). First, the system delays until the typewriter is quiescent. Then the speed and general handling of the input side of the typewriter is set from the low byte of the first word of the .it arg, and the speed of the output side is set from the high byte of the first word of the .it arg. The speeds are selected from the following table. This table corresponds to the speeds supported by the DH-11 interface. The starred entries are those speeds actually supported by the DC-11 interfaces actually present; if a non-starred speed is selected, it will be ignored and the present speed left unchanged. .s3 .lp +8 4 0 (turn off device) .lp +8 4 1 50 baud .lp +8 4 2 75 baud .lp +8 4 3 110 baud .lp +8 4 4* 134.5 baud .lp +8 4 5* 150 baud .lp +8 4 6 200 baud .lp +8 4 7* 300 baud .lp +8 4 8 600 baud .lp +8 4 9* 1200 baud .lp +8 4 10 1800 baud .lp +8 4 11 2400 baud .lp +8 4 12 4800 baud .lp +8 4 13 9600 baud .lp +8 4 14 External A .lp +8 4 15 External B .s3 .i0 In the current configuration, only 150 and 300 baud are really supported, in that the code conversion and line control required for 2741's (134.5 baud) must be implemented by the user's program, and the half-duplex line discipline required for the 202 dataset (1200 baud) is not supplied. .s3 The second word of the .it arg is currently unused and is available for expansion. .s3 The third word of the .it arg sets the .it mode. It contains several bits which determine the system's treatment of the typewriter: .s3 .lp +12 5 10000 no delays after tabs (e.g. TN 300) .lp +12 5 200 even parity allowed on input (e. g. for M37s) .lp +12 5 100 odd parity allowed on input .lp +12 5 040 raw mode: wake up on all characters .lp +12 5 020 map CR into LF; echo LF or CR as CR-LF .lp +12 5 010 echo (full duplex) .lp +12 5 004 map upper case to lower on input (e. g. M33) .lp +12 5 002 echo and print tabs as spaces .lp +12 5 001 inhibit all function delays (e. g. CRTs) .i0 .s3 Characters with the wrong parity, as determined by bits 200 and 100, are ignored. .s3 In raw mode, every character is passed back immediately to the program. No erase or kill processing is done; the end-of-file character (EOT), the interrupt character (DELETE) and the quit character (FS) are not treated specially. .s3 Mode 020 causes input carriage returns to be turned into new-lines; input of either CR or LF causes LF-CR both to be echoed (used for GE TermiNet 300's and other terminals without the newline function). .sh "SEE ALSO" stty(I), gtty(II) .sh DIAGNOSTICS The error bit (c-bit) is set if the file descriptor does not refer to a typewriter. From C, a negative value indicates an error. one; the end-of-file character (EOT), the interrupt ch.th TIME II 8/5/73 .sh NAME time \*- get date and time .sh SYNOPSIS (time = 13.) .br .ft B sys time .s3 time(tvec) .br int tvec[2]; .ft R .sh DESCRIPTION .it Time returns the time since 00:00:00 GMT, Jan. 1, 1970, measured in seconds. From .it as, the high order word is in the r0 register and the low order is in r1. From C, the user-supplied vector is filled in. .sh "SEE ALSO" date(I), stime(II), ctime(III) .sh DIAGNOSTICS none alue indicates an error. one; the end-of-file character (EOT), the interrupt ch.th UMOUNT II 8/5/73 .sh NAME umount \*- dismount file system .sh SYNOPSIS (umount = 22.) .br .ft B sys umount; special .ft R .sh DESCRIPTION .it Umount announces to the system that special file .it special is no longer to contain a removable file system. The file associated with the special file reverts to its ordinary interpretation (see .it mount ). .s3 .sh "SEE ALSO" umount(I), mount(II) .sh DIAGNOSTICS Error bit (c-bit) set if no file system was mounted on the special file or if there are still active files on the mounted file system. t \*- dismount file system .sh SYNOPSIS (umount = 22.) .br .ft B sys umount; special .ft R .sh DESCRIPTION .it Umount announces to the system that special file .it special is no longer to contain a removable file system. The file associated with the special file reverts to its ordinary interpretation (see .it mount ). .s3 .sh "SEE ALSO" umount(I), mount(II) .sh DIAGNOSTICS Error bit (c-bit) set if no file system was mounted on the special file or if there are still active.th UNLINK II 8/5/73 .sh NAME unlink \*- remove directory entry .sh SYNOPSIS (unlink = 10.) .br .bt B sys unlink; name .s3 unlink(name) .br char *name; .ft R .sh DESCRIPTION .it Name points to a null-terminated string. .it Unlink removes the entry for the file pointed to by .it name from its directory. If this entry was the last link to the file, the contents of the file are freed and the file is destroyed. If, however, the file was open in any process, the actual destruction is delayed until it is closed, even though the directory entry has disappeared. .sh "SEE ALSO" rm(I), rmdir(I), link(II) .sh DIAGNOSTICS The error bit (c-bit) is set to indicate that the file does not exist or that its directory cannot be written. Write permission is not required on the file itself. It is also illegal to unlink a directory (except for the super-user). From C, a \*-1 return indicates an error. d and the file is destroyed. If, however, the file was open in any process, the actual destruction is delayed until it is closed,.th WAIT II 8/5/73 .sh NAME wait \*- wait for process to die .sh SYNOPSIS (wait = 7.) .br .ft B sys wait .s3 wait(status) .br int *status; .ft R .sh DESCRIPTION .it Wait causes its caller to delay until one of its child processes terminates. If any child has died since the last .it wait, return is immediate; if there are no children, return is immediate with the error bit set (resp. with a value of \*-1 returned). In the case of several children several .it wait calls are needed to learn of all the deaths. .s3 If no error is indicated on return, the r1 high byte (resp. the high byte stored into .it status ) contains the low byte of the child process r0 (resp. the argument of .it exit ) when it terminated. The r1 (resp. .it status ) low byte contains the termination status of the process. See signal(II) for a list of termination statuses (signals); 0 status indicates normal termination. If the 040 bit of the termination status is set, a core image of the process was produced by the system. .sh "SEE ALSO" exit(II), fork(II), signal(II) .sh DIAGNOSTICS The error bit (c-bit) on if no children not previously waited for. From C, a returned value of \*-1 indicates an error. gument of .it exit ) when it terminated. The r1 (resp. .it status ) low byte contains the termination status of the process. See signal(II) for a list of termination statuses (signals); 0 status indicates normal termination. If the 040 bit of the termination status is set, a core image of the process was produced by the system. .sh "SEE ALSO" exit.th WRITE II 8/5/73 .sh NAME write \*- write on a file .sh SYNOPSIS (write = 4.) .br (file descriptor in r0) .br .ft B sys write; buffer; nbytes .s3 write(fildes, buffer, nbytes) .br char *buffer; .ft R .sh DESCRIPTION A file descriptor is a word returned from a successful .it open, .it creat or .it pipe call. .s3 .it Buffer is the address of .it nbytes contiguous bytes which are written on the output file. The number of characters actually written is returned (in r0). It should be regarded as an error if this is not the same as requested. .s3 Writes which are multiples of 512 characters long and begin on a 512-byte boundary are more efficient than any others. .sh "SEE ALSO" creat(II), open(II), pipe(II) .sh DIAGNOSTICS The error bit (c-bit) is set on an error: bad descriptor, buffer address, or count; physical I/O errors. From C, a returned value of \*-1 indicates an error. ch are written on the output file. The number of characters actually written is returned (in r0). It should be regarded as an error if .th INDIR II 8/5/73 .sh NAME indir \*- indirect system call .sh SYNOPSIS (indir = 0.; not in assembler) .br .ft B sys indir; syscall .ft R .sh DESCRIPTION The system call at the location .it syscall is executed. Execution resumes after the .it indir call. .s3 The main purpose of .it indir is to allow a program to store arguments in system calls and execute them out of line in the data segment. This preserves the purity of the text segment. .s3 If .it indir is executed indirectly, it is a no-op. .sh "SEE ALSO" \*- .sh DIAGNOSTICS \*- E indir \*- indirect system call .sh SYNOPSIS (indir = 0.; not in assembler) .br .ft B sys indir; syscall .ft R .sh DESCRIPTION The system call at the location .it syscall is executed. Execution resumes after the .it indir call. .s3 The main purpose of .it indir is to allow a program to store arguments in system calls and execute them out of line in the data segment. This preserves the purity of the text segment. .s3 If .it indir is executed indirectly, it is a no-op. .sh "SEE ALS.th SLEEP II 8/5/73 .sh NAME sleep \*- stop execution for interval .sh SYNOPSIS (sleep = 35.; not in assembler) .br (seconds in r0) .br .ft B sys sleep .s3 sleep(seconds) .ft R .sh DESCRIPTION The current process is suspended from execution for the number of seconds specified by the argument. .sh "SEE ALSO" sleep (I) .sh DIAGNOSTICS \*- m calls and execute them out of line in the data segment. This preserves the purity of the text segment. .s3 If .it indir is executed indirectly, it is a no-op. .sh "SEE ALS.th KILL II 8/5/73 .sh NAME kill \*- send signal to a process .sh SYNOPSIS (kill = 37.; not in assembler) .br (process number in r0) .br .ft B sys kill; sig .ft R .sh DESCRIPTION .it Kill sends the signal .it sig to the process specified by the process number in r0. See signal(II) for a list of signals. .s3 The sending and receiving processes must have the same controlling typewriter, otherwise this call is restricted to the super-user. .sh "SEE ALSO" signal(II), kill(I) .sh DIAGNOSTICS The error bit (c-bit) is set if the process does not have the same controlling typewriter and the user is not super-user, or if the process does not exist. .sh BUGS Equality between the controlling typewriters of the sending and receiving process is neither a necessary nor sufficient condition for allowing the sending of a signal. The correct condition is equality of user IDs. ame controlling typewriter, otherwise this call is restricted to the super-user. .sh "SEE ALSO" signal(II), kill(I) .sh DIAGNOSTICS The error bit (c-bit.th CSW II 8/5/73 .sh NAME csw \*- read console switches .sh SYNOPSIS (csw = 38.; not in assembler) .br .ft B sys csw .s3 getcsw( ) .ft R .sh DESCRIPTION The setting of the console switches is returned (in r0). ceiving process is neither a necessary nor sufficient condition for allowing the sending of a signal. The correct condition is equality of user IDs. ame controlling typewriter, otherwise this call is restricted to the super-user. .sh "SEE ALSO" signal(II), kill(I) .sh DIAGNOSTICS The error bit (c-bit.th SETGID II 8/5/73 .sh NAME setgid \*- set process group ID .sh SYNOPSIS (setgid = 46.; not in assembler) .br (group ID in r0) .ft B .br sys setgid .s3 setgid(gid) .ft R .sh DESCRIPTION The group ID of the current process is set to the argument. Both the effective and the real group ID are set. This call is only permitted to the super-user or if the argument is the real group ID. .sh "SEE ALSO" getgid(II) .sh DIAGNOSTICS Error bit (c-bit) is set as indicated; from C, a \*-1 value is returned. r bit (c-bit.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 affected is blank padded..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. ls .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. .s.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 .s.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 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 .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. variable .it fout which has the structure of a buffer .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. SEE ALSO" putc(III) .sh BUGS The .it fout notion is kludgy. variable .it fout which has the structure of a buffer .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. t 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.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 leaves a remainder in the external cell .it ldivr. .sh BUGS No divide check check. t 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.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). or is greater than that of the.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. .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 uni.th TTYN III 1/15/73 .sh NAME ttyn \*- return name of current typewriter .sh SYNOPSIS .ft B jsr pc,ttyn .s3 ttyn(file) .s3 .ft R .sh DESCRIPTION .it Ttyn hunts up the last character of the name of the typewriter which is the standard input (from \fIas\fR) or is specified by the argument .it file descriptor (from C). If \fIn\fR is returned, the typewriter name is then ``/dev/tty\fIn\fR''. .s3 .bd x is returned if the indicated file does not correspond to a typewriter. .sh BUGS /O has been done on the .it uni.th RAND III 1/15/73 .sh NAME rand \*- random number generator .sh SYNOPSIS (seed in r0) .br .ft B jsr pc,srand /to initialize .s3 jsr pc,rand /to get a random number .s3 .nf srand(seed) int seed; .s3 rand( ) .fi .ft R .s3 .sh DESCRIPTION .it Rand uses a multiplicative congruential random number generator to return successive pseudo-random numbers (in r0) in the range from 1 to 2\u\s715\s10\d\*-1. .s3 The generator is reinitialized by calling .it srand with 1 as argument (in r0). It can be set to a random starting point by calling .it srand with whatever you like as argument, for example the low-order word of the time. .sh 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. .sh BUGS The low-order bits are not very random. eturn successive pseudo-random numbers (in r0) in the range from 1 to 2\u\s715\s10\d\*-1. .s3 The generator is reinitialized by calling .it srand with 1 as argument (in r0). It can be set to a random s.tr | .th POW III 4/30/73 .sh NAME pow \*- floating exponentiation .sh SYNOPSIS .ft B movf x,fr0 .br movf y,fr1 .br jsr pc,pow .s3 .nf double pow(x,y) double x, y; .fi .s3 .ft R .sh DESCRIPTION .it Pow returns the value of \fIx\u\s8y\s10\d\fR (in fr0). .it "Pow(0,|y)" is 0 for any .it y. .it "Pow(\*-x,|y)" returns a result only if .it y is an integer. .sh "SEE ALSO" exp(III), log(III) .sh DIAGNOSTICS The carry bit is set on return in case of overflow, .it pow(0,|0), or .it pow(\*-x,|y) for non-integral .it y. From C there is no diagnostic. .sh BUGS floating exponentiation .sh SYNOPSIS .ft B movf x,fr0 .br movf y,fr1 .br jsr pc,pow .s3 .nf double pow(x,y) double x, y; .fi .s3 .ft R .sh DESCRIPTION .it Pow returns the value of \fIx\u\s8y\s10\d\fR (in fr0). .it "Pow(0,|y)" is 0 for any .it y. .it "Pow(\*-x,|y)" returns a result only if .it y is an integer. .sh "SEE ALSO" exp(III), log(III) .sh DIAGNOSTICS The carry bit is set on return in case of overflow, .it pow(0,|0), or .it pow(\*-x,|y) for non-integral .it .th COMPAR III 1/15/73 .sh NAME compar \*- default comparison routine for qsort .sh SYNOPSIS .ft B jsr pc,compar .ft R .sh DESCRIPTION .it Compar is the default comparison routine called by \fIqsort\fR and is separated out so that the user can supply his own comparison. .s3 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. .s3 Return is via the condition codes, which are tested by the instructions ``blt'' and ``bgt''. That is, in the absence of overflow, 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 .s3 cmpb (r0),(r4) .s3 suffices. .s3 Only r0 is changed by the call. .sh "SEE ALSO" qsort (III) .sh BUGS It could be recoded to run faster. to by r0 with the element pointed to by r4. .s3 Return is via the condition codes, which are tested by the instructions .th CRYPT III 4/30/73 .sh NAME crypt \*- password encoding .sh SYNOPSIS .ft B mov $key,r0 .br jsr pc,crypt .s3 char *crypt(key) .br char *key; .ft R .sh 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''. .s3 From C, the .it key argument is a string and the value returned is a pointer to the eight-character encrypted password. .s3 Login uses this result as a password. .sh "SEE ALSO" passwd(I), passwd(V), login(I) .sh BUGS .ft R .sh 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''. .s3 From C, the .it key argument is a string and the value returned is a point.th ATOF III 4/30/73 .sh NAME atof \*- ascii to floating .sh SYNOPSIS .ft B double atof(nptr) .br char *nptr; .br .ft R .sh DESCRIPTION .it Atof converts a string to a floating number. .it Nptr should point to a string containing the number; the first unrecognized character ends the number. .s3 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 \fBe\fR followed by a signed integer. .sh DIAGNOSTICS There are none; overflow results in a very large number and garbage characters terminate the scan. .sh BUGS The routine should accept initial \fB+\fR, initial blanks, and \fBE\fR for \fBe\fR. Overflow should be signalled. g the number; the first unrecognized character ends the number. .s3 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 \fBe\fR followed by a signed integer. .sh DIAGNO.th CTIME III 10/15/73 .sh NAME ctime \*- convert date and time to ASCII .sh SYNOPSIS .ft B char *ctime(tvec) .br int tvec[2]; .s3 .ft R [from Fortran] .br .ft B double precision ctime .br .li ... = ctime(dummy) .s3 int *localtime(tvec) .br int tvec[2]; .s3 int *gmtime(tvec) .br int tvec[2]; .br .ft R .sh DESCRIPTION .it Ctime converts a time in the vector .it tvec such as returned by time (II) into ASCII and returns a pointer to a character string in the form .s3 Sun Sep 16 01:03:52 1973\\n\\0 .s3 All the fields have constant width. .s3 Once the time has been placed into .it t and .it t+2, this routine is callable from assembly language as follows: .s3 .nf .ft B mov $t,\*-(sp) jsr pc,\*_ctime tst (sp)+ .s3 .ft R .fi and a pointer to the string is available in r0. .s3 The .it localtime and .it gmtime entries return integer vectors to the broken-down time. .it Localtime corrects for the time zone and possible daylight savings time; .it gmtime converts directly to GMT, which is the time UNIX uses. The value is a pointer to an array whose components are .s3 .lp +5 5 0 seconds .lp +5 5 1 minutes .lp +5 5 2 hours .lp +5 5 3 day of the month (1-31) .lp +5 5 4 month (0-11) .lp +5 5 5 year \*- 1900 .lp +5 5 6 day of the week (Sunday = 0) .lp +5 5 7 day of the year (0-365) .lp +5 5 8 Daylight Saving Time flag if non-zero .i0 .s3 The external variable .it timezone contains the difference, in seconds, between GMT and local standard time (in EST, is 5*60*60); the external variable .it daylight is non-zero iff the standard U.S.A. Daylight Saving Time conversion should be applied between the last Sundays in April and October. The external variable .it nixonflg if non-zero supersedes .it daylight and causes daylight time all year round. .s3 A routine named .it ctime is also available from Fortran. Actually it more resembles the .it time (II) system entry in that it returns the number of seconds since the epoch 0000 GMT Jan. 1, 1970 (as a floating-point number). .sh "SEE ALSO" time(II) .sh BUGS ight is non-zero iff the .th EXP III 4/30/73 .sh NAME exp \*- exponential function .sh SYNOPSIS .ft B jsr r5,exp .s3 double exp(x) .br double x; .ft R .sh DESCRIPTION The exponential of fr0 is returned in fr0. From C, the exponential of \fIx\fR is returned. .sh DIAGNOSTICS If the result is not representable, the c-bit is set and the largest positive number is returned. From C, no diagnostic is available. .s3 Zero is returned if the result would underflow. .sh BUGS number). .sh "SEE ALSO" time(II) .sh BUGS ight is non-zero iff the .th FPTRAP III 11/18/73 .sh NAME fptrap \*- floating point interpreter .sh SYNOPSIS .ft B sys signal; 4; fptrap .ft R .sh DESCRIPTION .it Fptrap is a simulator of the 11/45 FP11-B floating point unit. It works by intercepting illegal instruction faults and examining the offending operation codes for possible floating point. .sh FILES found in /lib/libu.a; a fake version is in /lib/liba.a .sh DIAGNOSTICS A break point trap is given when a real illegal instruction trap occurs. .sh "SEE ALSO" signal(II) .sh BUGS Rounding mode is not interpreted. Its slow. ating point interpreter .sh SYNOPSIS .ft B sys signal; 4; fptrap .ft R .sh DESCRIPTION .it Fptrap is a simulator of the 11/45 FP11-B floating point unit. It works by intercepting illegal instruction faults and examining the offending operation codes for possible floating point. .sh FILES found in /lib/libu.a; a fake version is in /lib/liba.a .sh DIAGNOSTICS A break point trap is given when a real illegal instruction trap occurs. .sh "SEE ALSO" signal(II) .sh BU.th PUTC III 6/12/72 .sh NAME putc \*- buffered output .sh SYNOPSIS .ft B .nf mov $filename,r0 jsr r5,fcreat; iobuf .s3 fcreat(file, iobuf) char *file; struct buf *iobuf; .s3 .ft R (get byte in r0) .ft B jsr r5,putc; iobuf .s3 putc(c, iobuf) int c; struct buf *iobuf; .s3 .ft R (get word in r0) .ft B jsr r5,putw; iobuf .s3 [putw not available from C] .s3 jsr r5,flush; iobuf .s3 fflush(iobuf) struct buf *iobuf; .fi .ft R .sh DESCRIPTION .it Fcreat creates the given file (mode 666) and sets up the buffer .it iobuf (size 518 bytes); .it putc and .it putw write a byte or word respectively onto the file; .it flush forces the contents of the buffer to be written, but does not close the file. The format of the buffer is: .s3 .nf .ft B iobuf: .=.+2 / file descriptor .=.+2 / characters unused in buffer .=.+2 / ptr to next free character .=.+512. / buffer .ft R .s3 Or in C, .s3 .ft B .nf struct buf { int fildes; int nunused; char *nxtfree; char buff[512]; }; .ft R .fi .s3 .it Fcreat sets the error bit (c-bit) if the file creation failed (from C, returns \*-1); none of the other routines returns error information. .s3 Before terminating, a program should call .it flush to force out the last of the output .it (fflush from C). .s3 The user must supply .it iobuf, which should begin on a word boundary. .s3 To write a new file using the same buffer, it suffices to call .it [f]flush, close the file, and call .it fcreat again. .sh "SEE ALSO" creat(II), write(II), getc(III) .sh DIAGNOSTICS error bit possible on .it fcreat call. .sh BUGS on failed (from C, returns \*-1); none of the other routines returns error information. .s3 Before terminating, a program should call .it flush to force out the last of the output .it (fflush from C). .s3 The user must supply .it iobuf, which should begin on a word boundary. .s3 To write a new file using the same buffer, it suffices to call .it [f]flush, close the file, and call .it fcreat again. .sh "SEE ALSO" creat(II), write(II), getc(III) .sh DIAGNOSTICS error bit possible on .it f.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 s 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 t.th LOG III 4/30/72 .sh NAME log \*- natural logarithm .sh SYNOPSIS .ft B jsr r5,log .s3 double log(x) .br double x; .ft R .sh DESCRIPTION The natural logarithm of fr0 is returned in fr0. From C, the natural logarithm of \fBx\fR is returned. .sh DIAGNOSTICS The error bit (c-bit) is set if the input argument is less than or equal to zero and the result is a negative number very large in magnitude. From C, there is no error indication. .sh BUGS r codes may be added to the system before they are added to the t.th MESG III 3/15/72 .sh NAME mesg \*- write message on typewriter .sh SYNOPSIS .ft B jsr r5,mesg; ; .even .ft R .sh DESCRIPTION .it Mesg writes the string immediately following its call onto the standard output file. The string must be terminated by an ASCII NULL byte. .sh BUGS gument is less than or equal to zero and the result is a negative number very large in magnitude. From C, there is no error indication. .sh BUGS r codes may be added to the system before they are added to the t.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. tatement) 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.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. nted (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 st.th SIN III 3/15/72 .sh NAME sin \*- sine, cosine .sh SYNOPSIS .nf .ft B jsr r5,sin (cos) .s3 double sin(x) double x; .s3 double cos(x) double x; .fi .ft R .sh DESCRIPTION The sine (cosine) of fr0 (resp. \fBx\fR), measured in radians, is returned (in fr0). .s3 The magnitude of the argument should be checked by the caller to make sure the result is meaningful. .sh BUGS 535). .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 st.th SWITCH III 3/15/72 .sh NAME switch \*- switch on value .sh SYNOPSIS .lp +7 7 (switch value in r0) .lp +7 7 .ft B jsr r5,switch; swtab .lp +7 7 .ft R (not-found return) .lp +7 7 .ft B ... .lp +7 7 swtab: val1; lab1; .lp +7 7 ... .lp +7 7 valn; labn .lp +7 7 ..; 0 .i0 .dt .ft R .sh DESCRIPTION .it Switch compares the value of r0 against each of the val\s8\fI\di\fR\u\s10; if a match is found, control is transferred to the corresponding lab\s8\fI\di\fR\u\s10 (after popping the stack once). If no match has been found by the time a null lab\s8\fI\di\fR\u\s10 occurs, .it switch returns. .sh BUGS in r0) .lp +7 7 .ft B jsr r5,switch; swtab .lp +7 7 .ft R (not-found return) .lp +7 7 .ft B ... .lp +7 7 swtab: val1; lab1; .lp +7 7 ... .lp +7 7 valn; labn .lp +7 7 ..; 0 .i0 .dt .ft R .sh DESCRIPTION .it Switch compares the value of r0 against each of the val\s8\fI\di\fR\u\s10; if a match is found, control is transferred to the corresponding lab\s8\fI\di\fR\u\s10 (after popping the stack once). If no mat.th GERTS III 3/15/72 .sh NAME gerts \*- Gerts communication over 201 .sh SYNOPSIS .ft B jsr r5,connect .br .ft R (error return) .br .ft B .li ... .s3 jsr r5,gerts; fc; oc; ibuf; obuf .br .ft R (error return) .br .ft B .li ... .s3 .ft R \fRother entry points:\fB gcset, gout .br .ft R .sh DESCRIPTION The GCOS GERTS interface is so painful that a description here is inappropriate. Anyone needing to use this interface should seek divine guidance. .sh "SEE ALSO" dn(IV), dp(IV), HIS documentation .sh FILES found in /lib/libg.a .sh BUGS NAME gerts \*- Gerts communication over 201 .sh SYNOPSIS .ft B jsr r5,connect .br .ft R (error return) .br .ft B .li ... .s3 jsr r5,gerts; fc; oc; ibuf; obuf .br .ft R (error return) .br .ft B .li ... .s3 .ft R \fRother entry points:\fB gcset, gout .br .ft R .sh DESCRIPTION The GCOS GERTS interface is so painful that a description here is inappropriate. Anyone needing to use this interface should seek divine guidance. .sh "SEE ALSO" dn(IV), dp(IV), HIS documentation .sh FILES foun.th GETC III 4/30/72 .sh NAME getc \*- buffered input .sh SYNOPSIS .ft B mov $filename,r0 .br jsr r5,fopen; iobuf .s3 fopen(filename, iobuf) .br char *filename; .br struct buf *iobuf; .s3 jsr r5,getc; iobuf .br .ft R (character in r0) .s3 .ft B getc(iobuf) .br struct buf *iobuf; .s3 jsr r5,getw; iobuf .br .ft R (word in r0) .s3 [getw not available in C] .sh DESCRIPTION These routines provide a buffered input facility. .it Iobuf is the address of a 518(10) byte buffer area whose contents are maintained by these routines. Its format is: .s3 .nf .ft B ioptr: .=.+2 / file descriptor .=.+2 / characters left in buffer .=.+2 / ptr to next character .=.+512. / the buffer .ft R .s3 Or in C, .s3 .ft B struct buf { int fildes; int nleft; char *nextp; char buffer[512]; }; .ft R .s3 .fi .it Fopen may be called initially to open the file. On return, the error bit (c-bit) is set if the open failed. If \fIfopen\fR is never called, \fIget\fR will read from the standard input file. From C, the value is negative if the open failed. .s3 .it Getc returns the next byte from the file in r0. The error bit is set on end of file or a read error. From C, the character is returned; it is \*-1 on end-of-file or error. .s3 \fIGetw\fR returns the next word in r0. .it Getc and \fIgetw\fR may be used alternately; there are no odd/even problems. \fIGetw\fR is not available from C. .s3 .it Iobuf must be provided by the user; it must be on a word boundary. .s3 To reuse the same buffer for another file, it is sufficient to close the original file and call \fIfopen\fR again. .sh "SEE ALSO" open(II), read(II), putc(III) .sh DIAGNOSTICS c-bit set on EOF or error; .br from C, negative return indicates error or EOF. .sh BUGS error. .s3 \fIGetw\fR returns the next word in r0. .it Getc and \fIgetw\fR may be used alternately; there are no odd/even problems. \fIGetw\fR is not available from C. .s3 .it Iobuf must be provided by the user; it must be on a word boundary. .s3 To reuse the same buffer for another file, it is sufficient to clo.th QSORT III 6/12/72 .sh NAME qsort \*- quicker sort .sh SYNOPSIS .nf (end+1 of data in r2) (element width in r3) .ft B jsr pc,qsort .s3 qsort(base, nel, width, compar) char *base; int (*compar)( ); .fi .ft R .sh DESCRIPTION .it Qsort is an implementation of the quicker-sort algorithm. The assembly-language version 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 are destroyed. .s3 The routine compar (q.v.) is called to compare elements and may be replaced by the user. .s3 The C version has somewhat different arguments and the user must supply a comparison routine. The first argument is to the base of the data; the second is the number of elements; the third is the width of an element in bytes; the last is the name of the comparison routine. It is called with two arguments which are pointers to the elements being compared. The routine must return a negative integer if the first element is to be considered less than the second, a positive integer if the second element is smaller than the first, and 0 if the elements are equal. .sh "SEE ALSO" compar (III) .sh BUGS ine. The first argument is to the base of the data; the second is the number of elements; the third is the width of an element in bytes; the last is the name of t.th NLIST III 6/12/72 .sh NAME nlist \*- get entries from name list .sh SYNOPSIS .ft B .lp +6 6 jsr r5,nlist; file; list .lp +6 6 ... .lp +6 6 file: ; .even .lp +6 6 list: ; type1; value1 .lp +6 6 ; type2; value2 .lp +6 6 ... .lp +6 6 0 .s3 .nf .i0 nlist(filename, nl) char *filename; .dt struct { char name[8]; int type; int value; } nl[ ]; .fi .ft R .sh DESCRIPTION .it Nlist examines the name list in the given executable output file and selectively extracts 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 null name. 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. .s3 This subroutine is useful for examining the system name list kept in the file \fB/usr/sys/unix\fR. In this way programs can obtain system addresses that are up to date. .sh "SEE ALSO" a.out(V) .sh DIAGNOSTICS All type entries are set to \*-1 if the file cannot be found or if it is not a valid namelist. .sh BUGS ked 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. .s3 This subroutine is useful for examining the system name list kept in the file \fB/usr/sys/unix\fR. In this way programs can obtain system addresses th.th SQRT III 3/15/72 .sh NAME sqrt \*- square root function .sh SYNOPSIS .br .ft B jsr r5,sqrt .s3 double sqrt(x) .br double x; .ft R .sh DESCRIPTION The square root of fr0 (resp. \fBx\fR) is returned (in fr0). .sh DIAGNOSTICS The c-bit is set on negative arguments and 0 is returned. There is no error return for C programs. .sh BUGS No error return from C. s3 This subroutine is useful for examining the system name list kept in the file \fB/usr/sys/unix\fR. In this way programs can obtain system addresses th.th ECVT III 4/30/73 .sh NAME ecvt \*- output conversion .sh SYNOPSIS .ft B jsr pc,ecvt .s3 jsr pc,fcvt .s3 char *ecvt(value, ndigit, decpt, sign) .br double value; .br int ndigit, *decpt, *sign; .s3 char *fcvt(value, ndigit, decpt, sign) .br .li ... .ft R .sh DESCRIPTION .it Ecvt is called with a floating point number in fr0. .s3 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 \fI\*_ndigits\fR. .s3 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. .s3 The sign of the number is indicated by r1 (0 for +; 1 for \*-). .s3 The low order digit has suffered decimal rounding (i. e. may have been carried into). .s3 From C, the .it value is converted and a pointer to a null-terminated string of \fIndigit\fR digits is returned. The position of the decimal point is stored indirectly through \fIdecpt\fR (negative means to the left of the returned digits). If the sign of the result is negative, the word pointed to by \fIsign\fR is non-zero, otherwise it is zero. .s3 \fIFcvt\fR is identical to \fIecvt\fR, except that the correct digit has had decimal rounding for F-style output of the number of digits specified by \fI\(*_ndigits\fR. .sh "SEE ALSO" printf(III) .sh BUGS er to a null-terminated string of \fIndigit\fR digits is returned. The position of the decimal point is.th ATAN III 4/30/73 .sh NAME atan \*- arc tangent function .sh SYNOPSIS .ft B jsr r5,atan\fR[\fB2\fR]\fB .s3 .br double atan(x) .br double x; .br .s3 double atan2(x, y) .br double x, y; .ft R .sh DESCRIPTION The \fIatan\fR entry returns the arc tangent of fr0 in fr0; from C, the arc tangent of \fIx\fR is returned. The range is \*-\*p/2 to \*p/2. The \fIatan2\fR entry returns the arc tangent of fr0/fr1 in fr0; from C, the arc tangent of \fIx/y\fR is returned. The range is \*-\*p to \(*p. .sh DIAGNOSTIC There is no error return. .sh BUGS \*- arc tangent function .sh SYNOPSIS .ft B jsr r5,atan\fR[\fB2\fR]\fB .s3 .br double atan(x) .br double x; .br .s3 double atan2(x, y) .br double x, y; .ft R .sh DESCRIPTION The \fIatan\fR entry returns the arc tangent of fr0 in fr0; from C, the arc tangent of \fIx\fR is returned. The range is \*-\*p/2 to \*p/2. The \fIatan2\fR entry returns the arc tangent of fr0/fr1 in fr0; from C, the arc tangent of \fIx/y\fR is returned. The range is \*-\*p to \(*p. .sh DIAGNOSTIC T.th HYPOT III 6/12/72 .sh NAME hypot \*- calculate hypotenuse .sh SYNOPSIS .ft B jsr r5,hypot .br .ft R .sh 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. .sh DIAGNOSTICS The c-bit is set if the result cannot be represented. .sh BUGS the arc tangent of fr0/fr1 in fr0; from C, the arc tangent of \fIx/y\fR is returned. The range is \*-\*p to \(*p. .sh DIAGNOSTIC T.th VS IV 10/28/73 .sh NAME vs \*- voice synthesizer interface .sh DESCRIPTION Bytes written on .it vs drive a Federal Screw Works Votrax\(rg voice synthesizer. The upper two bits encode an inflection, the other 6 specify a phoneme. The code is given in section vs (VII). .s3 Touch-Tone\(rg signals sent by a caller will be picked up during a .it read as the ASCII characters {0123456789#*}. .sh FILES /dev/vs .sh "SEE ALSO" speak (I), vs (VII) .sh BUGS is returned. The range is \*-\*p to \(*p. .sh DIAGNOSTIC T.th TIU IV 10/28/73 .sh NAME tiu \*- Spider interface .sh DESCRIPTION Spider is a fast digital switching network. .it Tiu is a directory which contains files each referring to a Spider control or data channel. The file /dev/tiu/d\fIn\fR refers to data channel \fIn\fR, likewise /dev/tiu/c\fIn\fR refers to control channel \fIn\fR. .s3 The precise nature of the UNIX interface has not been defined yet. .sh FILES /dev/tiu/d?, /dev/tiu/c? .sh BUGS sh BUGS is returned. The range is \*-\*p to \(*p. .sh DIAGNOSTIC T.th DA IV 10/28/73 .sh NAME da \*- voice response unit .sh DESCRIPTION Bytes written on this file control a Cognitronics optical drum voice response unit which can generate up to 31 fixed half-second utterances. Bytes read correspond to Touch-Tone\(rg signals received via a 403 dataset. .s3 The specifics of the interface will not be described. Consult M. E. Lesk for more information. .sh FILES /dev/da .sh BUGS ev/tiu/d?, /dev/tiu/c? .sh BUGS sh BUGS is returned. The range is \*-\*p to \(*p. .sh DIAGNOSTIC T.th CAT IV 10/27/73 .sh NAME cat \*- phototypesetter interface .sh DESCRIPTION .it Cat provides the interface to a Graphic Systems C/A/T phototypesetter. Bytes written on the file specify font, size, and other control information as well as the characters to be flashed. The coding will not be described here. .s3 Only one process may have this file open at a time. It is write-only. .sh FILES /dev/cat .sh "SEE ALSO" troff (I), Graphic Systems specification (available on request) .sh BUGS (*p. .sh DIAGNOSTIC T.th RP IV 10/15/73 .sh NAME rp \*- RP-11/RP03 moving-head disk .sh DESCRIPTION The files .it "rp0 ... rp7" refer to sections of RP disk drive 0. The files .it "rp8 ... rp15" refer to drive 1 etc. This is done since the size of a full RP drive is 81200 blocks and internally the system is only capable of addressing 65536 blocks. Also since the disk is so large, this allows it to be broken up into more manageable pieces. .s3 The origin and size of the pseudo-disks on each drive are as follows: .s3 .br disk start length .br 0 0 40600 .br 1 40600 40600 .br 2 0 3200 .br 3 3200 39000 .br 4 42200 39000 .br 5-7 unassigned .sh FILES /dev/rp? .sh BUGS The files .it "rp8 ... rp15" refer to drive 1 etc. This is done since the size of a full RP drive is 81200 blocks and internally the system is only capable of addressing 65536 blocks. Also since the disk is so large, this allows it to be broken up into more manageable pieces. .s3 The origin and size of the pseudo-disks on each drive are as follows: .s3 .br disk st.th TM IV 10/15/73 .sh NAME tm \*- TM-11/TU-10 magtape interface .sh DESCRIPTION The files .it "mt0, ..., mt7" refer to the DEC TU10/TM11 magtape. When opened for reading or writing, the magtape is rewound. A tape consists of a series of 512 byte records terminated by an end-of-file. When the magtape is closed after writing, an end-of-file is written. .s3 The magtape can only be opened once at any instant. .sh FILES /dev/mt? .sh "SEE ALSO" tp(I) .sh BUGS If you hit the EOF mark or get other non-data errors it refuses to do anything more until closed. There has to be some reasonable way to deal with multi-file tapes. efer to the DEC TU10/TM11 magtape. When opened for reading or writing, the magtape is rewound. A tape consists of a series of 512 byte records terminated by an end-of-file. When the magtape is closed after writing, an end-of-file is written. .s3 The magtape can only be opened once at any instant. .sh FILES /dev/mt? .sh "SEE ALSO" tp(I) .sh BUGS If you hit the EOF mark or get other non-data errors .th TC IV 10/15/73 .sh NAME tc \*- TC-11/TU56 DECtape .sh DESCRIPTION The files .it "tap0 ... tap7" refer to the TC-11/TU56 DECtape drives 0 to 7. .s3 The 256-word blocks on a standard DECtape are numbered 0 to 577. .sh FILES /dev/tap? .sh "SEE ALSO" tp(I) .sh BUGS Since reading is synchronous, only one block is picked up per tape reverse. is written. .s3 The magtape can only be opened once at any instant. .sh FILES /dev/mt? .sh "SEE ALSO" tp(I) .sh BUGS If you hit the EOF mark or get other non-data errors .th MEM IV 8/24/73 .sh NAME mem \*- core memory .sh DESCRIPTION .it Mem is a special file that is an image of the core memory of the computer. It may be used, for example, to examine, and even to patch the system using the debugger. .s3 A memory address is an 18-bit quantity which is used directly as a UNIBUS address. References to non-existent locations cause errors to be returned. .s3 Examining and patching device registers is likely to lead to unexpected results when read-only or write-only bits are present. .sh FILES /dev/mem .sh BUGS There should be another .it mem file that looks at core using the system's address map. mory of the computer. It may be used, for example, to examine, and even to patch the system using the debugger. .s3 A memory address is an 18-bit quantity which is used directly as a UNIBUS address. References to non-existent locations cause errors to be returned. .s3 Examining and patching device registers is likely to lead to unexpected results when read-only or write-only bits are pr.th RF IV 10/15/73 .sh NAME rf \*- RF11/RS11 fixed-head disk file .sh DESCRIPTION This file refers to the concatenation of all RS-11 disks. .s3 Each disk contains 1024 256-word blocks. The length of the combined RF file is 1024\*X(minor+1) blocks. That is minor device zero is 1024 blocks long; minor device one is 2048, etc. .sh FILES /dev/rf0 .sh BUGS ions cause errors to be returned. .s3 Examining and patching device registers is likely to lead to unexpected results when read-only or write-only bits are pr.th PC IV 10/15/73 .sh NAME pc \*- PC-11 paper tape reader/punch .sh DESCRIPTION .it Ppt refers to the PC-11 paper tape reader or punch, depending on whether it is read or written. .s3 When .it ppt is opened for writing, a 100-character leader is punched. Thereafter each byte written is punched on the tape. No editing of the characters is performed. When the file is closed, a 100-character trailer is punched. .s3 When .it ppt is opened for reading, the process waits until tape is placed in the reader and the reader is on-line. Then requests to read cause the characters read to be passed back to the program, again without any editing. This means that several null leader characters will usually appear at the beginning of the file. Likewise several nulls are likely to appear at the end. End-of-file is generated when the tape runs out. .s3 Seek calls for this file are meaningless. .sh FILES /dev/ppt .sh BUGS nched. .s3 When .it ppt is opened for reading, the process waits until tape is placed in the reader and.th DC IV 8/22/73 .sh NAME dc \*- DC-11 communications interface .sh DESCRIPTION The special files /dev/tty0, /dev/tty1, ... refer to the DC11 asynchronous communications interfaces. At the moment there are 12 of them, but the number is subject to change. .s3 When one of these files is opened, it causes the process to wait until a connection is established. In practice user's programs seldom open these files; they are opened by .it init and become a user's input and output file. The very first typewriter file open in a process becomes the .it "control typewriter" for that process. The control typewriter plays a special role in handling quit or interrupt signals, as discussed below. The control typewriter is inherited by a child process during a .it fork. .s3 A terminal associated with one of these files ordinarily operates in full-duplex mode. Characters may be typed at any time, even while output is occurring, and are only lost when the system's character input buffers become completely choked, which is rare, or when the user has accumulated the maximum allowed number of input characters which have not yet been read by some program. Currently this limit is 256 characters. When the input limit is reached all the saved characters are thrown away without notice. .s3 When first opened, the interface mode is 150 baud; either parity accepted; 10 bits/character (one stop bit); and newline action character. The system delays transmission after sending certain function characters. Delays for horizontal tab, newline, and form feed are calculated for the Teletype Model 37; the delay for carriage return is calculated for the GE TermiNet 300. Most of these operating states can be changed by using the system call stty(II). In particular the following hardware states are program settable independently for input and output (see DC11 manual): 134.5, 150, 300, or 1200 baud; one or two stop bits on output; and 5, 6, 7, or 8 data bits/character. In addition, the following software modes can be invoked: acceptance of even parity, odd parity, or both; a raw mode in which all characters may be read one at a time; a carriage return (CR) mode in which CR is mapped into newline on input and either CR or line feed (LF) cause echoing of the sequence LF-CR; mapping of upper case letters into lower case; suppression of echoing; suppression of delays after function characters; and the printing of tabs as spaces. See getty(VII) for the way that terminal speed and type are detected. .s3 Normally, typewriter input is processed in units of lines. This means that a program attempting to read will be suspended until an entire line has been typed. Also, no matter how many characters are requested in the read call, at most one line will be returned. It is not however necessary to read a whole line at once; any number of characters may be requested in a read, even one, without losing information. .s3 During input, erase and kill processing is normally done. The character `#' erases the last character typed, except that it will not erase beyond the beginning of a line or an EOT. The character `@' kills the entire line up to the point where it was typed, but not beyond an EOT. Both these characters operate on a keystroke basis independently of any backspacing or tabbing that may have been done. Either `@' or `#' may be entered literally by preceding it by `\\'; the erase or kill character remains, but the `\\' disappears. .s3 In upper-case mode, all upper-case letters are mapped into the corresponding lower-case letter. The upper-case letter may be generated by preceding it by `\\'. In addition, the following escape sequences are generated on output and accepted on input: .s3 .lp +14 7 for use .lp +15 7 \*g \\\*a .lp +15 7 .tr || .tc ? .br .tr ? .br \*v \\! .br .tr ?? .lp +15 7 ~ \\^ .lp +15 7 { \\( .lp +15 7 } \\) .s3 .i0 It is possible to use raw mode in which the program reading is awakened on each character. In raw mode, no erase or kill processing is done; and the EOT, quit and interrupt characters are not treated specially. .s3 The ASCII EOT character may be used to generate an end of file from a typewriter. When an EOT is received, all the characters waiting to be read are immediately passed to the program, without waiting for a new-line. Thus if there are no characters waiting, which is to say the EOT occurred at the beginning of a line, zero characters will be passed back, and this is the standard end-of-file signal. The EOT is not passed on except in raw mode. .s3 When the carrier signal from the dataset drops (usually because the user has hung up his terminal) a .it hangup signal is sent to all processes with the typewriter as control typewriter. Unless other arrangements have been made, this signal causes the processes to terminate. If the hangup signal is ignored, any read returns with an end-of-file indication. Thus programs which read a typewriter and test for end-of-file on their input can terminate appropriately when hung up on. .s3 Two characters have a special meaning when typed. The ASCII DEL character (sometimes called `rubout') is not passed to a program but generates an .it interrupt signal which is sent to all processes with the associated control typewriter. Normally each such process is forced to terminate, but arrangements may be made either to ignore the signal or to reveive a simulated trap to an agreed-upon location. See signal (II). .s3 The ASCII character FS generates the .it quit signal. Its treatment is identical to the interrupt signal except that unless a receiving process has made other arrangements it will not only be terminated but a core image file will be generated. See signal (II). .s3 Output is prosaic compared to input. When one or more characters are written, they are actually transmitted to the terminal as soon as previously-written characters have finished typing. Input characters are echoed by putting them in the output queue as they arrive. When a process produces characters more rapidly than they can be typed, it will be suspended when its output queue exceeds some limit. When the queue has drained down to some threshold the program is resumed. Even-parity is always generated on output. The EOT character is not transmitted (except in raw mode) to prevent terminals which respond to it from hanging up. .sh FILES /dev/tty[01234567abcd] 113B Dataphones .sh "SEE ALSO" kl (IV), getty (VII), stty (I, II), gtty (I, II), signal (II) .sh BUGS ive. When a process produces characters more rapidly than they can be typed, it will be suspended when its output queue exceeds some limit. W.th VT IV 10/22/73 .sh NAME vt \*- 11/20 (vt01) interface .sh DESCRIPTION The file .it vt0 provides the interface to a PDP 11/20 which runs a VT01A-controlled Tektronix 611 storage display. The inter-computer interface is a pair of DR-11C word interfaces. .s3 Although the display has essentially only two commands, namely ``erase screen'' and ``display point'', the 11/20 program will draw points, lines, and arcs, and print text on the screen. The 11/20 can also type information on the attached 33 TTY. .s3 This special file operates in two basic modes. If the first byte written of the file cannot be interpreted as one of the codes discussed below, the rest of the transmitted information is assumed to ASCII and written on the screen. The screen has 33 lines (1/2 a standard page). The file simulates a 37 TTY: the control characters NL, CR, BS, and TAB are interpreted correctly. It also interprets the usual escape sequences for forward and reverse half-line motion and for full-line reverse. Greek is not available yet. Normally, when the screen is full (i.e. the 34th line is started) the screen is erased before starting a new page. To allow perusal of the displayed text, it is usual to assert bit 0 of the console switches. This causes the program to pause before erasing until this bit is lowered. .s3 If the first byte written is recognizable, the display runs in graphic mode. In this case bytes written on the file are interpreted as display commands. Each command consists of a single byte usually followed by parameter bytes. Often the parameter bytes represent points in the plotting area. Each point coordinate consists of 2 bytes interpreted as a 2's complement 16-bit number. The plotting area itself measures (\(+-03777)\*X(\(+-03777) (numbers in octal); that is, 12 bits of precision. Attempts to plot points outside the screen limits are ignored. .s3 The graphic commands follow. .s3 .lp +10 5 order (1); 1 parameter byte .br The parameter indicates a subcommand, possibly followed by subparameter bytes, as follows: .s3 .lp +15 5 erase (1) .br The screen is erased. The program will wait until bit 0 of the console switches is down. .s3 .lp +15 5 label (3); several subparameter bytes .fi .br The following bytes up to a null byte are printed as ASCII text on the screen. The origin of the text is the last previous point plotted; or the upper left hand of the screen if there were none. .s3 .lp +10 5 point (2); 4 parameter bytes .br The 4 parameter bytes are taken as a pair of coordinates representing a point to be plotted. .s3 .lp +10 5 line (3); 8 parameter bytes .br The parameter bytes are taken as 2 pairs of coordinates representing the ends of a line segment which is plotted. Only the portion lying within the screen is displayed. .s3 .lp +10 5 frame (4); 1 parameter byte .br The parameter byte is taken as a number of sixtieths of a second; an externally-available lead is asserted for that time. Typically the lead is connected to an automatic camera which advances its film and opens the shutter for the specified time. .s3 .lp +10 5 circle (5); 6 parameter bytes .br The parameter bytes are taken as a coordinate pair representing the origin, and a word representing the radius of a circle. That portion of the circle which lies within the screen is plotted. .s3 .lp +10 5 arc (6); 12 parameter bytes .br The first 4 parameter bytes are taken to be a coordinate-pair representing the center of a circle. The next 4 represent a coordinate-pair specifying a point on this circle. The last 4 should represent another point on the circle. An arc is drawn counter-clockwise from the first circle point to the second. If the two points are the same, the whole circle is drawn. For the second point, only the smaller in magnitude of its two coordinates is significant; the other is used only to find the quadrant of the end of the arc. In any event only points within the screen limits are plotted. .s3 .lp +10 5 dot-line (7); at least 6 parameter bytes .br The first 4 parameter bytes are taken as a coordinate-pair representing the origin of a dot-line. The next byte is taken as a signed x-increment. The next byte is an unsigned word-count, with `0' meaning `256'. The indicated number of words is picked up. For each bit in each word a point is plotted which is visible if the bit is `1', invisible if not. High-order bits are plotted first. Each successive point (or non-point) is offset rightward by the given x-increment. .s3 .i0 Asserting bit 3 of the console switches causes the display processor to throw away everything written on it. This sometimes helps if the display seems to be hung up. .sh FILES /dev/vt0 .sh BUGS an unsigned word-count, with `0' meaning `256'. The indicated number of words is picked up. For each bit in each word a point is plotted which is visible if the bit is `1', invisible if not. High-order bits are plotted first. Each successive point (or non-point) is offset rightward by the given x-increment. .s3 .i0 Asserting bit 3 of the console switches causes the display processor to throw away everything written on it. This sometimes helps if.th KL IV 8/24/73 .sh NAME kl \*- KL-11/TTY-33 console typewriter .sh DESCRIPTION .it Tty (as distinct from .it tty? ) refers to the console typewriter hard-wired to the PDP-11 via a KL-11 interface. The disciplines involved in dealing with .it tty are identical to those for .it tty? and section DC(I) should be consulted. The following differences are salient: .s3 The system calls .it stty and .it gtty apply, and the bits in the mode word have the same meanings, but the speed-select word is ignored. The quit signal is generated by the key marked `alt mode.' .s3 By appropriate console switch settings, it is possible to cause UNIX to come up as a single-user system with I/O on this device. .sh FILES /dev/tty .br /dev/tty8 synonym for /dev/tty .br /dev/tty9 second console .sh "SEE ALSO" dc(IV), init(VII) .sh BUGS be consulted. The following differences are salient: .s3 The system calls .it stty and .it gtty apply, and the bits in the mode word have the same meanings, but the speed-select word is ignored. The qui.th DN IV 8/24/73 .sh NAME dn \*- dn11 ACU interface .sh DESCRIPTION The .it dn? files are write-only. The permissible codes are: .s3 .lp +8 4 0-9 dial 0-9 .lp +8 4 : dial * .lp +8 4 ; dial # .lp +8 4 = end-of-number .s3 .i0 The entire telephone number must be presented in a single .it write system call. .s3 It is recommended that an end-of-number code be given even though only one of the ACU's (113C) actually requires it. .dt .sh FILES /dev/dn0 connected to 801 with dp0 .br /dev/dn1 connected to 113C with ttyc .br /dev/dn2 not currently connected .sh "SEE ALSO" dp(IV), dc(IV), write(II) .sh BUGS It needs a delay character to handle second dial tone. dial 0-9 .lp +8 4 : dial * .lp +8 4 ; dial # .lp +8 4 = end-of-number .s3 .i0 The entire telephone number must be presented in a single .it write system call. .s3 It is recommended that an end-of-number code be given even though only one of the ACU's (113C) actually requires it. .dt .sh FILES /dev/dn0 connected to 801 with dp0 .br /dev/dn1 connected to 113C with .th DP IV 8/24/73 .sh NAME dp \*- dp11 201 data-phone interface .sh DESCRIPTION The .it dp0 file is a 201 data-phone interface. .it Read and .it write calls to dp0 are limited to a maximum of 512 bytes. Each write call is sent as a single record. Seven bits from each byte are written along with an eighth odd parity bit. The sync must be user supplied. Each read call returns characters received from a single record. Seven bits are returned unaltered; the eighth bit is set if the byte was not received in odd parity. A 10 second time out is set and a zero-byte record is returned if nothing is received in that time. .sh FILES /dev/dp0 .sh "SEE ALSO" dn(IV), gerts(III) .sh BUGS mited to a maximum of 512 bytes. Each write call is sent as a single record. Seven bits from each byte are written along with an eighth odd parity bit. The sync must be user supplied. Each read call returns characters received from a single record. Seven bits are returned unaltered; the eighth bit is set if the byte was not received in odd .th RK IV 10/15/73 .sh NAME rk \*- RK-11/RK03 (or RK05) disk .sh DESCRIPTION .it Rk? refers to an entire RK03 disk as a single sequentially-addressed file. Its 256-word blocks are numbered 0 to 4871. .s3 Drive numbers (minor devices) of eight and greater are treated specially. Drive 8+\fIx\fR is the \fIx\fR+1 way interleaving of devices rk0 to rk\fIx\fR. Thus blocks on rk10 are distributed alternately among rk0, rk1, and rk2. .sh FILES /dev/rk? .sh BUGS Care should be taken in using the interleaved files. First, the same drive should not be accessed simultaneously using the ordinary name and as part of an interleaved file, because the same physical blocks have in effect two different names; this fools the system's buffering strategy. Second, the combined files cannot be used for swapping. Ix\fR is the \fIx\fR+1 way interleaving of devices rk0 to rk\fIx\fR. Thus blocks on rk10 are distributed alternately among rk0, rk1, and rk2. .sh FILES /dev/rk? .sh BUGS Care should be taken in using the interleaved files..th TP V 9/10/73 .sh NAME tp \*- DEC/mag tape formats .sh DESCRIPTION The command .it tp dumps and extracts files to and DECtape and magtape. The formats of these tapes are the same except that magtapes have larger directories. .s3 Block zero contains a copy of a stand-alone bootstrap program. See boot procedures (VIII). .s3 Blocks 1 through 24 for DECtape (1 through 62 for magtape) contain a directory of the tape. There are 192 (resp. 496) entries in the directory; 8 entries per block; 64 bytes per entry. Each entry has the following format: .s3 .lp +24 20 path name 32 bytes .lp +24 20 mode 2 bytes .lp +24 20 uid 1 byte .lp +24 20 gid 1 byte .lp +24 20 unused 1 byte .lp +24 20 size 3 bytes .lp +24 20 time modified 4 bytes .lp +24 20 tape address 2 bytes .lp +24 20 unused 16 bytes .lp +24 20 check sum 2 bytes .s3 .i0 The path name entry is the path name of the file when put on the tape. If the pathname starts with a zero word, the entry is empty. It is at most 32 bytes long and ends in a null byte. Mode, uid, gid, size and time modified are the same as described under i-nodes (file system (V)). The tape address is the tape block number of the start of the contents of the file. Every file starts on a block boundary. The file occupies (size+511)/512 blocks of continuous tape. The checksum entry has a value such that the sum of the 32 words of the directory entry is zero. .s3 Blocks 25 (resp. 63) on are available for file storage. .s3 A fake entry (see tp(I)) has a size of zero. .sh "SEE ALSO" file system(V), tp(I) id, size and time modified are the same as described under i-nodes (file system (V)). The tape address is the tape block number of the start of the contents of the file. Every file starts on a block boundary. The file occupies (size+511)/512 blocks of continuous tape. The checksum entry has a value such that the sum of the 32 words of the directory entry is zero. .s3 Blocks 25 (resp. 63) on are available for file storage. .s3 A fake entry (see tp(I)) has a size of zero. .sh "SEE ALSO" file system(V), tp(I.th ARCHIVE V 9/10/73 .sh NAME ar \*- archive (library) file format .sh DESCRIPTION The archive command .it ar is used to combine several files into one. Archives are used mainly as libraries to be searched by the link-editor .it ld. .s3 A file produced by .it ar has a magic number at the start, followed by the constituent files, each preceded by a file header. The magic number is 177555(8) (it was chosen to be unlikely to occur anywhere else). The header of each file is 16 bytes long: .s3 .lp +13 8 0-7 file name, null padded on the right .lp +13 8 8-11 modification time of the file .lp +13 8 12 user ID of file owner .lp +13 8 13 file mode .lp +13 8 14-15 file size .s3 .i0 If the file is an odd number of bytes long, it is padded with a null byte, but the size in the header is correct. .s3 Notice there is no provision for empty areas in an archive file. .sh "SEE ALSO" ar (I), ld (I) .sh BUGS Names are only 8 characters, not 14. More important, there isn't enough room to store the proper mode, so .it ar always extracts in mode 666. the right .lp +13 8 8-11 modification time of the file .lp +13 8 12 user ID of file owner .lp +13 8 13 file mode .lp +13 8 14-15 file size .s3 .i0 If the file is an odd number of bytes long, it is padded with a null byte, but the size in the header is correct. .s3 Notice there is no provision for empty areas in an archive file. .sh "SEE ALSO" ar (I), ld (I) .sh BUGS Names are only 8 characters, not 14. More important, there isn't enough room to store the proper mode, so .it ar always .th A.OUT V 9/9/73 .sh NAME a.out \*- assembler and link editor output .sh DESCRIPTION .it A.out is the output file of the assembler .it as and the link editor .it ld. Both programs make .it a.out executable if there were no errors and no unresolved external references. .s3 This file has four sections: a header, the program and data text, a symbol table, and relocation bits (in that order). The last two may be empty if the program was loaded with the ``\*-s'' option of .it ld or if the symbols and relocation have been removed by .it strip. .s3 The header always contains 8 words: .s3 .lp +5 3 1 A magic number (407 or 410(8)) .lp +5 3 2 The size of the program text segment .lp +5 3 3 The size of the initialized portion of the data segment .lp +5 3 4 The size of the uninitialized (bss) portion of the data segment .lp +5 3 5 The size of the symbol table .lp +5 3 6 The entry location (always 0 at present) .lp +5 3 7 Unused .lp +5 3 8 A flag indicating relocation bits have been suppressed .s3 .i0 The sizes of each segment are in bytes but are even. The size of the header is not included in any of the other sizes. .s3 When a file produced by the assembler or loader is loaded into core for execution, three logical segments are set up: the text segment, the data segment (with uninitialized data, which starts off as all 0, following initialized), and a stack. The text segment begins at 0 in the core image; the header is not loaded. If the magic number (word 0) is 407, it indicates that the text segment is not to be write-protected and shared, so the data segment is immediately contiguous with the text segment. If the magic number is 410, the data segment begins at the first 0 mod 8K byte boundary following the text segment, and the text segment is not writable by the program; if other processes are executing the same file, they will share the text segment. .s3 The stack will occupy the highest possible locations in the core image: from 177776(8) and growing downwards. The stack is automatically extended as required. The data segment is only extended as requested by the .it break system call. .s3 The start of the text segment in the file is 20(8); the start of the data segment is 20+S\s6\dt\u\s10 (the size of the text) the start of the relocation information is 20+S\s6\dt\u\s10+S\s6\dd\u\s10; the start of the symbol table is 20+2(S\s6\dt\u\s10+S\s6\dd\u\s10) if the relocation information is present, 20+S\s6\dt\u\s10+S\s6\dd\u\s10 if not. .s3 The symbol table consists of 6-word entries. The first four words contain the ASCII name of the symbol, null-padded. The next word is a flag indicating the type of symbol. The following values are possible: .s3 .lp +6 3 00 undefined symbol .lp +6 3 01 absolute symbol .lp +6 3 02 text segment symbol .lp +6 3 03 data segment symbol .lp +6 3 37 file name symbol (produced by ld) .lp +6 3 04 bss segment symbol .lp +6 3 40 undefined external (.globl) symbol .lp +6 3 41 absolute external symbol .lp +6 3 42 text segment external symbol .lp +6 3 43 data segment external symbol .lp +6 3 44 bss segment external symbol .i0 .s3 Values other than those given above may occur if the user has defined some of his own instructions. .s3 The last word of a symbol table entry contains the value of the symbol. .s3 If the symbol's type is undefined external, and the value field is non-zero, the symbol is interpreted by the loader .it ld as the name of a common region whose size is indicated by the value of the symbol. .s3 The value of a word in the text or data portions which is not a reference to an undefined external symbol is exactly that value which will appear in core when the file is executed. If a word in the text or data portion involves a reference to an undefined external symbol, as indicated by the relocation bits for that word, then the value of the word as stored in the file is an offset from the associated external symbol. When the file is processed by the link editor and the external symbol becomes defined, the value of the symbol will be added into the word in the file. .s3 If relocation information is present, it amounts to one word per word of program text or initialized data. There is no relocation information if the ``suppress relocation'' flag in the header is on. .s3 Bits 3-1 of a relocation word indicate the segment referred to by the text or data word associated with the relocation word: .s3 .lp +6 3 00 indicates the reference is absolute .lp +6 3 02 indicates the reference is to the text segment .lp +6 3 04 indicates the reference is to initialized data .lp +6 3 06 indicates the reference is to bss (uninitialized data) .lp +6 3 10 indicates the reference is to an undefined external symbol. .i0 .s3 Bit 0 of the relocation word indicates if .it on that the reference is relative to the pc (e.g. ``clr x''); if .it off, that the reference is to the actual symbol (e.g., ``clr *$x''). .s3 The remainder of the relocation word (bits 15-4) contains a symbol number in the case of external references, and is unused otherwise. The first symbol is numbered 0, the second 1, etc. .sh "SEE ALSO" as(I), ld(I), strip(I), nm(I) alized data) .lp +6 3 10 indicates the reference is to an undefined external symbol. .i0 .s3 Bit 0 of the relocation word indicates if .it on that the reference is relative to the pc (e.g. ``clr x''); if .it off, that the reference is to the actual symbol (e.g., ``clr *$x''). .s3 The remainder of the relocation word (bits 15-4) contains a symbol number in the case of external references, and is unused otherwise. The first symbol is numbered 0, the second 1, etc. .sh "SEE ALSO" as(I), ld(I), str.th CORE V 9/10/73 .sh NAME core \*- format of core image file .sh DESCRIPTION UNIX writes out a core image of a terminated process when any of various errors occur. See .it "signal (II)" for the list of reasons; the most common are memory violations, illegal instructions, bus errors, and user-generated quit signals. The core image is called ``core'' and is written in the process's working directory (provided it can be; normal access controls apply). .s3 The first 512 bytes of the core image are a copy of the system's per-user data for the process, including the registers as they were at the time of the fault. The remainder represents the actual contents of the user's core area when the core image was written. At the moment, if the text segment is write-protected and shared, it is not dumped; otherwise the entire address space is dumped. .s3 The actual format of the information in the first 512 bytes is complicated. A guru will have to be consulted if enlightenment is required. In general the debugger .it "db (I)" should be used to deal with core images. .sh "SEE ALSO" db(I), signal(II) at the time of the fault. The remainder represents the actual contents of the user's core area when the core image was written. At the moment, if the text segment is write-protected and shared, it is not dumped; otherwise the entire address space is dumped. .s3 The actual format of the information in the first 512 bytes is complicated. A guru will have to be consulted if enlightenment is required. In general the debugger .it "db.th DIRECTORY V 9/10/73 .sh NAME dir \*- format of directories .sh DESCRIPTION A directory behaves exactly like an ordinary file, save that no user may write into a directory. The fact that a file is a directory is indicated by a bit in the flag word of its i-node entry. Directory entries are 16 bytes long. The first word is the i-number of the file represented by the entry, if non-zero; if zero, the entry is empty. .s3 Bytes 2-15 represent the (14-character) file name, null padded on the right. These bytes are not cleared for empty slots. .s3 By convention, the first two entries in each directory are for ``\fB.\fR'' and ``\fB..\fR''. The first is an entry for the directory itself. The second is for the parent directory. The meaning of ``\fB..\fR'' is modified for the root directory of the master file system and for the root directories of removable file systems. In the first case, there is no parent, and in the second, the system does not permit off-device references. Therefore in both cases ``\fB..\fR'' has the same meaning as ``\fB.\fR''. .sh "SEE ALSO" file system (V) entries in each directory are for ``\fB.\fR'' and ``\fB..\fR''. The first is an entry for the directory itself. The second is for the parent directory. The meaning of ``\fB..\fR'' is modified for the root directory of the master file system and for the root directories of removable file systems. In the first case, there is no parent, and in the second, the system does not permit off-device references. Therefore in both cases ``\fB..\fR'' h.th "FILE SYSTEM" V 9/7/73 .sh NAME fs \*- format of file system volume .sh DESCRIPTION .ft I Caution: this information applies only to the latest versions of the UNIX system. .s3 .ft R Every file system storage volume (e.g. RF disk, RK disk, RP disk, DECtape reel) has a common format for certain vital information. Every such volume is divided into a certain number of 256 word (512 byte) blocks. Block 0 is unused and is available to contain a bootstrap program, pack label, or other information. .s3 Block 1 is the .it "super block." Starting from its first word, the format of a super-block is .s3 .nf struct { int isize; int fsize; int nfree; int free[100]; int ninode; int inode[100]; char flock; char ilock; char fmod; int time[2]; }; .s3 .fi .it Isize is the number of blocks devoted to the i-list, which starts just after the super-block, in block 2. .it Fsize is the first block not potentially available for allocation to a file. This number is unused by the system, but is used by programs like .it "check (I)" to test for bad block numbers. The free list for each volume is maintained as follows. The .it free array contains, in .it "free[1], ... , free[nfree\*-1]," up to 99 numbers of free blocks. .it Free[0] is the block number of the head of a chain of blocks constituting the free list. The first word in each free-chain block is the number (up to 100) of free-block numbers listed in the next 100 words of this chain member. The first of these 100 blocks is the link to the next member of the chain. To allocate a block: decrement .it nfree, and the new block is .it free[nfree]. If the new block number is 0, there are no blocks left, so give an error. If .it nfree became 0, read in the block named by the new block number, replace .it nfree by its first word, and copy the block numbers in the next 100 words into the .it free array. To free a block, check if .it nfree is 100; if so, copy .it nfree and the .it free array into it, write it out, and set .it nfree to 0. In any event set .it free[nfree] to the freed block's number and increment .it nfree. .s3 .it Ninode is the number of free i-numbers in the .it inode array. To allocate an i-node: if .it ninode is greater than 0, decrement it and return .it inode[ninode]. If it was 0, read the i-list and place the numbers of all free inodes (up to 100) into the .it inode array, then try again. To free an i-node, provided .it ninode is less than 100, place its number into .it inode[ninode] and increment .it ninode. If .it ninode is already 100, don't bother to enter the freed i-node into any table. This list of i-nodes is only to speed up the allocation process; the information as to whether the inode is really free or not is maintained in the inode itself. .s3 .it Flock and .it ilock are flags maintained in the core copy of the file system while it is mounted and their values on disk are immaterial. The value of .it fmod on disk is likewise immaterial; it is used as a flag to indicate that the super-block has changed and should be copied to the disk during the next periodic update of file system information. .s3 .it Time is the last time the super-block of the file system was changed, and is a double-precision representation of the number of seconds that have elapsed since 0000 Jan. 1 1970 (GMT). During a reboot, the .it time of the super-block for the root file system is used to set the system's idea of the time. .s3 I-numbers begin at 1, and the storage for i-nodes begins in block 2. .tr | Also, i-nodes are 32 bytes long, so 16 of them fit into a block. Therefore, i-node .it i is located in block (\fIi\fR|+|31)|/|16, and begins 32\u\fB.\fR\d((\fIi\fR|+|31)|(mod 16) bytes from its start. I-node 1 is reserved for the root directory of the file system, but no other i-number has a built-in meaning. Each i-node represents one file. The format of an i-node is as follows. .s3 .nf .if t .ta .5i 1.i 2.5i struct { int flags; /* +0: see below */ char nlinks; /* +2: number of links to file */ char uid; /* +3: user ID of owner */ char gid; /* +4: group ID of owner */ char size0; /* +5: high byte of 24-bit size */ int size1; /* +6: low word of 24-bit size */ int addr[8]; /* +8: block numbers or device number */ int actime[2]; /* +24: time of last access */ int modtime[2]; /* +28: time of last modification */ }; .dt .fi .s3 The flags are as follows: .s3 .lp +10 9 100000 i-node is allocated .lp +10 9 060000 2-bit file type: .lp +15 9 000000 plain file .lp +15 9 040000 directory .lp +15 9 020000 character-type special file .lp +15 9 060000 block-type special file. .lp +10 9 010000 large file .lp +10 9 004000 set user-ID on execution .lp +10 9 002000 set group-ID on execution .lp +10 9 000400 read (owner) .lp +10 9 000200 write (owner) .lp +10 9 000100 execute (owner) .lp +10 9 000070 read, write, execute (group) .lp +10 9 000007 read, write, execute (others) .s3 .i0 Special files are recognized by their flags and not by i-number. A block-type special file is basically one which can potentially be mounted as a file system; a character-type special file cannot, though it is not necessarily character-oriented. For special files the high byte of the first address word specifies the type of device; the low byte specifies one of several devices of that type. The device type numbers of block and character special files overlap. .s3 The address words of ordinary files and directories contain the numbers of the blocks in the file (if it is small) or the numbers of indirect blocks (if the file is large). .s3 Byte number .it n of a file is accessed as follows. .it N is divided by 512 to find its logical block number (say .it b ) in the file. If the file is small (flag 010000 is 0), then .it b must be less than 8, and the physical block number is .it addr[b]. .s3 If the file is large, .it b is divided by 256 to yield .it i, and .it addr[i] is the physical block number of the indirect block. The remainder from the division yields the word in the indirect block which contains the number of the block for the sought-for byte. .s3 For block .it b in a file to exist, it is not necessary that all blocks less than .it b exist. A zero block number either in the address words of the i-node or in an indirect block indicates that the corresponding block has never been allocated. Such a missing block reads as if it contained all zero words. .sh "SEE ALSO" check (VIII) block number of the indirect block. The remainder from the division yields the word in the indirect block which contains the number of the block for the sought-for byte. .s3 For block .it b in a file to exist, it is not necessary that all blocks .th PASSWD V 9/10/73 .sh NAME passwd \*- password file .sh DESCRIPTION .it Passwd contains for each user the following information: .s3 .lp +10 5 name (login name, contains no upper case) .lp +10 5 encrypted password .lp +10 5 numerical user ID .lp +10 5 GCOS job number and box number .lp +10 5 initial working directory .lp +10 5 program to use as Shell .s3 .i0 This is an ASCII file. Each field within each user's entry is separated from the next by a colon. The job and box numbers are separated by a comma. Each user is separated from the next by a new-line. If the password field is null, no password is demanded; if the Shell field is null, the Shell itself is used. .s3 This file resides in directory /etc. Because of the encrypted passwords, it can and does have general read permission and can be used, for example, to map numerical user ID's to names. .sh "SEE ALSO" login(I), crypt(III), passwd(I) within each user's entry is separated from the next by a colon. The job and box numbers are separated by a comma..th UTMP V 9/10/73 .sh NAME utmp \*- user information .sh DESCRIPTION This file allows one to discover information about who is currently using UNIX. The file is binary; each entry is 16(10) bytes long. The first eight bytes contain a user's login name or are null if the table slot is unused. The low order byte of the next word contains the last character of a typewriter name. The next two words contain the user's login time. The last word is unused. .s3 This file resides in directory /tmp. .sh "SEE ALSO" /etc/init, which maintains the file; who(I), which interprets it. TION This file allows one to discover information about who is currently using UNIX. The file is binary; each entry is 16(10) bytes long. The first eight bytes contain a user's login name or are null if the table slot is unused. The low order byte of the next word contains the last character of a typewriter name. The next two words contain the user's login time. The last word is unused. .s3 This file resides in directory /tmp. .sh "SEE ALSO" /.th WTMP V 9/10/73 .sh NAME wtmp \*- user login history .sh DESCRIPTION This file records all logins and logouts. Its format is exactly like utmp(V) except that a null user name indicates a logout on the associated typewriter, and the typewriter name `x' indicates that UNIX was rebooted at that point. .s3 Wtmp is maintained by login(I) and init(VII). Neither of these programs creates the file, so if it is removed record-keeping is turned off. .s3 This file resides in directory /tmp. .sh "SEE ALSO" init(VII), login(I) 9/10/73 .sh NAME wtmp \*- user login history .sh DESCRIPTION This file records all logins and logouts. Its format is exactly like utmp(V) except that a null user name indicates a logout on the associated typewriter, and the typewriter name `x' indicates that UNIX was rebooted at that point. .s3 Wtmp is maintained by login(I) and init(VII). Neither of these programs creates the file, so if it is removed record-keeping is turned off. .s3 This file resides in directory /tmp. .sh "SEE ALSO" init(VII).th SFS VI 6/25/73 .sh NAME sfs \*- structured file scanner .sh SYNOPSIS .bd sfs filename [ \*- ] .sh DESCRIPTION .it Sfs provides an interactive program for scanning and pactching a structured file. If the second argument is supplied, the file is block addressed. .s3 Some features of .it sfs include. .br .lp +5 3 1. It provides interactive and preprogramed operation. .br .lp +5 3 2. It provides expression evaluation (32 bit precision) and branching. .br .lp +5 3 3. It provides the ability to assimulate a large set of heirarchical structure definitions. .br .lp +5 3 4. It provides the ability to locate, to dump, and to patch specific instances of structure in the file. Furthermore, in the dump and patch operations the external form of the structure is selected by the user. .br .lp +5 3 5. It provides the ability to escape to the UNIX command level to allow the use of other UNIX debugging aids. .i0 .sh "SEE ALSO" ``SFS reference manual'' (internal memorandum) .sh BUGS It provides the ability to assimulate a l.th WUMP VI 11/25/73 .sh NAME wump \*- hunt the wumpus .sh SYNOPSIS .bd /usr/games/wump .sh DESCRIPTION .it Wump plays the game of ``Hunt the Wumpus.'' A Wumpus is a creature that lives in a cave with several rooms connected by tunnels. You wander among the rooms, trying to shoot the Wumpus with an arrow, meanwhile avoiding being eaten by the Wumpus and falling into Bottomless Pits. There are also Super Bats which are likely to pick you up and drop you in some random room. .s3 The program asks various questions which you answer one per line; it will give a more detailed description if you want. .s3 This program is based on one described in .it "People's Computer Company," .it 2, 2 (November 1973). .sh BUGS It will never replace Space War. You wander among the rooms, trying to shoot the Wumpus with an arrow, meanwhile avoiding being eaten by the Wumpus and falling into Bottomless Pits. There are also Super Bats which are likely to pick you up and drop you in some random room. .s3 The program asks various quest.th HYPHEN VI 1/15/73 .sh NAME hyphen \*- find hyphenated words .sh SYNOPSIS .bd hyphen file ... .sh DESCRIPTION It finds all of the words in a document which are hyphenated across lines and prints them back at you in a convenient format. .s3 If no arguments are given, the standard input is used. Thus .it hyphen may be used as a filter. .sh BUGS Yes, it gets confused, but with no ill effects other than spurious extra output. to pick you up and drop you in some random room. .s3 The program asks various quest.th FACTOR VI 1/15/73 .sh NAME factor \*- discover prime factors of a number .sh SYNOPSIS .bd factor .sh DESCRIPTION When .it factor is invoked, it types out `Enter:' at you. If you type in a positive number less than 2\u\s756\s0\d (about .if n 7.2e16) .if t 7.2\(mu10\u\s716\s0\d\|) it will repeat the number back at you and then its prime factors each one printed the proper number of times. Then it says `Enter:' again. To exit, feed it an EOT or a delete. .s3 Maximum time to factor is proportional to .if n sqrt(n) .if t \(sr\o'\fIn\fR\(rn' and occurs when .it n is prime. It takes 1 minute to factor a prime near 10\u\s713\s0\d. .sh DIAGNOSTICS `Ouch.' for input out of range or for garbage input. .sh BUGS umber less than 2\u\s756\s0\d (about .if n 7.2e16) .if t 7.2\(mu10\u\s716\s0\d\|) it will repeat the number back at you and then its prime factors each one printed the proper number of times. Then it says `Enter:' again. To exit, feed it an EOT or a delete. .s3 Maximum time to factor is proportional to .if .th OV VI 6/12/72 .sh NAME ov \*- overlay pages .sh SYNOPSIS .bd ov [ file ] .sh DESCRIPTION .it Ov is a postprocessor for producing double column formatted text when using nroff(I). .it Ov literally overlays successive pairs of 66-line pages. .s3 If the file argument is missing, the standard input is used. Thus .it ov may be used as a filter. .sh "SEE ALSO" nroff(I), pr(I) .sh BUGS f times. Then it says `Enter:' again. To exit, feed it an EOT or a delete. .s3 Maximum time to factor is proportional to .if .th TTT VI 11/1/73 .sh NAME ttt \*- tic-tac-toe .sh SYNOPSIS .bd /usr/games/ttt .sh DESCRIPTION .it Ttt is the X and O game popular in the first grade. This is a learning program that never makes the same mistake twice. .s3 Although it learns, it learns slowly. It must lose nearly 80 games to completely know the game. .sh FILES ttt.k learning file .sh BUGS " nroff(I), pr(I) .sh BUGS f times. Then it says `Enter:' again. To exit, feed it an EOT or a delete. .s3 Maximum time to factor is proportional to .if .th MOO VI 11/1/73 .sh NAME moo \*- guessing game .sh SYNOPSIS .bd /usr/games/moo .sh DESCRIPTION .it Moo is a guessing game imported from England. The computer picks a number consisting of four distinct decimal digits. The player guesses four distinct digits being scored on each guess. A `cow' is a correct digit in an incorrect position. A `bull' is a correct digit in a correct position. The game continues until the player guesses the number (a score of four bulls). .sh BUGS Watch out for the random number generator. 1/1/73 .sh NAME moo \*- guessing game .sh SYNOPSIS .bd /usr/games/moo .sh DESCRIPTION .it Moo is a guessing game imported from England. The computer picks a number consisting of four distinct decimal digits. The player guesses four distinct digits being scored on each guess. A `cow' is a correct digit in an incorrect position. A `bull' is a correct digit in a correct position. The game continues until the player guesses the number (a score of four bulls). .sh BUGS Watch out for the random number.th MAZE VI 11/1/73 .sh NAME maze \*- generate a maze problem .sh SYNOPSIS .bd maze .sh DESCRIPTION .it Maze will ask a few questions and then print out a maze. .sh BUGS Some mazes (especially small ones) have no solutions. player guesses four distinct digits being scored on each guess. A `cow' is a correct digit in an incorrect position. A `bull' is a correct digit in a correct position. The game continues until the player guesses the number (a score of four bulls). .sh BUGS Watch out for the random number.th CUBIC VI 11/1/73 .sh NAME cubic \*- three dimensional tic-tac-toe .sh SYNOPSIS .bd /usr/games/cubic .sh DESCRIPTION .it Cubic plays the game of three dimensional 4\*X4\*X4 tic-tac-toe. Moves are given by the three digits (each 1-4) specifying the coordinate of the square to be played. .sh WARNING Too much playing of the game will cause it to disappear. .sh BUGS in a correct position. The game continues until the player guesses the number (a score of four bulls). .sh BUGS Watch out for the random number.th CHESS VI 11/1/73 .sh NAME chess \*- the game of chess .sh SYNOPSIS .bd /usr/games/chess .sh DESCRIPTION .it Chess is a computer program that plays class D chess. Moves may be given either in standard (descriptive) notation or in algebraic notation. The symbol `+' is used to specify check and is not required; `o-o' and `o-o-o' specify castling. To play black, type `first'; to print the board, type an empty line. .s3 Each move is echoed in the appropriate notation followed by the program's reply and the elapsed time in seconds. .sh FILES /usr/lib/book opening `book' .sh DIAGNOSTICS The most cryptic diagnostic is `eh?' which means that the input was syntactically incorrect. .sh WARNING Over-use of this program has been known to cause it to go away. .sh AUTHOR K. Thompson .sh BUGS Pawns may be promoted only to queens. and `o-o-o' specify castling. To play black, type `first'; to print the board, type an empty line. .s3 Each move is echoed in the appropriate notation followed by the program's reply and the e.th CAL VI 11/1/73 .sh NAME cal \*- print calendar .sh SYNOPSIS .bd cal [ month ] year .sh DESCRIPTION .it Cal will print a calendar for the specified year. If a month is also specified, a calendar just for that month is printed. .it Year can be between 1 and 9999. The .it month is a number between 1 and 12. The calendar produced is that for England and her colonies. .s3 Try September 1752. .sh BUGS The year is always considered to start in January even though this is historically naive. m's reply and the e.th M6 VI 11/15/72 .sh NAME m6 \*- general purpose macro processor .sh SYNOPSIS .bd m6 [ .bd \*-d arg1 ] [ arg2 [ arg3 ] ] .sh DESCRIPTION .it M6 takes input from file arg2 (or standard input if arg2 is missing) and places output on file arg3 (or standard output). A working file of definitions, ``m.def'', is initialized from file arg1 if that is supplied. .it M6 differs from the standard [1] in these respects: .s3 #trace:, #source: and #end: are not defined. .s3 #meta,arg1,arg2: transfers the role of metacharacter arg1 to character arg2. If two metacharacters become identical thereby, the outcome of further processing is not guaranteed. For example, to make [ ]{} play the roles of #:<> type .s3 .in+5 \\\#meta,<\\\#>,[: .br [meta,<:>,]: .br [meta,[substr,<<>>,1,1;,{] .br [meta,[substr,{{>>,2,1;,}] .in-5 .s3 #del,arg1: deletes the definition of macro arg1. .s3 #save: and #rest: save and restore the definition table together with the current metacharacters on file m.def. .s3 #def,arg1,arg2,arg3: works as in the standard with the extension that an integer may be supplied to arg3 to cause the new macro to perform the action of a specified builtin before its replacement text is evaluated. Thus all builtins except #def: can be retrieved even after deletion. Codes for arg3 are: .s3 .in+5 .nf 0 \*- no function 1,2,3,4,5,6 \*- gt,eq,ge,lt,ne,le 7,8 \*- seq,sne 9,10,11,12,13 \*- add,sub,mpy,div,exp 20 \*- if 21,22 \*- def,copy 23 \*- meta 24 \*- size 25 \*- substr 26,27 \*- go,gobk 28 \*- del 29 \*- dnl 30,31 \*- save,rest .fi .in-5 .sh FILES m.def working file of definitions .br /usr/lang/mdir/m6a m6 processor proper (/usr/bin/m6 is only an initializer) .br /usr/lang/mdir/m6b default initialization for m.def .br /bin/cp used for copying initial value of m.def .sh "SEE ALSO" [1] A. D. Hall, The M6 Macroprocessor, Bell Telephone Laboratories, 1969 .sh DIAGNOSTICS ``err'' \*- a bug, an unknown builtin or a bad definition table .br ``oprd''\*-can't open input or initial definitions .br ``opwr''\*-can't open output .br ``ova'' \*- overflow of nested arguments .br ``ovc'' \*- overflow of calls .br ``ovd'' \*- overflow of definitions .br ``Try again'' \*- no process available for copying m.def .sh AUTHOR M. D. McIlroy .sh BUGS Characters in internal tables are stored one per word. They really should be packed to improve capacity. For want of space (and because of unpacked formats) no file arguments have been provided to #save: or #rest:, and no check is made on the actual opening of file m.def. Again to save space, garbage collection makes calls on #save: and #rest: and so overwrites m.def. .s3 Since the program is written in the defunct language B it is currently unavailable. Expressions of interest may make a C version appear. Characters in internal tables are stored one per word. They really should be packed to improve capacity. For want of space (and because of unpacked formats) no file arguments have been provided to #save: or #rest:, and no check is made on the actual opening of file m.def. Again to save space, garbage collect.th TMG VI 10/21/72 .sh NAME tmg \*- compiler-compiler .sh SYNOPSIS .bd tmg name .sh DESCRIPTION .it Tmg produces a translator for the language whose parsing and translation rules are described in file name.t. The new translator appears in a.out and may be used thus: .s3 .bd a.out input [ output ] .s3 Except in rare cases input must be a randomly addressable file. If no output file is specified, the standard output file is assumed. .sh FILES /sys/tmg/tmgl.o the compiler-compiler .br /sys/tmg[abc] libraries .br alloc.d table storage .sh "SEE ALSO" A Manual for the Tmg Compiler-writing Language, internal memorandum. .sh DIAGNOSTICS Syntactic errors result in "???" followed by the offending line. .br Situations such as space overflow with which the Tmg processor or a Tmg-produced processor can not cope result in a descriptive comment and a dump. .sh AUTHOR M. D. McIlroy .sh BUGS 9.2 footnote 1 is not enforced, causing trouble. .br Restrictions (7.) against mixing bundling primitives should be lifted. .br Certain hidden reserved words exist: gpar, classtab, trans. .br Octal digits include 8=10 and 9=11. nal memorandum. .sh DIAGNOSTICS Syntactic errors result in "???" followed by the offending line. .br Situations such as space overflow with which the Tmg processor or a Tmg-produced processor can not cope result in a descriptive comment and a dump. .sh AUTHOR M. D. McIlroy .sh BUGS 9.2 footnote 1 is not enforced, causing trouble. .br Restrictions (7.) against mixing bundling primitives should be lifted. .br Certa.th AZEL VI 9/22/73 .sh NAME azel \*- obtain satellite predictions .sh SYNOPSIS .bd azel satellite ... .sh DESCRIPTION .it Azel predicts, in convenient form, the apparent trajectories of Earth satellites whose orbital elements are given in the argument files. If a given satellite name cannot be read, an attempt is made to find it in a directory of satellites maintained by the programs's author. .s3 For each satellite given the program types its full name, the date, and a sequence of lines each containing a time, an azimuth, an elevation, a distance, and a visual magnitude. Each such line indicates that: at the indicated time, the satellite may be seen from Murray Hill at the indicated azimuth and elevation, and that its distance and apparent magnitude are as given. Predictions are printed only when the sky is dark (sun more than 5 degrees below the horizon) and when the satellite is not eclipsed by the earth's shadow. Satellites which have not been seen and verified will not have had their visual magnitude level set correctly. .s3 All times input and output by .it azel are GMT (Universal Time). .s3 The satellites for which elements are maintained are: .s3 .lp +10 10 sla,|...|sll Skylab A through Skylab L. Skylabs A and B are the laboratory and its rocket respectively; the remainder are various other objects attendant upon its launch and subsequent activities. A, B, and probably K have been sighted and verified. .s3 .lp +10 10 cop Copernicus I. Never verified. .s3 .lp +10 10 oao Orbiting Astronomical Observatory. Seen and verified. .s3 .lp +10 10 pag Pageos I. Seen and verified; fairly dim (typically 2nd-3rd magnitude), but elements are extremely accurate. .s3 .lp +10 10 exp19 Explorer 19; seen and verified, but quite dim (4th-5th magnitude) and fast-moving. .s3 .lp +10 10 c103b, c156b, c184b, c206b, c220b, c461b, c500b .br Various of the USSR Cosmos series; none seen. .s3 .lp +10 10 7276a Unnamed (satellite # 72-76A); not seen. .s3 .i0 The element files used by .it azel contain five lines. The first line gives a year, month number, day, hour, and minute at which the program begins its consideration of the satellite, followed by a number of minutes and an interval in minutes. If the year, month, and day are 0, they are taken to be the current date (taken to change at 6 A.M. local time). The output report starts at the indicated epoch and prints the position of the satellite for the indicated number of minutes at times separated by the indicated interval. This line is ended by two numbers which specify options to the program governing the completeness of the report; they are ordinarily both ``1''. The first option flag suppresses output when the sky is not dark; the second supresses output when the satellite is eclipsed by the earth's shadow. The next line of an element file is the full name of the satellite. The next three are the elements themselves (including certain derivatives of the elements). The author should be consulted for more information. .sh FILES /usr/jfo/el/* \*- orbital element files .sh "SEE ALSO" sky (VI) .sh AUTHOR J. F. Ossanna .sh BUGS he report; they are ordinarily both ``1''. The first option flag suppresses output when the sky is not dark; the second supresses output when the satellite is eclipsed by the earth's shadow. The next line of an element file is the full name of the satellite. The next three are the elements themselves (including certain derivatives of the elements). The author should be consulted for more information. .sh FILES /usr/jfo/el/* \*- orbital element files .sh "SEE ALSO" sky.th SKY VI 9/22/73 .sh NAME sky \*- obtain ephemerides .sh SYNOPSIS .bd sky .sh DESCRIPTION .it Sky predicts the apparent locations of the Sun, the Moon, the planets out to Saturn, stars of magnitude at least 2.5, and certain other celestial objects including comet Kohoutek and M31. .it Sky reads the standard input to obtain a GMT time typed on one line with blanks separating year, month number, day, hour, and minute; if the year is missing the current year is used. If a blank line is typed the current time is used. The program prints the azimuth, elevation, and magnitude of objects which are above the horizon at the ephemeris location of Murray Hill at the indicated time. .s3 Placing a ``1'' input after the minute entry causes the program to print out the Greenwich Sidereal Time at the indicated moment and to print for each body its right ascension and declination as well as its azimuth and elevation. Also, instead of the magnitude, the geocentric distance of the body, in units the program considers convenient, is printed. (For planets the unit is essentially A. U.) .s3 The magnitudes of Solar System bodies are not calculated and are given as 0. The effects of atmospheric extinction are not included; the mean magnitudes of variable stars are marked with ``*''. .s3 For all bodies, the program takes into account precession and nutation of the equinox, annual (but not diurnal) aberration, diurnal parallax, and the proper motion of stars (but not annual parallax). In no case is refraction included. .s3 The program takes into account perturbations of the Earth due to the Moon, Venus, Mars, and Jupiter. The expected accuracies are: for the Sun and other stellar bodies a few tenths of seconds of arc; for the Moon (on which particular care is lavished) likewise a few tenths of seconds. For the Sun, Moon and stars the accuracy is sufficient to predict the circumstances of eclipses and occultations to within a few seconds of time. The planets may be off by several minutes of arc. .s3 Information about the program may be obtained from its author. .sh FILES /usr/lib/startab, /usr/lib/moontab .sh "SEE ALSO" azel (VI) .br .ft I American Ephemeris and Nautical Almanac, .ft R for the appropriate years; also, the .ft I Explanatory Supplement to the American Ephemeris and Nautical Almanac. .ft R .sh AUTHOR R. Morris nd stars the accuracy is sufficient to predict the circumstances of eclipses and occultations to within a few seconds of time. The planets may be off by several minutes of arc. .s3 Information about the program may be o.th YACC VI 6/6/73 .sh NAME yacc \*- yet another compiler-compiler .sh SYNOPSIS .bd yacc [ grammar ] .sh DESCRIPTION .it Yacc converts a context-free grammar into a set of tables for a simple automaton which executes an LR(1) parsing algorithm. .s3 For complete information, see the author. .sh "SEE ALSO" "LR Parsing", by A. V. Aho and S. C. Johnson. .sh AUTHOR S. C. Johnson .sh BUGS to within a few seconds of time. The planets may be off by several minutes of arc. .s3 Information about the program may be o.th SPLINE VI 10/20/73 .sh NAME spline \*- interpolate smooth curve .sh SYNOPSIS .bd spline [ option ] ... .sh DESCRIPTION .it Spline takes pairs of numbers from the standard input as abcissas and ordinates of a function. It produces a similar set, which is approximately equally spaced and includes the input set, on the standard output. The cubic spline output (R. W. Hamming, .ft I Numerical Methods for Engineers and Scientists, .ft R 2nd ed., 349ff) has two continuous derivatives, and sufficiently many points to look smooth when plotted, for example by .it plot (I). .s3 The following options are recognized, each as a separate argument. .s3 .lp +5 5 \fBa\fR Supply abscissas automatically (they are missing from the input); spacing is given by the next argument, or is assumed to be 1 if next argument is not a number. .s3 .lp +5 5 \fBn\fR Output approximately .it n points, where .it n is given by the next argument. (Default .it n = 100.) .s3 .lp +5 5 \fBp\fR Make output periodic, i.e. match derivatives at ends. First and last input values should normally agree. .s3 .lp +5 5 \fBx\fR Next 1 (or 2) arguments are lower (and upper) \fIx\fR limits. .i0 .sh "SEE ALSO" plot(I) .sh AUTHOR M. D. McIlroy .sh BUGS A limit of 1000 input points is enforced silently. t argument, or is assumed to be 1 if next argument is not a number. .s3 .lp +5 5 \fBn\fR Output approximately .it n points, where .it n is given by the next argument. (Default .it n = 100.) .s3 .lp +5 5 \fBp\fR Make output periodic, i.e. match derivatives at ends..th PTX VI 10/15/73 .sh NAME ptx \*- permuted index .sh SYNOPSIS .bd ptx [ .bd \*-t ] input [ output ] .sh DESCRIPTION .it Ptx generates a permuted index from file .it input on file .it output. It has three phases: the first does the permutation, generating one line for each keyword in an input line. The keyword is rotated to the front. The permuted file is then sorted. Finally the sorted lines are rotated so the keyword comes at the middle of the page. .s3 .it Input should be edited to remove useless lines. The following words are suppressed: `a', `an', `and', `as', `is', `for', `of', `on', `or', `the', `to', `up'. .s3 The optional argument .bd \*-t causes .it ptx to prepare its output for the phototypesetter. .s3 The index for this manual was generated using .it ptx. .sh FILES /bin/sort input line. The keyword is rotated to the front. The permuted file is then sorted. Finally the sorted lines are rotated so the keyword comes at the middle of the page. .s3 .it Input should be edited to remove useless lin.th BJ VI 3/15/72 .sh NAME bj \*- the game of black jack .sh SYNOPSIS .bd /usr/games/bj .sh DESCRIPTION .it Bj is a serious attempt at simulating the dealer in the game of black jack (or twenty-one) as might be found in Reno. The following rules apply: .s3 .lp +5 5 The bet is $2 every hand. .s3 A player `natural' (black jack) pays $3. A dealer natural loses $2. Both dealer and player naturals is a `push' (no money exchange). .s3 If the dealer has an ace up, the player is allowed to make an `insurance' bet against the chance of a dealer natural. If this bet is not taken, play resumes as normal. If the bet is taken, it is a side bet where the player wins $2 if the dealer has a natural and loses $1 if the dealer does not. .s3 If the player is dealt two cards of the same value, he is allowed to `double'. He is allowed to play two hands, each with one of these cards. (The bet is doubled also; $2 on each hand.) .s3 If a dealt hand has a total of ten or eleven, the player may `double down'. He may double the bet ($2 to $4) and receive exactly one more card on that hand. .s3 Under normal play, the player may `hit' (draw a card) as long as his total is not over twenty-one. If the player `busts' (goes over twenty-one), the dealer wins the bet. .s3 When the player `stands' (decides not to hit), the dealer hits until he attains a total of seventeen or more. If the dealer busts, the player wins the bet. .s3 If both player and dealer stand, the one with the largest total wins. A tie is a push. .s3 .i0 The machine deals and keeps score. The following questions will be asked at appropriate times. Each question is answered by .bd y followed by a new line for `yes', or just new line for `no'. .s3 ? (means, ``do you want a hit?'') .br Insurance? .br Double down? .s3 Every time the deck is shuffled, the dealer so states and the `action' (total bet) and `standing' (total won or lost) is printed. To exit, hit the interrupt key (DEL) and the action and standing will be printed. .sh BUGS Be careful of the random number generator. and k.th TMHEADER VII 10/20/73 .sh NAME tmheader \*- TM cover sheet .sh SYNOPSIS .bd "ed /usr/pub/tmheader" .sh DESCRIPTION .it /usr/pub/tmheader contains a prototype for making a .it troff(I) formatted cover sheet for a technical memorandum. Parameters to be filled in by the user are marked by self-explanatory names beginning with ``---''. .sh BUGS God help you on two-page abstracts. Try to write less. y (DEL) and the action and standing will be printed. .sh BUGS Be careful of the random number generator. and k.th VS VII 9/4/73 .sh NAME vs \*- voice synthesizer code .sh DESCRIPTION The octal codes below are understood by the Votrax\*r voice synthesizer. Inflection and phonemes are or-ed together. The mnemonics in the first column are used by .it speak (I); the upper case mnemonics are used by the manufacturer. .sp .if t .ta 0.3i 0.6i 3.0i 3.3i 3.6i .if n .ta 5 10 31 35 40 .if n .ds 2 __ .if t .ds 2 \\fR .if n .ds 1 _ .if t .ds 1 \\fR .nf 0 300 4\*-strong inflection u0 014 UH\*-b\fBu\*1t 1 200 3 u1 015 UH1\*-\fBu\*1ncle 2 100 2 u2 016 UH2\*-stirr\fBu\*1p 3 000 1\*-weak inflection u3 034 UH3\*-app\*_le ab\*_le yu 027 U\*-\fBu\*1se a0 033 AH\*-c\fBo\*1ntact iu 010 U1\*-\fBu\*1nite(,y1,iu,...) a1 052 AH1\*-c\fBo\*1nnect ju 011 IU\*-n\fBew\*2 aw 002 AW\*-l\fBaw\*2(,l,u2,aw) b 061 B au 054 AW1\*-f\fBau\*2lt d 041 D ae 021 AE\*-c\fBa\*1t f 042 F ea 020 AE1\*-\fBa\*1ntenna g 043 G ai 037 A\*-n\fBa\*1me(,n,ai,y0,m) h 044 H aj 071 A1\*-n\fBa\*1mely k 046 K e0 004 EH\*-m\fBe\*1t \fBe\*1nter l 047 L e1 076 EH1\*-s\fBe\*1ven m 063 M e2 077 EH2\*-sev\fBe\*1n n 062 N er 005 ER\*-weath\fBer\*2 p 032 P eu 073 OOH\*-G\fBoe\*2the chev\fBeu\*2x q 075 Q eh 067 EHH\*-l\fBe\*1 ch\fBe\*1veux r 024 R y0 023 EE\*-thr\fBee\*2 s 040 S y1 026 Y\*-sixt\fBy\*1 t 025 T y2 035 Y1\*-\fBy\*1es v 060 V ay 036 AY\*-ma\fBy\*1 w 022 W i0 030 I\*-s\fBi\*1x z 055 Z i1 064 I1\*-\fBi\*1nept \fBi\*1nside sh 056 SH\*-\fBsh\*2ow \fBsh\*2ip i2 065 I2\*-stat\fBi\*1c zh 070 ZH\*-plea\fBs\*1ure iy 066 IY\*-cr\fBy\*1(,k,r,a0,iy) j 045 J\*-edge\fB\*1 ie 003 IE\*-z\fBe\*1ro ch 057 CH\*-bat\fBch\*2 ih 072 IH\*-stat\fBi\*1on th 006 TH\*-\fBth\*2in o0 031 O\*-\fBo\*1nly n\fBo\*1 dh 007 THV\*-\fBth\*2en o1 012 O1\*-hell\fBo\*1 ng 053 NG\*-lo\fBng\*2 i\fBn\*1k o2 013 O2\*-n\fBo\*1tice \*-0 017 PA2\*-long pause ou 051 OO1\*-g\fBoo\*2d sh\fBou\*2ld \*-1 001 PA1 oo 050 OO\*-l\fBoo\*2k \*-2 074 PA0\*-short pause .sp .sh "SEE ALSO" speak(I), vs(IV) Bsh\*2ip i2 065 I2\*-stat\fBi\*1c zh 070 ZH\*-plea\fBs\*1ure iy 066 IY\*-cr\fBy\*1(,k,r,a0,iy) j 045 J\*-edge\fB\*1 ie 003 IE.th GREEK VII 10/31/72 .sh NAME greek \*- graphics for extended ascii type-box .sh SYNOPSIS .bd "cat /usr/pub/greek" .sh DESCRIPTION .it Greek gives the mapping from ascii to the ``shift out'' graphics in effect between SO and SI on model 37 Teletypes with a 128-character type-box. It contains: .s3 .nf .if n .ig .ta 1i .3i .75i 1i .3i .75i 1i .3i alpha \(*a A beta \(*b B gamma \(*g \\ GAMMA \(*G G delta \(*D D DELTA \(*D W epsilon \(*e S zeta \(*z Q eta \(*y N theta \(*t T THETA \(*T O lambda \(*l L LAMBDA \(*L E mu \(*m M nu \(*n @ xi \(*c X pi \(*p J PI \(*P P rho \(*r K sigma \(*s Y SIGMA \(*S R tau \(*t I phi \(*f U PHI \(*F F psi \(*q V PSI \(*Q H omega \(*o C OMEGA \(*W Z nabla \(gr [ not \(no \*_ partial \(pd ] integral \(is ^ .. .if t .ig .nf alpha A A | beta B B | gamma \\ \\ GAMMA G G | delta D D | DELTA W W epsilon S S | zeta Q Q | eta N N theta T T | THETA O O | lambda L L LAMBDA E E | mu M M | nu @ @ xi X X | pi J J | PI P P rho K K | sigma Y Y | SIGMA R R tau I I | phi U U | PHI F F psi V V | PSI H H | omega C C OMEGA Z Z | nabla [ [ | not _ _ partial ] ] | integral ^ ^ .. .sh "SEE ALSO" ascii (VII) nf alpha A A | beta B B | gamma \\ \\ GAMMA G G | delta D D | DELTA W W epsilon S S | zeta Q Q | eta N N theta T T | THETA O O | lambda L L LAMBDA E E | mu M M | nu @ @ xi X X | pi J J | PI.th DPD VII 3/15/72 .sh NAME dpd \*- spawn data phone daemon .sh SYNOPSIS .bd /etc/dpd .sh DESCRIPTION .it Dpd is the 201 data phone daemon. It is designed to submit jobs to the Honeywell 6070 computer via the GRTS interface. .s3 .it Dpd uses the directory .it /usr/dpd. The file .it lock in that directory is used to prevent two daemons from becoming active. After the daemon has successfully set the lock, it forks and the main path exits, thus spawning the daemon. The directory is scanned for files beginning with .bd df. Each such file is submitted as a job. Each line of a job file must begin with a key character to specify what to do with the remainder of the line. .s3 .lp +5 3 \fBS\fR directs .it dpd to generate a unique snumb card. This card is generated by incrementing the first word of the file .it /usr/dpd/snumb and converting that to three-digit octal concatenated with the station ID. .s3 .lp +5 3 \fBL\fR specifies that the remainder of the line is to be sent as a literal. .s3 .lp +5 3 \fBB\fR specifies that the rest of the line is a file name. That file is to be sent as binary cards. .s3 .lp +5 3 \fBF\fR is the same as \fBB\fR except a form feed is prepended to the file. .s3 .lp +5 3 \fBU\fR specifies that the rest of the line is a file name. After the job has been transmitted, the file is unlinked. .s3 .i0 Any error encountered will cause the daemon to drop the call, wait up to 20 minutes and start over. This means that an improperly constructed \fIdf\fR file may cause the same job to be submitted every 20 minutes. .s3 While waiting, the daemon checks to see that the .it lock file still exists. If it is gone, the daemon will exit. .sh FILES /dev/dn0, /dev/dp0, /usr/dpd/* .sh "SEE ALSO" opr(I) specifies that the rest of the line is a file name. After the job has been transmitted, the file is unlinked. .s3 .i0 Any error encountered will cause the daemon to drop the call, wait up to 20 minutes and start over. This means that an improperly constructed \fIdf\fR file may cause the same job to be submitted every.th TABS VII 6/15/72 .sh NAME tabs \*- set tab stops .sh SYNOPSIS .bd "cat /usr/pub/tabs" .sh DESCRIPTION When printed on a suitable terminal, this file will set tab stops every 8 columns. Suitable terminals include the Teletype model 37 and the GE TermiNet 300. .s3 These tab stop settings are desirable because UNIX assumes them in calculating delays. n to drop the call, wait up to 20 minutes and start over. This means that an improperly constructed \fIdf\fR file may cause the same job to be submitted every.th MSH VII 6/15/72 .sh NAME msh \*- mini-shell .sh SYNOPSIS .bd /etc/msh .sh DESCRIPTION .it Msh is a heavily simplified version of the Shell. It reads one line from the standard input file, interprets it as a command, and calls the command. .s3 The mini-shell supports few of the advanced features of the Shell; none of the following characters is special: .s3 > < $ \\ ; & \*v ^ .s3 However, ``*'', ``['', and ``?'' are recognized and \fIglob\fR is called. The main use of \fImsh\fR is to provide a command-executing facility for various interactive sub-systems. .sh "SEE ALSO" sh(I), glob(VII) s a heavily simplified version of the Shell. It reads one line from the standard input file, interprets it as a command, and calls the command. .s3 The mini-shell supports few of the advanced features of the Shell; none of the following characters is special: .s3 > < $ \\ ; & \*v ^ .s3 However, ``*'', ``['', and ``?'' are recognized and \fIglob\fR is called. The main use of \fImsh\fR is to provide.th GLOB VII 9/19/73 .sh NAME glob \*- generate command arguments .sh SYNOPSIS .bd /etc/glob command [ arguments ] .sh DESCRIPTION .it Glob is used to expand arguments to the shell containing ``*'', ``['', or ``?''. It is passed the argument list containing the metacharacters; .it glob expands the list and calls the indicated command. The actions of .it glob are detailed in the Shell writeup. .sh SEE ALSO" sh(I) .sh BUGS .it Glob gives the ``No match'' diagnostic only if no arguments at all result. This is never the case if there is any argument without a metacharacter. .sh SYNOPSIS .bd /etc/glob command [ arguments ] .sh DESCRIPTION .it Glob is used to expand arguments to the shell containing ``*'', ``['', or ``?''. It is passed the argument list containing the metacharacters; .it glob expands the list and calls the indicated command. The actions of .it glob are detailed in the Shell writeup. .sh SEE ALSO" sh(I) .sh BUGS .it Glob gives the ``No match'' diagnostic only if no arguments at all result. This is.th ASCII VII 6/12/72 .sh NAME ascii \*- map of ASCII character set .sh SYNOPSIS .bd "cat /usr/pub/ascii" .sh DESCRIPTION .it Ascii is a map of the ASCII character set, to be printed as needed. It contains: .in 2 .nf .cs R 20 |000 nul|001 soh|002 stx|003 etx|004 eot|005 enq|006 ack|007 bel| |010 bs |011 ht |012 nl |013 vt |014 np |015 cr |016 so |017 si | |020 dle|021 dc1|022 dc2|023 dc3|024 dc4|025 nak|026 syn|027 etb| |030 can|031 em |032 sub|033 esc|034 fs |035 gs |036 rs |037 us | |040 sp |041 ! |042  " |043 # |044 $ |045 % |046 & |047 \*a | |050 ( |051 ) |052 * |053 + |054 , |055 \*- |056 . |057 / | |060 0 |061 1 |062 2 |063 3 |064 4 |065 5 |066 6 |067 7 | |070 8 |071 9 |072 : |073 ; |074 < |075 = |076 > |077 ? | |100 @ |101 A |102 B |103 C |104 D |105 E |106 F |107 G | |110 H |111 I |112 J |113 K |114 L |115 M |116 N |117 O | |120 P |121 Q |122 R |123 S |124 T |125 U |126 V |127 W | |130 X |131 Y |132 Z |133 [ |134 \\ |135 ] |136 ^ |137 \*_ | |140 \*g |141 a |142 b |143 c |144 d |145 e |146 f |147 g | |150 h |151 i |152 j |153 k |154 l |155 m |156 n |157 o | |160 p |161 q |162 r |163 s |164 t |165 u |166 v |167 w | |170 x |171 y |172 z |173 { |174 | |175 } |176 ~ |177 del| .fi .i0 .cs R .sh FILES found in /usr/pub | |110 H |111 I |112 J |113 K |114 L |115 M |116 N |117 O | |120 P |121 Q |122 R |123 S |124 T |125 U |126 V |127 W | |130 X |131 Y |132 Z |133 [ |134 \\ |135 ] |136 ^ |137 \*_ .th INIT VII 6/15/72 .sh NAME init \*- process control initialization .sh SYNOPSIS .bd /etc/init .sh DESCRIPTION .it Init is invoked inside UNIX as the last step in the boot procedure. Generally its role is to create a process for each typewriter on which a user may log in. .s3 First, .it init checks to see if the console switches contain 173030. (This number is likely to vary between systems.) If so, the console typewriter \fItty\fR is opened for reading and writing and the shell is invoked immediately. This feature is used to bring up a single-user system. When the system is brought up in this way, the .it getty and .it login routines mentioned below and described elsewhere are not needed. .s3 Otherwise, \fIinit\fR invokes a Shell, with input taken from the file .it /etc/rc. This command file performs housekeeping like removing temporary files, mounting file systems, and starting the data-phone daemon. .s3 Then .it init forks several times to create a process for each typewriter mentioned in an internal table. Each of these processes opens the appropriate typewriter for reading and writing. These channels thus receive file descriptors 0 and 1, the standard input and output. Opening the typewriter will usually involve a delay, since the \fIopen\fR is not completed until someone is dialled up and carrier established on the channel. Then the process executes the program .it /etc/getty (q.v.). .it Getty will read the user's name and invoke .it login (q.v.) to log in the user and execute the shell. .s3 Ultimately the shell will terminate because of an end-of-file either typed explicitly or generated as a result of hanging up. The main path of \fIinit\fR, which has been waiting for such an event, wakes up and removes the appropriate entry from the file \fIutmp\fR, which records current users, and makes an entry in \fIwtmp\fR, which maintains a history of logins and logouts. Then the appropriate typewriter is reopened and .it getty is reinvoked. .sh FILES /dev/tty, /dev/tty?, /tmp/utmp, /tmp/wtmp, .sh "SEE ALSO" login(I), getty(VII), sh(I) e because of an end-of-file either typed explicitly or generated as a result of hanging up. The main path of \fIinit\fR, which has been waiting for such an event, wakes up and removes the appropriate entry from the file \fIutmp\fR, which records current users, and makes an entry in \fIwtmp\fR, which maintains a history of logins and logouts. Then the appropriate typewriter is reopened and .it getty is reinvoked. .sh FILES /dev/tty, /dev/tty?, /tmp/utmp, /tmp/wtmp, .sh "SEE ALSO" lo.th GETTY VII 9/19/73 .sh NAME getty \*- set typewriter mode .sh SYNOPSIS .bd /etc/getty .sh DESCRIPTION .it Getty is invoked by .it "init (VII)" immediately after a typewriter is opened following a dial-up. The user's login name is read and the login(I) command is called with this name as an argument. While reading this name .it getty attempts to adapt the system to the speed and type of terminal being used. .s3 .it Getty initially sets the speed of the interface to 150 baud, specifies that raw mode is to be used (break on every character), that echo is to be suppressed, and either parity allowed. It types the ``login:'' message (which includes the characters which put the 37 Teletype terminal into full-duplex and unlock its keyboard). Then the user's name is read, a character at a time. If a null character is received, it is assumed to be the result of the user pushing the ``break'' (``interrupt'') key. The speed is then changed to 300 baud and the ``login:'' is typed again, this time with the appropriate sequence which puts a GE TermiNet 300 into full-duplex. This sequence is acceptable to other 300 baud terminals also. If a subsequent null character is received, the speed is changed back to 150 baud. .s3 The user's name is terminated by a new-line or carriage-return character. The latter results in the system being set to to treat carriage returns appropriately (see stty(II)). .s3 The user's name is scanned to see if it contains any lower-case alphabetic characters; if not, and if the name is nonempty, the system is told to map any future upper-case characters into the corresponding lower-case characters. Thus UNIX is usable from upper-case-only terminals. .s3 Finally, login is called with the user's name as argument. .sh "SEE ALSO" init(VII), login(I), stty(II) eturn character. The latter results in the system being set to to treat carriage returns appropriately (see stty(II)). .s3 The user's name is scanned to see if it contains any lower-case alphabetic characters; if not, and if the name is nonempty, the.th RESTOR VIII 11/24/73 .sh NAME restor \*- incremental file system restore .sh SYNOPSIS .bd restor key [ arguments ] .sh DESCRIPTION .it Restor is used to read magtapes dumped with the .it dump command. The .it key argument specifies what is to be done. .it Key is a character from the set .bd trxw. .s3 .lp +5 3 \fBt\fR The date that the tape was made and the date that was specified in the .it dump command are printed. A list of all of the i-numbers on the tape are also given. .s3 .lp +5 3 \fBr\fR The tape is read and loaded into the file system specified in .it arguments. This should not be done lightly (see below). .s3 .lp +5 3 \fBx\fR Each file on the tape is individually extracted into a file whose name is the file's i-number. If there are .it arguments, they are interpreted as i-numbers and only they are extracted. .s3 .lp +5 3 \fBw\fR In conjunction with the .bd x option, before each file is extracted, its i-number is typed out. To extract this file, you must respond with .bd y. .s3 .i0 The .bd r option should only be used to restore a complete dump tape onto a clear file system or to restore an incremental dump tape onto this. Thus .s3 /etc/mkfs /dev/rp0 40600 .br restor r /dev/rp0 .s3 is a typical sequence to restore a complete dump. Another .it restor can be done to get an incremental dump in on top of this. .s3 A .it dump followed by a .it mkfs and a .it restor is used to change the size of a file system. .sh FILES /dev/mt0 .sh "SEE ALSO" dump, mkfs, check, clri (VIII) .sh DIAGNOSTICS There are various diagnostics involved with reading the tape and writing the disk. There are also diagnostics if the i-list or the free list of the file system is not large enough to hold the dump. .sh BUGS There is redundant information on the tape that could be used in case of tape reading problems. Unfortunately, .it restor's approach is to exit if anything is wrong. .s3 Files that have been deleted are not removed when incremental tapes are loaded. It will be necessary to .it check the restored file system and .it clri any files that show up with a 201 delta diagnostic. .s3 The current version of .it restor does not free space occupied by files that are overwritten. Thus a .it check will have to be performed to reclain the missing space. the tape that could be used in case of tape reading problems. Unfortunately, .it restor's approach is to exit if anything is wrong. .s3 Files that have been deleted are not removed when incremental tapes are loaded. It will be necessary to .it check the restored file system and .it c.th DUMP VIII 11/24/73 .sh NAME dump \*- incremental file system dump .sh SYNOPSIS .bd dump [ key [ arguments ] filesystem ] .sh DESCRIPTION .it Dump will make an incremental file system dump on magtape of all files changed after a certain date. The argument .it key, specifies the date and other options about the dump. .it Key consists of characters from the set .bd iu0hds. .s3 .lp +5 3 \fBi\fR the dump date is taken from the file .bd /etc/ddate. .s3 .lp +5 3 \fBu\fR the date just prior to this dump is written on .bd /etc/ddate upon successful completion of this dump. .s3 .lp +5 3 \fB0\fR the dump date is taken as the epoch (beginning of time). Thus this option causes an entire file system dump to be taken. .s3 .lp +5 3 \fBh\fR the dump date is some number of hours before the current date. The number of hours is taken from the next argument in .it arguments. .s3 .lp +5 3 \fBd\fR the dump date is some number of days before the current date. The number of days is taken from the next argument in .it arguments. .s3 .lp +5 3 \fBs\fR the size of the dump tape is specified in feet. The number of feet is taken from the next argument in .it arguments. It is assumed that there are 9 standard UNIX records per foot. When the specified size is reached, the dump will wait for reels to be changed. The default size is 1700 feet. .s3 .i0 If no arguments are given, the .it key is assumed to be .bd i and the file system is assumed to be .bd /dev/rp1. .s3 Full dumps should be taken on quiet file systems as follows: .s3 dump 0u /dev/rp1 .br check -l /dev/rp1 .s3 The .it check will come in handy in case it is necessary to resore indiviidual files from this dump. Incremental dumps should then be taken when desired by: .s3 dump .s3 When the incremental dumps get cumbersome, a new complete dump should be taken. In this way, a restore requires loading of the complete dump tape and only the latest incremental tape. .sh FILES /dev/mt0 magtape .br /dev/rp1 default file system .br /etc/ddate .sh "SEE ALSO" restor, check(VIII), dump(V) .sh BUGS 1 .br check -l /dev/rp1 .s3 The .it check will come in handy in case it is necessary to resore indiviidual files from this dump. Incremental dumps should then be taken when desired by: .s3 dump .s3 When the incremental dumps get cumbersome, a new complete dump should be taken. In this way, a restore requires loading of the complete dump tape and only the latest incremental tape. .sh FILES /dev/mt0 magtape .br /dev/rp1 default file system .br /etc/ddate .sh "SEE ALSO" restor, check(VIII), dump(V) .sh .th INO VIII 11/1/73 .sh NAME ino \*- get the i-number of a file .sh SYNOPSIS .bd ino file ... .sh DESCRIPTION The i-number of each file argument is printed. An i-number of zero is printed if a bad argument is given. .sh BUGS dumps get cumbersome, a new complete dump should be taken. In this way, a restore requires loading of the complete dump tape and only the latest incremental tape. .sh FILES /dev/mt0 magtape .br /dev/rp1 default file system .br /etc/ddate .sh "SEE ALSO" restor, check(VIII), dump(V) .sh .th UPDATE VIII 11/1/73 .sh NAME update \*- periodically update the super block .sh SYNOPSIS .bd update .sh DESCRIPTION .it Update is a program that executes the .it sync primitive every 30 seconds. This insures that the file system is fairly up to date in case of a crash. This command should not be executed directly, but should be executed out of the initialization shell command file. See sync(II) for details. .sh "SEE ALSO" sync(II), init(VII) .sh BUGS There is a system bug which, it is suspected, may be aggravated by this program. Until further notice, .it update should not be run. .sh SYNOPSIS .bd update .sh DESCRIPTION .it Update is a program that executes the .it sync primitive every 30 seconds. This insures that the file system is fairly up to date in case of a crash. This command should not be executed directly, but should be executed out of the initialization shell command file. See sync(II) for details. .sh "SEE ALSO" sync(II), init(VII) .sh BUGS There is a system bug which, it is suspected, may be .th SYNC VIII 11/1/73 .sh NAME sync \*- update the super block .sh SYNOPSIS .bd sync .sh DESCRIPTION .it Sync executes the .it sync system primitive. If the system is to be stopped, .it sync must be called to insure file system integrity. See sync(II) for details. .sh "SEE ALSO" sync(II) .sh BUGS be executed directly, but should be executed out of the initialization shell command file. See sync(II) for details. .sh "SEE ALSO" sync(II), init(VII) .sh BUGS There is a system bug which, it is suspected, may be .th RELOC VIII 2/7/73 .sh NAME reloc \*- relocate object files .sh SYNOPSIS .bd reloc file octal [ .bd \*- ] .sh DESCRIPTION .it Reloc modifies the named object program file so that it will operate correctly at a different core origin than the one for which it was assembled or loaded. .s3 The new core origin is the old origin increased by the given .it octal number (or decreased if the number has a `\*-' sign). .s3 If the object file was generated by .it ld, the .bd \*-r and .bd \*-d options must have been given to preserve the relocation information and define any common symbols in the file. .s3 If the optional last argument is given, then any .it setd instruction at the start of the file will be replaced by a no-op. .s3 The purpose of this command is to simplify the preparation of object programs for systems which have no relocation hardware. It is hard to imagine a situation in which it would be useful to attempt directly to execute a program treated by .it reloc. .sh "SEE ALSO" as(I), ld(I), a.out(V) .sh BUGS to preserve the relocation information and define any common symbols in the file. .s3 If the optional last argument is given, then any .it setd instruction at the start of the file will be replaced by a no-op. .s3 The purpose of this command is to simplify the preparation of object programs for systems which have no relocation hardware. It is hard to imagine a situation in which it would be useful to attempt directly to execute a program treated by .it reloc. .sh "SEE ALSO" as(I), ld(I), a.out(V) .sh .tr | .th "BOOT PROCEDURES" VIII 11/1/73 .sh NAME boot procedures \*- UNIX startup .sh DESCRIPTION The advent of the new system has changed the boot procedures. .it "These procedures apply only to C-language systems." .s3 .it "How to start UNIX.||" UNIX is started by placing it in core starting at location zero and transferring to zero. There are various ways to do this. If UNIX is still intact after it has been running, the most obvious method is simply to transfer to zero. .s3 The .it tp command places a bootstrap program on the otherwise unused block zero of the tape. The DECtape version of this program is called .it tboot, the magtape version .it mboot. If .it tboot or .it mboot is read into location zero and executed there, it will type `=' on the console, read in a .it tp entry name, load that entry into core, and transfer to zero. Thus the next easiest way to run UNIX is to maintain the UNIX code on a tape using .it tp. Then when a boot is required, execute (somehow) a program which reads in and jumps to the first block of the tape. In response to the `=' prompt, type the entry name of the system on the tape (we use plain `unix'). It is strongly recommended that a current version of the system be maintained in this way, even if the first or third methods of booting the system are usually used. .s3 The standard DEC ROM which loads DECtape is sufficient to read in .it tboot, but the magtape ROM loads block one, not zero. If no suitable ROM is available, magtape and DECtape programs are presented below which may be manually placed in core and executed. .s3 A third method of rebooting the system involves the otherwise unused block zero of each UNIX file system. The single-block program .it uboot will read a UNIX pathname from the console, find the corresponding file on a device, load that file into core location zero, and transfer to it. The current version of this boot program reads a single character (either .bd p or .bd k for RP or RK, both drive 0) to specify which device is to be searched. .it Uboot operates under very severe space constraints. It supplies no prompts, except that it echos a carriage return and line feed after the .bd p or .bd k. No diagnostic is provided if the indicated file cannot be found, nor is there any means of correcting typographical errors in the file name except to start the program over. .it Uboot can reside on any of the standard file systems or may be loaded from a .it tp tape as described above. .s3 The standard DEC disk ROMs will load and execute .it uboot from block zero. .s3 .it "The switches.||" The console switches play an important role in the use and especially the booting of UNIX. During operation, the console switches are examined 60 times per second, and the contents of the address specified by the switches are displayed in the display register. (This is not true on the 11/40 since there is no display register on that machine.) If the switch address is even, the address is interpreted in kernel (system) space; if odd, the rounded-down address is interpreted in the current user space. .s3 If any diagnostics are produced by the system, they are printed on the console only if the switches are non-zero. Thus it is wise to have a non-zero value in the switches at all times. .s3 During the startup of the system, the .it init program (VIII) reads the switches and will come up single-user if the switches are set to 173030. .s3 It is unwise to have a non-existent address in the switches. This causes a bus error in the system (displayed as 177777) at the rate of 60 times per second. If there is a transfer of more than 16ms duration on a device with a data rate faster than the bus error timeout (approx 10\*us) then a permanent disk non-existent-memory error will occur. .s3 .it "ROM programs.||" Here are some programs which are suitable for installing in read-only memories, or for manual keying into core if no ROM is present. Each program is position-independent but should be placed well above location 0 so it will not be overwritten. Each reads a block from the beginning of a device into core location zero. The octal words constituting the program are listed on the left. .s3 .ne 5 .nf DECtape (drive 0) from endzone: .if n .ta 3 11 15 23 38 .if t .ta .3i 1i 1.4i 2i 3.5i 012700 mov $tcba,r0 177346 010040 mov r0,-(r0) / use tc addr for wc 012710 mov $3,(r0) / read bn forward 000003 105710 1: tstb (r0) / wait for ready 002376 bge 1b 112710 movb $5,(r0) / read (forward) 000005 000777 br . / loop; now halt and start at 0 .s3 DECtape (drive 0) with search: 012700 1: mov $tcba,r0 177346 010040 mov r0,-(r0) / use tc addr for wc 012740 mov $4003,-(r0) / read bn reverse 004003 005710 2: tst (r0) 002376 bge 2b / wait for error 005760 tst -2(r0) / loop if not end zone 177776 002365 bge 1b 012710 mov $3,(r0) / read bn forward 000003 105710 2: tstb (r0) / wait for ready 002376 bge 2b 112710 movb $5,(r0) / read (forward) 000005 105710 2: tstb (r0) / wait for ready 002376 bge 2b 005007 clr pc / transfer to zero .s3 .fi Caution: both of these DECtape programs will (literally) blow a fuse if 2 drives are dialed to zero. .s3 .nf Magtape from load point: 012700 mov $mtcma,r0 172526 010040 mov r0,-(r0) / usr mt addr for wc 012740 mov $60003,-(r0) / read 9-track 060003 000777 br . / loop; now halt and start at 0 .s3 RK (drive 0): 012700 mov $rkmr,r0 177414 005040 clr -(r0) 005040 clr -(r0) 010040 mov r0,-(r0) 012740 mov $5,-(r0) 000005 105710 1: tstb (r0) 002376 bge 1b 005007 clr pc .s3 RP (drive 0) 012700 mov $rpmr,r0 176726 005040 clr -(r0) 005040 clr -(r0) 005040 clr -(r0) 010040 mov r0,-(r0) 012740 mov $5,-(r0) 000005 105710 1: tstb (r0) 002376 bge 1b 005007 clr pc .dt .sh FILES /usr/sys/unix \*- UNIX code .br /usr/mdec/mboot \*- \fItp\fR magtape bootstrap .br /usr/mdec/tboot \*- \fItp\fR DECtape bootstrap .br /usr/mdec/uboot \*- file system bootstrap .sh "SEE ALSO" tp(I), init(VII) 12740 mov $5,-(r0) 000005 105710 1: tstb (r0) 002376 bge 1b 005007 clr pc .s3 RP (drive 0) 012700 mov $rpmr,r0 176726 005040.th 20BOOT VIII 10/31/73 .sh NAME 20boot \*- install new 11/20 system .sh SYNOPSIS .bd 20boot .sh DESCRIPTION This shell command file copies the current version of the 11/20 program used to run the VT01 display onto the /dev/vt0 file. The 11/20 should have been started at its ROM location 773000. .sh FILES /dev/vt0, /usr/mdec/20.o (11/20 program) .sh "SEE ALSO" vt (IV) VII) 12740 mov $5,-(r0) 000005 105710 1: tstb (r0) 002376 bge 1b 005007 clr pc .s3 RP (drive 0) 012700 mov $rpmr,r0 176726 005040.th MOUNT VIII 10/31/73 .sh NAME mount \*- mount file system .sh SYNOPSIS .bd /etc/mount special file .sh DESCRIPTION .it Mount announces to the system that a removable file system is present on the device corresponding to special file .it special (which must refer to a disk or possibly DECtape). The .it file must exist already; it becomes the name of the root of the newly mounted file system. .sh "SEE ALSO" umount (VIII) .sh BUGS Mounting file systems full of garbage can crash the system. 176726 005040.th CHECK VIII 8/31/73 .sh NAME check \*- file system consistency check .sh SYNOPSIS .bd check [ .bd \*-lsib [ numbers ] ] [ filesystem ] .sh DESCRIPTION .it Check examines a file system, builds a bit map of used blocks, and compares this bit map against the free list maintained on the file system. It also reads directories and compares the link-count in each i-node with the number of directory entries by which it is referenced. If the file system is not specified, a check of a default file system is performed. The normal output of .it check includes a report of .s3 .lp +4 0 The number of blocks missing; i.e. not in any file nor in the free list, .lp +4 0 The number of special files, .lp +4 0 The total number of files, .lp +4 0 The number of large files, .lp +4 0 The number of directories, .lp +4 0 The number of indirect blocks, .lp +4 0 The number of blocks used in files, .lp +4 0 The highest-numbered block appearing in a file, .lp +4 0 The number of free blocks. .s3 .i0 The .bd \*-l flag causes .it check to produce as part of its output report a list of the all the path names of files on the file system. The list is in i-number order; the first name for each file gives the i-number while subsequent names (i.e. links) have the i-number suppressed. The entries ``\fB.\fR'' and ``\fB..\fR'' for directories are also suppressed. .s3 The .bd \*-s flag causes .it check to ignore the actual free list and reconstruct a new one by rewriting the super-block of the file system. The file system should be dismounted while this is done; if this is not possible (for example if the root file system has to be salvaged) care should be taken that the system is quiescent and that it is rebooted immediately afterwards so that the old, bad in-core copy of the super-block will not continue to be used. Notice also that the words in the super-block which indicate the size of the free list and of the i-list are believed. If the super-block has been curdled these words will have to be patched. The .bd \*-s flag causes the normal output reports to be suppressed. .s3 The occurrence of .bd i .it n times in a flag argument .bd \*-ii...i causes .it check to store away the next .it n arguments which are taken to be i-numbers. When any of these i-numbers is encountered in a directory a diagnostic is produced, as described below, which indicates among other things the entry name. .s3 Likewise, .it n appearances of .bd b in a flag like .bd \*-bb...b cause the next .it n arguments to be taken as block numbers which are remembered; whenever any of the named blocks turns up in a file, a diagnostic is produced. .sh FILES Currently, /dev/rp0 is the default file system. .sh "SEE ALSO" fs (V) .sh DIAGNOSTICS There are some self-evident diagnostics like ``can't open ...'', ``can't write ....'' If a read error is encountered, the block number of the bad block is printed and .it check exits. ``Bad freeblock'' means that a block number outside the available space was encountered in the free list. ``\fIn\fR dups in free'' means that \fIn\fR blocks were found in the free list which duplicate blocks either in some file or in the earlier part of the free list. .s3 An important class of diagnostics is produced by a routine which is called for each block which is encountered in an i-node corresponding to an ordinary file or directory. These have the form .s3 .dt \fIb# complaint \fB; i= \fIi# \fB(\fIclass \fB)\fR .s3 Here .it b# is the block number being considered; .it complaint is the diagnostic itself. It may be .s3 .lp +8 5 \fBblk\fR if the block number was mentioned as an argument after .bd \*-b; .lp +8 5 \fBbad\fR if the block number has a value not inside the allocatable space on the device, as indicated by the devices's super-block; .lp +8 5 \fBdup\fR if the block number has already been seen in a file; .lp +8 5 \fBdin\fR if the block is a member of a directory, and if an entry is found therein whose i-number is outside the range of the i-list on the device, as indicated by the i-list size specified by the super-block. Unfortunately this diagnostic does not indicate the offending entry name, but since the i-number of the directory itself is given (see below) the problem can be tracked down. .s3 .i0 The .it i# in the form above is the i-number in which the named block was found. The .it class is an indicator of what type of block was involved in the difficulty: .s3 .lp +8 5 \fBsdir\fR indicates that the block is a data block in a small file; .lp +8 5 \fBldir\fR indicates that the block is a data block in a large file (the indirect block number is not available); .lp +8 5 \fBidir\fR indicates that the block is an indirect block (pointing to data blocks) in a large file; .lp +8 5 \fBfree\fR indicates that the block was mentioned after .bd \*-b and is free; .lp +8 5 \fBurk\fR indicates a malfunction in .it check. .s3 .i0 When an i-number specified after .bd \*-i is encountered while reading a directory, a report in the form .s3 \fi# \fBino; i= \fId# \fB(\fIclass \fB) \fIname\fR .s3 where .it i# is the requested i-number. .it d# is the i-number of the directory, .it class is the class of the directory block as discussed above (virtually always ``sdir'') and .it name is the entry name. This diagnostic gives enough information to find a full path name for an i-number without using the .bd -l option: use .bd \*-b .it n to find an entry name and the i-number of the directory containing the reference to .it n, then recursively use .bd \*-b on the i-number of the directory to find its name. .s3 Another important class of file system diseases indicated by .it check is files for which the number of directory entries does not agree with the link-count field of the i-node. The diagnostic is hard to interpret. It has the form .s3 .dt .ft I i# delta .ft R .s3 Here .it i# is the i-number affected. .it Delta is an octal number accumulated in a byte, and thus can have the value 0 through 377(8). The easiest way (short of rewriting the routine) of explaining the significance of .it delta is to describe how it is computed. .s3 If the associated i-node is allocated (that is, has the .it allocated bit on) add 100 to .it delta. If its link-count is non-zero, add another 100 plus the link-count. Each time a directory entry specifying the associated i-number is encountered, subtract 1 from .it delta. At the end, the i-number and .it delta are printed if .it delta is neither 0 nor 200. The first case indicates that the i-node was unallocated and no entries for it appear; the second that it was allocated and that the link-count and the number of directory entries agree. .s3 Therefore (to explain the symptoms of the most common difficulties) .it delta = 377 (\*-1 in 8-bit, 2's complement octal) means that there is a directory entry for an unallocated i-node. This is somewhat serious and the entry should be be found and removed forthwith. .it Delta = 201 usually means that a normal, allocated i-node has no directory entry. This difficulty is much less serious. Whatever blocks there are in the file are unavailable, but no further damage will occur if nothing is done. A .it clri followed by a .it "check \*-s" will restore the lost space at leisure. .s3 In general, values of .it delta equal to or somewhat above 0, 100, or 200 are relatively innocuous; just below these numbers there is danger of spreading infection. .sh BUGS Unfortunately, .it "check \*-l" on file systems with more than 3000 or so files does not work because it runs out of core. .s3 Since .it check is inherently two-pass in nature, extraneous diagnostics may be produced if applied to active file systems. .s3 It believes even preposterous super-blocks and consequently can get core images. 3 In general, values of .it delta equal to or somewhat above 0, 100, or 200 are relatively innocuous; just below these numbers there is danger of spreading infection. .sh BUGS Unfortunately, .it "check \*-l" on file systems with more than 3000 or so files does not work because it runs out of core. .s3 Since .it check is inherently two-pass in nature, extraneous diagnostics may be produced if applied to active file systems. .s3 It believes even preposterous super.th DF VIII 1/20/73 .sh NAME df \*- disk free .sh SYNOPSIS .bd df [ filesystem ] .sh DESCRIPTION .it Df prints out the number of free blocks available on a file system. If the file system is unspecified, the free space on all of the normally mounted file systems is printed. .sh FILES /dev/rf?, /dev/rk?, /dev/rp? .sh "SEE ALSO" check(VIII) .sh BUGS ince .it check is inherently two-pass in nature, extraneous diagnostics may be produced if applied to active file systems. .s3 It believes even preposterous super.th SU VIII 10/31/73 .sh NAME su \*- become privileged user .sh SYNOPSIS .bd su .sh DESCRIPTION .it Su allows one to become the super-user, who has all sorts of marvelous (and correspondingly dangerous) powers. In order for \fIsu\fR to do its magic, the user must supply a password. If the password is correct, \fIsu\fR will execute the Shell with the UID set to that of the super-user. To restore normal UID privileges, type an end-of-file to the super-user Shell. .s3 The password demanded is that of the entry ``root'' in the system's password file. .s3 To remind the super-user of his responsibilities, the Shell substitutes `#' for its usual prompt `%'. .sh "SEE ALSO" sh (I) s (and correspondingly dangerous) powers. In order for \fIsu\fR to do its magic, the user must supply a password. If the password is correct, \fIsu\fR will execute the Shell with the UID set to that of the super-user. To restore normal UID privileges, type an end-of-file to the super-user Shell. .s3 The password demanded is that of the ent.th MKNOD VIII 10/31/73 .sh NAME mknod \*- build special file .sh SYNOPSIS .bd /etc/mknod name [ .bd c ] [ .bd b ] major minor .sh DESCRIPTION .it Mknod makes a directory entry and corresponding i-node for a special file. The first argument is the .it name of the entry. The second is .bd b if the special file is block-type (disks, tape) or .bd c if it is character-type (other devices). The last two arguments are numbers specifying the .it major device type and the .it minor device (e.g. unit, drive, or line number). .s3 The assignment of major device numbers is specific to each system. For reference, here are the numbers for the MH 2C-644 machine. Do not believe them too much. .s3 Block devices: .lp +8 4 0 RF fixed-head disk .lp +8 4 1 RK moving-head disk .lp +8 4 2 TC DECtape .lp +8 4 3 TM magtape .lp +8 4 4 RP moving-head disk .lp +8 4 5 Vermont Research moving-head disk .i0 .s3 Character devices: .lp +8 4 0 KL on-line console .lp +8 4 1 DC communications lines .lp +8 4 2 PC paper tape .lp +8 4 3 DP synchronous interface .lp +8 4 4 DN ACU interface .lp +8 4 5 core memory .lp +8 4 6 VT scope (via 11/20) .lp +8 4 7 DA voice response unit .lp +8 4 8 CT phototypesetter .lp +8 4 9 VS voice synthesizer .lp +8 4 10 TIU Spider interface .i0 .sh "SEE ALSO" mknod (II) .sh BUGS C DECtape .lp +8 4 3 TM magtape .lp +8 4 4 RP moving-head disk .lp +8 4 5 Vermont Research moving-head disk .i0 .s3 Character devices: .lp +8 4 0 KL on-line console .lp +8 4 1 DC communications lines .lp +8 4 2 PC paper tape .lp +8 4 3 DP synchro.th UMOUNT VIII 10/31/73 .sh NAME umount \*- dismount file system .sh SYNOPSIS .bd /etc/umount special .sh DESCRIPTION .it Umount announces to the system that the removable file system previously mounted on special file .it special is to be removed. .sh "SEE ALSO" mount (VIII) .sh DIAGNOSTICS It complains if the special file is not mounted or if it is busy. The file system is busy if there is an open file on it or if someone has his current directory there. .sh BUGS 8 4 2 PC paper tape .lp +8 4 3 DP synchro.th CLRI VIII 10/31/73 .sh NAME clri \*- clear i-node .sh SYNOPSIS .bd clri i-number [ filesystem ] .sh DESCRIPTION .it Clri writes zeros on the 32 bytes occupied by the i-node numbered .it i-number. If the .it "file system" argument is given, the i-node resides on the given device, otherwise on a default file system. The file system argument must be a special file name referring to a device containing a file system. After .it clri, any blocks in the affected file will show up as ``missing'' in a .it check of of the file system. .s3 Read and write permission is required on the specified file system device. The i-node becomes allocatable. .s3 The primary purpose of this routine is to remove a file which for some reason appears in no directory. If it is used to zap an i-node which does appear in a directory, care should be taken to track down the entry and remove it. Otherwise, when the i-node is reallocated to some new file, the old entry will still point to that file. At that point removing the old entry will destroy the new file. The new entry will again point to an unallocated i-node, so the whole cycle is likely to be repeated again and again. .sh BUGS Whatever the default file system is, it is likely to be wrong. Specify the file system explicitly. .s3 If the file is open, .it clri is likely to be ineffective. hould be taken to track down the entry and remove it. Otherwise, when the i-node is reallocated to some new file, the old entry will still point to that file. At that point removing the old entry will.th MKFS VIII 11/1/73 .sh NAME mkfs \*- construct a file system .sh SYNOPSIS .bd /etc/mkfs special proto .sh DESCRIPTION .it Mkfs constructs a file system by writing on the special file .it special according to the directions found in the prototype file .it proto. The prototype file contains tokens separated by spaces or new lines. The first token is the name of a file to be copied onto block zero as the bootstrap program (see boot procedures(VIII)). The second token is a number specifying the size of the created file system. Typically it will be the number of blocks on the device, perhaps diminished by space for swapping. The next token is the i-list size in blocks (remember there are 16 i-nodes per block). The next set of tokens comprise the specification for the root file. File specifications consist of tokens giving the mode, the user-id, the group id, and the initial contents of the file. The syntax of the contents field depends on the mode. .s3 The mode token for a file is a 6 character string. The first character specifies the type of the file. (The characters .bd \*-bcd specify regular, block special, character special and directory files respectively.) The second character of the type is either .bd u or .bd \*- to specify set-user-id mode or not. The third is .bd g or .bd \*- for the set-group-id mode. The rest of the mode is a three digit octal number giving the owner, group, and foreigner read, write, execute permissions (see .it chmod (I)). .s3 Two decimal number tokens come after the mode; they specify the user and group ID's of the owner of the file. .s3 If the file is a regular file, the next token is a pathname whence the contents and size are copied. .s3 If the file is a block or character special file, two decimal number tokens follow which give the major and minor device numbers. .s3 If the file is a directory, .it mkfs makes the entries \fB.\fR and \fB..\fR and then reads a list of names and (recursively) file specifications for the entries in the directory. The scan is terminated with the token \fB$\fR. .s3 If the prototype file cannot be opened and its name consists of a string of digits, .it mkfs builds a file system with a single empty directory on it. The size of the file system is the value of .it proto interpreted as a decimal number. The i-list size is the file system size divided by 50. (This corresponds to an average size of three blocks per file.) The boot program is left uninitialized. .s3 A sample prototype specification follows: .s3 .nf .in +5 /usr/mdec/uboot 4872 55 d\*-\*-777 3 1 usr d\*-\*-777 3 1 sh \*-\*-\*-755 3 1 /bin/sh ken d\*-\*-755 6 1 $ b0 b\*-\*-644 3 1 0 0 c0 c\*-\*-644 3 1 0 0 $ $ .in -5 .fi .sh "SEE ALSO" file system(V), directory(V), boot procedures(VIII) .sh DIAGNOSTICS There are various diagnostics for syntax errors, inconsistent values, and sizes too small. .sh BUGS It is not possible to initialize a file larger than 64K bytes. .br The size of the file system is restricted to 64K blocks. .br There should be some way to specify links. 4872 55 d\*-\*-777 3 1.th MON VI 11/1/73 .sh NAME mon \*- print calendar month .sh SYNOPSIS .bd mon .sh DESCRIPTION .it Mon asks for a month and year. The output is a calendar for that month and year. .sh "SEE ALSO" cal(VI) .sh BUGS OSTICS There are various diagnostics for syntax errors, inconsistent values, and sizes too small. .sh BUGS It is not possible to initialize a file larger than 64K bytes. .br The size of the file system is restricted to 64K blocks. .br There should be some way to specify links. 4872 55 d\*-\*-777 3 1.th ITOA III 3/15/72 .sh NAME itoa \*- integer to ascii conversion .sh SYNOPSIS .ft B jsr r5,itoa; subr .ft R .sh DESCRIPTION .it Itoa will convert the number in r0 into ASCII decimal preceded by a \*- sign if appropriate. For each character generated by .it itoa, the subroutine \fIsubr\fR (supplied by the caller) is called on register r5 with the character in r0. .s3 The subroutine \fIsubr\fR must not disturb any registers. 64K blocks. .br There should be some way to specify links. 4872 55 d\*-\*-777 3 1.th FTOA III 1/15/73 .sh NAME ftoa \*- floating to ascii conversion .sh SYNOPSIS .ft B jsr r5,ftoa; subr .ft R .sh DESCRIPTION .it Ftoa will convert the floating point number in fr0 into ascii in the form .s3 [\fB\*-\fR]ddddd\fB.\fRdd... .s3 if possible, otherwise in the form .s3 [\fB\*-\fR]d\fB.\fRdddddddd\fBe\fR[\fB\*-\fR]dd .s3 For each character generated by ftoa, the \fIsubr\fR (supplied by the caller) is called on register r5 with the character in r0. .s3 The number of digits can be changed by changing the value of \fB\*_ndigits\fR in ecvt (default is 10.). .s3 The \fIsubr\fR must not disturb any registers. .sh "SEE ALSO" ecvt(III), itoa(III), printf(III) g point number in fr0 into ascii in the form .s3 [\fB\*-\fR]ddddd\fB.\fRdd... .s3 if possible, otherwise in the form .s3 [\fB\*-\fR]d\fB.\fRdddddddd\fBe\fR[\fB\*-\fR]dd .s3 For each character generated by ftoa, the \fIsubr\fR (supplied by the caller) is called on register r5 with the character in r0. .s3 The number of digits can be changed by chang.pa 1 .he 'DLI (VIII)'3/15/72'DLI (VIII)' .ti 0 NAME dli -- load DEC binary paper tapes .sp .ti 0 SYNOPSIS dli output [input] .sp .ti 0 DESCRIPTION dli___ will load a DEC binary paper tape into the output file. The binary format paper tape is read from the input file (/dev/ppt is default.) .sp .ti 0 FILES /dev/ppt .sp .ti 0 SEE ALSO -- .sp .ti 0 DIAGNOSTICS "checksum" .sp .ti 0 BUGS -- ed by the caller) is called on register r5 with the character in r0. .s3 The number of digits can be changed by chang.th MT I 6/12/72 .sh NAME mt \*- manipulate magtape .sh SYNOPSIS .bd mt [ key ] [ name ... ] .sh DESCRIPTION .it mt saves and restores selected portions of the file system hierarchy on magtape. Its actions are controlled by the .it key argument. The key is a string of characters containing at most one function letter and possibly one or more function modifiers. Other arguments to the command are file or directory names specifying which files are to be dumped, restored, or tabled. .s3 The function portion of the key is specified by one of the following letters: .s3 .lp +3 3 \fBr\fR The indicated files and directories, together with all subdirectories, are dumped onto the tape. The old contents of the tape are lost. If no arguments are given, .bd r is the default. .s3 .lp +3 3 \fBx\fR extracts the named files from the tape to the file system. The owner, mode, and date-modified are restored to what they were when the file was dumped. If no file argument is given, the entire contents of the tape are extracted. .s3 .lp +3 3 \fBt\fR lists the names of all files stored on the tape which are the same as or are hierarchically below the file arguments. If no file argument is given, the entire contents of the tape are tabled. .s3 .lp +3 3 \fBl\fR is the same as .bd t except that an expanded listing is produced giving all the available information about the listed files. .s3 .i0 The following characters may be used in addition to the letter which selects the function desired. .s3 .lp +8 8 \fB0,|...,|7\fR This modifier selects the drive on which the tape is mounted. .bd 0 is the default. .s3 .lp +8 8 \fBv\fR Normally .it mt does its work silently. The .bd v (verbose) option causes it to type the name of each file it treats preceded by a letter to indicate what is happening: .bd a indicates a file is being added; .bd x indicates a file is being extracted. The .bd v option can be used with .bd r and .bd x only. .s3 .lp +8 8 \fBf\fR causes new entries copied on tape to be `fake' in that only the entries, not the data associated with the entries are updated. Such fake entries cannot be extracted. Usable only with .bd r. .s3 .lp +8 8 \fBw\fR causes .it mt to pause before treating each file, type the indicative letter and the file name (as with .bd v) and await the user's response. Response .bd y means `yes', so the file is treated. Null response means `no', and the file does not take part in whatever is being done. Response .bd x means `exit'; the .it mt command terminates immediately. In the .bd x function, files previously asked about have been extracted already. With .bd r, no change has been made to the tape. .s3 .i0 .sh FILES /dev/mt? .sh "SEE ALSO" tap(I), tap(V) .sh DIAGNOSTICS Several; the only non-obvious one is: .br `Phase error'\*- a file has changed after it was selected for dumping but before it was dumped. .br .sh BUGS It doesn't save the mode correctly, so files are restored mode 666. If, during an .bd x, the files are specified in a different order than they are on the tape, seek errors will result because the command believes the tape cannot be rewound. h .bd r, no change has been made to the tape. .s3 .i0 .sh FILES /dev/mt? .sh "SEE ALSO" tap(I), tap(V) .sh DIAGNOSTICS Several; the only non-obvious one is: .br `Phase error'\*- a file has changed after it was selected for dumping but before it was dumped. .br .sh BUGS It doesn't save the mode correctly, so files are restored mode 666. If, during an .bd x, the files are specified in a different order than they are on the tape, seek errors will result because the .th TAP I 3/15/72 .sh NAME tap \*- manipulate DECtape .sh SYNOPSIS .bd tap [ key ] [ name ... ] .sh DESCRIPTION .it tap saves and restores selected portions of the file system hierarchy on DECtape. Its actions are controlled by the .it key argument. The key is a string of characters containing at most one function letter and possibly one or more function modifiers. Other arguments to the command are file or directory names specifying which files are to be dumped, restored, or tabled. .s3 The function portion of the key is specified by one of the following letters: .s3 .lp +8 4 \fBr\fR The indicated files and directories, together with all subdirectories, are dumped onto the tape. If files with the same names already exist, they are replaced. `Same' is determined by string comparison, so `./abc' can never be the same as `/usr/dmr/abc' even if `/usr/dmr' is the current directory. If no file argument is given, `\fB.\fR' is the default. .s3 .lp +8 4 \fBc\fR updates the tape. .bd u is the same as .bd r, but a file is replaced only if its modification date is later than the date stored on the tape; that is to say, if it has changed since it was dumped. .bd u is the default command if none is given. .s3 .lp +8 4 \fBd \fRdeletes the named files and directories from the tape. At least one file argument must be given. .s3 .lp +8 4 \fBx\fR extracts the named files from the tape to the file system. The owner, mode, and date-modified are restored to what they were when the file was dumped. If no file argument is given, the entire contents of the tape are extracted. .s3 .lp +8 4 \fBt\fR lists the names of all files stored on the tape which are the same as or are hierarchically below the file arguments. If no file argument is given, the entire contents of the tape are tabled. .s3 .lp +8 4 \fBl\fR is the same as .bd t except that an expanded listing is produced giving all the available information about the listed files. .s3 .i0 The following characters may be used in addition to the letter which selects the function desired. .s3 .lp +10 6 \fB0,...,7\fR This modifier selects the drive on which the tape is mounted. `0' is the default. .s3 .lp +10 6 \fBv\fR Normally .it tap does its work silently. The .bd v (verbose) option causes it to type the name of each file it treats preceded by a letter to indicate what is happening. .s3 .lp +13 3 \fBr\fR file is being replaced .lp +13 3 \fBa\fR file is being added (not there before) .lp +13 3 \fBx\fR file is being extracted .lp +13 3 \fBd\fR file is being deleted .s3 .lp +10 6 The .bd v option can be used with .bd "r, u, d," and .bd x only. .s3 .lp +10 6 \fBc\fR means a fresh dump is being created; the tape directory will be zeroed before beginning. Usable only with .bd r and .bd u. .s3 .lp +10 6 \fBf\fR causes new entries on tape to be `fake' in that no data is present for these entries. Such fake entries cannot be extracted. Usable only with .bd r and .bd u. .s3 .lp +10 6 \fBw\fR causes .it tap to pause before treating each file, type the indicative letter and the file name (as with v) and await the user's response. Response .bd y means `yes', so the file is treated. Null response means `no', and the file does not take part in whatever is being done. Response .bd x means `exit'; the .it tap command terminates immediately. In the .bd x function, files previously asked about have been extracted already. With .bd "r, u," and .bd d no change has been made to the tape. .s3 .i0 .sh FILES /dev/tap? .sh "SEE ALSO" mt(I) .sh DIAGNOSTICS Several; the non-obvious one is `Phase error', which means the file changed after it was selected for dumping but before it was dumped. .sh BUGS Asks about fake entries on \fBxw\fR, when it should ignore them. If a fake entry is extracted, and the file already exists on disk, the extraction does not take place (as is correct), but the mode and user ID of the file are set to 0. y. With .bd "r, u," and .bd d no change has been made to the tape. .s3 .i0 .sh FILES /dev/tap? .sh "SEE ALSO" mt(I) .sh DIAGNOSTICS Several; the non-obvious one is `Phase error', which me.th ATOI III 1/15/73 .sh NAME atoi \*- ascii to integer .sh SYNOPSIS .ft B jsr r5,atoi; subr .ft R .sh DESCRIPTION .it Atoi will convert an ascii stream to a binary number returned in r1. .s3 The subroutine .it subr (supplied by the caller) is called on r5 for each character of the ascii stream. .it Subr should return the character in r0. The first character not used in the conversion is left in r0. .s3 The numbers recognized are: an optional minus sign followed by a string of digits. .s3 The subroutine .it subr must not disturb any registers. .sh DIAGNOSTICS There are none; the routine charges on regardless of consequences. .sh BUGS It pays no attention to overflow; you get whatever the machine instructions \fimul\fR and \fIdiv\fR happen to leave in the low order half. In fact, the carry bit should be set and isn't. .s3 The routine should accept initial \fB+\fR and initial blanks. on is left in r0. .s3 The numbers recognized are: an optional minus sign followed by a string of digits. .s3 The subroutine.th FTOO III 1/15/73 .sh NAME ftoo \*- floating to octal conversion .sh SYNOPSIS .ft B jsr r5,ftoo; subr .ft R .sh DESCRIPTION .it ftoo will convert the floating point number in fr0 into ascii in the conventional octal form .s3 000000;000000;000000;000000 .s3 For each character generated by ftoo, the subroutine .it subr (supplied by the caller) is called on register r5 with the character in r0. .s3 The \fIsubr\fR must not disturb any registers. inus sign followed by a string of digits. .s3 The subroutine.th PROF I 3/12/73 .sh NAME prof \*- display profile data .sh SYNOPSIS .bd prof [ .bd \*-v ] [ .bd \*-a ] [ .bd \*-l ] [ file ] .sh DESCRIPTION .it Prof will read the file mon.out produced by the monitor subroutine. Under default modes, the namelist in the object file (a.out default) is read and correlated to the mon.out profile. The percentage of time spent between adjacent valued external symbols is printed in decreasing order. If the .bd \*-a option is used, all symbols are used rather than just external symbols. If the option .bd \*-l is used, the output is listed by symbol value rather than decreasing percentage. If the .bd \*-v option is used, all printing is suppressed and a profile plot is produced on /dev/vt0. .sh FILES mon.out for profile .br a.out for namelist .br /dev/vt0 for plotting .sh "SEE ALSO" mon(III), profil(II) .sh BUGS tage of time spent between adjacent valued external symbols is printed in decreasing order. If the .bd \*-a option is used, all symbols are used rather than just external.bp .tr | .bl 1 .nf .ta 30 .tc . .ce TABLE OF CONTENTS I. COMMANDS .xx : place label ar archive (combine) files as assembler bas BASIC dialect cat concatenate (or print) files cc compile C program cdb C debugger chdir change working directory chmod change access mode of files chown change owner of files cmp compare file contents cp copy file cref cross reference table crypt encrypt, decrypt a file date get date and time of day db symbolic debugger dc desk calculator df  find free disk space dsw delete files interactively du find disk usage echo print command arguments ed text editor exit end command sequence factor factor a number fc compile Fortran program fed form letter editor form generate form letter forml generate form letters goto command transfer hyphen find hyphenated words if conditional command ld link editor (loader) ln link to file login log on to system ls list contents of directory m6 macroprocessor mail send mail to another user man run off manual section mesg permit or deny messages mkdir create directory mt save, restore files on magtape mv move or rename file nm print namelist nroff format text for printing od octal dump of file opr print file off-line ov page overlay file print passwd set login password pr print file with headings proof compare text files reloc relocate object files rew rewind DECtape rm remove (delete) file rmdir remove (delete) directory roff format text for printing sh command interpreter size get executable program size sno compile Snobol program sort sort ASCII file speak send words to voice synthesizer split break a file into pieces stat get file status strip remove symbols, relocation bits stty set typewriter modes sum sum file tap save, restore files on DECtape time get time information tmg compile tmgl program tss communicate with MH-TSS (GCOS) tty find name of terminal type print file page-by-page typo find typographic errors un find undefined symbols uniq find duplicate lines in a file vs generate voice synthesizer phonemes wc get (English) word count who who is on the system write write to another user II. SYSTEM CALLS .xx boot reboot the system break set program break cemt catch EMT traps chdir change working directory chmod change mode of file chown change owner of file close close open file creat create file csw read the console switches dup duplicate an open file exec execute program file exit terminate execution fork create new process fpe catch floating exception errors fstat status of open file getuid get user ID gtty get typewriter mode ilgins catch illegal instruction trap intr catch or inhibit interrupts kill destroy process link link to file makdir create directory mdate set date modified of file mount mount file system nice set low-priority status open open file pipe open inter process channel quit inhibit quits read read file rele release processor seek move read or write pointer setuid set user ID sleep delay execution stat get file status stime set system time stty set mode of typewriter sync assure synchronization time get time of year times get execution times umount dismount file system unlink remove (delete) file wait wait for process write write file III. SUBROUTINES .xx atan arctangent atof convert ASCII to floating atoi convert ASCII to integer compar string compare for sort crypt encrypt according to a keyword ctime convert time to ASCII ddsput display character on Picturephone ecvt edited output conversion exp exponential function ftoa convert floating to ASCII ftoo convert floating to octal gerts communicate with GCOS getc get character hypot compute hypotenuse itoa convert integer to ASCII log logarithm base e mesg print string on typewriter nlist read name list pow take powers of numbers ptime print time putc write character or word qsort quicker sort rand pseudo random number generator salloc storage allocator sin sine, cosine sqrt square root switch transfer depending on value ttyn find teletype name IV. SPECIAL FILES .xx dc remote typewriter dn 801 ACU dp 201 Dataphone kl console typewriter mem core memory pc punched paper tape rf RF disk rk RK disk tc DECtape tm 9-track magtape vt storage-tube display V. FILE FORMATS .xx a.out assembler and loader output archive archive file core core image file directory  directory format file system file system format passwd password file tap DECtape and magtape format utmp logged-in user information wtmp accounting files VI. USER MAINTAINED PROGRAMS .xx bc compile B program bj blackjack ptx permuted index yacc yet another compiler-compiler VII. MISCELLANEOUS .xx ascii map of ASCII dpd spawn dataphone daemon getty adapt to typewriter glob argument expander greek extended TTY 37 typebox map init initializer process msh mini Shell tabs set tab stops on typewriter vsp voice synthesizer phonemes VIII. SYSTEM MAINTAINANCE .xx 20boot reboot 11/20 system acct get connect-time accounting bproc boot procedure check check consistency of file system chk check all file systems clri clear file's i-node dcheck verify directory hierarchy dli load DEC binary paper tapes istat file status by i-number kill terminate a process mount mount removable file system ps get process status salv repair damaged file system su become super-user swtmp truncate accounting files tm get system time information umount dismount removable file system .xx .bp .bl 1 .ce INDEX .nf .tc .ta 9 17 25 33 41 49 57 .nx index check consistency of file system chk check all file systems clri clear file's i-node dcheck verify directory hierarchy dli load DEC binary paper tapes istat file status by i-number kill terminate a process mount mount removable file system ps get process status salv repair damaged file system su bec.th BC VI 6/12/72 .sh NAME bc \*- B interpreter .sh SYNOPSIS .bd bc [ .bd -c ] files ... .sh DESCRIPTION .it Bc is the UNIX B interpreter. It accepts three types of arguments: .s3 Arguments whose names end with .bd .b are assumed to be B source programs; they are compiled, and the object program is left on the file the file whose name is that of the source with .bd .o substituted for .bd .o. .s3 Other arguments, except for .bd -c, are assumed to be either loader flag arguments, or B-compatible object programs, typically produced by an earlier .it bc run, or perhaps libraries of B-compatible routines. These programs, together with the results of any compilations specified, are loaded (in the order given) to produce an executable program with name .bd a.out. .s3 The .bd -c argument suppresses the loading phase, as does any syntax error in any of the routines being compiled. .s3 The language itself is described in [1]. .s3 The future of B is uncertain. The language has been totally eclipsed by the newer, more powerful, more compact, and faster language C. .sh FILES file.b input file .br a.out loaded output .br b.tmp1 temporary (deleted) .br b.tmp2 temporary (deleted) .br /usr/lang/bdir/b[ca] translator .br /usr/lang/bdir/brt[12] runtime initialization .br /usr/lib/libb.a builtin functions, etc. .br /usr/lang/bdir/bilib.a interpreter library .sh "SEE ALSO" [1] K. Thompson; MM-72-1271-1; Users' Reference to B. .br cc(I) .sh DIAGNOSTICS see [1]. n. The language has been totally eclipsed by the newer, more po.th FORML I 10/24/72 .sh NAME forml _ form letter generator processor .sh SYNOPSIS .bd forml [ name ] ... .sh DESCRIPTION A streamlined program for typing form letters. The names pick out prestored form letters prepared according to the conventions of .it form and .it roff. The program prompts to get each blank filled in. When all the forms are completed, it prompts "Set paper." It waits for a newline before printing each letter. .s3 If more than one name is given, the name of each letter is announced before the prompts for it begin. If no names are given, the program asks "Which letter?" before each. Respond with the name and a newline, or newline only when done. .s3 On a 2741 type terminal, the program assumes the letter is to be typed with a correspondence ball, and also prompts "Change ball." Replace the ball at the end. .s3 .sh FILES form.m (memory), .br forma, formb, ... temporaries .sh "SEE ALSO" form(I), fed(I), roff(I) .sh DIAGNOSTICS "Try again"_can't get a process .sh BUGS letter is announced befo.pa 1 .he 'UNSPK (VIII)'4/13/73'UNSPK (VIII)' .ti 0 NAME unspk -- decode voice synthesizer text .sp .ti 0 SYNOPSIS unspk_____ [ -_ ] [ input [ output ] ] .sp .ti 0 DESCRIPTION unspk_____ is inverse to .ul speak. It translates coded voice synthesizer input, as created by .ul speak, into phonetic strings of the sort accepted by .ul speak. Standard output or input is assumed when one or the other is unspecified. .sp The -_ option produces output in a different phonetic code for another vocal tract synthesizer [C. H. Coker, Speech synthesis by modelling the human articulatory system, MM69-1232-29]. .sp unspk_____ lives in /crp/vs .sp .ti 0 FILES -- .sp .ti 0 SEE ALSO speak(I), vsp(VII) .sp .ti 0 DIAGNOSTICS "Input file." -- can't open it .br "Output file." -- can't create it .sp .ti 0 BUGS -- trings of the sort accepted by .ul speak. Standard output or input is assumed when one or the other is unspecified. .sp The -_ option produces output in a different phonetic code for another vocal tr.pa 1 .he 'TM (VIII)'3/15/72'TM (VIII)' .ti 0 NAME tm -- provide time information .sp .ti 0 SYNOPSIS tm__ .sp .ti 0 DESCRIPTION tm__ is used to provide timing information. Output like the following is given: .sp .in +5 tim 371:51:09 2:00.8 ovh 20:00:33 17.0 swp 13:43:20 4.6 dsk 27:14:35 4.5 idl 533:08:03 1:33.3 usr 24:53:50 1.2 der 0, 54 0, 0 .sp .in -5 The first column of numbers gives totals in the named categories since the last time the system was cold-booted; the second column gives the changes since the last time tm__ was invoked. The top left number is badly truncated and should be ignored. ovh___ is time spent executing in the system; swp___ is time waiting for swap I/O; dsk___ is time spent waiting for file system disk I/O; idl___ is idle time; usr___ is user execution time; der___ is RF disk error count (left number) and RK disk error count (right number). .ti 0 FILES /dev/rf0 (for absolute times); /tmp/ttmp for differential timing history. .sp .ti 0 SEE ALSO time(I), file system(V) .sp .ti 0 DIAGNOSTICS -- .sp .ti 0 BUGS -- er is badly truncated and should be ignored. ovh___ is time spent executing in the system; swp___ is time waiting for swap I/O; dsk___ is time spent waiting for file system disk I/O; idl___ is idle time; usr___ is user execution time; der___ is RF disk error count (left number) and RK disk error count (right number). .ti 0 FILES /dev/rf0 (for absolute times); /t.pa 1 .he 'SWTMP (VIII)'2/11/73'SWTMP (VIII)' .ti 0 NAME swtmp -- update accounting file .sp .ti 0 SYNOPSIS swtmp_____ .sp .ti 0 DESCRIPTION This shell sequence concatenates /tmp/wtmp onto /usr/adm/wtmp and truncates /tmp/wtmp. It should be used before using acct(VIII) and every so often in any case if accounting is to be maintained. .sp .ti 0 FILES /tmp/wtmp, /usr/adm/wtmp .sp .ti 0 SEE ALSO acct(VIII), wtmp(V) ) and RK disk error count (right number). .ti 0 FILES /dev/rf0 (for absolute times); /t.pa 1 .he 'SALV (VIII)'1/20/73'SALV (VIII)' .ti 0 NAME salv -- file system salvage .sp .ti 0 SYNOPSIS /etc/salv_________ filesystem [ -akfs_____ ] .sp .ti 0 DESCRIPTION .br .in 8 salv____ will place a given file system in a consistent state with almost no loss of information. This is the first step in putting things together after a bad crash. Salv performs the following functions: .sp .in +3 A valid free list is constructed. .in -3 The previous step is always performed; the following steps are performed only if the "a" option is given. If the file system's only defect is missing blocks, "a" should not be specified. .in +3 .sp All bad pointers in the file system are zeroed. .sp All duplicate pointers to the same block are resolved by changing one of the pointers to point at a new block containing a copy of the data. .sp Inodes (not directory entries) for special files are generated (mode 16). Files whose size is too large for the number of blocks they contain (after bad pointers are zeroed) have their size revised downward. .in -3 The file system should be unmounted while it is being salvaged. In cases of extreme need the permanently mounted file system may be salvaged; in such a case the system must be rebooted before it has a chance to write out the old, bad super-block. The "k", "f", and "s" options tell salv what magic numbers to use to generate the size of the free list and the i-node map. "k" is default (RK disk); "f" is RF; "s" is RK with swap space on it. If salv is to be used away from the mother system its code should be checked to verify the numbers. .sp After a salv, files may be safely created and removed without causing more trouble. If the "a" option had to be used, a dcheck (VIII) should be done to find the degree of the damage to the hierarchy. .sp .ti 0 SEE ALSO check(VIII), dcheck(VIII) .sp .ti 0 BUGS In only one (known) way does salv____ destroy information: if some random block appears to be an indirect block for a file, all "bad pointers" (for example, ASCII text) in it will be zeroed. If the block also appears in another file, it may be scribbled on before it is copied. .br .in 16 and removed without causing more trouble. If the "a" option had to be used, a dcheck (VIII) should be done to find the degree of the damage to the hierarchy. .sp .ti 0 SEE ALSO check(VIII), dcheck(VIII) .sp .ti 0 BUGS In only one (known) way does salv____ destroy information: if some random block appears to be an indirect block for a file, all "bad pointers" (for example, ASCII text) .pa 1 .he 'KILL (VIII)'1/20/73'KILL (VIII)' .ti 0 NAME kill -- terminate process with extreme prejudice .sp .ti 0 SYNOPSIS /usr/adm/kill_____________ processnumber .sp .ti 0 DESCRIPTION After ps__ (q.v.) has given you the unique ID of a process, you can terminate it by this command. A core image is produced in the process's working directory. Only the super-user can exercise this privilege. .sp .ti 0 FILES -- .sp .ti 0 SEE ALSO ps (VIII) .sp .ti 0 DIAGNOSTICS yes .sp .ti 0 BUGS If the process has executed sys nice (II) and there is another process which has not, but which loops, the first process cannot be done in properly, since it has to be swapped in so as cooperate in its own murder. It would also be nice if ordinary people could kill their own processes. e it by this command. A core image is produced in the process's working directory. Only the super-user can exercise this privilege. .sp .ti 0 FILES -- .sp .ti 0 SEE ALSO ps (VIII) .sp .ti 0 DIAGNOSTICS yes .sp .ti 0 BUGS If the pro.pa 1 .he 'ISTAT (VIII)'1/20/73'ISTAT (VIII)' .ti 0 NAME istat -- get inode status .sp .ti 0 SYNOPSIS istat_____ [ filesystem ] inumber\d1\u ... .sp .ti 0 DESCRIPTION istat_____ gives information about one or more i-nodes on the given file system or on /dev/rk0 if no file system is given. .sp The information is in exactly the same form as that for stat(I), except that mode letter "a" is used to indicate that the i-node is allocated, "u" that it is unallocated. .sp .ti 0 FILES /etc/uids, /dev/rk0 .sp .ti 0 SEE ALSO stat(I), ls(I) (-l option) .sp .ti 0 DIAGNOSTICS -- .sp .ti 0 BUGS istat_____ ignores any read error and pretends to give status even if the file system is not physically present. about one or more i-nodes on the given file system or on /dev/rk0 if no file system is given. .sp The information is in exactly the same form as that for stat(I), except that mode letter "a" is used to indicate that the i-node is allocated, "u" that it is unallocated. .sp .ti 0 FILES /etc/uids, /dev/r.pa 1 .he 'GACCT (VIII)'4/27/73'GACCT (VIII)' .ti 0 NAME gacct -- command accounting statistics .sp .ti 0 SYNOPSIS gacct [ -arnl ] [ files ] .sp .ti 0 DESCRIPTION X .sp .ti 0 FILES /usr/adm/tacct .sp .ti 0 SEE ALSO sh(i) .sp .ti 0 DIAGNOSTICS -- .sp .ti 0 BUGS -- dev/rk0 if no file system is given. .sp The information is in exactly the same form as that for stat(I), except that mode letter "a" is used to indicate that the i-node is allocated, "u" that it is unallocated. .sp .ti 0 FILES /etc/uids, /dev/r.pa 1 .he 'DCHECK (VIII)'1/20/73'DCHECK (VIII)' .ti 0 NAME dcheck -- directory consistency check .sp .ti 0 SYNOPSIS dcheck______ [ -l__ ] [ device ] .sp .ti 0 DESCRIPTION dcheck______ builds an image of the directory hierarchy of the specified device by reading all its directories (using physical I/O guided by the i-nodes on the device). A list entry is made for each file encountered. A second pass reads the i-nodes and for each file compares the number of links specified in its i-node with the number of entries actually seen. All discrepancies are noted. .sp If no device is specified, a default device is assumed. .sp The argument -l__ causes a complete listing of the file names on the device in i-node order. .sp .ti 0 FILES /dev/rk? .sp .ti 0 SEE ALSO check(VIII) .sp .ti 0 DIAGNOSTICS inconsistent i-numbers, unnamed files, unreachable files, loops in directory "hierarchy". .sp .ti 0 BUGS Unreachable files and loops are discovered only under the "-l" option. s specified in its i-node with t.pa 1 .he 'CHK (VIII)'1/20/73'CHK (VIII)' .ti 0 NAME chk -- check + dcheck .sp .ti 0 SYNOPSIS chk .sp .ti 0 DESCRIPTION This command file does a check_____ and a dcheck______ of all of the normally mounted file systems. .sp .ti 0 FILES /dev/[fkp]* .sp .ti 0 SEE ALSO check (VIII), dcheck (VIII) .sp .ti 0 DIAGNOSTICS see "SEE ALSO" eachable files, loops in directory "hierarchy". .sp .ti 0 BUGS Unreachable files and loops are discovered only under the "-l" option. s specified in its i-node with t.pa 1 .he 'ACCT (VIII)'1/20/73'ACCT (VIII)' .ti 0 NAME acct -- login accounting .sp .ti 0 SYNOPSIS acct____ [ -w__ wtmp ] [ -p__ ] [ -d__ ] people .sp .ti 0 DESCRIPTION acct____ produces a printout giving connect time for each user who has logged in during the life of the current wtmp____ file. A total is also produced. -w__ is used to specify an alternate wtmp file. -p__ prints individual totals; without this option, only totals are printed. -d__ causes a printout for each midnight to midnight period. The people______ argument will limit the printout to only the specified login names. If no wtmp file is given, /usr/adm/wtmp_____________ is used. .sp .ti 0 FILES /usr/adm/wtmp .sp .ti 0 SEE ALSO init(VII), login(I), wtmp(V). .sp .ti 0 DIAGNOSTICS "Cannot open 'wtmp'" if argument is unreadable. .sp .ti 0 BUGS -- to specify an alternate wtmp file. -p__ prints individual totals; without this option, only totals are printed. -d__ causes a printout for each midnight.th CRYPT I 10/23/71 .sh NAME crypt \*- encode/decode .sh SYNOPSIS .bd crypt [ password ] .sh DESCRIPTION .it crypt is an exact implementation of Boris Hagelin's cryptographic machine called the M-209 by the U. S. Army [1]. .s3 .it crypt reads from the standard input file and writes on the standard output. It is thus suitable for use as a filter. For a given password, the encryption process is idempotent; that is, .s3 .bd " crypt znorkle cypher" .br .bd " crypt znorkle cypher" .br .bd " crypt znorkle