Introduction_to_FOR_PRO_Oct83 Introduction To FOR PRO Oct83
Introduction_to_FOR_PRO_Oct83 Introduction_to_FOR_PRO_Oct83
Introduction_to_FOR_PRO_Oct83 The Eye | File Listing
User Manual: Introduction_to_FOR_PRO_Oct83
Open the PDF directly: View PDF .
Page Count: 345
Download | |
Open PDF In Browser | View PDF |
1:()RTIJ N E S\'STE l4S INTRODUCTION TO FOR:PRO , ~ ~Ij b! . .' SYSTEM TOOLS . INTRODUCTION TO FOR:PRO COMMAND,LEVEL USE OF FORTUNE'S OPERATING SYSTEM I :I:ORTUNE SYSTEMS 300 Harbor Boulevard Belmont, CA 94002 Copyright ~ 1983 Fortune Systems Corporation. All rights reserved. No part of this document may be copied, photocopied, reproduced, translated, or reduced to any electronic medium or machine readable form without prior consent in writing from Fortune Systems Corporation. The information in this manual may be used only under the terms and conditions of separate Fortune Systems Corporation license agreements. UNIX is a trademark of Bell Laboratories. FOR:PRO is a trademark of Fortune Systems Corporation. Printed in U.S.A. 1 234 5 6 7 8 9 0 Ordering Introduction to FOR:PRO Order Number: 1002268-01 October 1983 Software Release 1.7 Please do not order products from the address shown below. Consult an authorized Fortune Systems dealer for copies of manuals and technical information. Disclaimer of Warranty and Liability No representations or warranties, expressed or implied, of any kind are made by or with respect to anything in this manual. By way of example, but not limi tat ion , no representations or warranties of merchantability or fitness for any particular purpose are made by or with respect to anything in this manual. In no event shall Fortune Systems Corporation be liable for any incide'ntal, indirect, special or consequential damages whatsoever (including but not limited to lost profits) arising out of or related to this manual or any use thereof even if Fortune Systems Corporation has been advised, knew or should have known of the possibility of such damages. Fortune Systems Corporation shall not be held to any liability with respect to any claim on account of, or arising from, the manual or any use thereof. For full details of the terms and conditions for using Fortune software, please refer to the Fortune Systems Corporation Customer Software License Agreement. ii About This Book FOR: PRO, Fortune's Professional Operati ng System, is an enhanced version of Bell Laboratories' Version 7 UNIX operating system, modified to run on the Fortune system. The IntroductiQn~Q_EQR~ERQ is designed to address the needs of two different groups of Fortune system users: • Those who have read Understan~Your_EQrtllng_~Y§tgm, used the Fortune menu system, and need to know FOR:PRO at the command level. • Those with prior computer experience who want to use FOR:PRO at the command level rather than at the menu level. The main goals of this book are to familiarize you with the commands on the FOR:PRO single-user operating system so you can use them to perform everyday tasks, and to provide a complete set of MAN pages cor responding to the commands on the FOR: PRO set of flexible disks. The first two chapters are designed to bridge the gap between the menu system interface and the command level interface to FOR:PRO. The material contained in these chapters assumes only minimal familiarity with computer terminology and concepts. The last two chapters are designed to meet the needs of users experienced with other computer systems, but not necessarily UNIX-based systems. This book assumes you have already read Underst.§n~.J:...ouL-.Fortune so the concepts here are simply summarized. ~Y§tem, ORGANIZATION OF THIS BOOK This document has two parts: • Part 1 introduces FOR: PRO and describes how to use simple commands to perform common operations. • Part 2 is the entire collection of the manual pages, called "MAN pages." They provide reference documentation for all commands and files that are part of the single-user FOR:PRO system. iii Part 1 is divided as follows: • Chapter 1 reviews UNIX terms and concepts introduced in Understand Your Fortune System. It then explains how to access FOR:PRO at the command level and how to set up your working environment. • Chapter 2 compares • Chapter 3 deals • explains the organization of system director ies provided with FOR:PRO and summarizes the commands available on the FOR:PRO single-user operating system. • Appendix A describes the menu system with equivalent UNIX commands, and describes how to use some of these commands. with advanced commands, such as those enabling you to set up system security, change the way commands work, and put commands together to perform routine tasks. Chapter 4 the changes to the print spooler at this release. CONVENTIONS USED IN PART 1 When communicating with FOR:PRO at command level, you type entire commands without going through the menu system. Commands must be typed using proper command format, or syntax. This document uses certain conventions to help you understand exactly how a command is typed. These are outlined below. • Commands to FOR:PRO are almost always lowercase letters, as is with most UNIX commands. Occasionally, some command options may be uppercase. Be careful to type commands using the case shown in the syntax descriptions. • In examples, any input you must type appears in boldface, while output such as system messages does not. Also, items shown in boldface must be typed exactly as they appear in the text. • Words • Brackets to be replaced wi th your own text are under.11.D§Q. Such items are also referred to as command-line parameters. indicate one or more options you may select from. iv • Hyphens (-) usually signal an option on a command line, as in the command Is -1 Always remember to type the hyphen. • ( ... ) mean that repeated more than once. Ellipses the preceding option may be Commands are sent to FOR: PRO by pressing the RETURN key, shown as Return throughout this text. In examples and in command syntax, it is represented asfile.3 10/83 1-17 Introduction to FOR:PRO Inc ;)nCLL CI'IV I "'VI'IMCI'II Then file.3 is created from the results of concatenating file.l and file.2, leaving file.l and file.2 in their original form. The > symbol tells the system to put the results of the cat process into file.3. Should you use this form where file.3 already exists, file.3 is overwritten by the results of the concatenation of file.l and file.2. 3. cat allows you to create a new file by simply pausing while you enter text. In this case you'd type cat > new. file to create a brand new file called new.file. also type cat » You can old.file to append information you type at the terminal existing file, called old.file. to an In either case, the system waits while you type information you want sent to new. file or old. file. Just type in the lines you want. Signal the end of the file by pressing CTRL-D. Make sure new.file is the name of a new file and not an existing one; otherwise, it will be overwritten. Using cat: To use cat for the first time, use the cd command to get to letc and type cat group The system displays the contents of the file group on the screen. The file letc/group is a system file containing the names of all user groups on the system. NOTE Do not use cat to display binary files such as system programs and executable user programs on the screen. If you do this by mistake, you may get a strange screen display. Use the -v option of cat (cat -v) to look at binary files. Introduction to FOR:PRO 1-18 10/83 THE SHELL ENVIRONMENT Display a File a Screen at a Time (more) The more command is similar to the display function of cat, because it displays an already existing text file on the screen. However, the more command only displays 24 lines of text at a time. Use more to display long files, because cat rapidly scrolls a long file over several screens without stopping until the end of the file. To use more, type more filename The more command pauses at the bottom of the first screen of text until you press the Spacebar to display the next screen of text, or press Return to display the next line. A pipe (I) The following example demonstrates the use of more. will also be used. On many keyboards, the I key is one of the three gray keys located to the left of the standard keys. Pipes allow you to use the output of one command or process as input to another. 1. Type the following: Is -1 letc I more You've "piped" the results of an Is -1 operation to the more command. If letc is your current directory, you can omit letc from the Is command line. 2. The system displays the first screen of the long directory listing, indicating that there is more to come. 3. Press the Spacebar to view the next 24 lines of output. If the $ prompt isn't at the bottom of the directory list, keep pressing the Spacebar until you see the $ prompt, signifying the end of the file. To get out of a display before it is finished, type q and press Return, or press the Cancel key. INTRODUCTION TO TEXT EDITING AND THE ed COMMAND Text editors provide tools for creating and editing text files. If you need to create reports and memos on the Fortune system, you should use the Fortune:Word application. However, if you need to create source programs, perform minor file updates, and create data files, you should use a text editor. 10/83 Introduction to FOR:PRO THE SHELL ENVIRONMENT Types of Editors There are two basic types of text editors available on the FOR:PRO system: line editors and screen editors. Line editors enable you to create text, then edit one line at a time. The line editor, ed, is the text editor available on the single-user operating system set of disks. It's easy to learn and adequate for cr~ating simple ASCII text files. To do extensive text formatting on a file created with ed, use the commands associated with the text formatting program nroff, available with the Development Utilities software. Screen editors enable you to edit text a screenful at a time, taking advantage of the characteristics of the video screen. If you have the Development Utilities set on your system, you can use vi, the screen editor provided with that software package. The next couple of pages show you how to use ed. and table of ed commands are also provided. A brief example Accessing ed To use ed, you must be at the command level. Once there, use ed like any other FOR:PRO command. Use the syntax ed filename regardless of whether you are creating a new file or editing an existing one. NOTE The cursor control keys (grey keys with arrows) do not work in ed. Rules for Creating ~ There are a few rules governing the creation of files. The first rule is that filenames can be a maximum of 14 characters, and should not begin with the following special characters: ,$> (New text--as many lines as needed) • d Deletes the indicated line or lines. The syntax of d is [line number]d or [line number],[line number]d i Inserts text above the current line. You can insert as much text as necessary, indicating the end of text by typing a period on the I ine below the last line of text, followed by a Return. The syntax of i is (New text--as many lines as needed) • i p Prints on the screen the line or range of lines specified. The syntax of p is [line number]p [line number],[line number]p Use the $ symbol to specify the last line of the file. You can also print the contents of a line by typing that line number, for example, 3 Return. q 10/83 Quits ed and returns to the shell. 1-23 Introduction to FOR:PRO THE SHEll ENVIRONMENT s Substitutes (replaces) a new string of text for an old string in the given line, in a range of lines, or globally, throughout the entire file. Use this format to change the current line of text. Use the g option when you want to make the indicated change to every occurrence of oldtext on that line. s/oldtext/newtext/[gJ Use this format to change text over a lines indicated by A,Y. range of A,Y s/oldtext/newtext/ This format adds the newtext string to the beginning of the current line. s/" /newtext/ To add something to the end of the line, instead of .. use $ To change a string globally (throughout an entire file), use this format of the substitute (s) command: 1,$s/oldtext/newtext/g u Restores the results of the last editing command issued at the current line. This only applies to editing commands that may have modified the current line. The contents of the line are restored to their state before the last command was issued. This command will not undo global changes -- it will only undo the change made to the last line of the file. w Writes the contents of the file to the hard disk. /llx,1/ Searches for the characters between the slashes. (If the text contains special characters like / , \ , [ , ; , or * they must be preceded by a backslash \.) Introduction to FOR:PRO 1-24 10/83 THE SHELL ENVIRONMENT Return prints the current line. In edit mode, typing a period and pressing Return prints the current line. File Position Commands $ Moves you to the last line of a file, printing its contents. + Lon] Moves you from the current line to the next line; with.ll.ll, moves you forward .n.n lines. Moves you from the current line to the preceding line; with nu, moves you backwards illl lines (towards the top of the file). .n.n Moves you to the line numbered .n.n, and prints that line. belongs, and the shell into which the user is automatically placed upon logging in. For most accounts, the listing will end with /bin/menu meaning that the account enters the menu system upon login. To access a shell other than the menu system, you must change menu to read sh or csh. Changing the passwd File To change the /etc/passwd file from the FOR:PRO level, you must log in as manager or root. When you log in as manager or root, your working directory is automatically set to /. (Get to the shell from the menu by typing I or Ish.) Then use cd to get to the fete directory. It is recommended that a backup copy of the passwd file be made. To do this, simply use the cp command, as in cp passwd passwd.baekup There is now a backup copy that you can reinstate if needed. Should you accidentally delete or mangle the passwd file, type cp /etc/passwd.backup /etc/passwd to restore the file from your backup copy. 10/83 1-25 Introduction to FOR:PRO THE SHELL ENVIRONMENT Get into the passwd file by typing ed passwd. Find the line in the passwd file that pertains to your account. Use the I~/ command to find it. For example, /laura/ will find the entry for the user laura and print out that line. Note that the last entry on the line describing your account reads /bin/menu. Now change the string /bin/menu to read /bin/sh Type this command line to change the string s/menu/sh/p The changed line is then displayed. Save your changes using the w and q commands. See the previous section on the editor Editing Text Using ed if you need help. To see the effect of this change, you have to log in again. You can log off and log back in, or you can just type login, and you will be prompted for your account name and password. You should directly access the Bourne shell instead of the global menu. Once you've done this, you might want to set up your environment by modifying the .profile file. Setting up .profile The .profile file is listed in the / directory, and is merely a prototype file. It is meant for the manager or root account and does nothing for you as an ordinary user until you customize it. You must first make a copy of .profile in your home directory and then make the necessary modifications to the copy. These steps are described in the following paragraphs. NOTE Once you put a .profile file in your home directory, it will be executed upon login, even if your login shell is Ibin/menu. Introduction to FOR:PRO 1-26 10/83 THE SHELL ENVIRONMENT What's in ,profile Before you modify it, .profile looks like this: PATH=':/bin:/usr/bin:/usr/ucb:/etc'; export PATH TERM=FT; export TERM HOME=I; export HOME The first line of the file describes your command search PATH, which tells the system where to look for the commands you type. By default, the system first looks in the current directory, then the Ibin directory, then in lusr/bin, and so on, as shown above. Since the shell environment gives you the ability to define your own commands, you may want to change the PATH so the system looks in your directory first, then searches the others. The TERM line indicates the type of terminal you are USing, default FT, which stands for Fortune terminal. by The HOME line indicates the directory that FOR:PRO considers your home directory. The default for root and manager is I, which is why the PATH and HOME fields have the values they do. You should change this to be /u/yourname, where yourname is the name of your account. That way, whenever you type cd without specifying a name, you access your home directory. Customizing ,profile First, copy .profile to your home directory, as in this example: cp I,profile lu/yourname/.profile Now you have your own copy to work with. If you type the command Is -la, you will notice that the permission rights for the .profile file are read only r--r--r-You have to change this so you have write access to the file. Use the cbmod (change mode) command to give yourself write access. The cbmod command is complex, as is the entire concept of permissions. cbmod is described in Chapter 3. Enter this command line, so you can edit the file cbmod u+w .profile 10/83 1-27 Introduction to FOR:PRO THE SHELL ENVIRONMENT The "u" stands for user and the "w" stands for write. Issue the command Is -la, and you see a write permission to the file. Use ed to change the first line. This is the PATH line that indicates the search path for your account. Change the string :/bin to :/u/yourname:/bin where yourname is the name of your account. Use the following command string to change the PATH line, using a comma as the delimiter for the s command: s,:/bin,:/u/yourname:/bin,p This changes your PATH line and modifications you just made. prints it out with the Change the HOME line so that it has your account name instead of the root directory. Again, use the comma as a delimiter in the substitution. 3s,/,/u/yourname,p The "3" specifies that the change will take place on the third line of the file. You can omit it if "3" is already the current line. Type w Return and q Return to get out of ed and to make these changes permanent. Having done this, you can go to your home directory by simply typing cd. To put these changes into effect, you must log in again. First log out, using CTRL-D, then log in as you normally do. When you log into the system from now on, your .profile file will automatically be executed. MORE CUSTOMIZATIONS You can customize your login environment by adding items to your .profile file. Here is a list of some simple things you can do: • • • • • Display a message or "reminder" file Display the system time and date Change the default shell prompt List the contents of your directory Find out who is on the system Introduction to FOR:PRO 1-28 10/83 THE SHELL ENVIRONMENT The first item in the list involves using either the echo command, followed by some text to be displayed, or using the cat command to list a file of reminders you've previously created. For example, if you have a file called reminder in your directory, you can list its contents by including the command cat reminder in your .profile file. Similarly, the current time and date can be displayed by putting the date command in the .profile file. Here is a sample • profile file that uses all the custom features listed above. PATH=':/u/1aura:/bin:/usr/bin:/usr/ucb:/etc'; export PATH TERM=FT; export TERM HOME=/u/laura; export HOME PS1=LJD$ date echo This system is running 1.7 cat reminder 1s -las who Setting Shell Variables Changing the default Bourne shell prompt ($) involves setting the special PS1 variable. In the example shown above, the default prompt is set to the user's initials, followed by a dollar sign, in this case, LJD$. Like PS1, all shell variables are set by equating them to some value. The general format is variable=value with no space on either side of the equal (=) sign. For example, PS1=PROHPT$ If you want a prompt that contains embedded spaces, surround the entire prompt string with quotes, as in PS1="HI THERE$" 10/83 1-29 Introduction to FOR:PRO THE SHELL ENVIRONMENT Once set, a shell variable is referenced by preceding it with the dollar sign. For example, to display the setting of the HOME variable, type: echo $HOME. With a .profile setup like the one shown in the example, typing cd $HOME should get you to the directory you defined as "home". (You can also simply type cd to get home.) Qisplaying Variable Settings To find out what environment, type shell variables are currently set for your set A complete list of variables and their settings is displayed. /etc/profile in FOR:PRO The file /etc/profile defines the default language for the system (LANGUAGE=EN), the lpr defaul ts for users of the menu system (LPRFLAGS), and the XON/XOFF mode for Fortune terminals. In XON/XOFF mode, when output to the screen is suspended using CTRL-S, it can only be resumed by typing CTRL-Q. Currently, only the menu shell invokes /etc/profile. The Bourne shell (/bin/sh) does not read /etc/profile. If your login shell is Ibin/sh, incorporate the settings in Jete/profile into your environment by copying the lines from /etc/profile into your .profile file. Note that Ipr does not use the LPRFLAGS setting when used from the Bourne shell. (See Appendix A.) Introduction to FOR: PRO 1-30 10/83 2 Using FOR:PRO Commands The most frequently used FOR:PRO commands included in the single-user operating system set of disks are described in this chapter. You'll also find a section describing the connection between selec tions on the menu system and the FOR: PRO commands which the selections activate. HOW MENU FUNCTIONS RELATE TO FOR:PRO COMMANDS If you've used the menu system prior to reading this document, you probably noticed a similarity between the FOR:PRO commands discussed so far and certain selections on the menus. In fact, most of the selections on the System Utilities and System Management menus merely activate FOR:PRO commands. Other selections run shell scripts consisting of a series of commands. For example, the selection "Create a Directory" on the System Utilities menu activates the FOR:PRO command mkdir. Table 2-1 lists some commonly used menu system selections and the FOR:PRO commands that are activated by these selections. To use the commands with the "/etc" prefix, you must either be in the letc directory or you must type the full pathname for the command. If you are logged in as manager or root, you can use them without typing "/etc" before the command name. These commands are described more fully in Chapter 3. USING FOR:PRO COMMANDS FOR ROUTINE TASKS The next few pages describe some basic FOR: PRO commands. You'll use these commands to create and manipulate files and directories, print your work, and perform disk-related activities. You'll also learn how to receive and interpret system status information. 10/83 2-1 Introduction to FOR:PRO USING FOR:PRO COMMANDS Table 2-1. Menu System Selections and FOR:PRO Commands Menu Items FOR:PRO Command Invoked System Utilities Copy a file Delete a file Group ID change of a file List file contents on screen Move or rename a file Owner change file ownership Print file content on printer Permission change of a file Copy a directory Create a directory Delete a directory Go to another directory Group ID change of a directory List directory information Move or rename a directory Name current directory Owner change of a directory Permission change of a directory cp rm letc/chgrp more mv letc/chown Ipr chmod cp mkdir rmdir cd letc/chgrp Is mv pwd letc/chown chmod System Management Shutdown computer Who is using the computer Disk usage Percent of disk used Display current date and time Set date and time Write a message to a terminal Send a message to all terminals shutdown who du df date setdt write wall METACHARACTERS AS SHELL "SHORTHAND" The Bourne shell provides a notation method that enables you to use a single special character in a command to represent any number of Introduction to FOR:PRO 2-2 10/83 USING FOR:PRO COMMANDS files and directories. Use these special characters, called metacharacters, in the command line in the following fashion: • To match a string of characters of any length, including a null (empty) string. ? To match any single character except null. [.!1.=nl To match any single character within the range indicated in n-n where n=n can be any two letters in the alphabet. Metacharacters are most useful when copying, moving, deleting, and simply listing file names. The asterisk character matches a character string of any length. Suppose you had the following files in a directory: apples1 apples2 oranges grapes1 pears apples.a grapes2 apples.g If you issued the command Is apples. the result would be apples1 apples2 apples.a apples.g The system lists all files that begin with apples. The * matches any characters in the filename that follow the string apples. Using? Unlike the asterisk, the question mark metacharacter matches any single character in a file, not an unlimited string. Using the same directory as above, if you issued the command Is apples? 10/83 2-3 Introduction to FOR:PRO USING FOR:PRO COMMANDS the result would be apples1 apples2 The system lists any files in the directory whose names begin with the string apples and include one other single character. Notice that the files apples.a and apples.g were not listed because in both cases apples was followed by more than one character. If you type Is apples?? you receive the results apples.a apples.g In this case, the two question marks ?? match any two characters (except null) following the apples string. The brackets indicate that the match required by the command be any Using the same directory single character between the range n-n. as in the two previous examples, suppose you issued the command Is apples.[a-f] The system would respond only with the name apples.a. apples.g is outside the range enclosed in the brackets. The file CREATING AND MODIFYING DIRECTORIES AND FILES Among the most commonly used commands are those for creating and manipulating directories and files: mkdir, mY, cp, rm and rmdir. The next few pages describe the syntax and usage of these commands and their most commonly used options. CreatinR-Q1rectories (mkdir) You can use the To create a directory, use the mkdir command. mkdir command to create subdirectories in your home directory or in any other directory for which you have write permission. Introduction to FOR:PRO 2-4 10/83 USING FOR:PRO COMMANDS The easiest way to use mkdir is to first go to the directory where you want to create the new directory. Then issue the mkdir command using the following syntax: mkdir directory.name You can supply as many directory names as you want, depending on how many directories you are creating. However, remember to use a pathname for any directories not in the current directory. The mkdir command automatically creates the • file, representing the directory itself, and the file representing the parent directory, in any new directory. The my command's most commonly used function is to move files and directories to different places. You can also use my to simply rename files and directories without moving them. This is because my removes the file from its original location and puts it in the specified location. If you use my on a file in the current directory, and specify a new filename instead of a I@thname as destination, then the file remains in the original directory, but its name is changed. The syntax for that use of my is my {filenam~} dir.name.1 {filena~} dir.name.2 It's also possible to move a file or directory, changing its name in the process. Use the following syntax my {Old. filename Qld-Ll!ir...1l~ new. pathname} ne~I@thname new.pathname is a complete pathname which specifies where directory or file is located. the To move syntax the a file from the current directory to another, use my [options] filename •.. directory.name 10/83 2-5 Introduction to FOR:PRO USING FOR:PRO COMMANDS Supply the name of the file you want moved and the name of the destination directory. Remember, once you move a file to another directory, it no longer exists in its former directory. The options are explained below. Move one directory to another by using the syntax my [options] dir.name to.dir.name When you move a directory, all its files and subdirectories are moved as well. Note that you cannot move a directory to one of its subdirectories. my Command Options: You can use one of three options: -f, -i, or when invoking my. The -i option causes the system to pause if it finds an existing file in the directory with the same name as the file you want to move into that directory. If you type a "y" as the next character in response to the prompt, the system replaces the old file with the new file. If you type any other character in response, the system will not move that file. The-f option causes all files to be moved, regardless of any permissions set or the existence of duplicate filenames. The -f and -1 options are mutually exclusive. If you do use them together, -1 overrides -f. The - option interprets all later arguments to my as filenames. This means you can move a file whose name begins with Theoption can be used with -1 or -f. Copying Files and Directories (cp) The cp command offers facilities for copying both files and directories. When you use cp to copy a file or directory, the original is not destroyed. Instead, you have two copies of the same data. To make this clearer, in the following syntax descriptions for cp, the original file or directory is referred to as the "source," and the new copy or file or directory receiving the copy is called the "destination." Making a Copy of an Original File: following cp syntax: For basic file copying, use the cp [opt1ons][-] source.f1lg destination. file Introduction to FOR: PRO 2-6 10/83 USING FOR:PRO COMMANDS This form of cp makes a copy of a file in the same directory as the original or in a different directory. The options are described below. The destination file retains the same file permissions as the source file. If the destination file is in the same directory as the source, be sure to give the copy a different name than the source. If either the source or destination file isn't in your working directory, remember to use pathnames. Here's a shortcut for copying a file from another directory into the current directory. Recall that • represents the current directory. file is not changed when it is copied. The name of the Options~: On the Fortune system, the cp command has a great number of options. As with the mv command, you can use the option -i to have the system prompt you every time it finds an existing file in the destination directory with the same name as a source file to be copied into the directory. The -f forces copying of all source files to the destination directory even when the system encounters duplicate filenames. You can also use the - option to create files with names beginning with a hyphen. £QQyin~irectories: You can copy a directory into another by using the -r option. The -r stands for recursive, meaning that the source directory and all of its subdirectories and files are copied into the destination directory. You cannot copy a directory into one of its subdirectories. You must use the -r option to completely copy a directory that contains subdirectories, otherwise the system ignores any subdirectories it encounters and only copies the files. Removing Files and Directories-1rml The rm command removes files and directories from the file system. Its syntax is rm [-f][-i][-r][-] 10/83 2-7 Introduction to FOR:PRO U!)ING FOR:PRO COMMANDS You can use rm to delete more than one file by typing individual filenames or by using metacharacters. Due to the serious nature of rm, you should be very careful when using this command. Unless you use the -i option, the only time rm prompts during file deletion is when it encounters a file for which you do not have write permission. NOTE You do not need write permission on a file to delete it, as long as you have write permission for the directory in which the file resides. If you try to delete a file for which you don't have write access, the system simply informs you of the file's permission mode and then asks again if you want to delete it. All you have to do is type y and the system deletes the file. Options of rm: The safest way to use rm for deleting files is to use the command with the -i option, as in rm -i filename •.• In this case, the system prompts, "rm: remove filename?" and waits for your response. Type y to remove the file. Any other response cancels the deletion. To force rm to delete all files without displaying prompts or error messages (even on write-protected files), use the -f option, as in rm -f Once again, -i and -f are mutually exclusive, with -i taking precedence if you mistakenly use them in the same command. RLIILQ. v i n R-lLi r LUQLi.~_w i.LIL- r m: Tor e m0 v e a I I f i 1 e san d subd i rector i es in a directory, use the recur si ve option of rm, as in Introduction to FOR:PRO 2-8 10/83 USING FOR:PRO COMMANDS In this case, rm searches for and deletes first all files, then all subdirectories beneath the named directory. To give you an command rm -r idea of the danger of rm -r, if you issued the it the system would delete all files and directories from the current directory on down the file hierarchy. If you were to issue such a command from I, you could delete the entire contents of the hard disk! So be very cautious using rm -r, particularly with metacharacters. Use the -i option whenever you use -r, just to be safe. You can use the rmdir command to delete directories, provided the directories do not contain any files. The syntax of rmdir is rmdir dir.name If you created directories and didn't put any files into them, you can use rmdir to delete them. However, if you use rmdir to delete a directory that does contain files, you'll receive an error message, and the system will ignore the command. You must delete the directory's contents before you can delete it with rmdir. MANIPULATING FILES ON FLEXIBLE DISKS FOR:PRO provides three commands for handling flexible disks: mount, umount, and format. These commands, along with cp, help you store and retrieve user files on flexible disks. Note that to install and backup any Fortune Systems' software, you must use the Product Maintenance menu. HowJnformation-iLOrganized on a Flexible Disk a Each flexible disk contains a separate file system with the directory If at the top of the hierarchy. When you copy or move files to the flexible disk, they are listed under If. 10/83 2-9 Introduction to FOR: PRO USING FOR:PRO COMMANDS The file system on the hard disk includes an empty directory also called f listed directly under I. When you mount a flexible disk, the system "logically" attaches the files on the flexible disk to the If directory on the hard disk. When you unmount the flexible disk, the association between the flexible disk and If on the hard disk is removed. During the Before using a flexible disk, you must format it. formatting process, the system arranges the surface of the disk, so that data can be stored on it. The surface is divided into areas called blocks. Individual blocks hold 1024 bytes or characters, on the FOR:PRO operating system. NOTE An attempt to access an unformatted disk will If this happens, cause the system to hang. reset the system by pushing the reset switch. During formatting, the system also creates the configuration block, the first block on the disk. The configuration block describes the size of the disk, the date the disk was formatted, and other status information. Using the format Command: Use the format command to prepare brand new disks or to reformat a used flexible disk. The format command erases any files that might exist on the disk. Therefore, do not format a disk that contains files you want to save. The syntax of format is format [-k][other options] Idev/fd02 The -k option of the format command causes the system to save information in the configuration block about any bad blocks encountered in the formatting process. If you're reformatting disks, you may want to use format -k, because used disks are more likely to have bad blocks than new ones. Introduction to FOR:PRO 2-10 10/83 USING FOR:PRO COMMANDS After you've formatted the disk, you should use the command mkfs to make a file system on the flexible disk. Type mkfs -a /dev/fd02 This command creates a file system on the flexible disk. running mkfs, the system will display some messages. While The mount and umount commands tell the system that you want to load Before issuing the mount or unload a removable file system. Then use this command, place the flex i ble disk in the drive. syntax to mount the flexible disk /etc/mount /dev/fd02 /f Since fd02 is a special device file, it is contained in the /dev directory. This is why you use the full pathname /dev/fd02. The system attaches the file system on the disk in drive fd02 to the directory /f on the hard disk. NOTE If you followed the directions on setting up a .profile file in your home directory, you don't need to type the /etc prefix. Just type mount or umount plus the proper arguments. To unmount a file system, use the following syntax: /etc/umount /dev/fd02 Again, the /etc prefix is not necessary if your path has been changed to include /etc. This unmounts the files listed under /f on the hard disk. After typing the command, remove the disk from the drive. 10/83 2-11 Introduction to FOR:PRO USING FOR:PRO COMMANDS NOTE Do not remove the flexible disk from the drive before issuing the umount command. Such an action could damage the file system on the hard disk. To copy files to the flexible disk, mount the disk and then use cp with the following syntax: cp file1 [file2] .•• If You can copy as many files as you want onto the flexible disk, provided that there is enough space on the disk. Use metacharacters wi th cp as shortcuts; don I t forget to specify pathnames for files not in the current directory. To look at the contents of a mounted flexible disk, just type 11 If or Is -a If The second format displays all special "." files as well as other files. To copy a directory and all its contents to the flexible disk, use the -r option: cp -r dirname If For example, to copy the contents of the directory lu/greg/memos, type cp -r lu/greg/memos If Introduction to FOR:PRO 2-12 10/83 USING FOR:PRO COMMANDS Copying Files from a Flexible Disk To copy files from the flexible disk onto the hard disk, mount the disk, then use this syntax: first The directoryname represents a relative pathname, and specifies the directory name where the file is to be copied. The Qirecto£y~ argument should not contain the name of the file being copied. You can specify more than one filename to be copied from a flexible disk. Suppose you want to copy the file may from a flexible disk to the lu/greg/memos directory on the hard disk. You would use this format of cp: cp If/may lu/greg/memos To copy all the files and any directories on a flexible disk to a directory lu/greg/index on the hard disk, use cp -r If/* lu/greg/index All the files under If, including any directories (except special files beginning with "."), are copied to the directory lu/greg/index. To copy the entire contents of the flexible disk to your current directory, type cp -r If/* • To copy all the files and directories in the current directory to a flexible disk, use this form of cp: cp -r * If The contents of your current directory, including any subdirectories and all their contents (except for special files, like .profile, which have to be copied individually) are copied to the flexible disk. Other useful options are V, 0, t, B, and R. See the MAN page entry for cp in Part 2 of this book. PRINTING YOUR FILES FOR:PRO provides the following printer-related commands, which enable you to print files according to your specifications, and then manipulate these files once they are placed in the print queue: 10/83 2-13 Introduction to FOR: PRO USING FOR:PRO COMMANDS Command lpr Places the file you request in print queue printing. for pr Displays a paginated file on the screen, or, when used with lpr, causes the printing of a paginated file. lpq Displays the list of files printed. lprm Removes files from the list of those waiting to be printed. lpdun Interrupts and resumes printing. Sets printer defaults and creates new printer directories. lpmv Changes the order of files printed. waiting to be waiting to be Printing Files with the lpr Command The lpr command places requested files in a list called a print queue for printing. There are many options to the lpr command, ranging from those that serve the simplest printing needs to others used for more complex printing equipment. Only the basic options of lpr are explained here. Refer to Appendix A for information related to lpr and its associated utilities. Simple Print Requests Using lpr aruL.p!:: If you simply want a printout of a file, without page breaks or page numbers, use lpr as shown below: lpr [options] filename If you want page numbers on your printout, use a combination of pr and lpr. The command pr organizes the file into pages with the file title and the page number displayed at the top of each page. The syntax of pr is pr filename Introduction to FOR:PRO 2-14 10/83 USING FOR:PRO COMMANDS If you issue pr in this form, your file is displayed on the screen in the paginated format. To print a paginated file, you must use pr and Ipr connected by a pipe, as in pr filename I Ipr Some Useful Options of lQr Some particularly useful options of Ipr are summarized below. They are described in more detail in the following paragraphs and in Appendix A. -b Adds a banner preceding the text of the printed file containing the name you specify in the center. -d Causes the printer to stop after printing a page so you can load single sheet paper (only for printers with friction feed or single sheet feeders). -b Removes the leading banner from a printed file. -n Requests more than one copy of a file. -0 Changes the owner name printed on the banner page. -p Indicates the number of the printer you want to use on a multiple printer system. +P Specifies pitch of a printed file. +L Changes the print position of the left margin of a file. +V Determines the number of lines printed per inch. NOTE You can use more than one of these options on the command line. If you do, make sure you type all options beginning with - before typing those beginning with +. Otherwise, the + options override those beginning with a - 10/83 2-15 Introduction to FOR:PRO USING FOR:PRO COMMANDS Banner-related options: If your login shell is Ibin/sh instead of Ibin/menu, the first page of every printout created by Ipr usually consists of a banner containing the name of the person who printed the file, the date of printing, and the name of the file. Users wi th menu login shells (/bin/menu) will not have banner pages on Banners are the only method of identifying the their printouts. owner of a printout. You can use the -b option to produce a banner containing both your account name and another specified name. The format for this version of Ipr is Ipr -b user.name filename This might be useful if several people use the same account, like ENG, and you want to identify a printout as belonging to you, for example, MARVIN. The printout would show both the account name you were using, ENG, plus the user name you specified, MARVIN. In this case, the command line would be Ipr -b HARVIN report To eliminate the banner (header page) entirely, use the -h option: NOTE The default Ipr setting for users with menu login shells is to suppress the banner on each print job. Use the -b option to override the default. (See Appendix A for details.) You can print out more than one copy of a file by issuing the command: Duplicat~copies: xx is an integer specifying the number of copies to be printed. SpecifYin&-print~I__~mbers: your system, each will Introduction to FOR:PRO If you have more than one printer on have a printer number assigned. (See 2-16 10/83 USING FOR:PRO COMMANDS FOR:PRO Installation Instructions for details on defining printers.) The default printer number is 1. If you want to print a file on a printer other than printer 1, type Qrinter~ represents the number of the printer you wish to use. Printing one sheet at a time: The -d option of Ipr causes the printer to pause after printing each page of a file. This enables you to feed single sheets of paper 1 ike letterhead stationery or other preprinted forms into the printer while it is inactive. After you've loaded the next sheet, continue printing by issuing the command Ipdun. Specifying Pitgh: The +P option of Ipr lets you specify the pitch (characters per inch) for the individual print job. Its syntax is Ipr +Pnn filenam~ nn is either 10, 12, or 15 characters per inch. The default is 10. Use the +L option to specify the left margin of the printout. When the printer is inactive, its printhead rests in the leftmost print position which is position 0 on printers which have a margin ruler. Normally the left margin of a file begins at this print location. If you specify +L, the left margin changes without having to reposition the paper. Its syntax is Ipr +Lnn fil~name 1111 represents the number of characters to the right of the printhead where the left margin starts. If you use both the +P and +L options on the command line, be sure to specify +P before you specify +L. Changing-1in~~_Q~r_Inch: The +V option of Ipr lets you specify the number of vertical lines per inch you want on your printout. Its syntax is nn represents lines per inch. The default is 6 lines per inch. Other choices are 8 or 10 lines per inch. 10/83 2-17 Introduction to FOR:PRO USING FOR:PRO COMMANDS NOTE The +L, +P, and +V options are effecti ve on a per print job basis. To change specifications for all print jobs, you must change the defaults. To do this, see Appendix A. The Print Queue CQillmand-1lR9l When you use Ipr to send a file to the printer, the file is placed in the print queue. The system maintains the queue for the purpose of determining print priorities. By default, the first file sent to the printer is the first printed. However, you can change the order of files in the queue by using Ipmv. Each printer attached to the Fortune system has its own print queue. You can view the contents of the queue by issuing the Ipq command, using the following syntax: Ipq [-aqsp] The table below explains the Ipq options and their uses. -p nn The -p nn option lets you view the queue for the printer whose number is represented by nn. The default is printer 1. On a multiple printer system, use Ipq -p nn to view the queue for a printer other than printer 1. -a To view the queues of all printers on the system, type Ipq -a. -s The -s option displays a status table, in place of, or in addition to, the print queue. It is explained further in the following pages. -q When used with -s in the form Ipq -qs, both the print queue and status table. Introduction to FOR:PRO 2-18 displays 10/83 USING FOR:PKU Simply typing Ipq displays the queue for printer #1. should resemble the following: Pdf Owner 1 steff ruby QID Type Size 419 File 5183 421 File 13295 Filename cab00419 cab00421 l.UMMANU~ That display Jobname Comment bridge.2.3 prog.15 Copies The individual fields are defined below. prif Printer number - given only for first job in each queue. Owner Owner of the file in the queue. QID Queue identification number. Type Type of entry. are: The possible values for this field doc Word processing document file Ordinary file created by an editor pipe File created through a pipe shell File created through a shellscript Size Size of the file in bytes. Filename The name the system gives the file. Jobname The job name of file being printed, same as the actual file name. Comment Any comment typed on the comment line of a word processing document summary. Copies Number of printed copies requested. usually the In addition to the print queue, you can also view the state of the printer by issuing the Ipq command and the option -so The result is a table that describes the printer's current mode of operation. The display you receive after issuing Ipq -5 should resemble the one on the next page. 10/83 2-19 Introduction to FOR:PRO U;'II'I'V rUK:t'KU l.UMMANDS Pr# State Ribbon 1 Active Black Wheel Round Forms paper Line 256 Page 66 PID 422 Waiting on Here is a description of the individual fields. Description Pr# Printer number. State Current operational mode of the printer. Most common states are: active, suspended, and idle. Ribbon Type of ribbon currently loaded. Wheel Type of printwheel loaded on the printer. Forms Type of forms loaded. Line Maximum width of a line in characters. Page Maximum length of a page in lines. PID The process id number of the filter currently handling printing. Waiting on A message explaining why printing is suspended. To display both the print queue and the printer state, type Ipq -ds Removing Files from the Print Queue (lprm) To remove a file from the print queue or to terminate a job being printed, use the Iprm command. Before issuing Iprm, display the print queue; make note of the QID of the file you wish to delete. Then issue the Iprm command using the following syntax: Iprm [-p nn] OlD. number where OlD. number represents the QID of the file to be deleted. The system then alerts you that i t is deleting the file. If the Introduction to FOR:PRO 2-20 10/83 USING FOR:PRO LUMMANU~ deleted file was the one currently printing, printing halts, and the message, "Printing Cancelled by Operator" appears as the last line on the printout. Use the -p lin option to kill a file queued to a printer other than printer 1. The lin represents the number of the printer. NOTE If a file is almost done printing when you issue Iprm, it may finish printing anyway. This is because many printers have a large buffer size (typically 2000 characters) and the buffer must empty before the Iprm takes effect. To remove all jobs queued by the same person, type Iprm owner,name where owner.name is the login name of the person who sent the files to the printer. Suspending and Resuming Printing (lpdun) The command lpdun is used to suspend and restart a print job. You'll most often interrupt printing to fix buckling paper, change a ribbon, or change a printwheel on a character printer. Using the Ipdun command, you can resume printing at the last page printed before the paper or ribbon problem occurred. The proper syntax for suspending a print job is 1pdun -1 [-p nn] When you issue this command, the printer stops printing the current file. Use the -p nn option to interrupt printing on a printer other than printer 1. Resume printing by issuing Ipdun using the following syntax: Ipdun [-n lill] 10/83 2-21 Introduction to FOR:PRO U"'II~\..7 rVro;.:iro;.U LUMMANU~ You'll often use the -n option of Ipdun, where QQ represents the number of pages to be reprinted. For example, suppose paper started buckling on the fourteenth page of a file, mangling this page and the next, before you were able to suspend printing. Your last good page was the thirteenth page. In this case, you would type Ipdun -n2 to reprint the last 2 pages. However, you could reprint up to nine pages. If QQ is more than the number of pages that have been printed, printing starts at the beginning of the job. To restart the printer at the point it stopped, simply type Ipdun. On jobs that are being printed one sheet at a time (started with Ipr -d), issue lpdun after you've successfully fed and positioned the paper in the printer. In addition, Ipdun has other useful options explained in the MAN page entry for Iprm. SYSTEM STATUS COMMANDS The FOR: PRO operating system provides commands, among them are the following: a number of system status Command date Presents the date and time. who Tells you who system. ps Presents a table of programs on which your account is currently running. du Displays the amount of space in blocks a file takes uP. df Presents a table indicating how much free space remai~s on a disk. is currently logged into the The date and who commands were described in the previous chapter. The ps, dU, and df commands display tables concerning the operational state of the computer; they are especially useful if you are the manager of a multiuser system. The major aspects of these commands are discussed on the next pages. Introduction to FOR:PRO 2-22 10/83 USING FOR:PRO COMMANDS The ps command displays a table describing the state of all processes on the system. You might think of a process as a currently executing program. The process table displayed by ps lists any system and user-created programs that are currently running. The syntax of ps is ps [-a][-l][other options][Qig] To see the short form of the process table, type ps. The resulting display shows all processes running under your current account flame. (Note that if you are currently logged in at two terminals at the same time, the process table shows the processes running under the same account on both terminals.) The resulting short process table will resemble the following: PID 29 TTY 03 TIME 0:04 CMD -sh Here's an explanation of the fields in the short process table. PID The process ID number assigned by the system to the running process. TTY The terminal controlling the running process. TIME The amount of computer time used so far to execute the process. CMD The command line typed to start the process. Note that the information listed under CMD may not always look exactly like what you typed. If you run a shellscript or type a command that uses pipes, you'll see a process number for each pipe under CMD. In the above example, the account that issued the ps command is currently running the Bourne shell (-sh) from terminal TTY 03. The system assigned the process ID 29 to the shell and has spent four seconds of CPU time running the shell. 10/83 2-23 Introduction to FOR:PRO USING FOR:PRO COMMANDS NOTE If you are logged in as manager or root, you will also see an entry for the ps process itself, even when you issue the "short form" (no options) of ps. If you are the system manager, you'll probably want to view a table listing all processes initiated from every terminal on your system. The -a option lets you view all processes executing from all terminals. Type ps -a The resulting display resembles this one. PID 28 29 59 TTY TIME CMD co 0:07 /m/menu/bin/msh -p /m/menu/control -1 user -s 03 0:04 -sh co 0:00 sh -c TERM=FTAJexport TERMAJCLEARHOME =20 AL10 AAA Jexport CLEAR HOM In this case, terminal 03 is running the Bourne shell, while the console is running shell scripts from the menu system. If you have a single-user system, or are the system manager, you'll want to monitor disk usage from time to time on your system to prevent the hard disk from running out of space. Two commands, du and df, provide information relevant to disk usage. Displaying Used and Free Space: The df command displays a table depicting the number of free blocks available on the file system. You can use df to determine the free space not only on the hard disk, but also on a mounted flexible disk. The syntax of df is df [-f) [other options] [filesystem ••• ][file ••• ] Introduction to FOR:PRO 2-24 10/83 USING FOR:PRO COMMANDS filesystem represents system, /dev/hd02 for disk. (The the device containing the hard disk, flexible disk inserted, to use df.) the particular file or /dev/fd02 for a flexible doesn't have to be mounted, If you do not specify a filesystem, just the df table is shown for the root file system on the hard disk. The df Table Wh en Display: you type df, the resul ti ng t abl e resembles this one. Filesystem Mounted on kbytes used free /dev/hd02 / 7895 5342 2553 % used 68% Th€ fields of the table are described below. Filesystem Device containing the f{le system. Mounted on The top directory in the file system hierarchy on the specified device. the entry directory. entry kbytes If is I, For a In the example above, representing mounted the flexible root disk, the appears in this field. The total number of kilobytes of storage space available bytes. on the Also, disk. one (A block kilobyte is equal is 1024 to 1024 bytes.) used The number of kilobytes used or taken up by files. free The number of kilobytes still unused. % used The percentage of disk space used. The most significant field in the display is % used. check this field every day, heavily used. hard disk perhaps more often if your You should system is You shouldn't let the amount of used space on the exceed 90 percent, because hard disk efficiency reduced when free space on the disk gets closer to zero. this happen, 10/83 is Should delete files you don't need and backup on a flexible 2-25 Introduction to FOR:PRO USING FOR:PRO COMMANDS disk other files that you don't use routinely but want to save. The % used field. If you type df -f, you'll receive a message like -f option lets you view just the "68% of the available space is in use" Displaying Disk Usage iQyl The du command shows how much space a specified directory takes up on the disk in terms of blocks. (Remember that one block is one kilobyte, or 1024 bytes.) If you are the system manager or have your own single-user system, use du to determine the size of files. You may want to move any large files that are seldom used but still must be saved onto a flexible disk. The syntax of du is du [-a][-s][Qir.name ..• ] If you type du dir.name, the system presents a display resembling the following 56 /u/ruby where /u/ruby is the directory specified for If you simply type du, the resulting dir.nam~. display may resemble 11 Since you haven't supplied a name, the system gives you the disk usage of the current directory (.). If the current directory contains other directories, du (with no options or arguments) displays the size and names of all directories within the requested directory, plus any of their subdirectories. To view just a total -5 option of du, as in of blocks used by a directory, use the To see how many blocks the entire file system takes up, type du -5 / Introduction to FOR:PRO 2-26 10/83 USING FOR:PRO COMMANDS Displaying File Size in Blocks: The -a option of du gives the disk usage for all files in the specified directory. For example, suppose you wanted to view the disk usage for all files in the directory /u/ruby. You would type du -a /u/ruby The system's response might be 4 3 4 /u/ruby/a.out lu/ruby/hist.1ist lu/ruby/hist.1ist.fr lu/ruby/hist.1ist.dc lu/ruby/myprog.p If you want to view the disk usage of all files on the system, type du -a / I more since the list generated will appear on more than one screen. USING THE SORT COMMAND The sort command sorts information in existing files (typically lists) in alphabetic and numeric order. It is particularly useful for sorting files such as telephone lists, price lists, inventories, and statistics. The sort command considers each line in a list to be composed of fields: strings of alphanumeric characters, separated from others on the same line by spaces, tabs, or other delimiters. Since sorting is done on a field basis, you don't have to set up the data in a file in columns. The next paragraphs use the file, bookfile, as an example. You may want to use it for practice with sort. bookfile is the type of list a bookseller might use to keep an inventory. It lists anthologies of the works of famous authors, the price for each book, and current inventory. It has four fields on each 1 ine: first name, last name, price, and quantity. 10/83 2-27 Introduction to FOR:PRO USING FOR:PRO COMMANDS William Shakespeare Washington Irving Emily Bronte Leo Tolstoy Walt Whitman Charlotte Bronte Alexandre Dumas 24.98 10.98 5.98 20.00 3.35 5.98 12.00 14 10 85 6 103 71 28 You can have the system perform the sort on any or all of the four fields. Suppose you wanted the list rearranged alphabetically by last names. When issuing the sort command, you'd designate that the last name field is the field to be sorted. The field used in the sort is called the key field. sort looks at the key field on each line, and reorganizes the lines in the file so that the key fields are in alphabetic or numeric order. Invoking sort The general syntax of sort is sort [+QQ§j] [-pos2] [-0 new.file] [orig.file] •.• where origifile represents the file or files you want to sort. If you don't specify a filename for orig.file, sort expects you to type in the data you want sorted from your keyboard. When you're finished, type CTRL-D. To perform a simple sort on an existing file, type sort filename In this case, the system considers each line in filename to be a single field. NOTE Unless you specify otherwise, files are sorted according to the ASCII collating sequence. In this sequence, control characters come first, then special characters (1'#, and so forth), the Introduction to FOR:PRO 2-28 10/83 USING FOR:PRO COMMANDS numbers 0-9, uppercase letters, and finally lowercase letters. Tables containing the entire ASCII collating sequence can be found in most programming texts. Sorting by Key Field You are more likely to sort by specific fields, rather than by using an entire line. To do this, you must indicate the position of the field on the line. When defining key fields, use the syntax sort [+~] [-pos2] ••• QLig.file where +~ indicates the starting position and -pos2 the ending position of the field. Sort considers the starting position of the first field on a line to be position O. The ending character of the first field is position -1. The starting character of the next field is position +1, and so on. The chart below shows the position indicators for an entry in the bookfile illustrated earlier: William Shakespeare -1 +1 -2 24.98 +2 -3 14 +3-4 To sort the file by the author's last name, issue the command sort +1 -2 bookfile Sorting is done on the second field, which begins with position +1 and ends with position -2. You can indicate as many key fields as you want in a single sort command. The system sorts key fields in the order specified on the command line, not in the order they appear in the file. Saving Sorted Lists in a File (-0 and The -0 option of sort lets file. When you issue the sorted list is by default only as long as it remains 10/83 » you save the sorted list in a specified sort command without the -0 option, the displayed on your terminal, and exists on the screen. 2-29 Introduction to FOR:PRO USING FOR:PRO COMMANDS However, most of the time, you'll probably want to save the sorted file. To do so use the -0 option orig.file represents the file to be sorted and new.file represents the resulting sorted file. Note that new.file is not displayed on the screen. You'll have to use cat or more to display new. file. The contents of Qrig.file are unchanged by the sort operation. Another way to achieve the same results is to type sort [options] [+QQ~][-pos2] ..• orig.file > new.filg The > symbol preceding new. file tells the system to direct the sorted list to a file called new.file, rather than display it on the screen. In general, the> symbol can be used after any FOR:PRO command to redirect the output that would otherwise appear on the screen to a specified file. More sort Options The sort command has many options. They are usually specified before the field positions. The general format of sort, including options, is The most useful below: options for sorting single files are described -b Ignores leading blanks in fields. -f Treats uppercase and lowercase letters equally. -n Performs a numeric sort. -r Sorts the list in reverse order. -0 Saves the sorted list in the specified output file. -tx Lets you define field separators default tabs or spaces. Introduction to FOR:PRO 2-30 other than the 10/83 USING FOR:PRO COMMANDS Equal Treatment for ~ca~-E.nd--L.owercase LetteL.§_( -f) : The-f option tells the' system to sort an uppercase letter in the same Its syntax pOSition as the lowercase version of the same letter. is: sort -f [options] [+Qosl] [-Qos2] .•• ori~file For example, suppose you were sorting a list in which the starting letters of the key field were mixed uppercase and lowercase. Naturally, you'd put the fields beginning with Band b after the a's and before the C's. However, unless you specify the -f option, the system first lists all fields beginning with A-Z then all fields beginning with a-z. Remember, the system uses the ASCII collating sequence, where upppercase letters are higher in the collating order than lowercase letters. The -f option makes the system treat uppercase and lowercase letters equally. Removing Leading Blanks~: A blank also has a value in the ASCII collating sequence. If you have more than one blank at the beginning of the field, sorting is performed first on the blanks, then on the remaining characters in the field, which may result in an incorrect sort. Use the -b option to remove any leading blanks from fields. You can use -b in either of two ways. sort -b [options] [+~] [-pos2] ..• orig.file leading blanks are removed from all blanks from a specific field, type sort [+~]b If you type fields. To remove leading orig.file Leading blanks are now removed from the field indicated in +~. In the syntax form above, a letter following a field position is called a flag, rather than an option. Note that when you use a flag, it overrides other options. Numeric Sorts (-TIl: Numbers in fields can be regarded in two ways, as characters or as numeric values. A number regarded as a string of characters such as a phone number or serial number has no significant numeric value. Numbers such as prices or quantities obviously have significant numeric value. 10/83 2-31 Introduction to FOR:PRO USING FOR:PRO COMMANDS To sort a field in which numbers have values, use the -n option to indicate you want to perform a numeric sort. If you use the following syntax: sort -n [options] [+~] [-pos2] ••• orig.file all fields are treated as numeric fields. To limit numeric sorting to a specified field, use -n as a flag, as in sort where [+~]-n +QQ~ ••. filename represents the field to be sorted numerically. NOTE You can use the -b option to sort a field in which numbers are treated as characters, provided that the numbers are all equal in length. For example, zip codes occupy five character positions. If the numbers vary in length, you'll need to use -n to achieve the results you want. Sorting in Reverse Order l=r~: You can use the -r option to sort files in reverse alphabetic order (Z-A) or from highest numeric value to lowest. If you type sort -r [options] [+QQ§j] [-pos2] orig.file [-0 new.file] all fields are sorted in reverse alphabetic order. specific field in reverse alphabetic order, use r following the position indicator of the field. If you sort a specific field in reverse numeric order, use both flags, as in sort [+QQ§j]nr To sort a as a flag wanted to nand r as orig. file Specifying Field Delimiters (-tx): The -t option of sort lets you specify a delimiter other than a space or tab to represent field boundaries. Use the following syntax: sort -tx [options] Introduction to FOR:PRO [+QQ~] [-QQs2] 2-32 orig. file 10/83 USING FOR:PRO COMMANDS x represents the character you want to use as a delimiter for example, I or :). When choosing delimiters, be very careful that the delimiter is not one that has a special meaning to FOR: PRO, such as I or I. If you need to use a special character, precede it with the escape character I, as described in Chapter 2. COMMUNICATING WITH OTHER USERS The FOR:PRO single-user operating system includes two commands for sending messages, write and wall. The write command enables you to send a message to another terminal, even to carryon a telephone-like conversation. wall sends your message to all terminals. Communication Between Users-1writ~ The write command is very simple to use. Its syntax is You can specify either a user's account name or the tty number of the terminal used by the person with whom you want to communicate. NOTE Normally you don't have to supply the tty number to use write. However, sometimes you may want to contact a person who is logged in on two or more terminals at the same time. You may have to send a message to both terminals in order to contact the individual. Once you invoked write, the system waits for your input at the terminal. Type your message, ending each line with a Return. After you type the first line, the system sends your message to the specified user. To end the message, press CTRL-D. 10/83 2-33 Introduction to FOR:PRO USING FOR:PRO COMMANDS The person you indicated receives a message on the screen specifying your name and tty number plus a "beep" to get the recipient's attention. For example: Message from ruby tty03 Can you check the printer to see if it has enough paper? Thanks. NOTE If you send a message to a user who isn't currently logged in, that message will be lost. Therefore, use the who command before using write, not only to find out who is on the system, but also to see which terminals are in use. ~ending_a_Messa@ to All Terminals ~alll wall operates according to the same principle as write, except that the message you type is sent to every terminal on your Fortune system. To invoke wall, type wall As in write, the system pauses, waiting for your input. Type the message, indicating its end by pressing the CTRL-D. Unlike write, the system waits for the CTRL-D, regardless of the message's length, before transmitting it to everyone currently logged in. A typical message from wall might look like Message from manager console EMERGENCYI! We're 95% full. Please delete any junk files or move files you don't need right now to a flexible disk. ~ug@stions for Using write and wall Use write and wall with a certain amount of discretion. Ideally, these commands should only be used to communicate vital information, as in the case of the system in danger of becoming Introduction to FOR:PRO 2-34 10/83 USING FOR:PRO COMMANDS overloaded, or if a shared taken offline for servicing. resource, such as a printer, must be It is a good practice to restrict use of the wall command to the manager and root accounts. Since your messages are transmitted as you type them, they are displayed in the middle of whatever the recipient is currently viewing on the screen. Although the messages are only temporary, it appears as though the message text has been written into the recipient's file, particularly if the recipient is running an application. However, these messages are nondestructive. The recipient need only clear the screen and return to the file to see that the message has not become part of the file and has not disturbed anything. You may want to put the text of the message into a temporary file so you can edit it before sending it. To do this, use ed filename or cat filename to put the text into a file, then edit the text using ed. Send the message using this syntax: or The < symbol directs the text of fil~ to the indicated FOR:PRO command, for example, wall or write. Using write Like a Telepho~: You can carryon a two-way conversation with another user via write. For example, User issues the write command and sends a message to User 2 without pressing CTRL-D. User 2 invokes write and answers User l' s message. This response is promptly displayed on User 1's screen. Both users can continue sending messages in this fashion, until they both press CTRL-D. You should establish a protocol for carrying on two-way conversations, to ensure both users don't write to each other at the same time. When you finish writing to another user, wait for a response before writing again. End each message with a code you have both agreed upon. It is a common practice to end each message in the conversation with the letter "0" for "over." To indicate that you are going to sign off, end your final message with "00" for "over and out." 10/83 2-35 Introduction to FOR:PRO 2-36 3 Advanced Concepts This chapter describes advanced operations you may want to perform at command level. It also explains in detail more involved UNIX concepts you may have previously encountered. Among them are: • • • • • • File and directory permissions Changing file and directory ownership More about groups Changing default erase and kill characters Redirection of input and output Creating simple shell scripts PERMISSIONSIACCESS RIGHTS The methods used to keep files safe from unauthorized users have many names: file or directory permissions, access rights, user right~, and file protection rights. These terms all refer to the protection settings that can be placed on a file or directory. These settings specify what kind of access different users on the system have to that file or directory. File Permissions There are three kinds of access rights for files. Directories are a little different. (See Direct~ermissions below.) As used on the FOR:PRO operating system, these are: r Means the file can be examined or read but can I t modified or changed. w Means you can modify or write to the file. The file can also be edited or changed. x Means you can run or execute the file. Such a file contains instructions, as does a program. You can execute a shell script by simply typing its name, as long as it has "x" rights. 10/83 3-1 be Introduction to FOR:PRO ADVANCED CONCEPTS NOTE If a file is read only, you protection setting in order message asks whether you protection for the file when such a file. must override this to delete it. A want to override you try to remove For example, look at this listing, obtained by using the -1 option of the Is command: -rw-rw-r--rw-rw-r--rw-rw-r--rwxrw-r--rwxrw-r--rw-rw-r--rw-rw-r--rw-rw-rw-rw-rw-r--rwxrw-r-x laura laura laura laura laura laura laura laura laura laura 604 1926 210 42 5 1278 1578 652 114 47 Jun Jun Jun Jun Jun Jun Jun Jun Jun Jun 14 15 15 13 15 14 14 17 15 15 17:09 15:41 15:08 13:58 16:44 15: 10 16:44 16:34 16: 11 15:45 change. stuff customs ex1 fd.look logout 10ng2 new. stuff private reminder u The read, write, and execute permissions are indicated in the left' columns of the display. The first hyphen indicates an ordinary file rather than a directory. Nine possible permission slots follow, three for each class of user. Possible values for these permission slots are r, w, x, and -. They correspond to read, write, execute, and no, or null permission, respectively. (The hyphen indicates that a permission is denied.) The three classes of users on the FOR:PRO system are: user (u) Group (g) The user who created the file or now "owns" the file. The permissions for the owner are always shown first. Users can be placed in different groups on a FOR:PRO system. A group can have rights which di ffer from those of the owner and everybody else. Introduction to FOR:PRO 3-2 10/83 ADVANCED CONCEPTS Other (0) Everybody else, or the general public, is assigned a third set of rights. This is useful when you want to protect certain files from modification, but you want everyone to be able to read those files. Note that the three classes of users have single-letter abbreviations: u is user, g is group, and 0 is other. These will come in handy when you need to change a file's access rights. Directory permissions are a bit different from file permissions. Here is what the r, w, and x permissions mean when applied to directories. r Permits users contents. to list or read a directory's w Permits users to write or copy items to a directory. Thus, they can create files and directories in that directory, copy files and other directories into that directory, and remove files and directories within that directory. x Permits users to go to, or search the directory and to copy files from that directory as long as they also have read rights to that directory. Also allows users to execute programs from the directory, as long as they already know the program name. The hyphen (-) indicates the absence or denial of a permission. That is, the permission slot is set to nUll. You'll find it necessary to change the access rights on a file or directory from time to time. For example, you may want to 10/83 3-3 Introduction to FOR:PRO ADVANCED CONCEPTS make a file executable, as in the case of a shellscript, need to add or take away certain access privileges on a file or directory. It is important to remember that you the owner of a file or logged in as root or manager to access rights on a file or directory. or you may particular have to be change the To change file or directory permissions, use the chmod command. This command has a variety of arguments and options. A quick way to learn chmod is to memorize the following six letters: u user or owner (must be you!) g group (everyone else in your group) o other (everyone on group) r read permission w write permission x execute permission the system besides owner and NOTE The directory a file resides in must be writable in order to delete a file. If the file you are trying to delete is read only, but is in a writable directory, rm prints a message. If you answer y in response to it, the file is deleted. Also, if you use rm -f, it overrides the file's read only status and deletes it anyway. The chmod command uses these six letters in combination with these common operators: Meaning + Means "assign these rights to" Means "add this right to" Means "take this right away from" Introduction to FOR:PRO 3-4 10/83 ADVANCED CONCEPTS The chmod command is used in this form: filename chmod {ugo} {-+=} {rwx} You can specify more than one letter, more than one permission, and more than one filename in a single chmod command. For example, to assign all users except yourself read only rights to the file badges and payroll, you'd issue this command: chmod go=r badges payroll Of course, you would have to be the owner of both the badge and payroll files in order to change their access privileges. Another chmod example: Assume you are the user called pubs, and you want to take away write privileges from the general public (the user class other) for a file called private. This file currently has rw permissions assigned to all user classes. Here's the command line you would use: chmod o-w private You are subtracting the write privilege (w) other (0). from the user class If you issue the command Is -1 private you'd see the following display: -rw-rw-r-- 1 pubs 652 Jun 17 16:34 private Changing File/Directory Ownership (chown) When you copy a file from someone else's directory to your own, you become the owner of the copy in your directory. If another user copies a file or directory to your directory, that user will own the copy. If the permissions for the other class deny write access, you may need to use the chown command to change the ownership of that file or directory so you can modify it. 10/83 3-5 Introduction to FOR:PRO ADVANCED CONCEPTS You must be logged in as manager or root to use chown. format to change the ownership of a file or directory: Use this The name of the new. owner must be a valid existing user account name on the system. The filename can be a pathname, if necessary. MORE ABOUT GROUPS Users on a Fortune system can be organized into groups for purposes of restricting access to certain files or directories. All users on the system belong to the group called users by default. Assuming you belong to the group called users, any file or directory created by you can be assigned a special set of access rights for the rest of the user accounts on the system. Thus, any other account belonging to the users group can have special access to your files and directories as discussed previously. Conversely, if you don't want any other user accounts to access your files and directories, simply use chmod to take all access rights away from the group class. To find out what groups exist on your system and which users belong to each group, type cat /etc/group You may want to create another group for yourself and other people in your department to use. This makes it easier to control access to information that you want only certain people to use. On a FOR: PRO system, the best way to assign special access rights to certain people is to put those users into a group. Remember however, that a user account can only belong to one group at a time. The procedures for creating and modifying user groups are discussed in detail in Under:.§.tamL.1ouLLortul1Jl._~y..§.tem. You can accomplish the same tasks from FOR:PRO level, if necessary, by modifying the /etc/group and /etc/passwd files. Introduction to FOR:PRO 3-6 10/83 ADVANCED CONCEPTS Like the chown command, chgrp can only be accessed by the manager or root accounts. Its purpose is to change the group ownership of You may want to do this when you need to files and directories. turn over files to a different group of users. For example, if the Acctg group decides to turn over all the files in the back.order directory to the Audit group, you'd have to change the ownership of the directory. Use this format of the command: chgrp new~rogQ {filename } QirectorY...name CHANGING ERASE AND KILL CHARACTERS The default erase and kill characters were discussed in Chapter 1. Should you need to change either or both of them, use the stty command, followed by the word erase or kill, and the new character sequence you want to use. stty kill ne!:hkill.....ghill: You can find out what the default settings are for the erase and kill characters by typing stty everything This displays the various settings for your particular terminal, most of which may not mean much at first glance. If you look at the bottom two lines, you'll see listings for the current erase and kill characters. The defaults are: erase: AH kill: AX (CTRL-H) (CTRL-X) In this case the nAn means CTRL. 10/83 3-7 Introduction to FOR:PRO ADVANCED CONCEPTS Sometimes you may accidentally use cat on a long file instead of more. If you want to stop a screen display, type CTRL-S. To restart the display, type CTRL-Q. This is also known as XON/XOFF protocol, or flow control. REDIRECTION OF INPUT AND OUTPUT Command input and/or output can be redirected. You might redirect output so it can be used by another command. Input can come from a file, rather than the keyboard, as it normally does. This section describes how redirection can be done. Redirection of-QutQY1 Output produced by FOR:PRO commands is normally sent to the screen, which is called the standard output. When you run the who command, for example, the resulting list of who is on the system appears on your screen. However, if you want to send the listing to a file, you can redirect the output with a "greater than" sign (» followed by the destination filename. For example, who > whofile directs the output from the who command into a file named whofile in the current directory. The output is not displayed on the screen. If whofile already exists, its contents will be replaced by the output from the who command. If you wish to append a command's output to an existing file rather than overwriting the current contents, use two greater than signs (»). For example, you might start a list of thoughts for future reference with the following commands: date > ideas echo 'With the echo command and redirection of output I can easily jot down ideas in a file for future reference.' » ideas The date> ideas command line creates a file named ideas and places its output, the current date, within it. The echo command Introduction to FOR:PRO 3-8 10/83 ADVANCED CONCEPTS appends the first idea to the file. (If you follow the echo command with multiple lines of text as shown here, you will receive a > prompt at the start of the second and third lines, indicating that the shell is waiting for the rest of the command to be entered.) Additional entries could be appended similarly. For example, date » ideas echo 'I should keep a list of things I need to do in a separate file' » ideas Programs often expect input from the keyboard, called the standard Just as output can be redirected, input can be redirected so that it comes from a file or another device rather than from the keyboard. input. Suppose, for example, that you have written a novel, the chapters of which are stored in 34 files. You now decide to change the main characters' names from Paul, Mary, Jack, and Susan to Pierre, Marilyn, Jacques, and Victoria. Rather than entering the necessary editing commands 34 times while editing the 34 files, you can store the required commands in a file and use the file as input to the editor. This file, which might be called edits, could contain the following: 1,$s/Paul/Pierre/g 1,$s/Hary/Harilyn/g 1,$s/Jack/Jacques/g 1,$s/Susan/Victoria/g w q The first four of these commands tell the ed editor to start at the first line of the file being edited and to continue to the bottom line ($), and for each line in that range to substitute the second name shown for the first name. The g, which stands for global, changes every occurrence of the indicated string throughout the line. Without the g, only the first occurrence on each line would be replaced. 10/83 3-9 Introduction to FOR: PRO ADVANCED CONCEPTS Once the necessary editing commands have been stored in the file edits, you can change the names in Chapter 1 of the novel, which is contained in the file ch.01, by typing ed ch.01 < edits The result is exactly the same as if you had typed ed ch.01 and then proceeded to type the lines contained in edits from your keyboard. It would be tedious to make changes in all the files with the method just described j you would have to type 34 command lines. Bourne shell programs by default take input from the keyboard, but you can simplify the editing process by sending these 34 commands to the shell from a file instead. First, put the names of the files to be edited into a file named shell. input using the command Is ch.* > shell.input The shell.input file now contains 34 lines, each of which is the filename of one of the chapters. Edit shell.input using the following commands: ed shell.input 1,$srled 1 < editsl 1 ,$s/$1 w q The second of these commands tells the editor to insert the string Similarly, the next command fled " at the start of each line. instructs the editor to place the string " < edits" at the end of each line. When surrounded by slashes, the $ represents the end of a line just as the ~ represents the start of a line. After editing with these commands, the lines of shell.input look like this ed ch.01 ed ch.02 < edits < edits and so on. Introduction to FOR:PRO 3-10 10/83 ADVANCED CONCEPTS To initiate a shell that will take its input from the file you just created, shell. input, use this command: sh < shell. input A new Bourne shell is started up by this command. When the shell finishes executing the commands in shell. input it will die, and the original shell will then give a prompt indicating it is ready for another instruction. Instead of creating a new shell that takes its input from a file like shell. input, you can instruct the original shell to directly execute the commands in the file. To do so, you would first make the file executable by typing chmod +x shell. input Then, simply typing the filename shell.input would cause the commands in shell. input to be executed. Command files like shell.input are called shellscripts, and are useful when a sequence of commands must be executed numerous times. For example, FOR:PRO uses the shellscript named rc to perform part of the system start-up procedure every time you power up the Fortune system. See Mor~_On~hellscri~ in this section. PIPES In Chapter 1, you saw how a pipe Cl) could be used to send a long directory listing through the more command. A pipe connects one program's output channel to another program's input channel. The result is the same as redirecting the first program's output to a file, and then redirecting the second program's input from that file, but the pipe process is more efficient. Suppose, for example, that you want to examine a long listing of all files on your system. The command Is -lR / 10/83 3-11 Introduction to FOR:PRO ADVANCED CONCEPTS produces the desired listing, but it flashes by too quickly to be read. To make the listing appear a screenful at a time, pipe i t through more Is -IR / more Similarly, the listing could be sent to the printer by piping it through lpr Is -IR / I Ipr Mul tiple pipes are quite useful. For example, suppose you have a list of names and phone numbers in a file named phone. The list is in no particular order because new names have been appended as they became available. Thomas Decatur Barbara Danforth Paula Pearson Bill Brodsky 400-846-2412 200-347-9825 800-968-2135 200-845-7623 To produce a printed listing with last names in alphabetical order, including the date of the printout, a suitable heading, and line numbers, you can use the following command: sort +1 -2 phone cat -n I pr -h "Phone Numbers" I Ipr The +1 -2 sequence in the sort indicates that the second field of each line in the phone file (the last name field) should be used for sorting (see Chapter 2 for more information on how sort works). The first pipe symbol sends the output from the sort command to cat, which adds line numbers when used with the -n option. The pr command divides its input into pages, putting a heading at the top of each page which includes the date and time, the input filename (if any), and a page number. In this case, there is no input filename, because the input comes from a pipe rather than a file, so the -h (for "header") option has been used to include the character string "Phone Numbers" in the heading. The output from pr is piped into Ipr, which prints the text. The result is shown on the next page. Introduction to FOR:PRO 3-12 10/83 ADVANCED CONCEPTS Sep 1 12:16 1983 2 3 4 Phone Numbers Page 1 Bill Brodsky Barbara Danforth Thomas Decatur Paula Pearson 200-845-7623 200-347-9825 400-846-2412 800-968-2135 Shellscripts have many uses and are great timesavers. Mounting and unmounting disks are common operations, and are particularly suited to shellscripts. Earlier in Chapter 1, you saw an example of a shellscript that performed those disk-handling operations. Suppose you used the ed editor or the cat command to put the following command lines in a file called mu: mount Idev/fd02 If 11 If cd If pwd cd umount Idev/fd02 You could then command execute this series of commands by typing the sh mu Alternatively, you could make the command file executable (chmod +x mu) and then simply type its name, mu, at shell level. Now let's get fancy. Suppose you want to make a shellscript that will automatically back up all the files in your home directory to a flexible disk. This is probably a good idea because you want to back up your directory on a daily basis anyway. 10/83 3-13 Introduction to FOR:PRO ADVANCED CONCEPTS cd $HOME mount Idev/fd02 If cp -rtV * If 11 If echo 'The Backup Is Now Complete.' cd $HOME umount Idev/fd02 echo 'Please Remove Your Disk.' echo 'Bye!' Using the $HOME variable is a precaution to make sure you are in your home directory. The echo command I ines let you know what I s going on by displaying the text enclosed in quotes. Suppose you want to write a shellscript that prints files with certain printer attributes, like a different pitch or vertical spacing. It would be helpful to have a way of specifying the name of a file to be printed each time you run the shellscript. Using variables within a shell script gives you just that flexibility. Variables are indicated by a dollar sign $ followed by a number, or a string. For example, $1, $2, and $ans are typical shell variables. Here I s an example of a shellscript (called print) that uses a variable: lpr ,+P10 +V8 $1 To use this shellscript, type its name, followed by the name of the file to be printed, as in print chapter1.o (Remember that the file must be executable to be used this way. make it executable, type chmod +x print.) To When writing shellscripts, you may want to give yourself or other users the option of doing some particular action. For example, when mounting a disk, you might ask if the user wants to see what's on the flexible disk. In this case, you would have to perform one action if they wanted a l i s t , and another if Introduction to FOR:PRO 3-14 10/83 ADVANCtLJ LUNLtt'l~ they did not. That if ..• then •.• else, can be taken in calls for the use of a conditional, or statement. Often, the two alternate paths that a conditional statement are called branches, indicating that the program can branch to one section or another, depending on some particular condition. For example, if you ask a question and the user answers "yes," the program takes the then branch but if the user answers "no," the else branch is taken instead. Here is an example of using a conditional in a simple shellscript: mount Idev/fd02 If echo Disk is Not Hounted echo "Do you want to see what's on the flexible disk? (yes or no)" read ans if test "$ans" = "yes" then Is -las If I more else echo "Bye!" fi exit The test line checks the value of the $ans variable. If it is yes, the list operation is performed, if not, the word "Byel" is echoed. The test operation has many options which you can read about in many commercially recommended below. To learn books: more about S.R. Bourne. available UNIX shellscripts, Th~~ni~~~~~em: texts, consult some one of of which the are following Addison-Wesley Publishing Co., 1982. McGilton, H., Morgan, R. McGraw-Hill Book Co., 1983. 10/83 3-15 Introduction to FOR:PRO 3-16 4 Single-User Operating System The three flexible disks labeled FOR:PRO Single-User Operating System are packaged with FO~.lJIstallation_Instructio!l§.. They are distinguishable from the other command and utility sets available on the Fortune System: IlevelJ!.P.ment Utilities, and Langua~ DevelQQmgnt Tools. You may also have a multiuser operating system master disk which allows you to upgrade your system from one to multiple users. This chapter summarizes the commands and system files directories on the single-user operating system disks. and SYSTEM FILES AND DIRECTORIES The / directory, the root of the hard disk file system, also contains some special files. This section briefly summarizes the purpose of the files and directories located in the root directory. If you list the contents of the root directory using the command Is -las, you will see something like the following: /: total 126 drwxrwxr-x14 drwxrwxr-x14 -r--r--r-- 2 drwxrwxr-x 2 drwxr-xr-x 2 drwxrwxr-x 3 drwxrwxrwx 2 drwxrwxr-x 2 2 drwxrwxrwx 2 1 drwxrwxrwx 9 drwxr-xr-x 2 drwxrwxrwx 2 drwxrwxr-x 4 110 -r--r--r-- 2 1 drwxrwxr-x 9 10/83 root root bin root root root root bin root root bin root bin bin root 304 304 90 832 704 1024 64 32 2048 144 64 112 80 112580 144 4-1 Jul Jul May Jul Jul Aug Jul Jun Jun Jul Jun Aug Aug Jun Jul 13 16: 19 13 9 7 22 11 8 27 27 11 27 11 4 27 7 16: 19 20:30 16:30 10:42 09:25 17:08 11:06 12: 19 13:27 11 : 10 11: 04 14:45 12:22 16:28 . profile bin dev etc f h lost+found m sa tmp u unix usr Introduction to FOR:PRO SINGLE-USER OPERATING SYSTEM Remember that the contents of the root directory on your system may be somewhat different, especially if you have the multiuser operating system installed. In this list of entries, the first number you see indicates the number of i-nodes taken up by the file or directory. An i-node describes a file and points to the actual physical disk blocks that make up the file. There is at least one i-node for each file and directory on the system. A "d" in the column immediately to the right of the i-node number indicates that the entry is a directory. A hyphen (-) indicates that the entry is a file. An executable file contains information that can be interpreted by the shell as command input. Such files are sometimes called "command files" on other systems, because they contain commands that can be executed by the operating system. You will notice that certain executable files and commands in /bin and /etc have a Any program or file so special mode known as set user id. designated has an "s" instead of an "x" in the owner rights slot. This means that when users execute these files, the user ID is set equal to that of the actual owner of the file. This allows users other than root to use commands that must create files in directories to which they normally would not have access rights. The set user id mode is important for such processes as login, date, mail, and mkdir. The concept of a link is really a system-level way of saving space by having several command names linked to a single copy of the actual binary source for that command. Commands that are 1 inked use the same source but sometimes produce a slightly different result. Examples are 11, If, lr, and Is, all of which list the contents of a directory, but in different ways. You can see whether a command is linked by looking at the first number to the right of all the access and protection rights. For most entries, a 1 appears in this column. However, for files like 11, If, lr, and Is, the number is greater than 1, indicating that there are several different versions of the same command. Introduction to FOR:PRO 4-2 10/83 SINGLE-USER OPERATING SYSTEM Here's what the major directories listed in the root (I) directory are used for. 10/83 bin Contains the binary source code for most of the FOR:PRO commands on the system. These commands are accessible to all users on the system. dey Contains all the special device files needed by the operating system. Each peripheral device attached to the system is defined as a file, and has an entry in the Idev directory. The contents of this directory vary depending on the devices you have attached to your particular system. etc Contains those FOR :PRO commands and special files which can only be accessed by manager or root. There are some exceptions to this which are discussed below. letc also contains many crucial system files and tables which you can look at, but should not modify unless you know what you are doing. f The root node (directory) of the flexible disk file system. The If directory is used by the system in order to transfer information between the file system on the flexible disk and a file system on the hard disk. h Top-level directory for the hard disk-based file system. Like If, its function is to provide a way for the operating system to reference the contents of the hard disk by treaating it as a directory. sa Contains important files which are needed to reboot the system. These files are /sa/boot and /sa/reconf. The "sa" stands for stand alone because the programs in sa are meant to run without the aid of the operating system. tmp This is a very important directory used by many system processes to store temporary 4-3 Introduction to FOR:PRO SINGLE-USER OPERATING SYSTEM information. It is a "scratch" area on the disk where information may be temporarily stored before it is written or copied to some other location. Don't ever delete this directory. u This is the master directory for all user accounts. All the login accounts on the system which were created by the newuser process are 1 is ted in lu. (See .!In.951.rst an.1LLQ..YL_.Fortu~ System for more information about the newuser process.) unix The operating system itself -- don't touch this one! usr Contains programs for users, including macros, user libraries, and other development utilities. The Ibin DirectoLY Many of the commands you will use on a routine basis are stored in the Ibin directory. The word bin stands for binary. Most files in the Ibin directory are binary files, so don't try to use cat to display them unless you use the -v option. In FOR:PRO, Ibin contains the following commands on the single-user operating system set of disks: cat date echo 11 chmod dd ed lr mkdir pwd sh du login ps test who mv rm sync expr passwd sort true write cp df If Is rmdir cmp kill pr stty wall Most of the entries in letc are programs used by the system to do routine operations. For example, important system startup and shutdown programs are stored here. You must be logged in as manager or root to access some of these files and commands (for example, the passwd file). In this way, the files and commands that are crucial to the proper operation of the system are protected from unauthorized users. Introduction to FOR:PRO 4-4 10/83 SINGLE-USER OPERATING SYSTEM The chgrp command, which changes the group ownership of directories or files, can only be used by the manager. You can't change the ownership of a file unless you are logged in as manager or root. When You ~eed These Commands You may find it necessary to use some of the commands in letc and modify some of the files there if you need to reboot the system, or install a new operating system. For example, when starting up the system, you may experience an unsuccessful file check. You would then have to use the letc/fsck program to manually check the file system. You might also want to know what's in the special files that reside in this directory in case you need to modify them or back them up. The letc directory contains the following special files: 10/83 devtype Lists all peripheral devices the system. Specifies port number), baud rate, category device, printer message port location description. disk Contains configuration blocks for devices. disktab A list of all the disk drives available on potential Fortune systems. fstab The file system table which indicates the name of the device on which the file system resides. group Lists all the user groups defined for the system. By default, there are groups defined for sys, bin, daemon, and users. The first field is the group name, the second, the group password, the third, the group ID, and the last, a list of all the accounts that belong to that group. 4-5 attached to number (tty and type of and optional disk Introduction to FOR:PRO SINGLE-USER OPERATING SYSTEM motd Stands for message of the day. put in this file any message You can that you want all users to see when they log onto the system. mtab A table of all currently mounted devices. Useful when you want to know whether a flexible disk is really mounted or not. If a disk is mounted, you might see something like this when you type cat /etc/mtab Iffd02 This means a flexible disk is mounted on drive 02, with a root directory of If. passwd Contains a list of all the user accounts on the system, including default users like root and manager. printcap Contains defini tions for all supported printers on Fortune systems. These definitions are used by the printer control programs. profile A general purpose profile file which is executed prior to your own .profile file, if you have one in your home directory. At this release, /etc/profile defines print spooler defaults for printing files via the global menu "Print a File" option. It also defines the default language as "English," LANGUAGE=EN, and terminals to XON/XOFF mode. termcap sets Fortune The file used by FOR:PRO to interpret the in formation coming from your particul ar terminal. It contains data on nearly every terminal type supported by UNIX. ttys Defines the baud rate, login setting, and tty number for each port available on the system. Introduction to FOR:PRO 4-6 10/83 SINGLE-USER OPERATING SYSTEM A table of the device names and tty numbers that are connected to your system. There should be one entry here for each port listed in the ttys file. ttytype The fetc directory also contains the following commands: chgrp chown disk format getty init mkconf mkfs mknod pstat rc.cold rc.passl rc.passl.F1 rc.passl.H rc.pass2.run reboot setnswap surf test umount utmp boot chlog config dskselect fsck halt login.help mkdevs mklost+found mount rc rc.hd rc.passl.O rc.passl.F2 rc.pass2 rdconf setdt shutdown uconf update SINGLE-USER OPERATING SYSTEM CONTENTS This section is an alphabetical summary of all the commands available on the single-user operating system. If you have either or both of the other command sets installed on your system, you will notice that this list doesn't show some of the commands you may be accustomed to using. The (f) indicates the item is a text file, a (c) indicates it is a command, (sf) indicates it is a special system file, (sc) indicates it is a system administration level command, and (m) indicates it is a miscellaneous routine or table. basename (c) bootflop.conf (m) cd (c) chmod (c) 10/83 boot (c) capture (c) chgrp (c) chown (c) 4-7 bootcp (sc) cat (c) chlog (c) cmp (c) Introduction to FOR:PRO SINGLE-USER OPERATING SYSTEM config (sf) cp (c) cp.AM (sf) date (c) dd (c) devtype (f) df (c) disk (f) diskconf (f) disktab (f) du (c) dskselect (sc) dtinit (c) echo (c) ed (c) expr (c) filsys (f) find (c) flop.conf (m) format (sc) fsck (sc) fsck.AM (sf) fstab (f) getty (c) genstring (c) init (sc) group (f) kill (c) I f (c) halt (c) 11 (c) login (c) login. help (sf) Ipd (sc) Ipdun (sc) Ipf (sc) Ipdun (sc) 1 pq (c) Ipr (c) Iprm (c) lr (c) Is (c) menu (c) mid (sc) mkconf (sc) mkdevs (c) mkdir (c) mkfs (c) mklost+found (sc) mknod (sc) more (c) mknod (sc) more (c) motd (f) mount (sc) newgrp (c) mtab (f) mv (c) page (c) passwd (c) nice (c) pr (c) ps (c) profile (f) pstat (sc) pwac (c) pwd (c) rc (c) printstring (c) rc.cold (sf) rc.hd (sf) rc.pass1 (sf) rc.pass1.0 (sf) rc.pass1.F1 (sf) rc.pass1.F2 (sf) rc.pass1.H (sf) rc.pass2 (sf) rc. real (sf) rdconf (sc) rm (c) reboot (sc) reconf (sc) rmdir (c) setdt (sc) setnswap (sc) sleep (c) sh (c) shutdown (sc) sort (c) stty (c) tee (c) surf test (c) sync (sc) termcap (f) test (c) trans (f) true (c) tty (c) ttys (f) ttytype (f) uconf (sc) umount (c) update (sc) utmp (f) wall (c) what (c) whl (f) who (c) write (c) Introduction to FOR:PRO 4-8 10/83 Appendix A: The New Print Spooler A new version of the print spooler is included with the 1.7 operating system. This print spooler resides in the directory /usr/bin, instead of in /usr/ucb as in the previous release. Several new utilities are associated with the print spooler. Whether you print from the menus or use Ipr from FOR: PRO command level, you should read this information. WHAT'S IN THIS APPENDIX This appendix describes the following: • The new version of Ipr and its associated utilities • The changes to Ipr that affect print formatting options • The impact of the new spooler on various software applications • Related FOR:PRO programs and files made obsolete by the release of THE NEW Ipr The new Ipr command brings increased functions and some changes from the previous version, making it necessary for some users to change the way they use their printers. For example, software features are now available to do the following from the FOR: PRO command level, not just from the Fortune:Word menus: • Temporarily stop and restart a print job so you can change the paper or ribbon. • Change the pitch, lines per inch, and page size on a per print job basis, using Ipr options. • Run more than one printer on your system. can logically number them so you can specific printers. 10/83 A-1 In addition, you direct jobs to Introduction to FOR:PRO • Change the order in which print jobs will be printed by manipulating print queues. • Control individual print job formats by writing customized shellscripts, by setting variables in user .profile files. Alternatively, the system manager which can set up printer defaults for everyone on the system. The latter is most useful when people do thei r printing from the System Utilities menu. lpr and Related Commands The components of the print spooler interface include: • lpr Sends files to a designated printer with optional formatting. • lprm Removes one or more files from a designated print queue. • lpq Displays the status of one or more print queues. • lpmv Changes the order in which jobs for a given printer will be printed. • lpdun Stops and restarts a print job for printer servicing, or adding/changing paper or ribbon. Also sets new defaults for print page format. • pr Displays a file on the screen, placing page numbers at the top of each unit of 66 lines. Output from pr can be piped to lpr, if page numbers are desired on the printout. Per Print Session Formatting New features in the current lpr enable you to control the format of a print job via software on a per print job basis. This makes it possible for individual users to print documents according to their own specifications without interfering with one another. It is no longer possible to set print format parameters via hardware switches and have the lpr software recognize them. Users who Introduction to FOR:PRO A-2 10/83 previously controlled settings like pitch, lines per inch, page size, and baud rate by physically setting switches on the printer should note that the FOR:PRO spooler will not look at these hardware settings. Instead, such changes in pitch, lines per inch, and so forth, must be done by using options of the lpr command, or by modifying the system-supplied defaults for print jobs. For users printing from the System Utilities menu, system-supplied defaults can be found in the file /etc/profile, in a variable called LPRFLAGS. This is explained below. Users of lpr from command level will find that print job defaults are set by lpdun and lpr, and can be changed on a per user and per print job basis by issuing the appropriate options on the command line. Print Job Defaults in LPRFLAGS A file called /etc/profile is supplied with the FOR:PRO operating system. Currently, this file is only executed by the menu shell and is therefore effective only for menu system users. However, users can include its settings in their .profile files. It can be used to set up defaults for banners, pitch, lines per inch, page size, and line width for all print jobs queued through the print option of the System Utilities menu. When at the Bourne shell level, users who log into the menu shell can still override these settings on a per print job basis by using the proper lpr and lpdun options. As delivered, LPRFLAGS in /etc/profile contains the following default printer setting for global menu users: -h This means that all printouts will have no header (banner) page, unless otherwise specified. This is a change from the previous system in which banners were the default. The change was made speci fically to prevent paper waste in single-user systems where there is little need to identify printouts by user name. To change this default, you must edit the file and remove -h from the LPRFLAGS line. Use ed (or vi, if you have Development Utilities) to do this. You can also delete the LPRFLAGS line entirely if you like. 10/83 A-3 Introduction to FOR:PRO Users of the "Print" option on the System Utilities menu will get their print job defaults from the LPRFLAGS variable in /etc/profile. This is true except for users who have .profile files and who also use the menus. LPRFLAGS is ignored by lpr when used from the Bourne shell level. Only the menu shell uses LPRFLAGS with lpr. However, any other lpr-related setting in a user's .profile file will override the settings in /etc/profile, since the user's .profile file is executed after /etc/profile. Defaults and How to Override Them The following table shows how printer settings correspond to options of lpr and lpdun. To set these options for people using the global menus, include the proper option in LPRFLAGS in /etc/profile. Setting lpdun/lpr Option Default Value Line Length -tLnn (lpr) -cnn (lpdun) 132 Lines Per Page (Form Length) -Fnn (lpr) -Inn (lpdun) 66 Left Margin +Lnn (lpr) 0 Pitch +Pnn (lpr) 10 Lines Per Inch (Vertical Pitch) +Vnn (lpr) 6 NOTE Note that the - options must appear before the + options on a command line, and in LPRFLAGS. This is because any - options that appear after + options are treated as filenames. You can check the lpdun defaults by typing lpdun -z Introduction to FOR:PRO A-4 10/83 Changing the Vertical Pitch If you use the +V option to change vertical pitch, it will slightly adjust the size of a page. You will have to adjust the top-of-form after the job with the changed pitch size is completed. Note also that 10 pitch is really 9.6, so there are really 9.6 lines per inch instead of 10. This means the number of lines per page is really 105.6, not 105 or 106. You will notice a slight increase in page size on long print jobs when printing with +V10. Length ~hangin&-1ine The default line length is 132 characters. print job basis, use Ipr -tLnn To change it on a per filename The -t option guarantees the line will be truncated at nn characters. To change the default line length on a global basis, use the -c option of Ipdun Ipdun -c nn Indiyidual Settings for Print Jobs Print job settings can be altered on a per print job basis by each individual user. System defaults can be overriden by shellscripts that print files, or by customizing user .profile files. For example, the following one-line shellscript prints files with a horizontal pitch of 12 characters per inch, and a vertical pitch of 8 lines per inch: Ipr +P12 +V8 $1 By making this shellscript executable (chmod 755 filename), you could print files according to these settings by simply typing the name of the shellscript followed by the name of the file to be printed. For example, if the shellscript containing the above Ipr line were named mpr, you could print files wi th it using this command line: mpr filename 10/83 A-5 Introduction to FOR:PRO You could also put a line similar to this one .profile file: in your mpr='lpr -b Greg +L5 $1' Every time you type mpr filename from the Bourne shell, your printouts will have a banner name, like Greg in this case, and an adjusted left margin. Notice that the variable name used here is mpr and not lpr. It is advised that you do not use lpr as a name for shellscripts or aliases, as this can only cause confusion. By using other names you can make multiple lpr command lines that perform different functions. NOTE For users with login shells set to /bin/menu, your .profile file (if you have one) is executed after the /etc/profile file is read. Therefore, settings in your .profile file will override those in /etc/profile. Since /etc/profile is only read by the menu shell, you can incorporate its contents in your login environment with this command . /etc/profile as the first line of your .profile file. Multiple Printers and Print Queues The FOR:PRO spooler and Device Connection Menus allow you to define and make use of multiple printers per system. The lpq, lpmv, and lprm utili ties allow you to look at, manipulate entries in, and remove entries from multiple print queues. For Fortune:Word Users In order to use Fortune:Word 1.0 at Release 1.7, it must be upgraded using the 1.7 Upgrade disk. Users who are familiar with version 1.0 of Fortune:Word will recognize that much of the printer Introduction to FOR:PRO A-6 10/83 functionality available to them in Fortune:Word is now available at the FOR: PRO level v ia the new lpr. In Fortune :Word, the printer control menu can be used to set defaults on a per print job basis by changing the prototype file used for a particular print job. In order to use Multiplan on 1.7, it must be upgraded using the 1.7 Upgrade disk. The program mp.printer, which was formerly used to set printer defaults for Multiplan, has been replaced by a program called mpinit. This program defines the page size, pitch, number of lines per inch, and so forth for Multiplan print jobs. It is run automatically when you upgrade the Multiplan master disk using the 1.7 Upgrade disk, or when you use the Upgrade disk to mpinit can be run by the manager restore your system backup. account whenever the print job characteristics for Multiplan print jobs need to be changed. It is located in the directory usr/bin. In future releases of Multiplan, this program will be replaced by a printer menu similar to that of Fortune:Word. Users of BAS applications should note that /dev/lp is linked by default to /dev/tty01. If you have mul tiple printers on your system and want to print BAS application files on a printer attached to a port other than tty01, make changes to the IPL files as discussed in Technical Tip 1.1, MultiQle Printers within BASIC. (See also Appendix E of the Business BASIC manual.) NOTE Since BAS does not use Ipr, if you use the same printer for both BAS and FOR:PRO-level printing, output from both may appear intermixed on the same printer. In this case, use Ipdun to stop the Ipr-level print job, then reprint the pages after the BAS job is finished. The BAS job will have to be restarted if clean output is desired. The same problem may occur if two or more people are printing BAS jobs at the same time. 10/83 A-7 Introduction to FOR:PRO Related Print Spooler Files The following files are also related to the new print spooler on the single-user operating system: /etc/profile For users of global menu system. /etc/devtype Defines all devices, including printers. /devllp Used by BAS applications only. /etc/*.whl * stands for any supported printer type. Files of this nature are used for alternate character sets. /etc/printcap Defines printer control characteristics for all supported printers. Controlling Print Spooler Priority As delivered at 1.7, the print spooler is assigned the standard priority (0). The default number of pages saved is 2. To change either of these default settings, use these options of Ipdun: -mnn -Pnn Change number of pages to save Change priority of print spooler In the -m option, the nn argument specifies how many pages are to be kept in memory for reprinting if it is necessary to restart a print job several pages back from the one at which printing halted. The -P option takes an nn argument that can have a value of -20 to +20. The highest priority setting is -20, which devotes maximum system resources to the print spooler. The lowest priority setting is +20, which will improve interactive response, but slow printing down. (On very heavily loaded systems, low priority jobs may never run, so use caution when lowering priorities.) Introduction to FOR:PRO A-8 10/83 If you used Fortune:Word, Multiplan, following programs are now obsolete: or other applications, the letc/ttype lusr/bin/def.printer lusr/bin/mp.printer lusr/bin/lpint lusr/lib/lpfc lusr/bin/on.printer lusr/bin/off.printer lusr/ucb/lpr (*) lusr/ucb/lprm (*) lusr/ucb/lpq (*) Items marked with an asterisk (*) have been moved to lusr/bin as of this FOR:PRO release. 10/83 A-9 Introduction to FOR:PRO A-10 SINGLE,USER OPERATING SYSTEM MAN PAGES 2 Part 2 contains reference documentation for the FOR:PRO single-user operating system. It is provided in the form of MAN pages (manual pages) in the same format as the Bell Laboratories' IDi.lX Programmer's Manual. The MAN pages provide Fortune-specif ic reference material for all commands and system level files available on the single-user operating system set of disks. ORGANIZATION OF THE MAN PAGES UNIX MAN pages are traditionally divided into eight sections. This subset of the FOR:PRO MAN pages contains entries from Sections 1, 4, 5, and 8 and are descr ibed below. All sections appear in the FOR:PRO Programmer's Manual, which is included with the Development utilities software. Refer to the header on the page for correlation to UNIX MAN pages. Section Description 1 Commands (Chapter 1 in this manual.) References commands invoked directly from the shell, including the most commonly used commands. 4 Special Files (Chapter 2 in this manual.) Discusses the special device files contained in the directory /dev. These files describe peripheral devices connected to the Fortune system. 5 File Formats and Conventions (Chapter 3 in this manual.) Describes important system files used by a number of system programs. 8 System Administration Commands (Chapter 4 in this manual.) Explains commands used for system administration. THE MAN PAGE FORMAT All MAN pages follow a specific format. at least these three sections: NAME Most MAN page entries have Gives the command name and a description of its use. ii SYNOPSIS Presents the syntax of the particular command, all its options, and other possible arguments. DESCRIPTION Gives a detailed description of the command and how it interprets its arguments. NOTE In the SYNOPSIS section of certain commands, more than one command option may be listed. For example, the Is command has many options, as this syntax indicates: Is [-abcCdFgilmgrRstuxl] Each character within the brackets is an option of the Is command. You may use one, many, or none of the options on the same command line. However, make sure the first option you type is immediately preceded by a hyphen, as in Is -1 Some entries have additional sections that include the following: OPTIONS Command options are discussed in detail here. EXAMPLES Gives one or more examples of the command. FILES Names any files built into the command. SEE ALSO Refers you to commands related to the one described. DIAGNOSTICS Discusses diagnostics you may receive when using the command. WARNINGS Indicates problem areas and gives precautions. LIMITATIONS Lists known bugs and design limitations. iii iv BASENAME (1) Fortune Systems BASENAME (1) NAME basename - strip filename affixes SYNOPSIS basename string [suffixJ DESCRIPTION Basename deletes any prefix ending in II' and the suffix, if present in string, from string, and prints the result on the standard output. It is normally used inside substitution marks' , in shell procedures. This shell procedure invoked with the argument /usr/src/cmd/cat. c compiles the named file and moves the output to cat in the current directory: cc $1 mv a.out 'basename $1 .c' SEE ALSO sh(l) 9/83 1-1 FOR:PRO CAPTURE(1) Fortune Systems CAPTURE (1) NAME capture - allows automatic capture of certain key system information SYNOPSIS ca pture [fps J DESCRIPTION Capture is a shell-script which allows automatic capture of certain key system information to a diskette, a listing, or interactively to the screen. This information is intended to assist in problem reporting and trapping for software products. Capture gathers 'what' strings, directory listings, the contents of certain files, and other system information. It then dumps this data to a diskette or a listing which may be included with a problem report to provide information regarding the environment in which the problem occurred. Alternatively, capture has an interactive mode in which the user can select items of information items of information to be displayed on the screen, one at a time. Progress and information messages are sent to the screen. OPTIONS f sends the information to a flexible diskette. The user is asked whether to continue with the process ('y' to continue the process, 'n' to end the process). The diskette is formatted and the information from capture is written. The user is notified upon completion. p sends the information to a printer. s displays the information on the screen. Build a two digit code of (col)(row) from the displayed chart. Example: "2g". Reply to "«STOPPED»". Use "q" to quit. FILES lusrlbinlcapture shell script lusr/lib/capture_menu contains the menu for the screen option lusr/lib/capture_ inst displays instructions DIAGNOSTICS If no option is specified when capture is invoked, the following is disp!~ed: Usage: capture floppy or capture printer or capture screen FOR:PRO 1-2 9/83 Fortune Systems CAT(1) CAT(1) NAME cat - concatenate and print SYNOPSIS cat [-nJ [-5] [-u] [-vJ file ... DESCRIPTION Cat reads each file in sequence and writes it on the standard output. If no input file is given, or if the argument '-' is encountered, cat reads from the standard input file. Output is buffered in 1024-byte blocks unless the standard output is a terminal, in which case it is line buffered. OPTIONS -n Causes the output lines to be numbered sequentially from 1. Giving -b with -n causes numbers to be onutted from blank lines. -5 Causes the output to be single spaced. -u Causes the output to be completely unbuffered. -v Causes non-printing characters to be printed in a visible way. Control characters print like "X for control-x; the delete character (octal 0177) prints as "? Non-ascii characters (with the high bit set) are printed as M- (for meta) followed by the character of the low 7 bits. A -e option can be given with -v and causes the ends of lines to be followed by t~e character '$'; the -t option with -v causes tabs to be printed as 1. EXAMPLES cat file prints the file cat file1 file2 > file3 concatenates the first two files and places the result in the third SEE ALSO cp(l), ex(l), more(l), pr(l), tail(1). LIMITATIONS Beware of 'cat a b >a' and 'cat a b >b', which destroy the input files before reading them. 9/83 1-3 FOR:PRO CO(1) Fortune Systems CO(1) NAME cd - change working directory SYNOPSIS cd directory DESCRIPTION Directory becomes the new working directory. have execute (search) permission in directory. The process must Because a new process is created to execute each command, cd would be ineffective if it were written as a norma.l command. It is therefore recognized and executed by the shells. In csh{l) you can specify a list of directories in which directory is to be sought as a subdirectory if it is not a subdirectory of the current directory; see the description of the cdpath variable in csh{l). SEE ALSO csh(l), sh{l), pwd{l), chdir(2). FOR:PRO 1-4 9/83 CHLOG(1) Fortune Systems CHLOG(1) NAME chlog - change UNIX error logging format SYNOPSIS chlog [unixJ [defaultJ [debug hexllumberJ [decimal decimalJ DESCRIPTION Chlog changes the style in which UNIX prints internal error messages. Chlog unix switches to the standard unix style of error message, while chlog default prints them in the default style of error numbers. chlog debug hexnwnber controls how hardware fault messages are printed. Chlog uses the elog(2) system call. Chlog decimal decimal does a direct eLogO system call. EXAMPLES Chlog unix performs elog(LOCTYPE, LUNIX). ChLog default performs elog(LOGTYPE, LOEFL T), Chlog debug SOp performs elog(OBGLVL, Ox50f3). Chlog 4 40 performs elog(kupdate,4O), which instructs the kernel to do a sync(2) every 40 seconds. 1* * Used in the elogO system call to determine error logging type */ #define #define #define #define 1* 1* 1* 1* LOGTYPE 0 OBCL VL 1 KUPOA TE 4 KNOUPOA TE 5 #define LOEFL T #define LUNIX o 1 set the 'logtype' variable set the' debug' variable enable kernel updateOs disable updateOs from kernel */ *1 *1 *1 1* default error logging 1* make it more like normal *1 UNIX logging *1 The OBGLVL bits are defined as follows (from sys/debug.h) : #define #define #define #define #define #define #define #define 0_ MAIN OxOOOl /* starting icode & schduler msgs */ 0_TRAP Ox0002 /* system calls, trap messages */ 0_ UREG OxO004/* remapping calls to ureg, estabur*/ 0 _ SYSCALL OX0400 1* system call info */ 0_STACK OX0800 1* Stack trace before death */ 0 _FLOPPY OxlOOO /* Floppy disk mfg debugs */ 0 _FOPRINT Ox2000 /* Floppy disk verbose printfOs */ 0_ WOISK Ox4000 /* Winchester disk printfsOs */ FILES /usr/include/sys/err. h /usr/include/sys/types. h SEE ALSO elog(2) 9/83 1-5 FOR:PRO Fortune Systems CHMOD(1) CHMOD(1) NAME chmod - change mode SYNOPSIS chmod mode file .. , DESCRIPTION The mode of each named file is changed according to mode, which can be absolute or symbolic. An absolute mode is an octal number constructed from the OR of the following modes: 4000 2000 1000 0400 0200 0100 0070 0007 set user ID on execution set group ID on execution sticky bit, see chmod(2) read by owner write by owner execute (search in directory) by owner read, write, execute (search) by group read, write, execute (search) by others A symbolic mode has the form [who] op permission [op permission] ... The who part is a combination of the letters u (for user's permissions), g (group) and 0 (other). The letter a stands for all three types (ugo). If who is omitted, the default is a but the setting of the file creation mask (see umask(2» is taken into account. + to add permission to the file's mode, - to take away per- Op can be mission and reset). = to assign permission absolutely (all other bits will be Permission is any combination of the letters r (read), w (write), x (execute), s (set owner or group id) and t (save text - sticky). Letters u, g , or 0 indicate that permission is to be taken from the current mode. Omitting permission is only useful with = to take away all permissions. Multiple symbolic modes separated by commas may be given. Operations are performed in the order specified. The letter s is only useful with u or g. Only the owner of a file (or the super-user) can change its mode. FOR:PRO 1-6 9/83 CHMOD(1) Fortune Systems CHMOD(1) EXAMPLES To deny write permission to others, chmod o-w file To make a file executable: chmod +x file SEE ALSO Is(l), chmod(2), stat(2), urnask(2), chown(8). 9/83 1-7 FOR:PRO Fortune Systems CMP(1) CMP(1) NAME cmp - compare two files SYNOPSIS emp [-1] [-s] filel file2 DESCRIPTION The two files are compared. (If filel is '-', the standard input is used.) Under default options, cmp makes no comment if the files are the same; if they differ, it announces the byte and line number at which the difference occurred. If one file is an initial subsequence of the other, that fact is noted. OPTIONS -1 Print the byte number (decimal) and the differing bytes (octal) for each difference. If this option is not given, only the first difference is listed. -8 Print nothing for differing files; return codes only. SEE ALSO comm(l), diff(l). DIAGNOSTICS Exit code 0 is returned for identical files, 1 for different files, and 2 for an inaccessible or missing argument. FOR:PRO 1-8 9/83 Fortune Systems CP(1) NAME cp - copy OF CP(1) link files and directory trees SYNOPSIS cp [-abBdilnNoprRsStTuvVxXj [backup optionsj [-j filel file2 cp [-abBdilnNoprRsStTuvVxXj [-] file ... directory DESCRIPTION File1 is copied onto file2. In the second form, one or more files are copied into directory, which must exist, and the last element of the file pathname is used as the name of the new file in directory. Links between source files will be preserved in the destination wherever possible. If there is a single source argument and it is a special file, it is opened and read as if it were a regular file. In the multiple-sourceargument or recursive case, special files are ignored. If a destination file exists, its owner and mode are unchanged, and the source is copied onto it. Otherwise it is created with the ownership of the invoker and the mode of the source. The setuid and setgid bits will each be set only if the new file is owned by the same user id and group id as the source, respectively. If the source is not a regular file and the destination is new, then cp creates the new file with permissions rw-rw-rw- subject to the umask. Cp attempts to read 20K bytes at a time, and writes out the same amount it reads each time. Thus it is usable with tapes or other devices with large or irregular block sizes. Cp will not attempt to copy a file onto itself. OPTIONS -a Ask on all files before copying. If -r is selected, sets -d. Answer is interpreted as in -i. -b Copy a file only when the destination doesn't already exist or its inode modification time (st ctime) is older than the source. -B Backup. Automatically makes file systems, handles error recovery and works with any other cp option. -8 requires two backup options: . 1) special file to use (mount) 2) size of file system to make There is no destination file specified on the command line as it is assumed the same name is used on the backup media. Backup calculates the sizes of every file and tells you how many volumes are needed to store the files specified. Examples: cp -B Idev/fd02 770 !bin/cat !bin/Is This will back up only the files !bin/cat and !bin/Is. 9/83 1-9 FOR:PRO CP(l) Fortune Systems, CP(l) cp -Br Idev/fd02 770 /bin lusr This will backup all directories and files under /bin and lusr. cp -Broust Idev/fd02 770 I This will backup the entire filesystem -d Ask on all but regular files before copying. If cp is copying recursively, and you decline to examine a directory, that directory and recursively all its contents are skipped. Answer is interpreted as in -i. -i Prompts the user with the name of the file whenever the copy causes an existing file to be overwritten. An answer of 'y' or 'Y' will cause cp to continue. Any other answer prevents it from overwriting the file. -I Link instead of copying if source and destination are on the same file system If a link can be made and the destination already exists, cp unlinks it before making the new link. Note that this is different from the behavior of In(l). If you want a link to fail when the destination exists, as it would if you were using In(l), then use -n along with -1. -n Copy a file only when the -destination does not already exist. -N No copy operation. This allows you to do a -0 and/or -t, to destination file(s) which already exist. No file copies take place, and no directories are made when this option is in effect. Cannot be used with -I, -n, or -u. -0 Set the group and user id ownership of the destination to that of the source. Only super-user can do this. -p Use full pathnames. Form each destination name by appending the entire source path to the destination path. This is especially useful for copying selected files from one tree to another. Example: cp -p dl/d2lfi x will make xld1 and xldl/d2 if necessary and copy dlld2lfl to xldl/d2lfl. -r Recursive. Copy each source directory and its entire subtree. Make new subdirectories in the destination directory as necessary. Without this option, directories are skipped. -R Restore. Asks the user to insert diskettes and ensures they are all from the same backup. -R requires one backup option which is the special file to mount. Restore first dis~overs where each file is and asks you to insert each volume as needed. Examples: cp -R Idev/fd02 bin/cat bin/Is /bin FOR:PRO 1-10 9/83 CP(1) CP(1) Fortune Systems This restores the files "cat" and "Is" to the directory bin. cp -rpR Idev/fd02 bin usr I This restores everything in /bin and lusr. cp -Rroust Idev/fd02 I. I This restores an entire backed-up filesystem -5 Do special files. If -1 is not set, or it is set and cp can't link, and you are super-user, do a mknod(2) so that the destination file is a device just like the source. -5 Replace an argument of "=" with a list of newline-separated files from the standard input. If this option is in effect, it is assumed that you are copying multiple files to a directory even if there is only one file in the list from the standard input, and the destination argument must be on the command line. This option is incompatible with -B, -R or -i. -t Set the file modification and access times of the destination to that of the source. This only works if you are super-user or you own the destination file. To be sure that you will own destination files, use the -u option. -T Same as -t plus the access time of the source is unchanged by the copy. -u If the destination is not a directory and already exists, unlink it before copying. This is useful when the destination file is multiply-linked and you don't want to affect all the links. It is also useful when you want all the destination files to be owned by you and to have the same mode as the source. -v Verbose, partial. Print a line on the standard output noting each copy operation which is skipped because of conditions specified by the -n or -b options. -V Verbose, full. Print a line on the standard output noting each copy operation, whether it is to be done or skipped, each source directory that is examined, and each destination directory that is created. 9/83 -x Copy a file only when the destination already exists. make any directories. -X When used with the backup option, -B, verifies that the backup media is readable after each disk is written. Does not check file system integrity or do any data verification, however. This option is ignored when not used with -B. 1-11 Do not FOR:PRO Fortune Systems CP(1) CP(1) The null option - indicates that all the arguments following it are to be treated as file names. This allows cp to work with files whose names start with a minus. EXAMPLES For these examples, assume the following directories and files: dl/fl, dl/d2/f2, and d3 where dI, etc. are directories, and £1, etc. are files. Then cp dl/£1 d3 would make d3/£1, and cp -r dl d3 would make d3/dl/£1 and d3/dl/d2/f2, and cp -r dl/. d3 would make d3/£1 and d3/d2/f2. You can effect a recursive move across file systems by doing a 'cp -r' followed by a 'rm -r'. The mv(I) command is best for moving a subtree within a file system. SEE ALSO cat(I), In(I), mv(l), rm(I). DIAGNOSTICS Copy is normally silent about its operation. If an error occurs, a message will be printed to the standard error output. If a file is not copied for some other reason, this will be noted on the standard output unless this was because it did not meet a condition specified by -n or -b. For more verbosity, use -v or -V. Cp does not stop prematurely on errors. Exit status is '0' if all files are copied OK. If any file or directory was skipped for some reason, the exit status is 'I' unless any file or directory was supposed to be copied, but couldn't because of an error, in which case the exit status is '2'. Errors may result in partially-written destination files. Other exit statuses are possible for "fatal" errors. LIMITATIONS The ownership and times of directories created under the -p option cannot be set to match the source directories. In this case, the owner is set to the current uid, the time to the current times, and the mode is set to 'rwxrwxrwx'. Links may be 'preserved' in the destination to a file which did not copy successfully. FOR:PRO 1-12 9/83 DATE(1) Fortune Systems DATE(1) NAME date - print and set the date SYNOPSIS date [yymmddhhmm [.ss]] DESCRIPTION [f no argument is given, the current date and time are printed. [f an argument is given, the current date is set. yy is the last two digits of the year; the first mm is the month number; dd IS the day number in the month; hh is the hour number (24 hour system); the second mm is the minute number; .55 is optional and is the seconds. The year, month and day may be omitted, the current values being the defaults. (Only the super-user can change the default.) The system operates in CMT. Date takes care of the conversion to and from local standard and daylight time. Uconf(2) can be used to set the timezone. EXAMPLES date 8610080045 sets the date to Oct 8,1986 12:45 AM date 1345 sets time to 1:45 PM and leaves the date unchanged. FILES /usr/admJwtmp to record time-setting SEE ALSO uconf(8), utmp(5). DIAGNOSTICS 'No permission' if you aren't the super-user and you try to change the date; 'bad conversion' if the date set is syntactically incorrect. 9/83 1-13 FOR:PRO 00(1) Fortune Systems 00(1) NAME dd - convert and copy a file SYNOPSIS dd [option=va[uej ... DESCRIPTION Dd copies the specified input file to the specified output with possible conversions. The standard input and output are used by default. The input and output block size may be specified to take advantage of raw physical I/O. OPTIONS option bs=n values set both input and output block size, superseding ibs and obs; also, if no conversion is specified, it is particularly efficient since no copy need be done conversion buffer size cbs=n copy only 11 input records count=n convert EBCDIC to ASCII conv=ascii block convert variable length records to fixed length ebcdic convert ASCII to EBCDIC slightly different map of ASCII to EBCDIC ibm lease map alphabetics to lowercase noerror do not stop processing on an error swab swap every pair of bytes pad every input record to ibs sync ucase map alphabetics to uppercase unblock convert fixed length records to variable length several comma-separated conversions skip 11 input files before starting copy files=n input block size 11 bytes (default 512) ibs=n input file name; standard input is default if= seek over n input records before copying iseek=n same as skip iskip=n nocreat don't create the output file before writing to it output block size (default 512) obs=n output file name; standard output is default of= oseek=n same as seek. skip (read over) n output records oskip=n quiet Don't print summary of input and output records when done seek=n seek 11 records from beginning of output file before copying skip=n skip 11 input records before starting copy Where sizes are specified, a number of bytes is expected. A number may end with k, b or w to specify multiplication by 1024, 512, or 2 respectively; a pair of numbers may be separated by x to indicate a FOR:PRO 1-14 9/83 00(1) Fortune Systems 00(1) product. Cbs is used only if ascii, unblock, ebcdic, ibm, or block conversion is specified. In the first two cases, cbs characters are placed into the conversion buffer, any specified character mapping is done, trailing blanks trimmed and new-line added before sending the line to the output. In the latter three cases, characters are read into the conversion buffer, and blanks added to make up an output record of size cbs. After completion, dd reports the number of whole and partial input and output blocks. EXAMPLES To copy one 6-head (96 512byte blocks/cyl) hard disk to another, dd if=/dev/rhd02 of=/dev/rhd12 bs=48k Note the use of the raw hard disk. Dd is especially suited to I/O on the raw physical devices because it allows reading and writing in arbitrary record sizes. To back up a (small) directory to a floppy (10 1K blocks/cyl): tar cfv - dir I dd of=/dev/rfd02 obs= 10k SEE ALSO cp(l), tr(l). DIAGNOSTICS f+p records read( written) in(out): numbers of full and partial records LIMITATIONS The ASCIIIEBCDIC conversion tables are taken from the 256 character standard in the CACM Nov, 1968. The 'ibm' conversion, while less blessed as a standard, corresponds better to certain IBM print train conventions. 9/83 1-15 FOR:PRO DF(1) DF(1) Fortune Systems NAME df - disk free SYNOPSIS df [-f] [-i] [-1] [filesystem ... ] [file ... J DESCRIPTION Of prints out the number of free blocks available on the specified filesystem, e.g. "/dev/hdOz", or on the filesystem in which the specified file, e.g. "$HOME", is contained. If no file system is specified, the free space on all of the normally mounted file systems is printed. The reported numbers are in file system block units; currently each filesystem block is 1024 bytes long. du(l) or Is(l) with the -s option. OPTIONS -f gives the report in Fortune friendly format. Initial -f should be used exclusively, as it overides all other options. -i Report also the number of inodes which are used and free. -1 Also examines the free list, double checking that the summary number in the filesystem superblock is correct. EXAMPLES I elf Files1st . Mounted on kbytes /dev/hd02 / 5835 1 elf used 2106 free I used 3129 461 -1 Filesyst. Mounted on kbytes /dev/hd02 / 5835 used 2106 free harcbray 3129 31.29 " used 461 FILES letdfstab list of normally mounted filesystems SEE ALSO fstab(5), icheck(8). LIMITATIONS It should print some warning message when the' -1' option discovers a messed-up file system FOR:PRO 1-16 9/83 DTINIT(1) Fortune Systems DTINIT(1) NAME dtinit - initialize /etcldevtype SYNOPSIS /mlsysman/dtinit [-b baud] [-c classJ [-m #J [-n deviceJ [-eJ [-dJ [-s deviceJ [-t type] [-x nameJ [-TJ [-MJ DESCRIPTION Otinit is used to update the device type file /etcldevtype. [f an entry exists for the device, any new information specified in the command is added to the entry. If no entry exists, one is created. OPTIONS -b baud baud rate for the entry. baud can be any legal baud rate or the one character specified as defined in Berkeley getty. -c class class of the device (e.g. 'f" for printer, 'e' for comm line). -m=!l= number of the device in its class (e.g. P2. for the second printer). -n device UNIX special file name (i.e. the name in the device table /dev). lhis is used for transferring data. (see -s option). -d disable this line. lhis sets a status bit to 0 indicating that the line is disabled. -e enable this line. This sets a status bit to 1 indicating that the line is enabled. -5 device service notification port. UNIX special file name (i.e. the name in the device table /dev). Bells (control g) are sent to this port when operator intervention is needed. -t type type of device. This is most likely a string which identifies an entry in /etclprintcap or /etcltermcap. -x name external name. This is any string to identify the device (e.g. Dot matrix printer near the water cooler). -T Prints out a table of the entries in /etcldevtype. -M Updates the letclttys and /etclttytype files. There is a one-to-one correspondence benveen options and fields in a devtype entry. The minimum arguments necessary to uniquely identify an entry is either a name or a class and number. FILES 9/83 1-17 FOR:PRO DTINIT(1) Fortune Systems DTINIT(1) /etddevtype device configuration file SEE ALSO devtype(5), ttys(5), ttytype(5). FOR:PRO 1-18 9/83 DU(1) Fortune Systems DU(1) NAME du - summarize disk usage SYNOPSIS du [-aJ [-5J [name ... J DESCRIPTION Du gives the number of blocks contained in all files and (recursively) directories within each specified directory or file name. If name is missing, '.' is used. A file having two links to it is only counted once. OPTIONS -a causes an entry to be generated for each file. Absence of either causes an entry to be generated for each directory only. -5 causes only the grand total to be given. SEE ALSO df(l), filsys(S). LIMITATIONS Non-directories given as arguments (not under -a option) are not listed. If there are too many distinct linked files, du counts the excess files multiply. du does not count indirect blocks (see jilsys(S) ). 9/83 1-19 FOR:PRO ECHO(1) Fortune Systems ECHO(1) NAME echo - echo arguments SYNOPSIS echo [-nJ [arg] ... DESCRIPTION Echo writes its arguments separated by blanks and terminated by a newline on the standard output. Echo is useful for producing diagnostics in shell programs and for writing constant data on pipes. To send diagnostics to the standard error file, when running the Bourne shell, do 'echo ... 1>&2'. OPTIONS -n No newline is added to the output. FOR:PRO 1-20 9/83 Fortune Systems EO(1) EO(1) NAME ed - text editor SYNOPSIS ed [-xJ [-J [nameJ DESCRIPTION Ed is the standard text editor. If a name argument is given, ed simulates an e command (see below) on the named file; that is to say, the file is read into ed's buffer so that it can be edited. Ed operates on a copy of any file it is editing; changes made in the copy have no effect on the file until a w (write) command is given. The copy of the text being edited resides in a temporary file called the buffer. Commands to ed have a simple and regular structure: zero or more addresses followed by a single character command, possibly followed by parameters to the command. These addresses specify one or more lines in the buffer. Missing addresses are supplied by default. In general, only one command can appear on a line. Certain commands allow the addition of text to the buffer. While ed is accepting text, it is said to be in input mode. In this mode, no commands are recognized; all input is merely collected. Input mode is left by typing a period '.' alone at the beginning of a line. Ed supports a limited form of reguLar expression notation. A regular expression specifies a set of strings of characters. A member of this set of strings is said to be matched by the regular expression. In the following specification for regular expressions the word 'character' means any character but newline. 9/83 1. Any character except a special character matches itself. Special characters are the regular expression delimiter plus \ [. and sometimes 1\ >I- $. 2. A . matches any character. 3. A \ followed by any character except a digit or (\) matches that character. 4. A nonempty string 5 bracketed [5 J (or [ s J) matches any character in (or not in) s. In 5, \ has no special meaning, and J may only appear as the first letter. A substring a-b, with a and b in ascending ASCII order, stands for the inclusive range of ASCII characters. 5. A regular expression of form 1-4 followed by >I- matches a sequence of 0 or more matches of the regular expression. 1\ 1-21 FOR:PRO EO(1) Fortune Systems EO(1) 6. A regular expression, x, of form 1-8, bracketed \( x \) matches what x matches. 7. A \ followed by a digit n matches a copy of the string that the bracketed regular expression beginning with the nth \ ( matched. 8. A regular expression of form 1-8, x, followed by a regular expression of form 1-7, y matches a match for x followed by a match for y, with the x match being as long as possible while still permitting a y match. 9. A regular expression of form 1-8 preceded by 1\ (or followed by $), is constrained to matches that begin at the left (or end at the right) end of a line. 10. A regular expression of form 1-9 picks out the longest among the leftmost matches in a line. 11. An empty regular expression stands for a copy of the last regular expression encountered. Regular expressions are used in addresses to specify lines and in one command (see s below) to specify a portion of a line which is to be replaced. 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 II') and to '\' itself. To understand addressing in ed it is necessary to know that at any time there is a current line. Generally speaking, the current line is the last line affected by a command; however, the exact effect on the current line is discussed under the description of the command. Addresses are constructed as follows. 1. The character '.' addresses the current line. 2. The character '$' addresses the last line of the buffer. 3. A decimal number n addresses the n-th line of the buffer. 4. "x' addresses the line marked with the name x, which must be a lowercase letter. described below. Lines are marked with the k command 5. A regular expression enclosed in slashes 'I' addresses the line found by searching forward from the current line and stopping at the first line containing a string that matches the regular expression. If necessary the search wraps around to the beginning of the buffer. 6. A regular expression enclosed in queries I?' addresses the line found by searching backward from the current line and stopping at the first line containing a string that matches the regular expression. If necessary the search wraps around to the end of the buffer. FOR:PRO 1-22 9/83 ED(1) Fortune Systems ED(1) '+' 7. 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 can be omitted. 8. If an address begins with' or '-' the addition or subtraction is taken with respect to the current line; e.g. '-5' is understood to ll1ean '.-5'. 9. If an address ends with or '-', then 1 is added (resp. subtracted). As a consequence of this rule and rule 8, the address '-' refers to the line before the current line. Moreover, trailing and '-' characters have cumulative effect, so '--' refers to the current line less 2. +' '+' '+' 10. To mainta~n compatibility with earlier versions of the editor, the character' , in addresses is equivalent to '-'. 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 assull1e default addresses when insufficient addresses are given. If more addresses are given than such a command requires, the last one or two (depending on what is accepted) are used. Addresses are separated from each other typically by a comma I,'. They can also be separated by a semicolon ';'. In this case the current line '.' 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 ('I', '?'). The second address of any two-address sequence must correspond to a line following the line corresponding to the first address. In the following list of 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. As Il1entioned, it is generally illegal for more than one command to appear on a line. However, most commands can be suffixed by 'p' or by 'I', in which case the current line is either printed or listed respectively in the way discussed below. (.) a The append command reads the given text and appends it after the addressed line. '.' 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. (., .) c 9/83 1-23 FOR:PRO Fortune Systems ED(1) ED(1) The change command deletes the addressed lines, then accepts input text which replaces these lines. '.' is left at the last line input; if there were none, it is left at the line preceding the deleted lines. ( ., .) d 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. e filename The edit command causes the entire contents of the buffer to be deleted, and then the named file to be read in. '.' 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 filename in a subsequent r or w command. If 'filename' is missing, the remembered name is used. E filename This command is the same as e, except that no diagnostic results when no w has been given since the last buffer alteration. f filename The filename command prints the currently remembered filename. If 'filename' is given, the currently remembered filename is changed to 'filename'. (1,$) g/regular expression/command list 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 '.' 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 end with '\'. A, i, and c commands and associated input are permitted; the '.' terminating input mode can be omitted if it would be on the last line of the command list. The commands g and v are not permitted in the command list. ( .)i This command inserts the given text before the addressed line. '.' is left at the last line input, or, if there were none, at the line before the addressed line. This command differs from the a command only in the placement of the text. FOR:PRO 1-24 9/83 ED(1) Fortune Systems ED(1) (., .+l)j This command joins the addressed lines into a single line; intermediate newlines simply disappear. '.' is left at the resulting line. ( . ) kx The mark command marks the addressed line with name x, which must be a lowercase letter. The address form" x' then addresses this line. ( ., .) I The list command prints the addressed lines in an unambiguous way: non-graphic characters are printed in two-digit octal, and long lines are folded. The L command can be placed on the same line after any non-i/o command. (., .)trn The move command repositions the addressed lines after the line addressed by a. The last of the moved lines becomes the current line. (., .) p The print command prints the addressed lines. '.' is left at the last line printed. The p command can be placed on the same line after any non-i/o command. (., .) p This command is a synonym for p. q The quit command causes ed to exit. No automatic write of a file is done. Q This command is the same as q, except that no diagnostic results when no w has been given since the last buffer alteration. ($) r filename The read command reads in the given file after the addressed line. If no filename is given, the remembered filename, if any, is used (see e and f commands). The filename is remembered if there was no remembered filename already. Address '0' is legal for 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. '.' is left at the last line read in from the hle . . , .) s/regular expression/replacement! ., .) s/regular expression/replacementlg 9/83 1-25 FOR;PRO EO(1) Fortune Systems EO(1) 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 can be used instead of 'I' to delimit the regular expression and the replacement. ': is left at the last line substituted. An ampersand '&' appearing in the replacement is replaced by the string matching the regular expression. The special meaning of '&' in this context can be suppressed by preceding it by '\'. The characters '\ n' where n is a digit, are replaced by the text matched by the n-th regular subexpression enclosed between '\ (' and '\)'. When nested, parenthesized subexpressions are present, n is determined by counting occurrences of '\ (' starting from the left. Lines can be split by substituting new-line characters into them. The new-line in the replacement string must be escaped by preceding it by '\'. (., .)ta This command acts just like the m command, except that a copy of the addressed lines is placed after address a (which can be 0). '.' is left on the last line of the copy. u The undo command restores the preceding contents of the current line, which must be the last line in which a substitution was made. (1, $) vlregular expression/command list This command is the same as the global command g except that the command list is executed g with '.' initially set to every line except those matching the regular expression. (1, $) w filename The write command writes the addressed lines onto the given file. If the file does not exist, it is created mode 666 (readable and writable by everyone). The filename is remembered if there was no remembered filename already. If no filename is given, the remembered filename, if any, is used (see e and f commands). '.' is unchanged. If the command is successful, the number of characters written is printed. (I,$)W filename FOR:PRO 1-26 9/83 Fortune Systems EO(1) EO(1) This command is the same as w, except that the addressed lines are appended to the file. x A key string is dema.nded from the standard input. Later r, e and w commands will encrypt and decrypt the text with this key by the algorithm of crypt(l). An explicitly empty key turns off encryption. This option does not work unless you have the Development Utilities Set installed on the Fortune 32:16. ($)= The line number of the addressed line is typed. '.' is unchanged by this command. ! The remainder of the line after the '!' is sent to sh(l) to be interpreted as a command. '.' is unchanged. '( .+1) 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. If an interrupt signal (ASCII DEL) is sent, ed prints a '?' and returns to its command level. Some size limitations: 512 characters per line, 256 characters per global command list, 64 characters per filename, and 128K characters in the temporary file. The limit on the number of lines depends on the amount of core: each line takes 1 word. When reading a file, ed discards ASCII NUL characters and all characters after the last newline. It refuses to read files containing nonASCII characters. OPTIONS -x An x command is simulated first to handle an encrypted file. Suppresses the printing of character counts bye, r, and w commands. FILES Itmp/e* ed.hup work is saved here if terminal hangs up SEE ALSO sed(l), crypt(l). B. W. Kernighan, A Tutorial Introduction to the ED Text Editor B. W. Kernighan, Advanced editing on UNIX 9/83 1-27 FOR:PRO EO(1) Fortune Systems EO(1) DIAGNOSTICS I?narne' for inaccessible file; I?' for errors in commands; I?TMJY for temporary file overflow. To protect against throwing away valuable work, a q or e command is considered to be in error, unless a w has occurred since the last buffer change. A second q or e is obeyed regardless. LIMITATIONS The I command mishandles DEL. A! command cannot be subject to a g command. Because 0 is an illegal address for a w command, it is not possible to create an empty file with ed. FOR:PRO 1-28 9/83 EXPR(1) Fortune Systems EXPR (1) NAME expr - evaluate arguments as an expression SYNOPSIS expr arg .. , DESCRIPTION The arguments are taken as an expression. After evaluation, the result is written on the standard output. Each token of the expression is a separate argument. The operators and keywords are listed below. The list is in order of increasing precedence, with equal precedence operators grouped. expr I expr yields the first expr if it is neither null nor '0', otherwise yields the second expr. expr & expr yields the first expr if neither expr is null or '0', otherwise yields '0'. + expr expr expr - expr addition or subtraction of the arguments. expr'" expr expr / expr expr % expr multiplication, division, or remainder of the arguments. expr : expr The matching operator compares the string first argument with the regular expression second argument; regular expression syntax is the same as that of ed(l). The \ ( ... \) pattern symbols can be used to select a portion of the first argument. Otherwise, the matching operator yields the number of characters matched ('0' on failure). expr reLop expr where relop is one of < < = = != > = >, yields 'I' if the indicated comparison is true, '0' if false. The comparison is numeric if both expr are integers, otherwise lexicographic. ( expr ) parentheses for grouping. EXAMPLES To add 1 to the Shell variable a: a='expr $a + l' To find the filename part (least significant part) of the pathnarne stored in variable a, which mayor may not contain 'I': 9/83 1-29 FOR:PRO Fortune Systems EXPR(1) expr $a : ' .*/\(.*\)' EXPR(1) '1' $a Note the quoted Shell metacharacters. SEE ALSO sh(l), test(l). DIAGNOSTICS Expr returns the following exit codes: o 1 2 FOR:PRO if the expression is neither null nor '0', if the expression is null or '0', for invalid expressions. 1-30 9/83 FINO(1) Fortune Systems FINO(1) NAME find - fmd files SYNOPSIS find pathname-list expression DESCRIPTION Find recursively descends the directory hierarchy for each pathname in the pathname-list (i.e., one or more pathnames) seeking files that match a boolean expression written in the primaries given below. [n the descriptions, the argument 11 is used as a decimal integer where +n means more than n, -n means less than 11 and 11 means exactly 11. -atime n True if the file has been accessed in 11 days. -exec command True if the executed command returns a zero value as exit status. The end of the command must be punctuated by an escaped semicolon. A command argument I{}' is replaced by the current pathname. -group gname True if the file belongs to group gname (group name or numeric group 10). -inum n True if the file has inode number n. -links n True if the file has n links. -mtime n True if the file has been modified in 11 days. -name filename True if the filename argument matches the current file name. Normal Shell argument syntax can be used if escaped (watch out for ,[" I?' and 1*'). -newer file True if the current file has been modified more recently than the argument file. -ok command Like -exec except that the generated command is written on the standard output, then the standard input is read and the command executed only upon response y. -perm onum True if the file permission flags exactly match the octal number Ol1um (see chmod(l». If onum is prefixed by a minus sign, more flag bits (017777, see stat(2)) become significant and the flags are compared: (ftags&onum)==onum. 9/83 1-31 FOR:PRO FINO(1) Fortune Systems FIND(1) -print Always true; causes the current pathname to be printed. -size n True if the file is n blocks long (512 bytes per block). -type c True if the type of the file is c, where c is b , c, d or f for block special file, character special file, directory or plain file. -user unarne True if the file belongs to the user uname (login name or numeric user ID). The primaries can be combined using the following operators (in order of decreasing precedence): 1) A parenthesized group of primaries and operators (parentheses are special to the Shell and must be escaped). 2) The negation of a primary ('1' is the unary not operator). 3) Concatenation of primaries (the and operation is implied by the juxtaposition of two primaries). 4) Alternation of primaries ('-0' is the or operator). EXAMPLES To remove all files named 'a.out' or for a week: find I \( -name a.out -0 -name '*.0' '*.0' \) that have not been accessed -atirne +7 -exec rm {} \; FILES letdpasswd letdgroup SEE ALSO sh(l), test(l), filsys(5). FOR:PRO 1-32 9/83 KILL(1) Fortune Systems KILL(1) NAME kill - terminate a process with extreme prejudice SYNOPSIS kill [-signa] processid ... DESCRIPTION Kill sends signal 15 (terminate) to the specified processes. If a signal number preceded by '-' is given as first argument, that signal is sent instead of terminate (see signal(2)). This kills processes that do not catch the signal; in particular 'kill -9 ... ' is a sure kill. By convention, if process number 0 is specified, all members in the process group (i.e. processes resulting from the current login) are signaled. The killed processes must belong to the current user unless he or she is the manager. To shut the system down and bring it up single user the manager may use 'kill -1 1'; see init(8). The process number of an asynchronous process started with '&' is reported by the shell. Process numbers can also be found by using ps(l). SEE ALSO ps(l), kiU(2), signal(2). 9/83 1-33 FOR:PRO LOrnN(1 ) Fortune Systems LOGIN(1) NAME login - sign on SYNOPSIS login [username1 DESCRIPTION The login command is used when a user initially signs on, or it can be used at any time to change from one user to another. The latter case is the one summarized above and described here. See Understand Your Fortune System for initial login. If login. is invoked without an argument, it asks 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. After a successful login, accounting files are updated and the user is informed of the existence of mail, and the message of the day is printed. The user is also informed of the time he last logged in (unless he has a .hushlogin. file in his home directory - this is mostly used to make life easier for non-human users, such as uucp). Login initializes the user and group IDs and the working directory, then executes a command interpreter (usually sh(l» according to specifications found in a password file. Argument 0 of the command interpreter is "-s h ", or more generally the name of the command interpreter with a leading dash ("_") prepended. Login also initializes the environment environ(5) with information specifying home directory, command interpreter, terminal type (if available) and user name. [f the file letclnologin exists login prints its contents on the user's ter- minal and exits. Login is recognized by sh(l) and csh(l) and executed directly (without forking). FILES Ie tclu tmp accounting lusr/adm/wtmp accounting lusrlspooVmail/* mail letclmotd message-of-the-day FOR:PRO 1-34 9/83 LOGIN(1) LOGIN(1) Fortune Systems /etc/passwd password file /etc/nologin stops log ins .hushlogin makes login quieter /etc/securetty lists ttys that root may log in on SEE ALSO mail(l), newgrp(l), passwd(l), environ(5), init(8), shutdown(8). passwd(5), getty(8), DIAGNOSTICS "Login incorrect," if the name or the password is bad. "No Shell", "cannot open password file", "no directory": consult your dealer. 9/83 1-35 FOR:PRO Fortune Systems LPR(1) LPR(1) Ipr, print - line printer spooler SYNOPSIS print file ... Ipr -CdhclLmriTn -Fn -n n -p n -z n -f filter -j jobname -u file -0 name -q string -s cmd -Sn,n,n,A -An -Pname -Ln +Pn +0 +Wn +Vn +:xx=#: [file ... J DESCRIPTION Print runs the shell command 'pr $* /lpr', which prints a paginated copy of each file on the printer. Note that normal pr(l) options can also be used (but NOT Ipr options). Lpr causes the named files to be queued for printing. If no files are named, the standard input is read. OPTIONS Options which do not need an additional argument can be concatenated. For example: "Ipr -mhTcp 3" is the same as "Ipr -m -h -T -c -p 3" There are a number of options which are ignored if the -C flag is given, these are preceded by an ,.. The following options are accepted by Ipr (any , options MUST follow any '-' options that are given): +' -An Number of times to retry an unsuccessful print job. (The default is 3). -b name banner name to be used on the header page at the beginning of the print job. The default is the username of the owner of the print job. Overrides -h option. The -b option forces output of a header page, regardless of the default set by lpdun. -c n copy flag causes the print job to be copied into the print queue, instead of linked. This is usually slower than linking, but guards against changes that may occur in the file before it is printed. -C Input is expected to be in a special format, which is currently used only by Fortune:Word. A number of options are ignored if this option is given (see note above). -d Single sheet mode. Causes the printer to pause after printing each page and wait for a signal from lpdun(l). +0 draft mode printing (faster, and usually lower quality) is used, if supported by the printer. FOR:PRO 1-36 9/83 LPR(1) Fortune Systems LPR(1) -f name filter "name" will be used to do the actual printing instead of the normal filter. A full pathname MUST be used. The filter must accept (even if it ignores) the same flags as the normal filter. (see the man page for lpJ(8). * -F n form length is set to n lines for this job. The default form length is set with lpdun(l). This option is ignored if -S is given. If the value given does not match the length of the paper on the printer, top of form will be incorrect for subsequent jobs, unless manually reset. -h header page is NOT printed at the beginning of the print job. Generally used only if just one user is on the system, since this is the only way to identify the printout. (See also the -b option of lpdun(l).) This option is ignored if -b is given. -j name jobname for this print job. The default is the source filename of the print job if a file is being printed, shell commands default to the command, and standard input defaults to "Standard input." -i input from a pipe (or standard input) is not copied to a temporary file, as is normally done. This is mainly used for jobs so large that copying them would use up all or most of the free space on the filesystem Input from a terminal is not allowed, since there would then be two processes reading from the terminal at the same time. Requests for multiple copies force a copy file to be created. *-Ln line length is set to n characters for this job. Output lines longer than this are truncated, if the -t option is also given. This option is ignored if -5 is given. The default line length is set with lpdun(l). * +Ln Changes the left margin to position n. (Must follow the +P option if the +P is given.) For example, if n is 10, printing starts in colunm 11. -m mail(l) is sent to the owner of the job, when the job completes. If the owner was set with the -0 option, and the owner given is not a valid usemame, mail is sent to the person who submitted the job, unless the owner name contains an @ or an !, in which case it is assumed the owner name is a valid user on another system 9/83 1-37 FOR:PRO Fortune Systems LPR(1) LPR(1) -n n number of copies to be printed, the default is one. -0 name owner of the print job. The default is the username. 1his is NOT used to determine permission to remove jobs from the queue, but appears on the header page and in the queue listings as the owner of the job. It is also used to determine who mail should be sent to with the -m option. -p n printer the job is sent to. The default is printer 1. -Pname printer type is set to name for this job, rather than the default, (which is set by dtinit(l). * +Pn pitch for this job is set to rl. Some printers (such as the IDS) only support fixed pitches. For this reason only 10, 12, and 15 pitch are supported. -q string Any comment the user wishes can be placed here. At least the first 15 characters are displayed by lpq(l). -r remove the files (if any) that were submitted after they are queued. This is useful for printing files which are tmp files. Also see the -u option. -5 cmd cmd will be executed when the job is ready to be printed, and its standard output will be sent to the printer. Except for the time "cmd" is run, this is almost identical to: cmd Ilpr-i No file arguments are allowed with this option. "cmd" is parsed to determine if it contains any Bourne shell metacharacters. If it does, it is run in a subshell, otherwise an attempt is made to run the command directly. If the exec fails, an attempt is then made to run the cmd in a subshell. In both cases, the environment is set to that of the user when Ipr was invoked. This is currently used by Fortune:Word to do formatting at print time. -Sn,n,n,A Use the sheet feeder on this printer, if supported. No checks are made to ensure the sheet feeder is actually on the printer. At least 1, and up to 4 comma separated fields follow the '5'. The first 3 must be numbers from 1 to 3. The first number is the bin for the first page, the second is for the second page, and the third is for the third page. If the fourth field is present and is the letter 'A', the last two bins given will be alternated for the FOR:PRO 1-38 9/83 LPR(1) Fortune Systems LPR(1) rest of the job; otherwise the last field given will be used as the bin for the rest of the job. Bin 1 is the 'letterhead' bin, bin 2 is the 'plain paper' bin, and bin 3 is the 'envelope' bin. (For single bin feeders, you are considered to have only a 'letterhead' bin.) Several examples are given below: lpr -S3,1,2,A First page is an envelope, second page is letterhead, third page is plain paper; following this, even pages will be letterhead and odd pages will be plain paper. lpr -S1,1,2 First page is letterhead, second page is letterhead, third page is plain paper; following this, all pages will be plain paper. The sizes of the paper in each of the bins must be set correctly for some of the supported sheet feeders to work properly. Use the -5 option of lpdun(l) to set and display the sizes. If more bins are specified than are available for the printer type given (either via command line or from /etddevtype). Those bins will be converted to I, the 'plain paper' bin, and a diagnostic will be issued. Similarly, if the -S option is given, and the printer type does not support sheet feeders at all, the option will be ignored and a diagnostic issued. 9/83 -t truncation of overly long lines will be done. (line length is set by the -L option or by the default set by Lpdun(l).) The default is to do no truncation; overly long lines will print on the platen. -T Transparent mode. All characters in the job are sent to the printer exactly as they are. This is mainly so the user can include printer control sequences in their files, such as super/subscripts (this is particularly useful for moffil) output). This option does not allow reprinting of pages for print jobs, since the filter has no way of knowing where pages end. (See lpdun(l) for a description of this). Tabs are not expanded with this option, use expand(I) to expand them, if necessary. In addition, LF's are NOT turned into sequences, as this would alter some printer control sequences. Unfortunately, only the low 7 bits are used, because using 8 bits requires that the printer accept AND generate 8 bit characters. Some printers, like the NEC35XX series, can accept 8 bit characters, but always generate MARK parity on output. This has the unfortunate side effect of losing flow control, which is unacceptable. 1-39 FOR:PRO Fortune Systems LPR(1) LPR(1) -u file Causes the following file to be removed after printing. nus is useful with shell scripts that create or use temporary files. The FULL pathname MUST be given. This option may be given up to ten times to remove multiple files. The file will be removed even if job is not successfully printed. '" +Vn Vertical pitch is set to n lines per inch. Currently only 6, 8 and 10 lines per inch are su pported, although others may work for some printers. (10 lines per inch is actually 9.6 lines per inch for all currently supported printers, so page length may not come out the way one would expect.) "'+Wn Change to font n. This is only supported for printers (such as IDS) which can change their fonts under software control. -z n The size the user wishes reported by lpq for this job can be placed here. This is useful when no files are given to lpr, since a size would otherwise not be reported. +:xx=#: Can be used to pass any capability from the printcap file. xx is any 2 letter sequence, the the printcap entry where the character 'V' occurs, and the :'s are REQUIRED. FILES lusrlspooVlpd/pr# spooler directories (# is the printer number) lusrlspooVlpd/pr#/[ cdeltj '" Control files for use by the spooling system. lusr/lib/lpd printer daemon lusr/lib/lpf printer filter /etdprintcap For printer specific information letddevtype For correlation between printer #, printer port, and printer type, etc. lusr/admllperr If this file exists and is writable by all, all messages generated by the spooling system (including those suppressed by silent options) are written here. In addition, messages which are for troubleshooting only, (and hence are never output to a FOR:PRO 1-40 9/83 Fortune Systems LPR(1) LPR(1) terminal), are written here. Note that this file grows rapidly and is generally created only for troubleshooting. SEE ALSO dti11it(1), lprm(l), printcap(S). Lpmv(l), Lpq(l), Lpdu11(1), lpf(8) , Lpd(8), pr(l), NOTES Each page starts at the right margin (whatever it is). Thus, a line which has a formfeed in it will become 1WO lines on output, the second of which will start at the right margin. Note also that a formfeed followed by a newline will result in a blank line at the top of the new page. Error messages are written by a routine which attempts to decide whether it can output a newline, or if the user is using a screen oriented program, and therefore cannot do a newline (because the screen might be scrolled). The determination IS made by checking to see if the terminal from which the job was started is set in raw and/or cbreak mode. If so, a message is written (in a terminal independent manner) to the bottom line of the screen; otherwise it simply outputs the message followed by a newline. An attempt is made to send error messages to the terminal that started the job (the stderr, stdout, and stdin of Ipr are checked in that order until one is found to correspond to a terminal; if one does, it is passed thru to Ipd and Ipf). If a spooler program does not inherit the terminal name as in the program above (or if it is not writable), /dev/tty is tried, then stderr, which may, in some cases (e.g. a daemon running jobs started from more than one terminal), be the wrong terminal. The terminal type is set from the TERM shell variable, or if TERM is not set, it is set to FT. Some messages which are of informational nature only (such as specifying a sheetfeeder when the printer does not support it) are not written to the terminal if a screen oriented program is running (they are still written to the error logging file, if it exists). LIMITA TIONS For normal printing (without the -T or -C options) the spooling system will not handle videotext characters. They will be printed as '''Yx' where x is the escape characters. Future versions may handle videotext in the same manner as Fortune:Word, by looking up wheel files and mapping videotext sequences to the appropriate output sequences. 9/83 1-41 FOR:PRO LPRM(1) Fortune Systems LPRM(1) NAME Iprm, Ipq, Ipdun, Ipmv - line printer auxilIary programs SYNOPSIS lprm [-sp nJ [QID] [filenameJ [ownerJ [pbnameJ ... Ipq [-aqsp nJ Ipdun -b on'pff -c n -C -f form -i -I n -mn -n n -N -p n -Pn -F -r ribbon -s -S[+-][wl,ll, ... w3,l3J -w printwheel -z Ipmv [-sp nJ printid newid DESCRIPTION These commands all default to printer #1, unless the -p n option is given (where 11 is the printer number). IMPORTANT NOTE Because of the communications between these programs and the filter program(s) (see Lpf(8», the action requested may not occur until the printer is ready to accept more data. The printer may not accept data if the printer cover is open, if a ribbon breaks, if the paper runs out, or simply if the data buffer of the printer is full. If for some reason the printer doesn't request more data, while the filter sends data to the printer, nothing will happen. For all supported printers this condition can be cleared by turning the printer off and on. In this case, some data will probably be lost. Iprm This command allows users to remove jobs from the print queue. Users may only remove their own jobs; the superuser may, however, remove any job. Jobs may be identified by qid, filename, owner, or jobname. These are all reported by Ipq(l). -s silent option; normal results are not reported, but errors are. rt is important to note that spaces or special characters in the jobname must be given exactly. It is usually easiest to give the QID. ALL jobs matching ANY of the arguments will be removed. Thus, "lprm olson" will remove all of the jobs in the queue submitted by "olson l (also any jobs named "olson"). NOTE: Giving one (or more) filenames for a job which has multiple files (such as 'lpr a.c b.c d.c e.c') results in ALL files for that job being removed. This is always the case, no matter what type of argument is given; if more than one file is assocIated with a job, they will ALL be removed. Multiple arguments may be given, as: lprm 456 789 lpr.c root Each job removed will be reported by QID, unless the -s option was given. Jobs that are prmting at the time they are removed are stopped, and a message is printed on the last printed page. FOR:PRO 1-42 9/83 lPRM(1) Fortune Systems lPRM(1) Lpq This command lists the line printer queues and state. The following options are accepted: -a all printer queues are displayed. Otherwise, only the information for the printer specified is given. The pnnter nu mber is listed in the first column for the first job in each queue. -s display the state information; the default is to list only the queue(s). -q when given with -s, queue information is displayed, followed by the state information. Each entry in the queue is printed showing the owner of the queue entry, the queue identification number, the type of entry (doc (WP), file, pipe, or shell), the size (in characters), the file to be printed, the jobname of the entry, any comments attached to the entry, and the number of copies to be printed. Jobs are listed in the order they will be printed. For shell jobs, the shell command is listed under jobname, unless the -j name option was used with Ipf. The jobname and comment fields are used entirely for the jobname/comment, if there is nothing in the other field. With -s, the state, what (if anything) the printer is waiting on, the current ribbon, wheel and form, the line width in characters, the page length in lines, and the process id of the filter currently running are displayed (if the PIO is not shown, nothing is printing). lpdun Lpdun is used to restart a suspended print job or notify the spooler of a change in the printer's condition. It is also used to set up default paper sizes and other default attributes of the printers. With any ot the options that set defaults (e.g. -5, -c, and -P options) or with -z, options that interact with the filter (Le., -i, -n, and -N), will be ignored. With no options, if a job was waiting on a new sheet, form, etc., it is restarted. lpdun depends heavily on the normal filter Ipf(8) bemg the printing filter. If another filter is used, and it does not work in the same manner, lpdun may not work properly. -b [onpffl [f "on" is given, changes printer so it defaults to printing the banner page, if "off", changes default to no banner page. Either way, this can be overridden by options to lpr(l). -c n changes the default line width (in characters) for printer. (See also the -Ln option of lpr(l).) 9/83 1-43 FOR:PRO LPRM(1) Fortune Systems LPRM(1) -c When given with the -5 option, indicates that the sizes given are in centimeters instead of inches. -f jDrm The form type is set to jDrm. lhis, like ribbon is not used by the spooling system, but may be used by Fortune:Word in the future. -i interrupt the printing of a job, if a job is active. Note: many printers have a large (typically 2000 character) buffer; therefore printing may continue for a page or more after printing is interrupted. -In changes the default formlength in lines per page for printer. (See also the -Fn option of /pr(l).) -mn n is the number of pages to be saved in memory by the filter so that they can be reprinted if necessary. The range is 0 to 9, with the default 2. If n is 0, nothing is saved, and no reprinting is possible. lhis option is provided to allow the user some control over how much memory is used by the filter; systems that have little memory or many users will want to keep n low. -n n restarts a suspended print job and gives the number of pages to backup (1 means restart at top of current page, unless a new page was just fed, in which case it means reprint from the previous page). The header page, if any, is never reprinted. If printing is suspended while reprinting, and reprinting is again requested, reprinting starts n pages back from the highest numbered page that has actually been printed, NOT n pages back from the page that is currently printing. That is, if pages 1-21 have been printed, then a request is made to reprint 4 pages (18-21), and printing is then stopped at page 19, a request to reprint 2 pages will cause pages 20 and 21 to be reprinted, NOT pages 18 and 19. If this option is omitted, or n is 0, printing resumes at the current position (this is the only exception to the highest numbered page rule). "lpdun" is thus equivalent to "lpdun -n 0". -N This option is used to initialize or reinitialize a printer with a sheet feeder on it, since some sheetfeeders do not have manual controls to do this. If a job is running or suspended, the filter is told to output the appropriate strings, and then suspend itself. If there is no job running, a special job is submitted to the spooling system requesting that the printer be initialized. FOR:PRO 1-44 9/83 Fortune Systems LPRM(1) LPRM(1) -Pn n is the priority level for the spooler to run at. The range may be from -20 to 20; 0 is the default for most Unix programs. A negative n will cause the spooler to run at a higher priority, but will slow other programs down. If n is 20 (the default) the spooler wIll run with a very low pnority, putting as little load on the system as possible. -r name Changes the default ribbon for the printer to name. -5 This option is used with single sheet jobs to inform the spooler that a new sheet has been inserted, and printing can resume. -5 If followed by '-', no sheet feeder is in use. If followed by a sheet feeder is in use, and up to 6 ',' separated numbers can follow. These are the width and length (in inches by default) of the paper in each of up to 3 bins. See the -5 option of lpr(l) for the correspondence between bin numbers and their contents. Fields that are left blank (two commas in a row, or a comma immediately after the' +') are left unchanged. '+ ", lpdun -5+3.3,4.5",8.5,11 sets bin 1 to 3.3 inches wide and 4.5 inches long. The width and length of bin 2 is left unchanged, and bin 3 is set to 8.5 inches wide by 11 inches long. -w name changes the default wheel for the printer. (See also the +Wn option of lpr(l).) -z reports the sizes of the paper in the various bins, the width in characters, and the length in lines for single sheet and tractor feed jobs. Lpdun is also used to set up new printers (in combination with dtinit(I». If the printer spooling directories and/or control files are not found, lpdun will try to create 11 /usr/spoolllpd 11 must already exist.) them (The directory lpmv moves a print job to a new position in the queue. printid and newid are the numbers displayed by Ipq. in the QID column. -5 silent option; normal results are not reported, but errors are. Printid is the id of the print job to be moved. Newid is the print job printid will be printed before. Note that moving a job in front of a printing job does NOT interrupt the printing job to print the moved job, however, the moved job will be the next job printed. 9/83 1-45 FOR:PRO Fortune Systems LPRM(1) LPRM(1) FILES /usrispoolllpd/pr# spooler directories (# is the printer number) The file (in each spooling directory) that records current state of a printer. letddevtype The master configuration file for serial devices. Checked by Ipq to see what printers are available. SEE ALSO Lpr(l), Lpf(8), Lpd(8). FOR:PRO 1-46 9/83 LS(1) Fortune Systems LS(1) NAME Is - list contents of directory SYNOPSIS Is [-abcCdfFgilmqrRstuxl] name ... II [is options] name .. . If [is options] name .. . Ir [is options] name .. . DESCRIPTION For each directory argument, is lists the contents of the directory; for each file argument, is 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 three major listing formats. The format chosen depends on whether the output is going to a teletype, and can also be controlled by option flags. The default format for a teletype is to list the contents of directories in multi-column format, with the entries sorted down the columns. (Files which are not the contents of a directory being interpreted are always sorted across the page rather than down the page in columns. This is because the individual file names may be arbitrarily long.) If the standard output is not a teletype, the default format is to list one entry per line. Finally, there is a stream output format in which files are listed across the page, separated by',' characters. The -m flag enables this format; when invoked as L this format is also used. OPTIONS -a List all entries; usually all files beginning with a '.' are suppressed. -b Force printing of non-graphic characters to be in octal notation. -c Use time of file creation for sorting or printing. -C Force multi-column output, e.g. to a file or a pipe. 9/83 -d If argument is a directory, list only its name, not its contents (mostly used with -I to get status on directory). -f Force each argument to be interpreted as a directory and list the name found in each slot. This option turns off -1, -t, -5, and -r, and turns on -aj the order is the order in which entries appear in the directory. -F Cause directories to be marked with a trailing 'I' and executable files to be marked with a trailing '*'; this is the default if the last character of the name the program is invoked with is a 'f. 1-47 FOR:PRO LS(1) Fortune Systems LS(1) -g Give group ID instead of owner ID in long listing. -i Print i-number in first column of the report for each file listed. -1 List in long format, giving mode, number of links, owner, size in bytes, and time of last modification for each file. (See below.) If the file is a special file the size field will instead contain the major and minor device numbers. The mode printed under this option contains 11 characters which are interpreted as follows: b c d m the first character is if the entry is a block-type special file; if the entry is a character-type special file; if the entry is a directory; if the entry is a multiplexor-type character special file; if the entry is a plain file. The next nine 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: r w x if the if the if the if the file is readable; file is writable; file is executable; indicated permission is not granted. The group execute permission character is given as s if the file has set-group-ID mode; likewise the user execute permission character is given as s if the file has set-user-ID mode. The last character of the mode (normally 'x' or '-') is t if the 1000 bit of the mode is on. See chmod(l) for the meaning of this mode. When the sizes of the files in a directory are listed, a total count of blocks, including indirect blocks is printed. -m Force stream output format. -n FOR:PRO Displays the user or group id number instead of user or group id name in a long listing. This option makes a long listing run much more quickly, as the names do not have to be searched for in letdpasswd or letdgroup, respectively. 1-48 9/83 Fortune Systems LS(1) LS(1) -q Force printing of non-graphic characters in file names as the character I?'; this normally happens only if the output device is a teletype. -r Reverse the order of sort to get reverse alphabetic or oldest first as appropriate. -R Recursively list subdirectories encountered. -s Give size in blocks, including indirect blocks, for each entry. -t Sort by time modified (latest first) instead of by name, as is normal. -u Use time of last access instead of last modification for sorting (-t) or printing (-I). -x Force colUlrmar printing to be sorted across rather than down the page; this is the default if the last character of the name the program is invoked with is an 'x'. -1 force one entry per line output format, e.g. to a teletype. FILES JetcJpasswd to get user ID's for 'Is -I'. Jete/group to get group ID's for 'Is -g'. LIMITATIONS Newline and tab are considered printing characters in file names. The output device is assumed to be 80 columns wide. The option setting based on whether the output is a teletype is undesirable as "Is _s" is much different than "Is -s I Ipr". On the other hand, not doing this setting would make old shell scripts which used Is almost certain losers. Column width choices are poor for terminals which can tab. 9J83 1-49 FOR:PRO MAN(1) Fortune Systems MAN(1) NAME man - print out the manual SYNOPSIS man [section J title ... DESCRIPTION Man is a shell program which provides on-line access to sections of the printed manual. If a section specifier is given, man looks in that section of the manual for the given titles. Section is an Arabic section number, i.e. 3. If section is omitted, man searches all sections of the manual and prints all the sections it finds, if any. Man pipes its output through more(l) to stop after each page on the screen. Hit a space to continue, a control-D to scroll 11 more lines when the output stops. More(l) is smart enough not to ask for terminal input if the output of man has been redirected to a file. FILES lusr/manlman?l* SEE ALSO more(l). FOR:PRO 1-50 9/83 MENU(1) MENU(1) Fortune Systems NAME menu - execute the Schmidt shell . unix - provide unix interface for users of the Schmidt shell SYNOPSIS menu .unix DESCRIPTION Menu puts you in the "user-friendly" command interpreter . . unix allows the user to access the unix system directly from the Schmidt shell. The unixdoor file contains a list of commands run by sh(l}. Currently, it contains a single command which calls sh(l) so the user can interact with the regular unix shell. By editing this file, a different command processor such as csh(l) can be used instead of the regular shell. 9/83 1-51 FOR:PRO MKOIR(1) Fortune Systems MKOIR(1) NAME mkdir - make a directory SYNOPSIS mkdir dirname ... DESCRIPTION Mkdir creates the specified directories. Standard entries, '.', for the directory itself, and ' .. ' for its parent, are made automatically. Mkdir requires write permission in the parent directory. The permission bits of the directories will be 777, as modified by the user's umask (see sh(1)). SEE ALSO chmod(l), rm(l). DIAGNOSTICS Mkdir returns exit code 0 if all directories were successfully made. Otherwise it prints a diagnostic and returns nonzero. FOR:PRO 1-52 9/83 Fortune Systems MORE(1) MORE(1) NAME more, page - file perusal filter for crt viewing SYNOPSIS more [-cdflsuJ [-nJ [+linenumberJ [+patternJ [name ... J page more options DESCRIPTION More is a filter which allows examination of a continuous text, one screenful at a time on a soft copy terminal. It normally pauses after each screenful, printing --More-- at the bottom of the screen. A return displays just one more line and a space displays another screenful. Other possibilities are enumerated later. OPTIONS -c More draws each page by beginning at the top of the screen and erasing each line just before it draws on it. This avoids scrolling the screen, making it easier to read while more is writing. This option is ignored if the terminal does not have the ability to clear to the end of a line. -d More prompts the user with the message "Hit space to continue, Rubout to abort" at the end of each screenful. This is useful if more is being used as a filter in some setting, such as a class, where many users may be unsophisticated. -f This causes more to count logical, rather than screen lines, meaning long lines are not folded. This option is recommended if nroff output is being piped through ul, since the latter may generate escape sequences. These escape sequences contain characters which would ordinarily occupy screen positions, but do not print when sent to the terminal as part of an escape sequence. Thus more thinks that lines are longer than they actually are, and fold lines erroneously. -I Do not treat "L (form feed) specially. If this option is not given, more will pause after any line that contains a L, as if the end of a screenful had been reached. Also, if a file begins with a form feed, the screen will be cleared before the file is printed. -n An integer which is the size (in lines) of the window which more will use instead of the default. -s Squeeze multiple blank lines from the output, producing only one blank line. Especially helpful when viewing nroff output, this option maximizes the useful information present on the screen. -u Normally, more will handle underlining such as produced by nroff in a manner appropriate to the particular terminal: if the terminal can perform underlining or has a standout mode, more will output appropriate escape sequences to enable underlining 9/83 1-53 FOR:PRO MORE(1) Fortune Systems MORE(1) or standout mode for underlined information in the source file. The -u option suppresses this processing. +linenumber Start up at linenumber. +Ipattern Start up two lines before the line containing the regular expression pattern. If the program is invoked as page, then the screen is cleared before each scree nfu I is printed (but only if a full screenful is being printed), and k - 1 rather than k - 2 lines are printed in each screenful, where k is the number of lines the terminal can display. More looks in the file letc/termcap to determine terminal characteristics, and to determine the default window size. On a terminal capable of displaying 24 lines, the default window size is 22 lines. More looks in the environment variable MORE to preset any flags desired. For example, if you prefer to view files using the -c mode of operation, the csh command setenv MORE -c or the sh command sequence MORE='-c' ; export MORE would cause all invocations of more, including invocations by programs such as man and msgs , to use this mode. Normally, the user will place the command sequence which sets up the MORE environment variable in the .cshrc or .profile file. If more is reading from a file, rather than a pipe, then a percentage is displayed along with the --More-- prompt. This gives the fraction of the file (in characters, not lines) that has been read so far. Other sequences which may be typed when more pauses, and their effects, are as follows (i is an optional integer argument, defaulting to 1) : i display i more lines, (or another screenful if no argument is given). "D display 11 more lines (a "scroll"). If i is given, then the scroll size is set to i. d same as "D (control-D). iz same as typing a space except that i, if present, becomes the new window size. is skip i lines and print a screenful of lines. if skip i screenfuls and print a screenful of lines. FOR:PRO 1-54 9/83 Fortune Systems MORE(1) MORE(1) "q or Q" Exit from more. Display the current line number. v Start up the editor vi at the current line. i/expr search for the i -th occurrence of the regular expression expr. If there are less than i occurrences of expr, and the input is a file (rather than a pipe), then the position in the file remains unchanged. Otherwise, a screenful is displayed, starting two lines before the place where the expression was found. The user's erase and kill characters may be used to edit the regular expression. Erasing back past the first column cancels the search command. in search for the i -th occurrence of the last regular expression entered. (single quote) Co to the point from which the last search started. If no search has been performed in the current file, this command goes back to the beginning of the file. !command invoke a shell with command. The characters '%' and '!' in "command" are replaced with the current filename and the previous shell command respectively. If there is no current filename, '%' is not expanded. The sequences "\ %" and "\!" are replaced by "%" and "!" respectively. i:n skip to the i -th next file given in the command line (skips to last file if n doesn't make sense). i:p skip to the i -th previous file given in the command line. If this command is given in the middle of printing out a file, then more goes back to the beginning of the file. If i doesn't make sense, more skips back to the first file. If more is not reading from a file, the bell is rung and nothing else happens. :f display the current filename and line number. ':q or :Q" exit from more (same as q or Q). (dot) repeat the previous command. The commands take effect immediately, i.e., it is not necessary to type a carriage return. Up to the time when the command character itself is given, the user may press the line kill character to cancel the numerical argument being formed. In addition, the user may press the erase character to redisplay the --More--(xx%) message. At any time when output is being sent to the terminal, the user can press the cancel key. More will stop sending output, and will display 9/83 1-55 FOR:PRO Fortune Systems MORE(1) MORE(1) the usual --More-- prompt. The user may then enter one of the above commands in the normal manner. Unfortunately, some output is lost when this is done, due to the fact that any characters waiting in the terminal's output queue are flushed when the quit signal occurs. The terminal is set to noecho mode by this program so that the output can be continuous. What you type will thus not show on your terminal, except for the I and! commands. If the standard output is not a teletype, then more acts just like cat, except that a header is printed before each file (if there is more than one). A sample usage of more in previewing nroff output would be nroff -ms +2 doc.n I more -s FILES Ie tdte rmcap Terminal data base lusr/lib/more. help Help file SEE ALSO csh(l), man(l), msgs(l), script(l), sh(l), environ(S). FOR:PRO 1-56 9/83 Fortune Systems MV(1) MV(1) NAME mv - move or rename files SYNOPSIS mv [-f] [-i] [-] file1 file2 mv [-f] [-i] [-J file .. .directory mv [-f] [-i] [-] directory1 ... directory2 DESCRIPTION Mv moves (renames) file1 to file2. If file2 already exists, it is removed before file1 is moved. If file2 has a mode which forbids writing, mv prints the mode (see chmod(2)) and reads the standard input to obtain a line; if the line begins with y, the move takes place; if not, mv exits. In the second form, one or more files are moved to the directory with their original filenames. Mv refuses to move a file onto itse If. Mv also moves (or renames) directory1 to directory2 along with all of its files and subdirectories. OPTIONS -f Stands for force, overrides any mode restrictions or the -i switch. -i Stands for interactive mode. Whenever a move is to supercede an existing file, the user is prompted by the name of the file followed by a question mark. If answered with a line starting with 'y', the move continues. Any other reply preve1\lts the move from occurring. means interpret all the following arguments to mvas filenames. This allows filenames starting with minus. SEE ALSO cp(l), In(l). LIMITATIONS If filel and file2 lie on different file systems, mv must copy the file and delete the original. In this case the owner name becomes that of the copying process and any linking relationship with other files is lost. Directories can only be moved within the same parent directory. 9/83 1-57 FOR:PRO NEWGRP(1) Fortune Systems NEWGRP(1) NAME newgrp - log in to a new group SYNOPSIS newgrp [group] DESCRIPTION Newgrp changes the group identification of its caller, analogously to login(l). The same person remains logged in, and the current directory is unchanged, but calculations of access permissions to files are performed with respect to the new group ID. Newgrp without an argument changes the group identification to the group in the password file; in effect it changes the group identification back to the caller's original group. A password is demanded if the group has a password and the user himself does not, or if the group has a password and the user is not listed in fete/group as being a member of that group. When most users log in, they are members of the group named users. FILES Jetdgroup Jetdpasswd SEE ALSO login(l), group(5). LIMITATIONS There is no convenient way to enter a password into Jete/group. Use of group passwords is not encouraged, because, by their very nature, they encourage poor security practices. Croup passwords may disappear in the future. FOR:PRO 1-58 9i83 PASSWD(1) Fortune Systems PAS5WD(1) NAME passwd - change login password SYNOPSIS passwd [name] DESCRIPTION This command changes (or installs) a password associated with the user name (your own name by default). The program prompts for the old password and then for the new one. The caller must supply both. The new password must be typed twice, to forestall mistakes. New passwords must be at least four characters long if they use a sufficiently rich alphabet and at least six characters long if monocase. These rules are relaxed lf you are insistent enough. Only the owner of the name or the manager can change a password; the owner must prove he knows the old password. FILES /etc/passwd SEE ALSO login(l), crypt(3), passwd(5). Robert Morris and Ken Thompson, UNIX password security LIMIT ATIONS The password file information should be kept in a different data structure allowing indexed access. 9/83 1-59 FOR:PRO Fortune Systems PR(1) PR(1) NAME pr - print file SYNOPSIS pr [option] ... [file] ... DESCRIPTION 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 specified header t and the page number. If there are no file arguments, pr prints its standard input. OPTIONS Options apply to all following files but can be reset between files: -f Use form feeds instead of new lines to separate pages. A form feed is assumed to use up two blank lines at the top of a page. (This option does not affect the effective page length.) -b Take the next argument as a page header. -In Take the length of the page to be n lines instead of the default 66. -m Print all files simultaneously, each in one column. -F Fold, rather than truncate, lines in multi-column output. -n Produce n-colunm output. +n Begin printing with page n. -sc Separate columns by the single character c instead of by the appropriate amount of white space. A missing c is taken to be a tab. -t Do not print the 5-line header or the 5-line trailer normally supplied for each page. -wn For purposes of multi-column output, take the width of the page to be n characters instead of the default 72. SEE ALSO cat(l}. FOR:PRO 1-60 9/83 PRINTSTRING (1) Fortune Systems PRINTSTRING (1) NAME printstring - prints arguments with possible translation SYNOPSIS printstring translation-table [argJ ... DESCRIPTION Printstring writes its arguments or a translated version of its arguments terminated by a newline on the standard output. It also understands C-like escape conventions; beware of conflicts with the shell's use of \: \ b backspace print line without new-line \f form-feed \n new-line \r carriage return \t tab \ \ backs lash \n the 8-bit character whose ASCII code is the 1, 2 or 3-digit octal number n, which must start with a zero. This last escape convention is not yet implemented. \c Each argument is looked up in a translation table to determine if a corresponding value exists. If there is a corresponding value it is printed. If no value is found, the argument is printed. This does not apply if the argument begins with a blank or a backslash. If the argument begins with a blank or a backs lash the argument is printed untranslated. Printstring is useful for producing diagnostics in command files and for sending known data into a pipe. SEE ALSO echo(I), sh(l), trans(5). 9/83 1-61 FOR:PRO Fortune Systems PS(1) PS(1) NAME ps - process status SYNOPSIS ps [akItUvxJ [pid] DESCRIPTION Ps prints process status information. First, ps prints a heading line, then the information for each process. The default short listing prints only the PI 0, TrY, TIME, and CMD fields described below, whereas the long listing prints all fields, as in the following example: FUGS S UID IC S 0 CS 0 C S 101 C B 101 PID ppm CPU PHI nCE SZ ICRU 0 0 0 70 20 2 runout 20 15 Cwait) 1 0 0 30 32 1 0 28 20 39 ttJ6,O 876 42 51 877 20 37 m ! ! 02 co TIllE 8:08 0:02 O:U 0:01 CJO) snpper /etc/Wt -csh ps 10: The fields are as follows: Flags associated with the process: F D: Detached process, parent has died. U: Process has asked that it be locked in core. W: Traced process, parent process is waiting for it. T: Traced process. S: Process is swapped out. L: Temporarily locked in core (e.g. for raw I/O). K: System process, not normal program. C: Loaded in core. S The state of the process: 0: nonexistent; S: sleeping; W: waiting; R: running; I: intermediate; Z: terminated; T: stopped. UIO The user ID of the process owner. PIO The process ID of the process, which can be used to kill it. The listing is sorted in PIO order. PPID The process 10 of the parent process. CPU Amount of processor utilization, used for scheduling. FOR:PRO 1-62 9i83 PS(1) Fortune Systems PS(1) PRI The priority of the process, ranging from highest priority, -128, to lowest, 127. The process cannot be killed while this number is negative, which should only happen during certain types of 110. NICE Used in priority computation. A lower nice value begets higher priority. Normal value is 20. SZ The size in 1K core increments of the data and stack portions of the process, i.e. exclusive of the code segment if it is sharable. WCHAN The event for which the process is waiting or sleepmg; if blank, the process is running. This field is either the name of an internal kernel variable (like runout, lbolt, buf[10J, inode[3J, etc.), a system call name such as wait or pause (in parentheses), a tty major/minor dev like ttyO,O, any of the above with an offset, as in tty1,1+56, or a hex address in rare cases. TIY The controlling tty for the process. Examples are "co" for console, "02" for tty02, or I/?" if none. TIME The cumulative execution time for the process. CMD The command and its arguments. A process that has exited and has a parent, but has not yet been waited for by the parent is marked < defunct> . Ps makes an educated guess as to the command name and arguments given when a process was created by examining the argument list in the memory image of the process in memory or the swap area, wherever it is. The method is inherently somewhat unreliable and in any event a process is entitled to destroy this information, so the names cannot be counted on too much. OPTIONS If the pid argument is specified, ps prints information about only that process. a gives information about all processes with terminals (ordinarily only one's own processes are displayed). k uses the file /usr/sys/core in place of /dev/mem. This is used only by kernel developers for debugging after a system crash. gives a long listing. 9/83 1-63 FOR:PRO Fortune Systems PS(1) PS(1) ttty gives information only about processes associated with terminal tty. U Prints the current time, the length of time the system has been up, and the average number of jobs in the run queue over the last I, 5 and 15 minutes; followed by the ps information. v prints the accumulated child user and child system time for each process in addition to the accumulated time for the process itself. The I option overrides this option. x gives information even about processes with no terminal. FILES Idev/hdOI this or another disk is the swap device Idev/mem core memory lusrlsys/core alternate core file SEE ALSO kill(I), pstat(l). LIMITATIONS Things can change while ps is running; thus, the picture it gives is only a close approximation to reality. In rare cases, ps can die from a segmentation fault because the kernel tables change too quickly. Some data printed for defunct processes is irrelevant. FOR:PRO 1-64 9/83 Fortune Systems PWAC(1) PWAC(1) NAME pwac - maintain account and group information files SYNOPSIS /m/sysman/pwac [option] ... [name] '" /m/sysman/pwac -a [option] '" [name] .,. /m/sysman/pwac -d [option] .. , [name] ... /m/sysman/pwac -t [option] '" DESCRIPTION Pwac is used to add, modify, delete and list the information maintained in the files /ete/passwd and fete/group. The simple version of the command lists the information for the specified accounts or groups and makes any desired changes. OPTIONS Names and options can be given in any order. Options can also be combined. The following options are recognized by pwac: -a adds new accounts or groups. The information is normally taken from a template account or group called proto . Normally names must start with a lower case letter and contain only lower case letters and digits. The -1 option allows any names to be added. -d deletes accounts or groups. -t lists all accounts or groups in a table format. Most items are printed as they are stored. A few items are not printed but are instead labeled flags. Currently they are 'y' if the account or group is on, 'n' if the account or group is off, and 'p' if the account or group has a password. A group that has been turned off can still be used by its members. Other people, however, are unable to newgrp(l) to this group even if they know the password. In addition, the following options can be used: -F format Use format to print only specific information about an account or group. Most characters are printed without expansion. Many letters, however, expand to values. For example, the character '5' expands to the shell, the character 'H' expands to the home and so forth. A back-slash ('\') causes the next character to be printed without expansion. -g 9/83 Group operations are performed. 1-65 FOR:PRO Fortune Systems PWAC(1) -1 Values are taken literally. -q (quiet) prints only error messages. PWAC(1) -T name Use the name as a template instead of the default account "proto·. The following options can be used for adding or modifying: -A group Adds the accounts specified as members of group. This option can be repeated several times to add accounts to several groups. -C comment Use comment as the comment to be associated with the specified accounts. On some computers this comment is used to store the real name of the person who uses this account. On other systems, it is used to store job control information for sending requests to other systems. -D group Deletes the accounts specified as members of group This option can be repeated several times to delete accounts from several groups. It is not an error to attempt to delete an account from a group in which it is not a member. -G group or number Use group as the default group for the specified accounts. When used with a group operation use number as the group-id-number in the same manner as the user-id-number described above. -H directory Use directory as the new home directory. The character '&' is replaced with the account or group name. The -1 option prevents this expansion. This is useful when working with accounts which are to be used as the templates for making other accounts. -n Turn the specified accounts or groups off. This has the same effect as if the account or group has a password which is unknown. -N name Use name as the new name of the specified accounts or groups. This should normally not be done with more than one account or group. The rules for a valid name are the same as those used when adding accounts or groups. -p password Use password as the password for the specified accounts or groups. This password is normally encrypted before being stored. Using the -1 option this can be prevented. In either case FOR:PRO 1-66 9/83 Fortune Systems PWAC(1) PWAC(1) an empty password indicates no password. -S shell Use shell as the new shell. -U number Use number as the user-id-number. If more than one account is listed the number is used for the first account, the number plus one is used for the second account and so forth. -y Tum the specified accounts or groups on. SEE ALSO newgrp(l), passwd(l), sU(l), passwd(5), group(5). FILES letdpasswd account information file letdgroup group information file /etdptmp lock file /etdpasswd. temp account information temporary /etdgroup. temp group information temporary /etdptmp.link lock file temporary LIMITATIONS There is no way to specify that only some items are to be taken literally. The rules affecting group membership are somewhat confusing. 9/83 1-67 FOR:PRO PWO(1) Fortune Systems PWO(1) NAME pwd - working directory name SYNOPSIS pwd DESCRIPTION Pwd prints the pathname of the working (current) directory. SEE ALSO cd(l), csh(l). FOR:PRO 1-68 9/83 Fortune Systems RM(1) RM(1) NAME rm, rmdir - remove (unlink) files SYNOPSIS rm [-f] [-i] [-r] [-] file ... rmdir dir ... DESCRIPTION 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. If a file has no write permission and the standard input is a terminal, its permissions are printed and a line is read from the standard input. If that line begins with 'y' the file is deleted, otherwise the file remains. If a designated file is a directory, an error comment is printed unless the optional argument -r has been used. Rmdir removes entries for the named directories, which must be empty. OPTIONS -f No questions are asked and no errors are reported. -i Asks whether to delete each file (interactive option) and, under -r, whether to examine each directory. -r No errors messages are given and rm recursively deletes the entire contents of the specified directory and the directory itself. The null option indicates that all the arguments following it are to be treated as filenames. This allows the specification of filenames starting with a minus. SEE ALSO unlink(2). DIAGNOSTICS Cenerally self-explanatory. It is forbidden to remove the file ' .. ' merely to avoid the antisocial consequences of inadvertently doing something like 'rm -r . *'. 9/83 1-69 FOR:PRO SH(1) Fortune Systems SH(1) NAME sh, for, case, if, while, :, ., break, continue, cd, eval, exec, exit, export, login, newgrp, read, read-only, set, shift, times, trap, umask, wait - command language SYNOPSIS sh [-ceiknrstuvx] [argJ ... DESCRIPTION Sh is a command programming language that executes commands read from a terminal or a file. See invocation for the meaning of arguments to the shell. Commands. A simple command is a sequence of non blank words separated by blanks (a blank is a tab or a space). The first word specifies the name of the command to be executed. Except as specified below the remaining words are passed as arguments to the invoked command. The command name is passed as argument 0 (see exec(2». The value of a simple command is its exit status if it terminates normally or 200+status if it terminates abnormally (see signal(2) for a list of status values). A pipeline is a sequence of one or more commands separated by I. The standard output of each command but the last is connected by a pipe(2) to the standard input of the next command. Each command is run as a separate process; the shell waits for the last command to terminate. A list is a sequence of one or more pipelines separated by;, &, && or II and optionally terminated by ; or &. ; and & have equal precedence which is lower than that of && and I I, && and 11 also have equal precedence. A semicolon causes sequential execution; an ampersand causes the preceding pipeline to be executed without waiting for it to finish. The symbol && (I I) causes the list following to be executed only if the preceding pipeline returns a zero (non zero) value. Newlines may appear in a list, instead of semicolons, to delimit commands. A command is either a simple command or one of the following. The value returned by a command is that of the last simple command executed in the command. for name [in word ... ] do list done Each time a for command is executed name is set to the next word in the for word list If in word '" is omitted then in -$@is assumed. Execution ends when there are no more words in the list. FOR:PRO 1-70 9/83 SH(1) SH(1) Fortune Systems case word in [pattern [ I pattern J ... ) list ;; J '" esac A case command executes the list associated with the first pattern that matches word. The form of the patterns is the same as that used for filename generation. if List then List [elif list then List J '" [else list J fi The List following if is executed and if it returns zero the list following then is executed. Otherwise, the List following elif is executed and if its value is zero the list following then is executed. Failing that the else list is executed. while list [do list J done A while command repeatedly executes the while list and if its value is zero executes the do list; otherwise the loop terminates. The value returned by a while command is that of the last executed command in the do list. Until may be used in place of while to negate the loop termination test. ( List) Execute list in a subshelL { List} list is simply executed. The following words are only recognized as the first word of a command and when not quoted. if then else elif fi case in esac for while until do done { } Command substitution. The standard output from a command enclosed in a pair of grave accents (' ') may be used as part or all of a word; trailing newlines are removed. Parameter substitution. The character $ is used to introduce substitutable parameters. Positional parameters may be assigned values by set. Variables may be set by writing name=vaLue [ name=value J '" $ {parameter} A parameter is a sequence of letters, digits or underscores (a name), a digit, or any of the characters >10 @ #- ? - $ The value, if any, of the parameter is substituted. The braces are required only when parameter is followed by a letter, digit, or underscore that is not to be interpreted as part of its name. If parameter is a digit then it is a po~itional parameter. If parameter is >10 or @ then all the positional parameters, starting with $1, are substituted separated by spaces. $0 is set from argument zero when the shell is invoked. 9/83 1-71 FOR;PRO Fortune Systems SH(1) SH(1) $ {parameter -word} If parameter is set then substitute its value; otherwise substitute word. $ {parameter = word} If parameter is not set then set it to word; the value of the parameter is then substituted. assigned to in this way. Positional parameters may not be $ {parameter? word} If parameter is set then substitute its value; otherwise, print word and exit from the shell. [f word is omitted then a standard message is printed. $ {parameter +word } If parameter is set then substitute word; otherwise substitute nothing. In the above word is not evaluated unless it is to be used as the substituted string. (So that, for example, echo ${ d-' pwd'} will only execute pwd if d is unset.) The following parameters are automatically set by the shell. §. ? $ The number of positional parameters in decimal. Options supplied to the shell on invocation or by set. The value returned by the last executed command in decimal. The process number of this shell. The process number of the last background command invoked. The following parameters are used but not set by the shell. HOME The default argument (home directory) for the cd command. PATH The search path for commands (see execution). MAIL If this variable is set to the name of a mail file then the shell informs the user of the arrival of mail in the specified file. PSt Primary prompt string, by default '$ '. PS2 Secondary prompt string, by default I> '. IFS Internal field separators, normally space, tab, and newline. Blank interpretation. After parameter and command substitution, any results of substitution are scanned for internal field separator characters (those found in SIFS) and split into distinct arguments where such characters are found. Explicit null arguments ("" or ") are retained. Implicit null FOR:PRO 1-72 9/83 Fortune Systems SH(1) SH(1) arguments (those resulting from parameters that have no values) are removed. Filename generation. Following substitution, each command word is scanned for the characters "', ? and [. If one of these characters appears then the word is regarded as a pattern. The word is replaced with alphabetically sorted filenames that match the pattern. If no filename is found that matches the pattern then the word is left unchanged. The character . at the start of a filename or immediately following a I, and the character I, must be matched explicitly. '" ? [. .. ) Matches any string, including the null string. Matches any single character. Matches anyone of the characters enclosed. A pair of characters separated by - matches any character lexically between the pair. Quoting. The following characters have a special meaning to the shell and cause termination of a word unless quoted. ; & ( ) I < > newline space tab A character may be quoted by preceding it with a \ I. \ newline is ignored. All characters enclosed between a pair of quote marks (' '), except a single quote, are quoted. Inside double quotes ( •• ) parameter and command substitution occurs and quotes the characters and $. $* is equivalent to $1 $2 ... whereas $@ is equivalent to $1 $2 ... . Prompting. When used interactively, the shell prompts with the value of PSI before reading a command. If at any time a newline is typed and further input is needed to complete a command then the secondary prompt ($PS2) is issued. Input output. Before a command is executed its input and output can be redirected using a special notation interpreted by the shell. The following may appear anywhere in a simple command or can precede or follow a command and are not passed on to the invoked command. Substitution occurs before word or digit is used. word Use file word as standard output (file descriptor 1). If the file does not exist then it is created; otherwise it is truncated to zero length. »word Use file word as standard output. If the file exists then output is appended (by seeking to the end); otherwise the file is created. «word The shell input is read up to a line the same as word, or end of file. The resulting document becomes the standard input. If any character of word is quoted then no interpretation is placed upon the characters of the document; otherwise, parameter and command substitution occurs, newline is ignored, and is used to quote the characters and the first character of word. < &digit The standard input is duplicated from file descriptor digit; see dup(2). Similarly for the standard output using> . <&The standard input is closed. Similarly for the standard output using> . It should be noted that the command 'program < file > file' will probably destroy file before calling program and should be avoided. If one of the above is preceded by a digit then the file descriptor created is that specified by the digit (instead of the default 0 or 1). For example, ... 2>&1 creates file descriptor 2 to be a duplicate of file descriptor 1. If a command is followed by & then the default standard input for the command is the empty file (/dev/null). Otherwise, the environment for the execution of a command contains the file descriptors of the invoking shell as modified by input output specifications. Environment. The environment is a list of name-value pairs that is passed to an executed program in the same way as a normal argument list; see exec(2) and environ(S). The shell interacts with the environment in several ways. On invocation, the shell scans the environment and creates a parameter for each name found, giving it the corresponding value. Executed commands inherit the same environment. If the user modifies the values of these parameters or creates new ones, none of these affects the environment unless the export command is used to bind the shell's parameter to the environment. The environment seen by any executed command is thus composed of any unmodified name-value pairs originally inherited by the shell, plus FOR:PRO 1-74 9/83 SH(1) Fortune Systems SH(1) any modifications or additions, all of which must be noted in export commands. The environment for any simple command may be augmented by prefixing it with one or more assignments to parameters. Thus these two lines are equivalent TERM=450 cmd args (export TERM; TERM=450; cmd args) If the -k flag is set, aLL keyword arguments are placed in the environment, even if they occur after the command name. The following prints 'a=b c' and 'c': echo a=b c set -k echo a=b c Signals. The INTERRUPT and QUIT signals for an invoked command are ignored if the command is followed by &; otherwise signals have the values inherited by the shell from its parent. (But see also trap.) Execution. Each time a command is executed the above substitutions are carried out. Except for the 'special commands' listed below a new proces.s is created and an attempt is made to execute the command via an exec(2). The shell parameter $PATH defines the search path for the directory containing the command. Each alternative directory name is separated by a colon (:). The default path is :lbin:/usrlbin. If the command name contains a / then the search path is not used. Otherwise, each directory in the path is searched for an executable file. If the file has execute permission but is not an a.out file, it is assumed to be a file containing shell commands. A subshell (Le., a separate process) is spawned to read it. A parenthesized command is also executed in a subshell. Special commands. The following commands are executed in the shell process and except where specified no input output redirection is permitted for such commands. No effect; the command does nothing . . file Read and execute commands from file and return. The search path $P ATH is used to find the directory containing ~le. break [n j Exit from the enclosing for or while loop, if any. If 11 is specified then break n levels. 9/83 1-75 FOR:PRO SH(1) Fortune Systems SH(1) continue [11 J Resume the next iteration of the enclosing for or while loop. If n is specified then resume at the n-th enclosing loop. cd [arg J Change the current directory to argo The shell parameter SHOME is the default argo eva} [arg ... J The arguments are read as input to the shell and the resulting command(s) executed. exec [arg ... J The command specified by the arguments is executed in place of this shell without creating a new process. lnput/output arguments may appear and if no other arguments are given cause the shell input/output to be modified. exit [11 J Causes a non interactive shell to exit with the exit status specified by 11. If n is omitted then the exit status is that of the last command executed. (An end of file will also exit from the shell.) export [name ... J The given names are marked for automatic export to the environment of subsequently executed commands. If no arguments are given then a list of exportable names is printed. login [arg ... J Equivalent to 'exec login arg ... '. newgrp [arg ... ] Equivalent to 'exec newgrp arg ... '. read name ... One line is read from the standard input; successive words of the input are assigned to the variables name in order, with leftover words to the last variable. The return code is 0 unless the end-of-file is encountered. read-only [name ... ] The given names are marked read-only and the values of the these names may not be changed by subsequent assignment. If no arguments are given then a list of all read-only names is printed. set [ -eknptuvx [arg ... ] J -e If non interactive then exit immediately if a command fails. -k All keyword arguments are placed in the environment for a command, not just those that precede the command name. -n Read commands but do not execute them -t Exit after reading and executing one command. -u Treat unset variables as an error when substituting. -v Print shell input lines as they are read. FOR:PRO 1-76 9/83 Fortune Systems SH(1) -x SH(1) Print commands and their arguments as they are executed. Turn off the -x and -v options. These flags can also be used upon invocation of the shell. The current set of flags may be found in $-. Remaining arguments are positional parameters and are assigned, in order, to $1, $2, etc. If no arguments are given then the values of all names are printed. shift The positional parameters from $2... are renamed $1 ... times Print the accumulated user and system times for processes run fro m the she ll. trap [arg j [n] ... Arg is a command to be read and executed when the shell receives signal(s) n. (Note that arg is scanned once when the trap is set and once when the trap is taken.) Trap commands are executed in order of signal number. If arg is absent then all trap(s) n are reset to their original values. If arg is the null string then this signal is ignored by the shell and by invoked commands. If n is 0 then the command arg is executed on exit from the shell, otherwise upon receipt of signal 11 as numbered in signal(2). Trap with no arguments prints a list of commands associated with each signal number. umask [ nnn] The user file creation mask is set to the octal value nnn (see umask(2». If nnn is omitted, the current value of the mask is printed. wait [n] Wait for the specified process and report its termination status. If n is not given then all currently active child processes are waited for. The return code from this command is that of the process waited for. Invocation. If the first character of argument zero is -, commands are read from $HOME/. profile, if such a file exists. Commands are then read as described below. The following flags are interpreted by the shell when it is invoked. -c string If the -c flag is present then commands are read from string. -s If the -s flag is present or if no arguments remain then commands are read from the standard input. Shell output is written to file descriptor 2. 9/83 1-77 FOR:PRO Fortune Systems SH(1) -i SH(1) If the -i flag is present or if the shell input and output are attached to a terminal (as told by gtty) then this shell is interac- tive. In this case the terminate signal SIG1ERM (see signal(2» is ignored (so that 'kill 0' does not kill an interactive shell) and the interrupt signal SIGINT is caught and ignored (so that wait is interruptable). In all cases SICQUIT is ignored by the shell. The remaining flags and arguments are described under the set command. FILES $HOME/. profile Itmp/sh* Idev/null SEE ALSO csh(l), exec(2), test(l). DIAGNOSTICS Errors detected by the shell, such as syntax errors cause the shell to return a non zero exit status. If the shell is being used non interactively then execution of the shell file is abandoned. Otherwise, the shell returns the exit status of the last command executed (see also exit). LIMITATIONS If < < is used to provide standard input to an asynchronous process invoked by &, the shell gets mixed up about naming the input document. A garbage file Itmp/sh* is created, and the shell complains about not being able to find the file by another name. FOR:PRO 1-78 9/83 Fortune Systems SLEEP(1) SLEEP(1) NAME sleep - suspend execution for an interval SYNOPSIS sleep time DESCRIPTION Sleep suspends execution for time seconds. EXAMPLES To execute a command after a certain amount of time: (sleep 105; command)& To execute a command every so often from the Bourne shell: while true do command sleep 37 done SEE ALSO alarm(2), sleep(3). LIMITATIONS Time must be less than 2147483647 seconds. 9/83 1-79 FOR:PRO SORT(1) Fortune Systems SORT(1) NAME sort - sort or merge files SYNOPSIS sort [-bcdfimnor] [-txJ f+posl [-pos2J] ... [-oname] [-TdirectoryJ [name] DESCRIPTION Sort sorts lines of all the named files together and writes the result on the standard output. The name '-' means the standard input. If no input files are named, the standard input is sorted. The default sort key is an entire line. Default ordering is lexicographic by bytes in machine collating sequence. The ordering is affected globally by the options, one or more of which can appear. The notation +posl -pos2 restricts a sort key to a field beginning at posl and ending just before pos2. Posl and pos2 each have the form m.n, optionally followed by one or more of the flags bdfinr, where m tells the number of fields to skip from the beginning of the line and n tells the number of characters to skip further. If any flags are present they override all the global ordering options for this key. If the b option is in effect n is counted from the first nonblank in the field; b is attached independently to pos2. A missing .n means .0; a missing -pos2 means the end of the line. Under the -tx option, fields are strings separated by x; otherwise fields are nonempty nonblank strings separated by blanks. When there are multiple sort keys, later keys are compared only after all earlier keys compare equal. Lines that otherwise compare equal are ordered with all bytes significant. OPTIONS b Ignore leading blanks, spaces, and tabs in field comparisons. c Check that the input file is sorted according to the ordering rules; give no output unless the file is out of sort. d 'Dictionary' order: only letters, digits and blanks are significant in comparisons. f Fold uppercase letters onto lowercase. Ignore characters outside the ASCII range 040-0176 in nonnumeric comparisons. m Merge only, the input files are already sorted. n An initial numeric string, consisting of optional blanks, optional minus sign, and zero or more digits with optional decimal point, is sorted by arithmetic value; implies option b. FOR:PRO 1-80 9/83 SORT(1) Fortune Systems SORT(1) o The next argument is the name of an output file to use instead of the standard output. This file can be the same as one of the inputs. r Reverse the sense of comparisons. tx 'Tab character' separating fields is x. T The next argument is the name of a directory in which temporary files should be made. u Suppress all but one in each set of equal lines. Ignored bytes and bytes outside keys do not participate in this comparison. EXAMPLES Print in alphabetical order all the unique spellings in a list of words. Capitalized words differ from uncapitalized. sort -u +Of +0 list Print the password file (passwd(5» sorted by user id number (the 3rd colon-separated field). sort -t: +2n letdpasswd Print the first instance of each month in an already sorted file of (month day) entries. The options -um with just one input file make the choice of a unique representative from a set of equal lines predictable. sort -urn +0 -1 dates FILES lusr/tmp/strrf, Itmp/* first and second tries for temporary files SEE ALSO comm(l), join(l), uniq(l). DIAGNOSTICS Comments and exits with nonzero status for various trouble conditions and for disorder discovered under option -c. LIMITATIONS Very long lines are silently truncated. 9/83 1-81 FOR:PRO Fortune Systems STTY(1) STTY(1) NAME stty - set terminal options SYNOPSIS stty [option ... ] DESCRIPTION Stty sets certain va options on the current output terminal, placing its output on the diagnostic output. With no argument, it reports the speed of the terminal and the settings of the options which are different from their defaults. With the argument "all", all normally used option settings are reported. With the argument "everything", everything stty knows about is printed. OPTIONS cbreak -cbreak cooked echo -echo ek even -even lease -lease -nl nl odd -odd raw -raw tabs -tabs tandem -tandem make each character available to read(2) as received; no erase and kill processing, but all other processing (interrupt, quit, ... ) is performed make characters available to read only when newline is received same as '-raw' echo back every character typed do not echo characters set erase and kill characters to # and @ allow even parity input disallow even parity input map upper case to lower case do not map case allow carriage return for new-line, and output CR-LF for carriage return or new-line accept only new-line to end lines allow odd parity input disallow odd parity input raw mode input (no input processing (erase, kill, interrupt, ... ); parity bit passed back) negate raw mode preserve tabs replace tabs by spaces when printing enable flow control,(the system sends out the stop character when its internal queue is in danger of overflowing on input, and sends the start character when it is ready to accept further input disable flow control For the following commands which take a character argument c, you may also specify c as the "u" or "under', to set the value to be undefined. A value of ""x", a 2 character sequence, is also interpreted as a control character, with ;/"7" representing delete. FOR:PRO 1-82 9/83 STTY(1) Fortune Systems STTY(1) brk c set break character to c (default undefined.) This character is an extra wakeup causing character. bsO bsl select style of delay for backspace crO crt cr2 cr3 select style of delay for carriage return (see ioctl(2)) dec set all modes suitable for Digital Equipment Corp. ope rat~g /lsystems" users; (erase, kill, and interrupt characters to ?, U, and C, decctlq and "newcrt".) eof c set end of file character to c (default control D.) erase c set erase character to c (default '#', but often reset to "H.) ffO ff1 select style of delay for form feed intr c set interrupt character to c (default DEL or "? (delete), but often reset to "C.) kill c set kill character to c (default '@', but often reset to "U.) nlO nil n12 nl3 select style of delay for linefeed quit c set quit character to c (default control \.) start c set start character to c (default control Q.) stop c set stop character to c (default control S.) tabO tab1 tab2 tab3 select style of delay for tab set all modes suitable for Tektronix 4014 terminal tek set all modes suitable for Texas Instruments 700 series terti700 minal set all modes suitable for a General Electric TermiNet 300 tn300 set all modes suitable for the Teletype Corporation Model tty33 33 terminal. set all modes suitable for the Teletype Corporation Model tty37 37 terminal. vt05 set all modes suitable for Digital Equipment Corp. VT05 terminal o hang up phone line immediately 50 75 110 134 150 200 300 600 1200 1800 2400 4800 9600 19200 (exta) extb Set terminal baud rate to the number given, if possible. A teletype driver which supports more functionality that the basic driver is introduced in newtty(4) and fully described in tty(4). The following options apply only to it. crt -crt crtbs crterase 9/83 Set options for a CRT (crtbs, ctlecho and, if > = 1200 baud, crterase and crtkill.) Tum off options set by crt. Echo backspaces on erase characters. Wipe out erased characters with "backspace-spacebackspace." 1-83 FOR:PRO STTY(1) -crterase crtkill -crtkill ctlecho -ctlecho decctlq Fortune Systems STTY(1) Leave erased characters visible; just backspace. Wipe out input on like kill as in crterase. Just echo line kill character and a newline on line kill. Echo control characters as ,/, x" (and delete as II"?".) Print two backspaces following the EaT character (control D). Control characters echo as the mselves; in cooked mode EOT (control-D) is not echoed. After output is suspended (normally by "S), only a start character (normally "Q) will restart it. This is compatible with DEC's vendor supplied systems. After output is suspended, any character typed will restart it; the start character will restart output without providing any input. (This is the default.) etxack Diablo style etxlack handshaking (not implemented). Output is being discarded usually because the user typed flusho control a (internal state bit). Output is not being discarded. -flusho litout Send output characters without any processing. -litout Do normal output processing, inserting delays, etc. mdmbuf Start/stop output on carrier transitions (not implemented). -mdmbuf Return error if write attempted after carrier drops. new Use new driver (switching flushes typeahead). nohang Don't send hangup signal if carrier drops. -no hang Send hangup signal to control process group when carrier drops. pendin Input is pending after a switch from cbreak to cooked and will be re-input when a read becomes pending or more input arrives (internal state bit). -pendin Input is not pending. prterase For printing terminal echo erased characters backwards within "\" and "/". tilde Convert II"''' to II,,, on output (for Hazeltine terminals). -tilde Leave poor II"''' alone. -decctlq The following special characters are applicable only to the new teletype driver and are not normally changed. flush c Inext c rprnt c werase c set flush output character to c (default control 0.) set literal next character to c (default control V.) set reprint line character to c (default control R.) set word erase character to c (default control W.) The following options control page mode, a Fortune enhancement. Page mode may be used only after pageen, and then comes into effect with a pageon command or when one of the page mode control characters is pressed. FOR:PRO 1-84 9/83 STIV(1) Fortune Systems STTY(1) pageen Enable page mode. pagelen n Set page length to n (default 25). pageon Tum on page mode, if enabled. Page mode prints out < > at the bottom of the screen and waits for input, whenever page/en lines has been printed, and interesting stuff would scroll off the top of the screen. (See more(1). When the < > prompt is printed, one of the following characters will print the next page, the next line, the next halfpage, or clear the screen and print a page. Any other character will continue printing and turn off page mode. dear c nxhalf c nxpage c nxline c set clear character to c (default control N.) set next half page character to c (default control B.) set next page character to c (default control F.) set next line character to c (default control Eo) SEE ALSO tabs(l), tset(l), ioctl(2), newtty(4), tty(4). 9/83 1-85 FOR:PRO TEE(1) Fortune Systems TEE(1) NAME tee - pipe fitting SYNOPSIS tee [-aJ [-iJ [filej ... DESCRIPTION Tee transcribes the standard input to the standard output and makes copies in the files. OPTIONS -a Causes the output to be appended to the files rather than overwriting them -i FOR:PRO Ignores interrupts. 1-86 9/83 Fortune Systems TEST(1) TEST(1) NAME test - condition command SYNOPSIS test expr DESCRIPTION test evaluates the expression expr, and if its value is true then returns zero exit status; otherwise, a non zero exit status is returned. test returns a non zero exit if there are no arguments. The following primitives are used to construct expr. -d file true if the file exists and is a directory. -£ file true if the file exists and is not a directory. -n sl true if the length of the string 51 is nonzero. n1 -eq n2 true if the integers nl and n2 are algebraically equal. Any of the comparisons -ne, -gt, -ge, -It, or -Ie can be used in place of -eq. -r file true if the file exists and is readable. -s file true if the file exists and has a size greater than zero. sl true if 51 is not the null string. sl = s2 true if the strings 51 and 52 are equal. sl != s2 true if the strings 51 and 52 are not equal. -t [ fildes J true if the open file whose file descriptor number is filde5 (1 by default) is associated with a terminal device. -wfile true if the file exists and is writable. -z sl true if the length of string 51 is zero. These primaries can be combined with the following operators: 9/83 -a binary and operator -0 binary or operator 1-87 FOR:PRO TEST(1) Fortune Systems TEST(1) ( expr) parentheses for grouping. unary negation operator -a has higher precedence than -0. Notice that all the operators and flags are separate arguments to test. Notice also that parentheses are meaningful to the Shell and must be escaped. SEE ALSO find(l), sh(l). FOR:PRO 1-88 9/83 TRUE(1) Fortune Systems TRUE(1) NAME true, false - provide truth values SYNOPSIS true false DESCRIPTION True does nothing, successfully. False does nothing, unsuccessfully. EXAMPLE True and false are typically used in input to sh(l) such as: while true do command done SEE ALSO sh(l). DIAGNOSTICS True has exit status zero, fnlse nonzero. 9/83 1-89 FOR:PRO TTY(1) Fortune Systems TTY(1) NAME tty - get terminal name SYNOPSIS tty DESCRIPTION Tty prints the pathname of the user's terminal. DIAGNOSTICS 'not a tty' if the standard input file is not a terminal. FOR:PRO 1-90 9/83 WAIT(1) Fortune Systems WAIT(1) NAME wait - await completion of process SYNOPSIS wait DESCRIPTION Wait until all processes started with & have completed, and report on abnormal terminations. Because the wait(2) system call must be executed in the parent process, the Shell itself executes wait, without creating a new process. SEE ALSO sh(l). LIMITATIONS Not all the processes of a 3- or more-stage pipeline are children of the Shell, and thus can't be waited for. (This does not apply to csh(l).) Csh prints out the names and process numbers of all background processes when wait is interrupted, while sh does not. 9/83 1-91 FOR:PRO WALL(1) Fortune Systems WALL{1) NAME wall - write to all users SYNOPSIS wall DESCRIPTION Wall reads its standard input until an end-of-file. It then sends this message, preceded by 'Broadcast Message ... ', to all logged in users. The sender should be manager to override any protections the users may have invoked. FILES /dev/tty? /etdutmp SEE ALSO mesg(l), write(l). DIAGNOSTICS 'Cannot send to ... ' when the open on a user's tty file fails. FOR:PRO 1-92 9/83 Fortune Systems WHAT (1) WHAT(1) NAME what - identify SCCS files SYNOPSIS what files DESCRIPTION What searches the given files for all occurrences of the pattern that get(l) substitutes for @(#) (this is @(#) at this printing) and prints out what follows until the first IV, >, new-line, \' or null character. For example, if the C program in file f.e contains char ident[J = "@(#)identification information "; and f.e is compiled to yield £.0 and a.out, then the command what f.c f.o a.out prints f.c: identification information f.o: identification information a.out: identification information sces What is intended to be used in conjunction with the command get(l), which automatically inserts identifying information, but it can also be used where the information is inserted manually. SEE ALSO get(l), help(l). DIAGNOSTICS Use he/p(1) for explanations. LIMITATIONS It's possible that an unintended occurrence of the pattern @(#) could be found just by chance, but this causes no harm in nearly all cases. 9/83 1-93 FOR:PRO WHO(1) Fortune Systems WHO(1) NAME who - who is on the system SYNOPSIS who [who-file] [-f] [am IJ DESCRIPTION Who, without an argument, lists the login name, terminal name, and login time for each current user. Without an argument, who examines the letclutmp file to obtain its information. If a file is given, that file is examined. Typically the given file is /usr/admtwtmp, which contains a record of all the log ins since it was created. Then who lists log ins , logouts, and crashes since the creation of the wtmp file. Each login is listed with user name, terminal name (with '/devl' 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. With two arguments, as in 'who am I' (and also 'who are you'), who tells who you are logged in as. OPJ'IONS -f prints in Fortune friendly format. FILES /etciutmp SEE ALSO getuid(2), utmp(S). FOR:PRO 1-94 9/83 WRITE(1) Fortune Systems WRITE(1) NAME write - write to another user SYNOPSIS write user [ttynameJ DESCRIPTION Write copies lines from your terminal to that of another user. When first called, it sends the message Message from yourname you rttyna me ... The recipient of the message should write back at this point. Communication continues until an end of file is read from the terminal or an interrupt is sent. At that point write writes 'EOT' on the other terminal and exits. If you want to write to a user who is logged in more than once, the ttyname argument can be used to indicate the appropriate terminal name. Permission to write can be derued or granted by use of the mesg command. At the outset writing is allowed. Certain commands, in particular nroff and pr(l) disallow messages in order to prevent messy output. If the character 'I' is found at the beginning of a line, write calls the shell to execute the rest of the line as a command. The following protocol is suggested for using 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- (0) for 'over' is conventional so that the other can reply. (00) for 'over and out' is suggested when the conversation is about to be terminated. FILES /etdutmp to find user Ibinlsh to execute '!' SEE ALSO mail(l) , mesg(l), who(l). 9/83 1-95 FOR:PRO INTRO(4) Fortune Systems INTRO(4) NAME intro - introduction to special files DESCRIPTION Each type of device is accessed through a 'driver' module in the kernel. These drivers can be accessed through 'special files', which can be opened, closed, read, and written, just like ordinary disk files. Some of the special files support Iseek(2), and many of them support ioctl(2). By heavily entrenched convention, unix special files are found in the /dev directory. Special files are created by calling the mknod(2) system call The mknod(l) program can be used to make a special file from the shell, but that is never necessary on the Fortune Systems 32:16 because when the system comes up, the program mkdevs(8) is run, which correctly makes the files in /dev automatically. Manual pages in Section 4 describe the device drivers on the Fortune Systems 32: 16. These special files in /dev are found on all configurations: ttyOO tty01 console conf mem kmem null tty fdO[0-7] rfdO[O-7] fd[1-3][0-7] rfd[l-3][0-7] Built-in keyboard Rear serial port System console Configuration information. Memory. Kernel data memory Empty file on input, black hole on output. The controlling terminal of the opening process. Built-in floppy disk buffered (block) interface, partitions 0-7 Built-in floppy disk raw (character) interface, partitions 0-7 Other optional floppy disks, buffered interface. Other optional floppy disks, raw interface. Some files for accessing optional plug-in device controller cards: ttyxx hd[O-3][0-7] rhd[0-3][0-7] Terminal special files, from tty02 on up. For accessing Comm-A, cards. Optional hard disk(s) buffered (block) interface, partitions 0-7 Optional hard disk(s) raw (character) interface, partitions 0-7 Some of these devices can be accessed through other names in /dev for the convenience of certain application programs. lp tar culO, cuaO 9/83 Line printer. Default device used by tar(l), same as rfd02. tty ports for cu(l) and uucp(l). 2-1 FOR:PRO INTRO(4) Fortune Systems INTRO(4) SEE ALSO mkdevs(l), mknod(l), mknod(2), ttys(8), All of Section 4. FOR:PRO 2-2 9/83 CONSOLE (4) Fortune Systems CONSOLE (4) NAME console - Fortune 32:16 system console DESCRIPTION Idevlconsole is a character terminal. The built-in keyboard port, also known as /devlttyOO, operates at 2400 baud. The keyboard is a standard ASCII device. The front port is not a standard RS-232 port, it only drives 5 volts, instead of the standard 12. The built-in 25x80 monitor operates at a maximum effective rate of 45000 characters/second. It operates according to AT&T Presentation Level Protocol, as defined in /usrlincludelvideotex.h. FILES /dev/console /dev/ttyOO /usr/include/videotex. h SEE ALSO tty(4) , reconf(8). DIAGNOSTICS All UNIX internal problems are reported on the built-in monitor. 9/83 2-3 FOR:PRO FLOPPY (4) Fortune Systems FLOPPY (4) NAME floppy - built-in floppy disk drive DESCRIPTION The on-board floppy disk controller supplied with the Fortune 32:16 is based on the NEe 765A. The software currently supports MFM, 8O-tra~k, double-sided, double-density (MFM) disks with 5 lK blocks per track. This adds up to BOOK bytes per disk. There can be up to 3 additional drives attached. See diskconf(S) to find out how floppy disks are arranged. FILES /dev/fd[0-4J[0-7] /dev/rfd[0-4] [0-7] SEE ALSO disk(S) FOR:PRO 2-4 9/83 HO(4) Fortune Systems HO(4) NAME Hard Disk - Winchester disks DESCRIPTION The hard disks currently offered for the Fortune 32:16 are 5-1/4' Winchester disks, based on the Seagate-506 electrical interface. The controller is a version of the Western Digital 1000 Hard Disk Controller. Each controller can support 4 disk drives. The maximum effective throughput (by dumping a large disk file into /dev/null) is around 80,000 bytes/second. The raw device (/dev/rhd??) provides faster throughput in large sequential transfers. The disks are laid out in from 0 to 7 partitions, described by a table at the beginning of the disk. See diskconf(5). FILES /dev/hd[0-3] [0-7] /dev/rhd[0-3 J[0-7] SEE ALSO disk(5), diskconf(5). 9/83 2-5 FOR:PRO MEM(4) Fortune Systems MEM(4) NAME mem, kmem, conf - main memory DESCRIPTION Mem is a special file that is an image of the main memory of the computer. It can be used, for example, to examine the system Byte addresses in mem are interpreted as physical memory addresses. References to non-existent locations cause errors to be returned. Examining and patching device addresses is likely to lead to unexpected results when read-only or write-only bits are present. The file kmem is the same as mem except that kernel data memory, rather than physical memory, is accessed. /dev/Conf is a window onto a small area in low core which contains a copy of the data in the EAROM. It is the only memory file that is accessible to user-written programs. FILES /dev/mem /dev!kmem FOR:PRO 2-6 9/83 NEWTTY(4) Fortune Systems NEWTTY(4) NAME newtty - summary of the "new" tty driver SYNOPSIS stty new stty new crt DESCRIPTION This is a summary of the new tty driver, described completely, with the old terminal driver, in tty(4). The new driver is largely compatible with the old but provides additional functionality for page control. CRTs and printing terminals. The new terminal driver acts differently on CRTs and printing terminals. On CRTs at speeds of 1200 baud or greater it normally erases input characters physically with backspace-space-backspace when they are erased logically; at speed under 1200 baud this is often unreasonably slow, so the cursor is normally moved to the left. This is the behavior when you say stty new crt; to have the tty driver always erase the characters say stty new crt crterase crtkill, to have the characters remain even at 1200 baud or greater say stty new crt -crterase -crtkill. On printing terminals the command stty new prterase should be given. Logically erased characters are then echoed printed backwards between a '\' and an 'I' character. Other terminal modes are possible, but less commonly used; see tty(4) and stty(l) for details. Input editing and output control. When preparing input the character #: (normally changed to "H using stty(l)) erases the last input character, "w the last input word, and the charac!er @ (often changed to "U) erases the entire current input line. A R character causes the pending input to be retyped. Lines are terminated by a return or a newline; a "0 at the beginning of a line generates an end-of-file. Control characters echo as "x when typed, for some x; the delete character is represented as "? The character "Y can be typed before any character so it can be entered without its special effect. For backwards compatibility with the old tty driver the character '\' prevents the special meaning of the character and line erase characters, much as "Y does. Output is suspended when a "s character is typed and resumed when a "Q character is typed. Output is discarded after a "0 character is typed until another "0 is typed, more input arrives, or the condition is cleared by a program (such as the shell just before it 9/83 2-7 FOR:PRO NEWTTY(4) Fortune Systems NEWTTY(4) prints a prompt.) Page Mode. When page mode is set, printing more than a screenful of characters stops the display, the legend n < > n prints at the bottom of the screen, and the user must type a ch~racter before the printout continues. The nxpage character (default F) shows another page. The nxhalf character ~default liB) shows another half-page. The nxline character (default E) shows another line, and the nxpage character (default liN) clears the screen and shows a page. Stty pageen enables the mode. Enabled means that is possible to tum on page mode. If the mode is not enabled, the above four special characters are not interpreted. Page mode can then actually be turned on when cbreak and raw modes are off, and echo mode is on. When the mode is enabled, any of the above four characters, or the conupand stty pageon, turns page mode on. The printer restart (default Q) restarts the printout and tum page mode off. Typing any: other character to the n < > n prompt is equivalent to I\F. Stty pagelen 25 sets the length of the page to be used, the default is 25 lines, the screen length of the Fortune Intelligent Workstation. Signals. II A non-interactive pr?gram is interrupted by ~ ? (delete); this character is often reset to C using stty(l). A quit \ character causes programs to terminate like II? does, but also causes a core image file to be created which can be examined with a debugger. This is often used to stop runaway processes. Interactive programs often catch interrupts and return to their command loop; only the most well debugged programs catch quits. See tty( 4) for a more complete description of the new terminal driver. SEE ALSO csh(l), newcsh(l), stty(l), tty(4). LIMITA TIONS There is always room for more complexity in this area. The page mode scheme is wired into Fortune terminal control codes. To operate well with cursor-control programs, it should be sensitive to cursor controls, this might downgrade efficiency. FOR:PRO 2-8 9/83 NULL (4) Fortune Systems NULL(4) NAME null - data sink DESCRIPTION Data written on a null special file is discarded. Reads from a null special file always return 0 bytes. FILES Idev/null 9/83 2-9 FOR:PRO 510(4) Fortune Systems 510(4) NAME sio, comrn-a - Standard and optional serial I/O ports DESCRIPTION The Fortune 32:16 has two asynchronous serial ports as standard equipment. One is used for the keyboard input and its beeper output. The other is available for RS-232C connection at the back of the main unit. Each optional Communications-A board has either two or four asynchronous serial ports. All of these devices are accessed through the 'tty' interface described in tty(4). The functionality of these serial I/O ports is provided by Zilog Z-80 SIO (motherboard ports) and DART (Comm-A ports) chips. The Zilog DART is a functional subset of the Z-80 SIO, lacking only the synchronous capabilities. These ports can operate at the standard UNIX speeds, 0-19200 baud, with the exception that Comm-A ports cannot operate at 200 baud. The setting for the input baud rate determines both the input and output baud rates. The output baud rate setting is explicitly ignored. The default baud rates for ttyOO and tty01 are determined by values stored in the EAROM. See reconf(8). The DART interrupts the CPU for each character input or output; however, for efficiency, input characters are batched up and sent to the reading process with a delay of no more than 1120 of a second. The device file names for the standard SIO ports are Idev/ttyOO (built-in keyboard), and Idev/tty01, (RS-232C port at rear of main unit). The device file names for the Comm-A ports are Idev/tty02, Idev/tty03, etc. Later, other communications devices may also be known by ttyxx device names, the actual name assignment depending on the placement of the boards in the I/O option slots. Electrically, the inputs and outputs of the serial ports described here appear at the back of the main unit on RS-232C connectors. (RS232C is the Electronic Industries Association standard for serial I/O.) The world is divided into two kinds of equipment, as far as RS-232C connectors are concerned: Data Communication Equipment (DCE), e.g. modems, and Data Terminal Equipment (DTE), e.g. CRT terminals. You can connect DCE to DTE with a simple, straight-through cable. A special adaptor cable known as a "null modem" must be used to connect DTE to DTE, and a "null terminal" adaptor cable must be used to connect DCE to DCE. A port on a host computer might be connected to either a DCE or DTE depending on the application, requiring a special cable in one of the two cases. The serial ports on the computers used for the initial development of UNIX were wired as DTE, and the modem control signals are described in the software and the manual pages as if this were the FOR:PRO 2-10 9/83 SI0(4) SI0(4) Fortune Systems case (Fortune retains this nomenclature for standardization with UNIX practice). However, the Fortune 32:16 RS-232C ports are wired as DCE so that terminals can be connected with a simple, straight-through cable. Therefore, modems must be attached with special adaptor cables. All of this can be a little confusing, so be careful to note that when the tty(4) manual page talks about DCD, you can think of this as if it were describing the DCD signal at the modem end of a modem adaptor cable. (In fact, on the host port, it corresponds to the DTR pin.) In general, therefore, the tty(4) man page nomenclature and the software names for the modem control bits follow the names at the modem end of a modem adaptor cable as shown below. The tables below show the correspondence, between the DART signals, RS-232C connector pinouts, and modem cable connections. Note that the Zilog Z-80 DART is designed to be used as ow. The pinouts on the RS-232C ports look like this: DART RxD TxD ClS DTR RlS GND DTR DCD RI < ----- > < --- --- > --- > --- > <--- < --- PIN 2 3 4 5 6 7 8 20 25 NAME TxDTransmitted Data RxDReceived Data RTSRequest to Send ClSClear to Send DSRData Set Ready GNDGround DCDData Carrier Detect DTRData Terminal Ready TRBTrouble Note that the use of pin 25 is not officially defined in the RS-232C specification, but many printers and modems use it to indicate some problem (out of paper, taken off line, etc.). When a port is to be connected to a modem, an adaptor cable must be used. (Note that this adaptor cable is not the same as a 'null modem' adaptor.) This adaptor cable has the following connections: DART RxD TxD CTS DTR RTS GND DTR DCD RI HOST TxD 2 RxD 3 RTS 4 CIS 5 DSR 6 7 GND DCD 8 DTR 20 BUSY 25 <-----> <--- 3 2 5 ---> 4 7 ---> <--<--- 20 8 6 MODEM Received Data RxD TxD Transmitted Data crs Clear to Send RTS GND DTR DCD DSR Request to Send Ground Data Terminal Ready Data Carrier Detect Data Set Ready The end of the cable that connects to the Fortune 32:16 must terminate in a male connector. 9/83 2-11 FOR:PRO Fortune Systems 510(4) 510(4) NOTE: Noise on the input control lines on pins 4, 20, and 25 can put a heavy interrupt load on the CPU, crippling or even stopping system activity. Therefore, these pins are all pulled to -12 volts through a 15k ohm resistor (inactive logic level), so that if left unconnected, they do not fluctuate from noise. A connected peripheral device must actively pull them up to the high level to change their state. As per industry standard, pin 9 is connected to + 12 volts, and pin 10 is connected to -12 volts, for the benefit of short-haul moderns. These voltages will current-limit at 100 milliamperes. (In the official EIA RS-232C spec, these pins are defined as "Reserved for dataset testing". ) The keyboard jack on the front of the unit is intended only for connection of the standard Fortune keyboard. The keyboard input and output signals are connected directly to the Z-80 DART chip, which does not use RS-232C voltage levels. Permanent damage is done to that chip if you connect an RS-232C device to this jack. For the unusual case that needs to use the front keyboard port for something other than the normal keyboard, the pinouts look like this: 1 Shield 3 GND 4 5 6 7 8 +5V +5V Data to keyboard. Data from keyboard. gnd --- > < --- FILES Idev/tty[OI ][0-9] Idev/console SEE ALSO Zilog Z-80 SID Technical ManuaL tty(4) LIMITATIONS Because of a limitation of the baud rate generation hardware, the 200 baud speed is not supported on the Corom-A. The serial port on the back of the motherboard handles input slightly more efficiently than the Comm-A ports, its use is preferred for high-speed input from another computer. FOR:PRO 2-12 9/83 Fortune Systems TTY (4) TTY (4) NAME tty - general terminal interface SYNOPSIS #include #include #include DESCRIPTION The serial communications lines, /dev/tty"', and the console keyboard-screen combination, /dev/console, are interfaced to the system through this driver. These devices are called tty devices, or just tty's. What happens when you open, close, read, and write a tty depends heavily on the many options you can set with calls to ioctl(2). We will approach the matter by describing all the basic mechanisms and how the options affect them. Some of the options actually affect the hardware, such as setting the speed of a serial device, but most of the options affect the software behavior of the device. Unfortunately, you won't find a lot of cleanliness, modularity, or regularity in anything having to do with tty devices. The whole subject is an incredible morass of compatability with past versions of the system, Berkeley extensions, Fortune extensions, and the painful truth that dealing with serial terminals in the real world is like unto the problems faced at the Tower of Babel. We refer the reader to the documentation for the standard Bell Version 7 release or the Berkeley release, if he wants to know which features of this driver are standard Version 7, which came from Berkeley, and which are Fortune extensions. For our discussion of control characters, we will often use the official ASCII names as found in ascii(7). We will use all caps for these names, as in CR for carriage return. Line disciplines. Tty devices do all their input and output through a kind of driver called a line discipline. In the case where there is more than one line discipline available, line discipline switching is accomplished with the TIOCSETD ioctl: int ldisc = LDISC; ioctl(filedes, TIOeSETD, &ldisc); where LOISe would be the manifest constant from for the desired line discipline. The active line discipline can be obtained with the TIOCGETD ioctl. Pending input is discarded when the line discipline is changed. In this version of the system there is only one discipline available, the new tty line discipline from the 4.1 Berkeley Software Distribution, with further extensions added at Fortune Systems. The 9/83 2-13 FOR:PRO TTY (4) Fortune Systems TTY (4) manifest constant for this line discipline, found in , is NTIYDISC. This section describes both the characteristics of this particular line discipline and characteristics that are common to all line disciplines; unfortunately, the distinction is somewhat blurred. First open and last close. Like most UNIX devices, a tty is in a dormant state when it is not open by any process. It makes the transition from this dormant state to an active state when a process opens it. This kiss of life is referred to as 'first open'. Many processes can have the device open at the same time, and it will remain active until the last of those processes closes it, an event known as 'last close'. The control terminal and process groups. Each process has a pointer to a tty known as its control terminal. The special file /dev/tty is a handy name for the control terminal of the process that opens it. This special device can be used by programs that wish to be sure of writing messages on the control terminal no matter how output has been redirected. It can also be used by programs that demand a file name for output, when terminal output is desired and it is tiresome to find out which terminal is currently in use. Each process has a process ID and a process group ID. There can be only one process with a certain process ID, but more than one process can have a given process group ID. The process group ID of 0 is the null process group, i.e. belonging to process group 0 is like belonging to no process group. Each tty device has a process group ID associated with it. If a process whose process group 10 is 0 opens a tty device, then that tty device becomes the control terminal for that process, and the process group 10 of the process is set to that of the tty device unless the process group 1D of the tty is 0, in which case the process group 1D of both the opening process and the tty device are set to the process ID of the opening process. On last close, the process group 10 of the tty is set to O. Under various conditions, a tty device will send a signal to all the processes with its process group ID. The TIOCGPGRP ioctl can be used to read the process group ID of the tty, and the TIOCSPGRP ioctl can be used to set it. The process group 1D and the control terminal of a process are both inherited by a child process during a [vrk(2), even if the control terminal is closed. Basic modes. FOR:PRO 2-14 9/83 Fortune Systems TTV(4) TTV(4) There are several shorts, longs, and structures in the kernel that contain bits, characters, and numbers used by a tty to determine its mode of operation and its current state. These are called things like the 'tty state word', the 'local modes word', the 'sgtty structure', etc. For now, we will just talk about these things and what they do. You can read and write them with various ioctls which will be summarized later, and you can use the stty(l) command to display and to modify these things from the shell. On first open, the tty characteristics are initialized to default values, and changes persist only until last close. The TIOCSA VEMODES ioctl causes the current characteristics to be saved as the defaults for the tty on subsequent first opens. For normal interactive use, process 1 (init(8» forks a child which opens a tty then execs getty(8) which sets up tty modes then execs login(l). Thus most of the defaults are quickly overridden by getty(8) for login terminals. The sgJags word. Historically, the oldest of the mode words in the tty driver is the sg_flags word of the sgtty structure. There are two bits in the sg_flags word of the sgtty structure which determine one of three major modes of operation, characterized by the amount of processing done on the input and output characters. The bits are RAW and CBREAK. If the RAW bit is set, it overrides the CBREAK bit. The major features of these modes are: cooked The name comes from the fact that this mode is not RAW. It is also not CBREAK, but once upon a time there was only RAW and cooked (Ah, the History of Comedy). In this mode, the driver collects 7-bit input characters, allowing editing like backspacing to be done on the data. A process reading from the device will not get any data until a NL or an EOT (t_eofc) character, normally liD, is entered, at which point it gets all the buffered data up through the NL or up to the EOT (the EOT is not passed to the reading process). All dnver functions (input editing, interrupt generation, output processing such as delay generation and tab expansion, etc.) are available in this mode. CBREAK This mode is just like cooked mode except that input is not collected and editing is not effective; each input character is made available to a reading process as it is received by the hardware. RAW 9/83 In this mode, 8-bit characters are passed into and out of the device with minimal hassle. Each input character is made available to a reading process as it is received by the hardware. 2-15 FOR:PRO TTY (4) Fortune Systems TTY (4) Other bits in the sg_flags word of the sgtty structure are: ECHO If this bit is set, input characters are echoed to the output. CRMOD If RAW is not set and this bit is set, an input CR is read as a NL. On output, NL is translated into two characters: a CR and a NL. If ECHO and CRMOD are both set, CR and NL will each echo as the two character sequence CR NL. LCASE It is pointless to try to use an upper-case-only terminal with UNIX. The intent of this bit was try to help a user of an upper-case-only terminal. In the Fortune 32:16, this bit is ignored by the tty driver. TANDEM When this bit is set'll the system outputs a stop (t_stopc) character, normally 5, whenever the input queue is in danger of" overflowing, and a start (t_startc) character, normally Q, when the input queue has drained sufficiently. This mode is used when the input comes from the output of another machine rather than a person typing at a keyboard, and when the other machine understands this convention. TANDEM mode is unaffected by RAW or CBREAK modes. EVENP ODDP If the EVENP bit is set, input characters with even parity are accepted. If the ODDP bit is set, input characters with odd parity are accepted. If both bits are set or nei- ther bit is set, input parity is ignored, and all input characters are accepted and their parity bit (most significant bit) is set to O. Input characters which are not accepted because they are the wrong parity are discarded. Characters are ouptut with even parity if EVENP is set and ODDP is not, otherwise they are output with odd parity. In RAW mode, all input parity checking and output parity generation is disabled and full 8-bit characters are input and output. Output delays and tab expansion. In cooked and CBREAK mode, delays can be invoked after outputting backspaces (H), form feeds (L), carriage returns (M), tabs (I) II and newlines (J). These delays are controlled by bit fields in the sg_flags word of the sgtty structure. For compatibility with the past, when the C compiler did not support bit fields, the bit fields are not declared as such in the sgtty structure in but instead, masks and manifest constants are provided for the job. The backspace delay capability is not implemented. FOR:PRO 2-16 9/83 TTY (4) Fortune Systems TTY (4) The vertical tab delay, which should really be called the form feed delay, is either on or off. If it is on, an output Form Feed is followed by a delay of 2.12 seconds. The carriage return delay can be CRO (off), or one of three types: CRt, CR2, or CR3. Delay type 1 lasts about .08 seconds and is suitable for the General Electric Terminet 300. Delay type 2 lasts about .16 seconds and is suitable for the DEC VT05 and the 11 700. Delay type 3 is intended for the Concept-100 and is not really a delay. If delay type 3 is set, then enough nulls are output to guarantee that at least nine characters are ouptut on each line. The newline delay can be NLO (off) or one of three types: NLt, NL2, or NL3. Delay type 1 is dependent on the current column and is tuned for Teletype model 37's. Type 2 is useful for the DEC VT05 and is about .10 seconds. Type 3 is unimplemented and is O. The tab delay can be off, T ABO (off) or one of three types: T ABt, TAB2, or XTABS. Tab delay type 1 is dependent on the amount of movement and is tuned to the Teletype model 37. Type 2 is unimplemented and is O. Type 3, called XTABS, is not a delay at all but causes tabs to be replaced by the appropriate number of spaces to advance the column to the next multiple of 8. Input. UNIX expects terminals to operate in full-duplex mode. Characters may be input at any time, even while output is occurring. Input characters are buffered by the tty driver until some process reads them Input characters will be discarded if the number of buffered input characters exceeds the maximum allowed, 255, or in extremely rare circumstances when the system's character input buffers become completely choked. In cooked or CBREAK mode, a BEL character is echoed when an input character is discarded. In RAW mode, if a character is discarded, all buffered input and output characters for that tty are discarded and no BEL is echoed. In cooked mode, and less so in CBREAK mode, special behavior is invoked when certain characters are input. Some of the characters cause editing of the buffered input (cooked mode only), others control the flow of output, and others cause signals to be sent to the process group associated with the device. There are ioctls, to be discussed later, which will select the control character which invokes each kind of special processing. In cooked mode, terminal input is processed in units of lines. A program attempting to read will normally be suspended until an entire line has been received. 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 9/83 2-17 FOR:PRO Fortune Systems TTY (4) TTY (4) data. Note, however, that it is much more efficient to read several characters at a time. In cooked mode, an input EaT (t_eofc) terminates a line of input and starts a new one in much the same way that a NL does, except that an EaT is discarded and not read. If an EaT is input at the beginning of a line, a read will return with a count of 0, indicating end-of-file. The t_brkc character, normally disabled, acts like a new-line in that it terminates a line, is echoed, and is read. Typically, this character is set to ESC by programs that use it. lt is possible for a program to simulate terminal input using the TIOCSTI ioctl, which takes as its third argument the address of a character. The system pretends that this character was typed on the terminal, which must be the control terminal except for the superuser. If the LTELETEX bit in the local modes word is set, the tty driver tries its best to treat videotex three-character sequences that describe accented alphabetic characters as if they were a unit. Such a /I sequence is a Y followed by a character in the range of Ox40 through Ox5F followed by a character in the range of Ox20 through OxFF. Input editing (cooked mode only). In cooked mode, inlZut line editing is done with the erase (sg_erase) character, normally H (same as the backspace key), ~rasing the last character typed, the kill (sg_kill) character, normally X, erasing the entire current input line, and the word-erase (t_werasec) character, normally W, erasing the last word typed. For the purposes of the word-erase character, a word is defined as a sequence of non-blank characters, with tabs counted as blanks. Erasing of input characters never goes back beyond the beginning of the current input line. The literal-next (t_lnextc) character, normally /IV, can be typed preceding any character to prevent its special meaning. This also works in CBREAK mode. The erase and kill characters may also be entered literally by preceding them with '\ for compatiblity with olden days; the '\ will normally disappear upon typing the next character. I I The reprint (t_rprntd character, normally /lR, retypes all unread input. Retyping occurs automagically in cooked mode if you attempt to erase over intermingled program output. If the LRETYPE bit in the local modes word is set, then output is retyped on every input character which was preceded by program output. Input echoing and redisplay options. The driver has several options for handling the echoing of terminal input, controlled by bits in the local modes word. (The name is an FOR:PRO 2-18 9/83 TIV(4) Fortune Systems TTV(4) artifact from Berkeley, where the 'new tty' line discipline was originally considered a 'local extension' in the Berkeley system It is really just another funny-named word containing a bunch of bits controlling tty operation.) Hardcopy terminals. The LPRTERA bit is normally set in the local modes word when a hardcopy terminal is in use. Characters which are logically erased are then printed out backwards preceded by '\' and followed by'/' in this mode. Crt terminals. The LCRTBS bit is normally set in the local modes word when a crt terminal is in use. The terminal driver then echoes the proper number of backspace ( "H) characters when input is erased; in the normal case where the erase character is a "H this causes the cursor of the terminal to back up to where it was before the logically erased character was typed. If the input has become fouled due to interspersed asynchronous output, the input is automagically retyped. Erasing characters from a crt. When a crt terminal is in use, the LCRTERA bit may be set to cause input to be erased from the screen with a backspace-space-backs pace sequence when character or word deleting sequences are used. The LCRTKIL bit may be set as well, causing the input to be erased in this manner with the kill character as well. Echoing of control characters. [f the LCTLECH bit is set in the local modes wor~, then non-printing (control) characters are normally echoed as X (for some X) rather than being echoed unmodified; DEL is echoed as "? Output flow control. . cause output to be The stop (t stope) character, normally "5, will suspended.- The start (t_startc> character, normally "5, will cause output to resume. Extra stop characters typed when output is already stopped have no effect. Extra start characters typed when output is not stopped have no effect except to tum off page mode (see below). [f the LDECCTQ bit of the local modes word is set, stopped output will only restart when the start character is input; otherwise any character will restart output (page mode characters, discussed below are special here). If the start and stop characters are both set to the same character, then the function of that character toggles between stopping and starting output. These characters have no effect in RAW mode unless the LOUTFLOW bit is set in the local modes word, in which case they do have this effect, and they are read instead of discarded. If the AUTOEN bit in the tty state word is set, output flow is controlled by the ClS input modem control status bit. I.e. output flows only when C1S is on. Also when AUTOEN is set, input is discarded 9/83 2-19 FOR:PRO TTY (4) Fortune Systems TTY (4) whenever the OeD input modern control status bit is off. Flushing input and output. Output to serial devices, as well as input, is buffered in the tty driver. Depending on the speed of the device, up to 496 characters may be buffered by the driver on their way to the output port. Under certain conditions, the tty driver will discard, or 'flush', buffered output. The flush (t_flushd character, normally "0, sets the LFLUSHO bit in the local modes word, causing subsequent output to be flushed until the LFLUSHO bit is cleared by a program or more input is typed. This character has effect in both cooked and CBREAK modes and causes pending input to be retyped if there is any pending input. The TIOCFLUSH ioctls can be used to flush the characters in the input and/or output queues depending on the third argument. The TIOCOUTQ ioctl can be used to determine the number of characters still in the output queue. Page mode. Very fast terminal screen output, such as one finds on the Fortune 32:16 console or on terminals running at 19200 baud, can go by so fast that you can't read it. Page mode is intended to solve this problem When page mode is on, the tty driver keeps a count of the number of lines it has output since the last input character. When this number reaches the number of lines on the page, output stops, the < » prompt is printed, and the terminal driver waits for input. The nxpage (t_pagec) character, normally "F, enables" another page of output, the nxhalf (t_halfc) character, normally B, enables another half page of output, and the nxline (t_lined character, normally "E, enables another line of output. If you type these characters ahead, the amount of output enabled will accumulate. If the LPAGE _ EN bit in the local modes word is set, page mode is enabled, which means that it mayor may not be turned on. Then if the LPAGE _ ON bit in the local modes word is set, page mode is turned on. When the LP AGE_EN bit is set, LPAGE _ ON can be set by typing any of the three page mode characters mentioned above. The start character turns page mode off, but does not disable it. The stop character does not tum page mode on or off, but it does stop output, and then the page mode characters can be used to get more output. The TIOCSPAGE and TIOCGP AGE ioctls are used to change the page length and to read it, respectively. Page mode is never enabled if the page length is O. FOR:PRO 2-20 9/83 TTY (4) Fortune Systems TTY (4) Input characters that generate signals. There are several characters that generate signals in cooked and CBREAK mode; such signals are sent to all processes with the same process group IO as the tty. In addition, when input, these characters also flush pending input and output. This same flushing action can be effected with the TIOCFLUSH ioctl. The interrupt (t_intrc) character, normally "? (same as ASCII DEL), sends a SIGINT signal. This is the normal way to blow away a process from the terminal. In addition, many interactive programs catch this signal and revert to command mode when they catch it. In cooked and CBREAK mode, a received break is converted by the driver into an interrupt character, and acts just like one. In RAW mode, a received break is read as a NUL. The quit (t_quitc) character, normally "\' sends a SIGQUIT signal. This signal is used to cause a foreground program to terminate and produce a core image if possible, in a file called core in the current directory. Output. When one or more characters are written, they are transmitted to the terminal as soon as previously-written characters have finished typing. (As noted above, input characters are normally echoed by putting them in the output queue as they arrive.) When a process writes characters more rapidly than they can be output through the output hardware, it will be suspended when its· output queue exceeds a limit which is automatically selected to be higher for higher output speeds, with a maximum of 496 characters. When the queue has drained down to a threshold, the program is resumed. If the LNOEOTOUT bit in the local modes word is set, the EOT character is not transmitted in cooked or CBREAK mode. This is to prevent terminals that respond to it from hanging up; programs using RAW or CBREAK mode should be careful. If the LLITOUT bit in the local modes word is set, output translations are suppressed in cooked and CBREAK mode, and output acts much like RAW mode. Modem control signals NOTE: Important information on modem control signal information is presented in sio(4). The tty driver knows about the output modem control signals 01R and RIS, and the input modem control signals DCD, OSR, and CIS. Output modem control signals Whenever a tty is opened, whether it is the first open or not, the DTR and RTS output modem control signals are both raised. If the 9/83 2-21 FOR:PRO TTY(4) Fortune Systems TTY(4) LNOOPENDTR bit of the local modes word is set, DTR will not be raised on open. Similarly, if the LNOOPENRTS bit of the local modes word is set, RTS will not be raised on open. If the HUPCLS bit of the tty state word is set, OTR and RTS will be lowered on last close. Setting the input speed to 0 causes OTR and RTS to be lowered immediately. The TIOCSDTR ioctl raises OTR, and the TIOCCDTR ioctllowers it. The TIOCSRTS ioctl raises RTS, and the TIOCCRTS ioctl lowers it. Input modem controL signaLs If the NOMDMINTS bit of the local modes word is set, then the input modem control signals are totally ignored, an input break will act as if it were an ordinary null character, and the discussion of other features relating to input modem status signals and input breaks elsewhere in this section becomes moot. (1llis bit should only be used if the equipment connected to the port generates noise on one of the input modem control signals, and it is inconvenient to disconnect the offending signal(s), and the status of the other unoffending signals is unimportant. Specifically, some printers generate noise on pin 25. Noise on an input modem control signal can very seriously degrade system performance.) The current state of the three modem control inputs is available in the tty state word as the DCD_STATUS, CTS_STATUS, and DSR_STATUS bits. Three more bits in the tty state word, DCD_ CHANGE, CTS_ CHANGE, and DSR_CHANGE, are set to indicate a change since first open or since the most recent TIOCGETSTATE ioctl on the device. These bits are useful for detecting transitions that are too quick to be caught by looking at the status bits. A process can issue a TIOCSETSIG ioctl to arrange for a specified signal to be sent to the tty's process group on each transition of selected input modem control bits. The selection of bits is made with a bitrnask made up of the DCD STATUS, CTS STATUS, and DSR_STATUS bits. The TIOCGETSIG ioctl reportS the currently selected modem status change signal number and the selected bits. On last close, the bitmask of selected bits and the selected modem status change signal are both set to O. Carrier Detect. The tty driver maintains a bit in the tty state word named CARR_ON, for 'carrier on'. The name 'connected' would be more appropriate to its true function, since this bit can often be set when the DCD input is not. Depending on the settings of the RESPECTCARR, IWTCARR, and OWTCARR bits in the tty state word, CARR_ON may go up and down with the DeD input signal or it may be independent of it. FOR:PRO 2-22 9/83 TTY (4) Fortune Systems TTY (4) If the RESPECTCARR bit in the tty state word is not set, then the OeD input signal has no effect on CARR_ON, and the IWTCARR and OWTCARR bits in the tty state word are ignored. In this case, the CARR_ON bit is set on first open, and cleared on last close. Both input and output function normally when the CARR_ON bit is on. If the RESPECTCARR bit in the tty state is set, then CARR_ON starts out high on first open, but will then go down and up with the DeD input signal. If OeD makes CARR_ON drop while the tty is open, a SIGHUP signal is sent to all the processes in the tty's process group, and all current and subsequent reads and writes terminate prematurely, i.e. with a returned count of 0 (reads) or a smaller count than requested (writes). (Pending reads and writes which are interrupted by the SIGHUP signal will return -1.) The SIGHUP is suppressed if the LNOHANG bit in the local modes word is set. A normal tty device, such as /dev/tty01, is considered an 'incoming' device. For each incoming device there can be a corresponding 'outgoing' device, which is the same except that its minor device number is 128 greater than its corresponding incoming device. Logins use incoming devices; cu(l) and uucico(8) use outgoing devices. For example, if /dev/tty01, which is an incoming device, is device major:minor 1:1, then the corresponding outgoing device, which would probably be named /dev/cuIO, would be device major:minor 1:129. If the RESPECTCARR and IWTCARR bits in the tty state word are both set on an incoming device, then if DCD is low, opens will block until DCD comes up, at which point CARR_ON is set and sleeping open calls will return. Similarly, the OWTCARR bit can be used to cause opens on an outgoing device to wait for carrier. If a process, such as getty, is waiting for carrier on an incoming device, the corresponding outgoing device can be used, and the process sleeping on the incoming device will continue to sleep until the outgoing device is dosed, at which time the incoming process will continue to wait for carrier. If an incoming tty is open, then opens on the corresponding outgoing tty will fail with errno set to EBUSY. If the RESPECTCARR bit in the tty state word is set, the TIOCW AITCARR ioctl can be used to explicitly wait until carrier is up. This ioctl returns immediately if carrier is already up at the time of the call. Breaks. The TIOCSBRK ioctl will set the 'transmit break' bit in the hardware interface causing the transmitted line to go to the mark condition until this condition is reversed by a TIOCCBRK ioctl (usually after a delay with sleep(3». The TCSBRK ioctl will cause a 250 millisecond break to be transmitted. 9/83 2-23 FOR:PRO Fortune Systems TTV(4) TTV(4) An input break in RAW mode is read as a NUL character. In cooked or CBREAK mode it is read as if it were the interrupt character. More detail on the ioct} commands. Programs using tty ioctls will include and which in turn includes . Some ioctls require including < sys/tty.h > . #include struct sgtty sgtty; ioctI(filedes, TIOCGETP, &sgtty); This ioctl reads the sgtty structure. The TIOCSETN ioctl writes it, and the TIOCSETP ioctl writes it after waiting until output is quiescent, the flushes input and output. The sgtty structure, and the defines for the bits used in that structure, are defined in : struct sgttyb { char char char char short }; sg ispeed; sg=ospeed; sg erase; sg=kill; sg_flags; The sg ispeed and sg ospeed fields describe the input and output speeds of the device according to the following table. Symbolic values in the table are as defined in : 80 850 875 8110 8134 8150 8200 8300 8600 81200 81800 82400 84800 89600 EXTA EXTB FOR:PRO 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 (hang up dataphone) 50 baud 75 baud 110 baud 134.5 baud 150 baud 200 baud 300 baud 600 baud 1200 baud 1800 baud 2400 baud 4800 baud '9600 baud External A (19200 baud) External 8 2-24 9/83 TTY (4) Fortune Systems TTY (4) The EXTA baud rate is 19200 baud on the Fortune 32:16. Code conversion and line control required for IBM 2741's (134.5 baud) must be implemented by the user's program Half-duplex operation, (such as is used on the Bell 202 dataset is not supported. The bits in the sg_flags field are as follows: ALLDELAY BSDELAY 0177400 0100000 BSO BS1 VTDELAY FFO FF1 CRDELAY CRO CR1 CR2 CR3 TBDELAY TABO TAB1 TAB2 XTABS NLDELAY NLO NL1 NL2 NL3 0 0100000 0040000 0 0100000 0030000 0 0010000 0020000 0030000 0006000 0 0001000 0004000 0006000 0001400 0 0000400 0001000 0001400 EVENP 0000200 ODDP RAW 0000100 0000040 CRMOD 0000020 ECHO LCASE CBREAK TANDEM 0000010 0000004 0000002 0000001 Delay algorithm selection Select backspace delays (not implemented): Select form-feed and vertical-tab delays: Select carriage-return delays: Select tab delays: Select new-line delays: Even parity allowed on input (most terminals) Odd parity allowed on input Raw mode: wake up on all characters, 8-bit interface Map input CR into LF, output LF to CR LF Echo (full duplex) Map upper case to lower on input Return each character as soon as typed Input flow control include struct tchars tchars; ioctl(filedes, TIOCGETC, &tchars); This ioctl reads the tchars structure, and the TIOCSETC ioctl writes it. This structure contains some of the characters that are special on 9/83 2-25 FOR:PRO Fortune Systems TTY(4) - input. The tchars structure is defined in strud tchars { char char char char char char t_intrc; t_quitc; t_startc; t_stopc; t_eofc; t_hrkc; TTY (4) < syslioctL. h > : 1* interrupt "'I 1* quit *1 1* start output"I 1* stop output *1 1* end-of-file "'I 1* input delimiter (like nl) *1 include struct Itchars Itchars; iodl(filedes, TIOCGLTC, &Itchars); 'Ihis ioctl reads the ltchars structure, and the TIOCSLTC ioctl writes it. This structure contains some of the characters that are special on input. The It<;hars structure is defined in < syslioctl.h >: struct ltchars { char char char char char char }; t_suspc; t_dstopc; t_rprntc; t_flushc; t_ werasec; t_Inextc; 1* stop process signal "'I 1* delayed stop process signal *1 1* reprint line "'I 1* flush output (toggles) *1 1* word erase *1 1* literal next character *1 The t_suspc and t_dstopc characters are not implemented. include struct ptchars ptchars; ioctl(filedes, TIOCGPTC, &ptchars); This ioctl reads the Itchars structure, and the TIOCSPTC ioctl writes it. This structure contains the characters that are special to page mode. The ptchars structure is defined in : struct ptchars { char t_pagec; char t_linec; char t_halfc; char t_clearc; 1* show next page *1 1* show next line *1 1* show half next page "'I 1* clear screen and show next page *1 }; The t_clearc character is not implemented. Characters in the sgtty, tchars, ltchars, and ptchars structures should be unique, except that the t stopc and t startc can be the same for a toggling effect. Setting ooe of these characters to OxFF FOR:PRO 2-26 9/83 Fortune Systems TTY (4) TTY (4) disables that function. unsigned long localmodes; ioct1(filedes, TIOCLGET, &Iocalmodes); This ioctl reads the local modes word. The TIOCLSET ioctl writes it, the TIOCLBIS ioctl ORs localmodes into it, and the TIOCLBIC ioctl ANOs it with the complement of localmodes. The bits of the local modes word are: LCRTBS OxOOOOOl LPR1ERA LCR1ERA OxOOOOO2 OxOOOOO4 LTlLDE OxOOOOO8 LMDMBUF OxOOOOlO LLITOUT LTOSTOP OxOOOO20 OxOOOO40 LFLUSHO LNOHANG OxOOOO80 OxOOOlOO LETXACK OXOOO200 LCRTKIL OXOOO400 LINTRUP OxOOO800 LCTLECH OxOOlOOO LDECCTQ OXOO4000 LPAGE EN OXOO8000 LPAGE ON L1ELE1EX LNOEOTOUT LOUTFLOW OxOlOOOO OX020000 OX040000 OX080000 LRE1YPE OxlOOOOO LNOOPENDTR LNOOPENRTS Ox200000 Ox400000 Backspace on erase rather than echoing erase Printing terminal erase mode Erase character echoes as backspace-space-backspace Convert '" to ' on output (for Haze ltine terminals) Stop/start output when carrier drops Suppress output translations Send SIGTTOU for background output Output is being flushed Don't send hangup when carrier drops Diablo style buffer hacking ( unimplemented) BS-space-BS erase entire line on line kill Generate interrupt SIGTlNT when input ready to read . A Echo mput control chars as X, delete as A? A A Only Q restarts output after S, like DEC systems Enable page mode, does not tum it on. Turn page mode on. teletex multi-char sequences don't output EOT's flow ctrl in raw mode & read the chars Retype whenever echoed data is messed up Do not raise DTR on open Do not raise RTS on open The LTILDE, LTOSTOP, LINTRUP, and LMDMBUF bits are 9/83 2-27 FOR:PRO Fortune Systems TTY (4) TTY (4) unimplemented. unsigned long state; ioctl(filedes, TIOCGETSTATE, &state); This ioctl reads the tty state word, and the TIOCSETSTATE ioctl writes certain bits into it. The interesting bits of the tty state word are: CARR ON BUSY XCLUDE TISTOP HUPCLS TBLOCK DCD STATUS CTS STATUS DSR STATUS RTS ON DTR ON RESPECTCARR IWTCARR OWTCARR AUTOEN OxOOOOOlO OxO000020 OXOOOO080 OxOOOOlOO Ox0000200 Ox0000400 OxOOOlOOO OxO002000 Ox0004000 OxO008000 OxO 100000 OX0200000 OX0400000 OX0800000 OxlOOOOOO DCD CHANGE CTS CHANGE DSR CHANGE Ox2000000 Ox4000000 Ox8000000 Connected Output in progress Exclusive-use flag against open Output stopped by ctl-s Hang up upon last close Tandem queue blocked DCD status CTS status DSR status (RI on the sio) Software copy of rts on Software copy of dtr on Respect the carrier Wait for carrier on incoming open Wait for carrier on outgoing open DCD & CTS enable receiver and xmitter DCD status changed CTS status changed DSR status changed (RI on the sio) The TIOCSETSTATE ioctl loads only the XCLUDE, HUPCLS, IWTCARR, OWTCARR, RESPECTCARR, and AUTOEN bits. The others are read-only. The TIOCGETSTATE ioctl clears the DCD_CHANGE, CTS_CHANGE, and DSR CHANGE bits after reading them include struct mdmsig mdmsig; ioctl(filedes, TIOCSETSIG, &mdmsig); This ioctl writes the modem signaling information and the TIOCGETSIG reads it. This information is transmitted with the mdmsig structure found in : struct mdmsig { unsigned long ms mask;/" mask of status bits to signal on ../ unsigned char ms_ signo;/" which signal to send .., }; FOR:PRO 2-28 9/83 TTY (4) Fortune Systems TTY (4) A number of other ioctL(2) calls apply to ttys, and have the general form: #include ioctl(fildes, command, arg) item *arg; where item would be an unsigned long, or a short, or an int, as appropriate for the ioctl command. Unless otherwise specified, ioctl commands that don't take an argument should be passed a NULL pointer for the argo With the following commands the arg is ignored, although 0 is recommended. TIOCEXCL Set exclusive-use mode: no further opens are permitted until last close. TIOCNXCL Tum off exclusive-use mode. TIOCHPCL On last close, hang up, i.e. drop the D1R and R1S outputs. This is useful when the line is associated with an ACU used to place outgoing calls. TIOCSAVEMODES Save the current characteristics as the defaults for the tty on subsequent first opens. This is what is saved: sgtty structure, tchars structure, ltchars structure, ptchars structure, local modes word, line discipline, page length, and the DTR_ ON, RTS_ON, DCD_STATUS, CTS_STATUS, and DSR_STATUS bits of the tty state word. TIOCWAITCARR Wait until DCD is up if the RESPECTCARR bit is set in the tty state word, otherwise return immediately. In the remaining calls, where arguments are required they are described; arg should otherwise be given as the NULL pointer (0). TIOCFLUSH If arg is 0, all characters waiting in input or output queues are flushed. If arg is non-O, it is taken as a pointer to an into The input queue is flushed if the 1 bit of the int is set, and the output queue is flushed if the 2 bit of the int is set. TIOCSTI the argument is the address of a character which the system pretends was typed on the terminal. TIOCSBRK the break trans mit bit is set. 9/83 2-29 FOR:PRO TTY (4) Fortune Systems TTY (4) TIOCCBRK the break transmit bit is cleared. TIOCSDTR DTR output is set. TIOCCDTR D1R output is cleared. TIOCSR1S R1S output is set. TIOCCR1S R1S output is cleared. TIOCGPGRP arg is the address of a short into which is placed the process group number of the tty. TIOCSPGRP arg is a short (typically a process id) which becomes the process group for the tty. TIOCOUTQ reads the number of characters awaiting output into the int whose address is argo TIOCSPAGE loads the page length from the int whose address is argo TIOCGPAGE reads the page lenth into the int whose address is argo TCSBRK Wait for output to be quiescent, and if arg is the NULL pointer, output a 250 millisecond break. FIONREAD returns in the long integer whose address is arg the number of immediately readable characters from the argument unit. This works for files, pipes, and ttys. FILES Idev/tty Idev/tty* Idevlconsole SEE ALSO csh(l), stty(l), ioctl(2), signal(2), stty(2), getty(8), init(8). FOR:PRO 2-30 9/83 DEVTYPE(5) Fortune Systems DEVTYPE(5) NAME devtype - serial line configuration file DESCRIPTION Oevtype contains for each serial line the following information: unix device name internal name (eg. As described in termcap, printcap .. ) class (P=printer, T=terminal, C=communications device) number - number of device in it's class baud rate external name (eg. location) service notification port Status bit 1 = enabled, 0 = disabled This is an ASCII file. Each field within each entry is separated from the next by a tab. Each entry is separated from the next by a newline. This file resides in directory lete. FILES letddevtype SEE ALSO dtinit(l). 9/83 3-1 FOR:PRO DIR(5) Fortune Systems DIR(5) NAME dir - format of directories SYNOPSIS #include DESCRIPTION A directory behaves exactly like an ordinary file, save that no user can 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 see, jilsys(5). The structure of a directory entry as given in the include file is: #ifndef DIRSIZ #define DIRSIZ 14 #endif struct direct { ino t char d_ino; d_ name[DIRSIZj; }; By convention, the first two entries in each directory are for '.' and ' . .'. The first is an entry for the directory itself. The second is for the parent directory. The meaning of ' .. ' 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 ' .. ' has the same meaning as '.'. SEE ALSO filsys(5). FOR:PRO 3-2 9/83 DISK (5) Fortune Systems DISK(5) NAME disk - Special liD commands for disk devices SYNOPSIS ioctl(fildes, request, addr) devctl(b_or_ c, dev, request, addr) DESCRIPTION Special disk maintenance operations are done with the ioetl and devctl calls. Some special operations may only be done when the device has no outstanding open(2) calls, necessitating the use of devctl, and some can be done either with devctl or with ioctl. The different calls use and return data in addr pointers. The various calls and their arguments. devct1(b or c,dev,IOCRCONFB,struct diskconf *) ioctl(fildes,IOCRCONFB,struct diskconf *) Read the configuration for this disk into struct diskconf. devctl(b_ or_ c,dev , IOCWCONFB,struct diskconf *) Change the configuration block to that in struct diskconf. There can be no outstanding requests on the drive, and the conf block must be correct. devctl(b or c,dev ,IOCFMT ,struct diskconf *) Format the drive. There may be no outstanding requests. The conf block must be correct. devct1(b _ or_ c,dev ,IOCFMTTRK,strud fmttrk *) Format the track on the drive. Same as above. devct1(b _ or_ c,dev ,IOCCHMED,unused) Force driver to assume that media in drive has changed. There may be no outstanding requests. devctl(b _ or_ c,dev ,IOCAUTO,struct devauto *) ioctl(fildes,IOCAUTO,struct devauto *) Place standard name and mode of device, if it exists, into struct devauto. devct1(b or c,dev,IOCSAFE,unused) Move disk heads to a safe place, in case of power outage, global or local earthquake, or other acts of Cod. devct1(b_ or_ c,dev,IOCSEEK,cylinder) ioctl(fildes,IOCSEEK,cy linder) Seek disk heads to given cylinder. devctl(b_ or_ c,dev ,IOCRESET, unused) Force driver to rebuild its concept of the state of the drive. No outstanding requests. devctl(b or c,dev,IOCDRVSTAT,struct diskstat *) ioctl(fildes,IOCDRVSTAT,struct diskstat *) 9/83 3-3 FOR:PRO Fortune Systems DISK (5) DISK (5) Report current state of drive: its head position, any error conditions, and indicate any outstanding accesses. FILES lusr/include/sys/ioctl. h lusr/include/sys/diskconf. h SEE ALSO devctl(2), ioctl(2), diskconf(5), floppy(5), wd(5). DIAGNOSTICS Devctl and ioctl return -1 on error. LIMITATIONS It is not guaranteed that all of these commands are implemented in every driver. FOR:PRO 3-4 9/83 DISKCONF (5) Fortune Systems DISKCONF (5) NAME Diskconf DESCRIPTION The diskconf structure, also known as the disk configuration block, occupies the first block of every disk used by the Fortune 32:16. It contains information describing physical characteristics of the disk, the disk partition layout, bad block information, etc. used by the particular disk driver. Mkconf(l), rdconf(l), and format(l) manipulate the config block. PHYSICAL CHARACTERISTICS The canonical disk described by the config block consists of one or more platters each of which is a series of dc _cyls concentric circles of information-bearing magnetic media. The disk also has dc head read/write heads, each of which has its own platter. The heads can move from outermost cylinder to the innermost. They are usually attached together and must move in tandem. Each individual band is called a track, and there are dc_head * dc _cyls tracks per disk. Each track is subdivided into dc sectrk sectors. Each sector holds dc_blksiz bytes. Each sector is called a block, and the standard address of any sector on the disk is its block number. There are dc_head * de_eyls * dc _sectrk blocks on a disk. Block numbers increase by sector, then by head, then by cylinder. The UNIX system has a notion of two kinds of blocks: logical blocks and physical blocks. Logical blocks are 1024 bytes long. The 32:16 built-in floppy disk operates with 1024-byte (or 1K) physical blocks. The Winchester disks operate with S12-byte (or 1I2K) physical blocks. All block numbers in the config block are in physical blocks. The dc _ wrtred and de _ wrtpre fields stand for write reduce and writeprecompensation. These affect the way data is encoded on the surface of the disk via magnetic blips. The dc_ro Jags contain one bit per partition. If that bit is on, the partition can be accessed but not changed. The disk can be divided into NPART (defined in /usr/include/sys/diskconf. h) contiguous areas, called partitions. Partition X is described by the first block and number of blocks, i.e., it starts at block de _sizes[X].dcJoffset and continues for dc _sizes[X].dcJsize blocks. The disk can also contain up to NPART level 1 boot program areas. These are indicated in a separate table, similar to the partition table. A boot area must be wholly within a partition, because only the partitions are accessed by the drivers. When a disk error occurs, the offending block(s) is/are replaced by the sparing mechanism. When a block is decided to be unusable, any reference to it is redirected to its replacement block. Spare blocks are pulled from the first cylinder. Thus, data should never be stored on the first cylinder. The field dc nbad and the array de_bad[J 9/83 3-5 FOR:PRO DISKCONF (5) Fortune Systems DISKCONF (5) constitute the bad block map. The construction of the bad block map differs between devices. A config block must follow certain rules: dc_magic must contain CONFMAGIC (defined in /linc1ude /linc1ude /linc1ude < sys/ino.h > DESCRIPTION Every file system storage volume (e.g. /dev/hd[O-3J[2-7], /dev/fd[O3][2-7]) has a common format for certain vital information. Every such volume is divided into a certain number of l024-byte blocks. Block 0 is unused. Block 1 is the super block. The layout of the super block as defined by the include file is: 1* * Structure of the super-block */ struct filsys { unsigned short s_ isize; 1* size in blocks of i-list */ daddr t s fsize; /* size in blocks of entire volume */ short - s==nfree; /* number of addresses in s free */ daddr t s free[NICFREE]; 1* free block list */ short - s-ninode; 1* number of i-nodes in s inode */ ino t s- inode[NICINOD]; /* free i-node list */ char s-flock; /* lock during free list manipulation */ char s- ilock; 1* lock during i-list manipulation */ char s fmod; 1* super block modified flag */ char s==ronly; /* mounted read-only flag */ time s_time; /* last super block update */ /* remainder not maintained by this version of the system */ daddr_ t s_ tfree; ino t s _ tinode; • short s_ m; short s_n; char s _ fname[6]; char s _ fpack[6]; /* 1* /* /* /* /* total free blocks*/ total free inodes *1 interleave factor *1 " " */ file system name */ file system pack name */ }; S isize is the address of the first block after the i-list, which starts just after the super-block, in block 2. Thus the i-list is s_isize-2 blocks long. SJize is the address of the first block not potentially available for allocation to a file. These numbers are used by the system to check for bad block addresses; if an 'impossible' block address is aUocated from the free list or is freed, a diagnostic is written on the on-line console. Moreover, the free array is cleared, so as to prevent further allocation from a presumably corrupted free list. FOR:PRO 3-8 9/83 Fortu ne Systems FllSYS(5) FllSYS(5) The free list for each volume is maintained as follows. The sJee array contains, in sJee{1]' ... , sJee[s_nfree-1], up to NICFREE free block numbers. NlCFREE is a configuration constant. 5 Jee[OJ is the block address of the head of a chain of blocks constituting the free list. The layout of each block of the free chain as defined in the include file is: struct fblk { int df_ nfree; daddr_ t df_ free[NICFREE]; }; The fields df_nfree and dfJee in a free block are used exactly like s_ nfree and sJee in the super block. To allocate a block: decrement s_nfree, and the new block number is sJee[s_nfree1. If the new block address is 0, there are no blocks left, so give an error. If s_ nfree became 0, read the new block into s_ nfree and s Jee. To free a block, check if 5_ nfree is NlCFREE; if so, copy s_nfree and the sJee array into it, write it out, and set 5 _n free to O. In any event set sJee[s _nfree1 to the freed block's address and increment s_nfree. 5_ninode is the number of free i-numbers in the s_in ode array. To allocate an i-node: if s_ninode is greater than 0, decrement it and return s inode[s ninodeJ. If it was 0, read the i-list and place the numbers-of all free inodes (up to NlCINOO) into the s_inode array, then try again. To free an i-node, provided s_ ninode is less than NlCINOOE, place its number into s_inode[s _l1illodeJ and increment s ninode. If s ninode is already NlCINOOE, 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. The fields s lasti and s nbehind are used to avoid searching the inode list from the beginning each time the system runs out of inodes. 5_Lasti gives the base of the block of inodes last searched on the filesystem when inodes ran out, and s_ nbehind gives the number of inodes, whose numbers were less than 5_lasti when they were freed with s_ ninode already NlCINOOE. Thus s ninode is the number of free inodes before s_lasti. The system will search forward for free inodes from s lasti for more inodes unless s l1behind is sufficiently large, in which case it will search the file system inode list from the beginning. This mechanism serves to avoid n**2 behavior in allocating inodes. 5Jock and s_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 sJnod on disk is likewise immaterial; it is used as a flag to indicate that the super-block has changed and should be copied to 9/83 3-9 FOR:PRO FILSYS(5) Fortune Systems FILSYS(5) the disk during the next periodic update of file system information. S_,only is a write-protection indicator; its disk value is also immaterial. S_time is the last time the super-block of the file system was changed. During a reboot, s_time of the super-block for the root file system is used to set the system's idea of the time. The fields s_tfree, s_tinode, syame and sJJack are not currently maintained. I-numbers begin at I, and the storage for i-nodes begins in block 2. I-nodes are 64 bytes long, so 16 of them fit into a block. I-node 2 is reserved for the root directory of the file system, but no other inumber has a built-in meaning. Each i-node represents one file. The format of an i-node as given in the include file is: 1* "" Inode structure as it appears on * a disk block. *1 struct dinode { unsigned short di_ mode; I"" mode and type of file *1 short di_ nlink; 1* number of Links to file *1 short di_ uid; 1* owner's user id *1 short di_gid; 1* owner's group id *1 off t di_size; 1* number of bytes in file *1 chell di addr[40]; 1* disk block addresses *1 time t d(~atime; 1* time last accessed *1 time t di_ mtime; I"" time last modified *1 time t di_ctime; 1* time created *1 }; 1* * the 40 address bytes: * 39 used; 13 addresses * of 3 bytes each. */ Di_mode tells the kind of file; it is encoded identically to the st_mode field of stat(2). Di nlink is the number of directory entries (links) that refer to this i-nOde. Di_ uid and diJid are the owner's user and group IDs. Size is the number of bytes in the file. Di_atime and di mtime are the times of last access and modification of the file contents (read, write or create) (see times(2»; Di_ctime records the time of last modification to the inode or to the file, and is used to determine whether it should be dumped. Special files are recognized by their modes and not by i-number. A block-type special file is one which can potentially be mounted as a FOR:PRO 3-10 9/83 FILSVS(5) Fortune Systems FILSVS(5) file system; a character-type special file cannot, though it is not necessarily character-oriented. For special files, the di addr field is occupied by the device code (see types(5». The device cOdes of block and character special files overlap. Disk addresses of plain files and directories are kept in the array di_addr packed into 3 bytes each. The first 10 addresses specify device blocks directly. The last 3 addresses are singly, doubly, and triply indirect and point to blocks of 256 block pointers. Pointers in indirect blocks have the type daddr _t (see types(5)). For block b in a file to exist, it is not necessary that all blocks less than 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. SEE ALSO stat(2), dir(5), types(5) dcheck(8), fsck(8), icheck(8), mount(8). 9/83 3.. 11 FOR:PRO Fortune Systems FSTAB(5) FSTAB(5) NAME fstab - static information about the file systems SYNOPSIS #include DESCRIPTION The file letc/fstab contains descriptive information about the various file systems. letclfstab is only read by programs, and not written; it is the duty of the system administrator to properly create and maintain this file. These programs use letclfstab: dump, mount, umount, swapon, fock and df The order of records in letc/fotab is important, for fock, mount, and umount sequentially iterate through letclfotab doing their thing. The special file name is the block special file name, and not the character special file name. If a program needs the character special file name, the program must create it by appending an "r" after the last "I" in the special file name. If fo_type is "rw" or "ro" then the file system whose name is given in the fo Jle field is normally mounted read-write or read-only on the specified special file. The fo Jeq field is used for these file systems by the dump(8) command to determine which file systems need to be dumped. The fs yassno field is used by the fock(8) program to determine the order in which file system checks are done at reboot time. The root file system should be specified with a fs yassno of 1, and other file systems should have larger numbers. File systems within a drive should have distinct numbers, but file systems on different drives can be checked on the same pass to utilize parallelism available in the hardware. Fs _type can be specified as IIXX" to cause an entry to be ignored. This is useful to show disk partitions which are currently not used but will be used later. #define FSTAB #define FSNMLG "letclfstab" 16 #define FSTABFMT "%I6s:%I6s:%2s:%d:%d\n" #define FSTABARG(p) (p)->fs_spec, (p)->fs_file, \ (p)- > fs _type, &(p)- > fs _ freq, &(p)- > fs Jassno #define FSTABNARGS 5 #define #define #define #define FSTAB_RW "rw ll FSTAB_RO "ro" FSTAB_ SW "sw II FSTAB_ XX "XXII /* read write device *1 1* read only device *1 /* swap device *1 1* ignore totally *1 struct fstab { FOR:PRO 3-12 9/83 FSTAB(5) Fortune Systems char char char int int FSTAB(5) fs spec[FSNMLG]i 1* block special device name */ fs~)ile[FSNMLG]i /* file system path prefix */ fs _ type[3]; 1* TW,ro,SW or xx */ fs _ freq; 1* dump frequency, in days */ fs _passno; 1* pass number on parallel dump */ }; The proper way to read records from letclfstab is to use the routines getfsentO, getfsspecO or getfsfileO. FILES letdfstab SEE ALSO getfsent(3) 9/83 3-13 FOR:PRO GROUP (5) Fortune Systems GROUP (5) NAME group - group file DESCRIPTION Group contains for each group the following information: group name encrypted password numerical group lD a comma separated list of all users allowed in the group This is an ASCII file. The fields are separated by colons. Each group is separated from the next by a carriage return. If the password field is null, no password is demanded. 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 group lD's to names. FILES /etdgroup SEE ALSO newgrp(l), passwd(l), pwac(l), crypt(3), passwd(5). LIMITATIONS The passwd(l) command won't change the passwords. The group concept is nowhere near sophisticated enough for 'real' security systems and not really very handy for small systems. FOR:PRO 3-14 9/83 MOTD(5) Fortune Systems MOTD(5) NAME motd - message of the day DESCRIPTION Motd is a file that resides in directory Jete and is the "message of the day" that is printed out when users login. SEE ALSO login(l) 9/83 3-15 FOR:PRO MTAB(S) Fortune Systems MTA8(S) NAME mtab - mounted file system table DESCRIPTION Mtab resides in directory fete and contains a table of devices mounted by the mount command. Umount removes entries. Each entry is 64 bytes long; the first 32 are the null-padded name of the place where the special file is mounted; the second 32 are the null-padded name of the special file. The special file has all its directories stripped away; that is, everything through the last 'I' is thrown away. This table is present only so people can look at it. It does not matter to mount if there are duplicate entries or to umount if a name cannot be found. FILES fetcJIl'ltab SEE ALSO mount(8). FOR:PRO 3-16 9/83 PASSWD(5) Fortune Systems PASSWD(5) NAME passwd - password file DESCRIPTION Passwd contains for each user the following information: name (login name, contains no upper case) encrypted password numerical user ID numerical group ID comment initial working directory program to use as Shell This is an ASCII file. Each fie ld within each user's entry is separated from the next by a colon. 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, then /bin/sh is used. 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. Appropriate precautions must be ta~en to lock the file against changes if it is to be edited with a text editor; vipw(8) does the necessary locking. FILES /etdpasswd SEE ALSO login(l), passwd(l), pwac(l), crypt(3), getpwent(3), group(S). LIMITATIONS User information (name, office, etc.) should be stored elsewhere. 9/83 3-17 FOR:PRO Fortune Systems PRINTCAP (5) PRINTCAP (5) NAME printcap - printer capability data base SYNOPSIS letc/printcap DESCRIPTION Printcap is a data base describing printers. They are described by giving a set of capabilities which they have, and by describing how operations are performed. Entries in printcap consist of a number of ':' separated fields. The first entry for each printer gives the names which are known for the printer, separated by , , characters. TYPES OF PRINTCAP DESCRIPTORS :xx: This is a switch. It is either present or absent. :xx# : < num> must be a decimal number. This is frequently used as the number of an algorithm applicable to the printer being described. Example: :ir#l: Use initialization routine 1. :XX= < string> : < string> is any string of ascii characters other than ':'. It may also include \E for escape, \nnn for an octal code, \n, etc. Example: :wh=/etddiab. whl: Printwheel descriptor file is letddiab. whl :XX= < expr>: is a string as above. It is evaluated as a sequence of numbers and operators. The legal operators are: +, -, *, I, II, > >, < <, I, ", &, N The symbol II is remainder (% in C), and the rest have their normal C meanings. There is no precedence, and evaluation is strictly left to right. Numbers may be decimal, octal (begins with 0), or hex (begins with Ox). The letter 'I' is interpreted as a number whose value is an inch. Example: :bv= I/48*12S: Maximum vertical increment is 12S/48ths of an inch. :XX= < format>: < format> is a string as above. If the string is to be used to output a value, it may contain format specifications. A format specification begins with a '%'. Thus a real '%' must be represented in the string as '%%'. The '%' is followed by an expr FOR:PRO 3-18 9/83 Fortune Systems PRINTCAP (5) PRINTCAP (5) as above, with the addition that 'V' is interpreted as the value to be output. The expr is followed by a 'c', a 'd', or a''''. c' causes the low order 8 bits of the value of the expression to be output as a single byte. I I d' causes the value of the expression to be output in decimal. causes the string which follows (terminated by another ,,,, to be output the number of times specified by the value of the expression. The characters in the string are interpreted as 7-bit, so if a' ", must be repeated, it can be expressed as \242. I ,,' Examples: :ah=EG, %Vd,$: Absolute horizontal positioning on the IDS is done by sending ESC, 'G', ',', the position to move to as a string of decimal digits, ',', '$'. + :iu=E 36% V lc: The vertical increment on a Diablo 630 is set by sending ESC, '\036', and the binary value of the size of the increment plus 1 as a single byte. :rh=EI% V> >6&077 0100c% V&077 0100c: Relative horizontal positioning on the Sanders is done by sending ESC, 'I', and the value in two bytes, each containing 6 bits, and with the 0100 bit on. :fl=E?E7% V"OELE@:Forms length on the NEC 3510 is set by putting the printer in format mode (ESC, '?'), clear- ing forms length (ESC, '7'), sending newlines to feed to the bottom of the page (% V"\n"), setting form length to the number of lines just fed (ESC, 'L'), and exiting format mode (ESC, '@'). :XX= < numlist >: < numlist> must be a list of decimal, octal or hex numbers, separated by','. This is frequently used as a list of numbers of an algorithms applicable to the printer being described. DET AILED DESCRIPTION OF /etc/printcap ENTRIES Bold text: :bs# : bold start routine number or :bs= : bold start string :be# : bold end routine number or 9/83 3-19 FOR:PRO PRINTCAP (5) Fortune Systems PRINTCAP (5) :be= : bold end string :bo= : bold offset :bc= : bold repeat count bs can be a number of a routine to enter bold mode or a string which causes the printer to start printing in the bold mode. be can be a number of a routine to exit bold mode or a string which causes the printer to stop printing in the bold mode. If 'bs' and 'be' are numbers, they must be identical. Routines currently in existence are 1 and 2. ' Routine 1 prints the char 'be' times, advances the printhead a distance of 'bo', and prints the char 'be' times. If 'bo' is 0, the char will print 'be' times (not 2*'be'). Routine 2 disables bolding. Overstruck text: :os# : overstrike start routine number or :os= : overstrike start string :oe# : overstrike end routine number or :oe= : overstrike end string os can be a number of a routine to enter overstrike mode or a string which causes the printer to start printing in overstrike mode. oe can be a number of a routine to exit overstrike mode or a string which causes the printer to stop printing in overstrike mode. If 'os' and 'oe' are numbers, they must be identical. Routines currently in existence are 1 and 2. Routine 1 prints each character overstruck with a ' /'. Routine 2 disables overstriking. Underlined text: :us# : underline start routine number or FOR:PRO 3-20 9/83 PRINTCAP (5) Fortune Systems PRINTCAP (5) :us= : underline start string :ue# : underline end routine number or :ue= : underline end string us can be a number of a routine to enter underline mode or a string which causes the printer to start printing in underline mode. ue can be a number of a routine to exit underline mode or a string which causes the printer to stop printing in underline mode. If 'us' and 'ue' are numbers, they should be identical. Routines currently in existence are 1 and 2. Routine 1 prints the characters to be underlined, backs up the print head, and underlines them Routine 2 disables underlining. Double underlined text: :ds# : double underline start routine number or :ds= < string>: double underline start string :de# : double underline end routine number or :de= < string>: double underline end string :di= < expr> : double underline increment ds can be a number of a routine to enter double underline mode or a string which causes the printer to start printing in double underline mode. de can be a number of a routine to exit double underline mode or a string which causes the printer to stop printing in double underline mode. If 'ds' and 'de' are numbers, they should be identical. Routines currently in existence are 1 and 2. Routine 1 prints the characters to be underlined, backs up the print head, underlines them, moves down the double underline increment, backs up the print head, underlines again, and moves up the double underline increment. 9/83 3-21 FOR:PRO PRINTCAP (5) Fortune Systems PRINTCAP (5) Routine 2 disables double underlining. Unrecognized sequences: :Bs# : bad sequence start routine number or :Bs= < string>: bad sequence start string :Be# : bad sequence end routine number or :Be= : bad sequence end string Bs can be a number of a routine to enter bad sequence display mode or a string which causes the printer to start printing in this mode. Be can be a number of a routine to exit bad sequence display mode or a string which causes the printer to stop printing in this mode. If '8s' and 'Be' are numbers, they should be identical. Routines currently in existence are 1 and 2. Routine 1 prints the characters to be displayed in this mode, backs up the print head, and prints "A",S underneath them Routine 2 disables the special mode display. Horizontal motion: :hf= : list of horizontal positioning routine numbers hI is a list of routine numbers to be tried for moving horizon- tally. All routines in the list will be tried, and the one producing the fewest bytes will be used. Routines currently in existence are I, 2, 3, 4, and 5. Routines 1 to 4 output spaces or the string 'bk' to move to the desired location, changing the increment as necessary, using the routine specified in 'hi'. Routines 2 and 4 change to the largest increment first. Routines 1 and 3 only change the increment if the distance to be traversed is not an integral multiple of the current increment. Routines 1 and 2 move left by sending backspaces. Routines 3 and 4 move left by sending the string' cr' followed by spaces. FOR:PRO 3-22 9/83 PRINTCAP (5) Fortune Systems PRINTCAP (5) Routine 5 moves to the desired horizontal location by sending the number of minimum increments 'lh' formatted according to 'ah'. :ah= < format>: absolute horizontal positioning string ah is used only if horizontal positioning routine 5 is selected. :nb: no backspace (for diablo firmware) nb prevents routines 1 thru 4 from sending a backspace. The firmware in some Diablo 630' s does not always get its backspace increment from the horizontal increment register. :hi# : horizontal increment routine :lh= < expr> : minimum (littlest) horizontal increment :bh= < expr>: maximum (biggest) horizontal increment :ih= < format>: horizontal increment string hi is the number of the routine to set the horizontal increment. This is only used if routine I, 2, 3, or 4 is specified in the 'hf list. Routines currently in existence are 1 and 2. Routine 1 is used to change the horizontal increment by sending the number of minimum increments 'lh' formatted according to 'ih'. It never changes to an increment larger than 'bh'. Routine 2 does nothing. :cr= < string>: carriage return cr is the string sent to move the printhead to the left margin. :bk= : backspace bk is the string sent to move the printhead left one character position. Vertical motion: :vf= : list of vertical positioning routine numbers vf is a list of routine numbers to be tried 9/83 3-23 for moving vertically. FOR:PRO PRINTCAP (5) Fortune Systems PRINTCAP (5) All routines in the list are tried, and the one producing the fewest bytes is used. Routines currently in existence are 1, 2, and 3. Routines 1 and 2 output up or down strings to move to the desired location, changing the increment as necessary, using the routine specified in 'vu' or 'vd' as appropriate. Routine 2 changes to the largest increment first. Routine 1 only changes the increment if the distance to be traversed is not an integral multiple of the current increment. Routine 3 is used only for an IDS printer. Routine 4 outputs the string 'ff if the destination is the bottom of the page. :vd# : downward vertical increment routine number :vu# : upward vertical increment routine number :bv= : maximum (biggest) vertical increment :lv= : minimum (littlest) vertical increment :id= : downward vertical increment string :iu= : upward vertical increment string vd is the number of the routine to set the downward vertical increment. vu is the number of the routine set the upward vertical increment. These are only used if routine 1 or 2 is specified in the 'vf list. Routines currently in existence are 1 and 2. Routine 1 is used to change the vertical increment by sending the number of minimum increments 'Iv' formatted according to 'id' or 'iu'. It never changes to an increment larger than 'bh'. Routine 2 does nothing. :ud: up and down vertical increments are kept in separate registers This indicates that 'id' and 'iu' load different registers in the printer. FOR:PRO 3-24 9/83 PRINTCAP (5) Fortune Systems PRINTCAP (5) :ii= < format>: Third vertical increment string ii initializes another vertical increment register for the IDS printer. :dn= < string>: line feed :up= < string>: reverse line feed dn and up are the strings sent to move down or up on the page by the current vertical increment. :ff= : form feed if is the string sent to eject a page. :xv= : extra vertical increment for good paper registration when moving upwards When moving paper backwards, it is sometimes necessary to move back some distance beyond the desired location, and then move forward in order to take up paper slack. xv is this distance. :dm- : defeat firmware Some printers have optimizing firmware that takes a sequence such as 'up 3 units, down 2 units', and turns it into 'up 1 unit'. If the hardware on such a printer does not give good vertical registration, setting the 'xv' value to nonzero does not have the desired effect. The firmware defeats the software attempt to make up for the hardware limitations. dm is any string which convinces the firmware that it has printed something. This prevents the firmware from outsmarting the software. :sd# : subscript routine number :su# : superscript routine number Routines currently in existence are 1 and 2. Routine 1 moves vertically by a fraction of a line. Routine 2 disables superscripting and subscripting. Miscellaneous: 9/83 3-25 FOR:PRO PRINTCAP (5) Fortune Systems PRINTCAP (5) :is= : initialization string is is the string sent to reset the printer to a known state for all attributes except forms length and top of form :tf= < string> : top of form initialization string tf is the string sent to reset forms length and top of form This is used by spoolers between print jobs. WP uses fl and fi instead. This string may cause the printer to read its switch settings or set forms length to a fixed value. :ir# : initialization routine number Routines currently in existence are 1 and 2. Routine 1 does nothing. Routine 2 is used only by the IDS. :fi= : forms length increment :fl= < format>: forms length initialization The page length is set using fl. The value formatted ('V') is ' fi', or the current line height if 'fi' evaluates to O. :pl= : pitch if 10 cpi selected from menu :p2= : pitch if 12 cpi selected from menu :p3= < expr > : pitch if 15 cpi selected from menu (IDS uses 16.8) These are the fractions of an inch to be used as a character width for the menu selections labeled 10, 12, and 15 pitch. :wh= < string>: printwheel descriptor file This is the file from which font information is taken. :of= < string>: output filter This is an executable file, which filters wpprfmt's output into printer-specific, print-ready format. FOR;PRO 3-26 9/83 PRINTCAP (5) Fortune Systems PRINTCAP (5) :qo# : quick output routine number Routines currently in existence are 1 and 2. Routine 1 is the normal one to use. Routine 2 is used only by the IDS. ALPHABETIC LISTING OF PRINTCAP SWITCHES :ah= < format>: absolute horizontal positioning string :bc= : bold repeat count :be# : bold end routine number :be= : bold end string :Be# : unrecognized \ sequence end routine number :Be= : unrecognized \ sequence end string :bh= : maximum (biggest) horizontal increment :bk= : backspace :bo= : bold offset :bs# : bold start routine number :bs= : bold start string :Bs# : unrecognized \ sequence start routine number :Bs= < string>: unrecognized \ sequence start string :bv= : maximum (biggest) vertical increment :cr= : carriage return 9/83 3-27 FOR:PRO PRINTCAP (5) Fortune Systems PRINTCAP (5) :de# : double underline end routine number :de= : double underline end string :di= < expr>: double underline increment :dm= : defeat firmware - send this string to keep the printer from optimizing out our ups and downs, intended to produce good paper registration when moving upwards :dn= < string>: line feed :ds# : double underline start routine number :ds= : double underline start string :ff= < string>: form feed :fi= : forms length incre ment :f1= < format>: forms length initialization string :hf= : list of horizontal positioning routine numbers :hi# : horizontal increment routine :id= < format>: downward vertical increment string :ih= < format>: horizontal increment string :ii= < format>: third vertical increment string :ir# : initialization routine number :is= < string>: initialization string :iu= < format>: upward vertical increment string FOR:PRO 3-28 9/83 PRINTCAP(5) Fortune Systems PRINTCAP (5) :lh= < expr>: minimum (littlest) horizontal incre ment :lv= < expr>: minimum (littlest) vertical increment :nb: no backspace (for diablo firmware) :oe# : overstrike end routine number :oe= < string>: overstrike end string :of= : output filter :os# : overstrike start routine number :os= : overstrike start string :p1= : pitch if 10 cpi selected from menu :p2= < expr>: pitch if 12 cpi selected from menu :p3= < expr>: pitch if 15 cpi selected from menu (IDS uses 16.8) :qo# : quick output routine number :sd# : subscript routine number :su# : superscript routine number :tf: reset top of form and set form length to a known value :ud: up and down vertical increments are kept in separate registers :ue# : underline end routine number :ue= : underline end string :up= < string>: reverse line feed 9/83 3-29 FOR:PRO PRINTCAP (5) Fortune Systems PRINTCAP (5) :us# : underline start routine number :us= : underline start string :vd# : downward vertical increment routine number :vf= : list of vertical positioning routine numbers :vu# : upward vertical increment routine number :wh= : printwheel descriptor file :xv= : extra vertical increment for good paper registration when moving upwards FILES /etdprintcap file containing printer descriptions SEE ALSO printcap(5) FOR:PRO 3-30 9/83 PROFILE (5) Fortune Systems PROFILE (5) NAME profile - setting up an environment at login time DESCRIPTION If your login directory contains a file named .profile, that file will be executed (via the shell's exee .profile) before your session begins; .profiles are handy for setting exported environment variables and terminal modes. If the file fete/profile exists, it will be executed for every user before the . profile. The following example is typical (except for the comments): =1= Make some environment variables global export MAIL PATH TERM =1= Set file creation mask umask 22 =1= Tell me when new mail comes in MAIL=/usrlspooV maiV myna me =1= Add my Ibin directory to the shell search sequence PATH=$PATH:$HOMEibin Currently letdprofile defines Ipr defaults for users printing from the global menu, system language defaults (eg. LANGUAGE=EN), and specifies XON/XOFF protocol for Fortune terminals. FILES s-l$HOME/. profile fete/profile SEE ALSO login(l), mail(l), menu(l), sh(l), stty(l), su(l). BUGS At present, the "/etdprofile" file is only implemented for users whose shell is menu(l). 9/83 3-31 FOR:PRO Fortune Systems TERMCAP(5) TERMCAP(5) NAME terrncap - terminal capability data base SYNOPSIS /etc/termcap DESCRIPTION Termcap is a data base describing terminals, used, e.g., by vi(l) and curses(3). Terminals are described in termcap by giving a set of capabilities which they have, and by describing how operations are performed. Padding requirements and initialization sequences are included in termcap. Entries in termcap consist of a number of I:' separated fields. The first entry for each terminal gives the names which are known for the terminal, separated by characters. The first name is always two characters long and is used by older version six systems which store the terminal type in a 16-bit word in a systemwide data base. The second name given is the most common abbreviation for the terminal, and the last name given should be a long name fully identifying the terminal. The second name should contain no blanks; the last name can contain blanks for readability. CAPABILITIES (P) indicates padding can be specified (P*) indicates that padding can be based on no. lines affected Name ae al am as be bs bt bw CC cd ce ch cI cm co cr cs cv da dB db FOR:PRO Type str str boo I str str bool str bool str str str str str str num str str str bool num bool (P) (P*) (P) (P) (P*) (P) (P) (P*) (P) (P*) (P) (P) Pad? Description End alternate character set Add new blank line Terminal has automatic margins Start alternate character set Backspace if not IIH Terminal can backspace with IIH Back tab Backspace wraps from column 0 to last column Command character in prototype if terminal settable Clear to end of display Clear to end of line Like cm but horizontal motion only, line stays same Clear screen Cursor motion Number of columns in a line . II Carnage return, (default M) Change scrolling region (vt100), like cm Like ch but vertical only. Display can be retained above Number of millisec of bs delay needed Display can be retained below 3-32 9/83 TERMCAP(5) dC dc dF dl dm dN do dT ed ei eo ff hc hd ho hu hz num str num str str num str num str str str str boo I str str str str ic str if str im bool in bool str ip is str kO-k9 str kb str kd str ke str kh str kl str kn num ko str kr str ks str ku str 10-19 str Ii num 11 str rna str mi bool m1 str ms bool mu str nc bool nd str nl str ns bool bool os 9/83 Fortune Systems TERMCAP(5) Number of millisec of cr delay needed Delete character Number of millisec of ff delay needed (P*) Delete line Delete mode (enter) Number of millisec of nl delay needed Down one line Number of millisec of tab delay needed End delete mode End insert mode; give :ei=: if ic Can erase overstrikes with a blank (P*) Hardcopy terminal page eject (default "L) Hardcopy terminal Half-line down (forward 112 Iinefeed) Home cursor (if no cm) Half-line up (reverse 112 line feed) Hazeltine; can't print ""s (P) Insert character Name of file containing is Insert mode (enter); give :im=: if ic Insert mode distinguishes nulls on display (P*) Insert pad after character inserted Terminal initialization string Sent by other function keys 0-9 Sent by backspace key Sent by terminal down arrow key Out of keypad transmit mode Sent by home key Sent by terminal left arrow key Number of other keys Termcap entries for other non-function keys Sent by terminal right arrow key Put terminal in keypad transmit mode Sent by terminal up arrow key Labels on other function keys Number of lines on screen or page Last line, first column (if no cm) Arrow key map, used by vi version 2 only Safe to move while in insert mode Memory lock on above cursor. Safe to move while in standout and underline mode Memory unlock (tum off memory lock). No correctly working carriage return (DM2500,H2000) Non-destructive space (cursor right) (P*) Newline character (default \n) Terminal is a CRT but doesn't scroll. Terminal overstrikes (P*) 3-33 FOR:PRO TERMCAP(5) str boo I str (P) str num str str (P) str (P) str str str str str num bool str str str str str boo I bool bool boo I bool pc pt se sf sg so sr ta tc te ti uc ue ug ul up us vb ve vs xb xn xr xs xt Fortune Systems TERMCAP(5) Pad character (rather than null) Has hardware tabs (may need to be set with is) End stand out mode Scroll forwards Number of blank chars left by so or se Begin stand out mode Scroll reverse (b~ckwards) Tab (other than I or with padding) Entry of similar terminal - must be last String to end programs that use cm String to begin programs that use cm Underscore one char and move past it End underscore mode Number of blank chars left by us or ue Terminal underlines even though it doesn't overstrike Upline (cursor up) Start underscore mode Visible bell (may not move cursor) Sequence to end open/visual mode Sequence to start open/visual mode Beehive (f1=escape, f2=ctrl C) A newline is ignored after a wrap (Concept) Return acts like ce \r \n (Delta Data) Standout not erased by writing over it (HP 264?) Tabs are destructive, rna.gic so char (Teleray 1061) A Sample Entry The following entry, which describes the Concept-IOO, is among the more complex entries in the termcap file as of this writing. (This particular concept entry is outdated, and is used as an example only.) c11c100IconceptlOO:\ :is=\EU\Ef\E7\E5\E8\EI\E~\EK\E\2g0\Eo&\~00:\ :al=3*\E R:am:bs:cd=16*\E C:ce=16\E S:cl=2* L:\ II II :cm=\Ea%+ %+ :co#80:dc=16\E A:dl=3*\E B:ei=\E\200:eo:\ :00= \ Ellp:in:ip= 16*:li#24:mi:nd= \E=: \ :se=\Ed\Ee:so=\ED\EE:ta=8\t:ul:up=\E;:vb=\Ek\EK:xn: Entries can continue onto multiple lines by giving a \ as the last character of a line, and empty fields can be included for readability (here between the last field on a line and the first field on the next). Capabilities in termcap are of three types: Boolean capabilities which indicate the terminal has some particular feature, numeric capabilities giving the size of the terminal or the size of particular delays, and string capabilities, which give a sequence which can be used to perform particular terminal operations. Types of Capabilities All capabilities have two letter codes. For instance, the fact that the FOR:PRO 3-34 9/83 TERMCAP(5) Fortune Systems TERMCAP(5) Concept has "automatic margins" (i.e. an automatic return and linefeed when the end of a line is reached) is indicated by the capability am Hence the description of the Concept includes am Numeric capabilities are followed by the character '#' and then the value. Thus co which indicates the number of columns the terminal has gives the value '80' for the Concept. Finally, string valued capabilities, such as ce (clear to end of line sequence) are given by the two character code, an '=', and then a string ending at the next following ':'. A delay in milliseconds may appear after the '=' in such a capability, and padding characters are supplied by the editor after the remainder of the string is sent to provide this delay. The delay can be either a integer, e.g. '20', or an integer followed by an '*', i.e. '3*'. An ,*, indicates that the padding required is proportional to the number of lines affected by the operation, and the amount given is the per-affected-unit padding required. When an ,*, is specified, it is sometimes useful to give a delay of the form '3.5' and specify a delay per unit to tenths of milliseconds. A number of escape sequences are provided in the string valued capabilities for easy encoding of characters there. A \ E maps to an II • ESCAPE character, x maps to a control-x for any appropnate x, and the sequences \n \r \t \b \f give a newline, return, tab, backspace and formfeed. Finally, characters may be given as three octal digits after a \' and the characters II and \ can be given as \" and \ \. If it is necessary to place a : in a capability it must be escaped in octal as \ 072. If it is necessary to place a null character in a string capability it must be encoded as \200. The routines which deal with termcap use C strings, and strip the high bits of the output very late so that a \200 comes out as a \000 would. Preparing Descriptions We now outline how to prepare descriptions of terminals. The most effective way to prepare a terminal description is by imitating the description of a similar terminal in termcap and to build up a description gradually, using partial descriptions with ex to check that they are correct. Be aware that a very unusual terminal may expose deficiencies in the ability of the termcap file to describe it or limitations in ex. To easily test a new terminal description you can set the environment variable TERMCAP to a pathname of a file containing the description you are working on and the editor looks there rather than in /etcltermcap. TERMCAP can also be set to the termcap entry itself to avoid reading the file when starting up the editor. (1his only works on version 7 systems.) Basic Capabilities The number of colunms on each line for the terminal is given by the co numeric capability. If the terminal is a CRT, then the number of 9/83 3-35 FOR:PRO TERMCAP(5) Fortune Systems TERMCAP(5) lines on the screen is given by the Ii capability. If the terminal wraps around to the beginning of the next line when it reaches the right margin, then it should have the am capability. If the terminal can clear its screen, then this is given by the cl string capability. If the terminal can backspace, then it should have the bs capability, unless a backspace is accomplished by a character other than "H in which case you should give this character as the be string capability. If it overstrikes (rather than clearing a position when a character is struck over) then it should have the os capability. A very important point here is that the local cursor motions encoded in termcap are undefined at the left and top edges of a CRT terminal. The editor never attempts to backspace around the left edge, nor attempts to go up locally off the top. The editor assumes that feeding off the bottom of the screen causes the screen to scroll up, and the am capability tells whether the cursor sticks at the right edge of the screen. If the terminal has switch selectable automatic margins, the termcap file usually assumes that this is on, i.e. am. These capabilities suffice to describe hardcopy and "glass-tty" terminals. Thus the model 33 teletype is described as t3 33 tty33:co#72:os while the Lear Siegler ADM-3 is described as cl adm3 3 lsi adrn3:am:bs:cl= "Z:li#24:co#80 Cursor addressing Cursor addressing in the terminal is described by a cm string capability, with printf(3s) like escapes %x in it. These substitute to encodings of the current line or column position, while other characters are passed through unchanged. If the cm string is thought of as being a function, then its arguments are the line and then the column to which motion is desired, and the % encodings have the following meanings: %das in printf, 0 origin %2like %2d %3like %3d %.like %c % +xadds x to value, then %. % >xyif value> x adds y, no output. %rreverses order of line and column, no output %iincrements linelcolumn (for 1 origin) %%gives a single % %nexclusive or row and column with 0140 (DM2S00) %BBCD (16*(X/10» (x%10), no output. %DReverse coding (x-2*(x%16)), no output. (Delta Data). + Consider the HP2645, which, to get to row 3 and column 12, needs to be sent \E&a12c03Y padded for 6 milliseconds. Note that the FOR:PRO 3-36 9/83 TERMCAP(5) Fortune Systems TERMCAP(5) order of the rows and columns is inverted here, and the row and colunm are printed as two digits. Thus its cm capability is "cm-6\E&%r%2c%2Y". The Microterm ACT-IV needs the current row and column sent preceded by a "T, with the row and column simply encoded in binary, "cm= "T%. %.". Terminals which use "%." need to be able to backspace the cursor (bs or be), and to move the cursor up one line on the screen (up introduced below). This is necessary because it is not always safe to transmit \t, \n "0 and \r, as the system can change or discard them A final example is the LSI AOM3a, which uses row and column offset by a blank character, thus "cm=\E=%+ %+ ". Cursor motions If the terminal can move the cursor one position to the right, leaving the character at the current position unchanged, then this sequence should be given as nd (non-destructive space). If it can move the cursor up a line on the screen in the same column, this should be given as up. If the terminal has no cursor addressing capability, but can home the cursor (to very upper left comer of screen) then this can be given as ho; similarly a fast way of getting to the lower left hand comer can be given as 11; this may involve going up with up from the home position, but the editor never does this itself (unless 11 does) because it makes no assumption about the effect of moving up from the home position. Area clears If the terminal can clear from the current pOSition to the end of the line, leaving the cursor where it is, this should be given as ceo If the terminal can clear from the current pOSition to the end of the display, then this should be given as cd. The editor only uses cd from the first column of a line. Insertldelete line If the terminal can open a new blank line before the line where the cursor is, this should be given as al; this is done only from the first position of a line. The cursor must then appear on the newly blank line. If the terminal can delete the line which the cursor is on, then this should be given as dl; this is done only from the first position on the line to be deleted. If the terminal can scroll the screen backwards, then this can be given as sb, but just al suffices. If the terminal can retain display memory above then the da capability should be given; if display memory can be retained below then db should be given. These, let the editor understand that deleting a line on the screen can bring non-blank lines up from below or that scrolling back with sb can bring down non-blank lines. Insertldelete character There are two basic kinds of intelligent terminals with respect to insert/delete character which can be described using tenncap. The 9/83 3-37 FOR:PRO TERMCAP(5) Fortune Systems TERMCAP(5) most common insert/delete character operations affect only the characters on the current line and shift characters off the end of the line rigidly. Other terminals, such as the Concept 100 and the Perkin Elmer Owl, make a distinction between typed and untyped blanks on the screen, shifting upon an insert or delete only to an untyped blank on the screen which is either eliminated, or expanded to two untyped blanks. You can find out which kind of terminal you have by dearing the screen and then typing text separated by cursor motions. Type "abc def" using local cursor motions (not spaces) between the "abc" and the "def". Then position the cursor before the "abc" and put the terminal in insert mode. If typing characters causes the rest of the line to shift rigidly and characters to fall off the end, then your terminal does not distinguish between blanks and untyped positions. If the "abc" shifts over to the "def" which then move together around the end of the current line and onto the next as you insert, you have the second type of terminal, and should give the capability in, which stands for "insert null". If your terminal does something different and unusual then you may have to modify the editor to get it to use the insert mode your terminal defines. The editor can handle both terminals which have an insert mode, and terminals which send a simple sequence to open a blank position on the current line. Give as im the sequence to get into insert mode, or give it an empty value if your terminal uses a sequence to insert a blank position. Give as ei the sequence to leave insert mode (give this, with an empty value also if you gave im so). Now give as ic any sequence needed to be sent just before sending the character to be inserted. Most terminals with a true insert mode will not give ic, terminals which send a sequence to open a screen position should give it here. (Insert mode is preferable to the sequence to open a position on the screen if your terminal has both.) If post insert padding is needed, give this as a number of milliseconds in ip (a string option). Any other sequence which needs to be sent after an insert of a single character can also be given in ip. It is occasionally necessary to move around while in insert mode to delete characters on the same line (e.g. if there is a tab after the insertion position). If your terminal allows motion while in insert mode you can give the capability rni to speed up inserting in this case. Omitting rni affects only speed. Some terminals (notably Datamedia's) must not have mi because of the way their insert mode works. Finally, you can specify delete mode by giving drn and ed to enter and exit delete mode, and dc to delete a single character while in delete mode. Highlighting, underlining, and visible bells If your terminal has sequences to enter and exit standout mode FOR:PRO 3-38 9/83 TERMCAP(5) Fortune Systems TERMCAP(5) these can be given as so and se respectively. If there are several flavors of standout mode (such as inverse video, blinking, or underlining - half bright is not usually an acceptable "standout" mode unless the terminal is in inverse video mode constantly) the preferred mode is inverse video by itself. If the code to change into or out of standout mode leaves one or even two blank spaces on the screen, as the TVI 912 and Teleray 1061 do, then ug should be given to tell how many spaces are left. Codes to begin underlining and end underlining can be given as us and ue respectively. If the terminal has a code to underline the current character and move the cursor one space to the right, such as the Microterm Mime, this can be given as uc. (If the underline code does not move the cursor to the right, give the code followed by a nondestructive space.) Many terminals, such as the HP 2621, automatically leave standout mode when they move to a new line or the cursor is addressed. Programs using standout mode should exit standout mode before moving the cursor or sending a newline. If the terminal has a way of flashing the screen to indicate an error quietly (a bell replacement) then this can be given as vb; it must not move the cursor. If the terminal should be placed in a different mode during open and visual modes of ex, this can be given as vs and ve, sent at the start and end of these modes respectively. These can be used to change, e.g., from a underline to a block cursor and back. If the terminal needs to be in a special mode when running a program that addresses the cursor, the codes to enter and exit this mode can be given as ti and teo This arises, for example, from terminals like the Concept with more than one page of memory. If the terminal has only memory relative cursor addressing and not screen relative cursor addressing, a one screen-sized window must be fixed into the terminal for cursor addressing to work properly. If your terminal correctly generates underlined characters (with no special codes needed) even though it does not overstrike, then you should give the capability ul. If overstrikes are erasable with a blank, then this should be indicated by giving eo. Keypad If the terminal has a keypad that transmits codes when the keys are pressed, this information can be given. Note that it is not possible to handle terminals where the keypad only works in local (this applies, for example, to the unshifted HP 2621 keys). If the keypad can be set to transmit or not transmit, give these codes as ks and ke. Otherwise the keypad is assumed to always transmit. The codes sent by the left arrow, right arrow, up arrow, down arrow, and 9/83 3-39 FOR:PRO TERMCAP(5) Fortune Systems TERMCAP(5) home keys can be given as kI, kr, ku, kd, and kh respectively. If there are function keys such as £0, fl., ... , f9, the codes they send can be given as kO, kI, ... , k9. If these keys have labels other than the default £0 through f9, the labels can be given as 10, 11, ... , 19. If there are other keys that transmit the same code as the terminal expects for the corresponding function, such as clear screen, the termcap 2 letter codes can be given in the ko capability, for example, ":ko=cl,ll,sf,sb:", which says the terminal has clear, home down, scroll down, and scroll up keys that transmit the same thing as the cl, ll, sf, and sb entries. The rna entry is also used to indicate arrow keys on terminals which have single character arrow keys. It is obsolete but still in use in version 2 of vi, which must be run on some minicomputers due to memory limitations. This field is redundant with kI, kr, ku, kd, and kh. It consists of groups of two characters. In each group, the first character is what an arrow key sends, the second character is the corresponding vi command. These commands are h for kI, j for kd, k for ku, I for kr, and H for kh. For examole, the mime would be A ,A II A" II :ma= KJ ~k XI: indicating arrow keys left ( H), down ( K), up ( Z), and right (X). (There is no home key on the mime.) Miscellaneous lf the terminal requires other than a null (zero) character as a pad, then this can be given as pc. lf tabs on the terminal require padding, or if the terminal uses a character other than "I to tab, then this can be given as tao Hazeltine terminals, which don't allow ,"I, characters to be printed should indicate hz. Datamedia terminals, which echo carriage-return linefeed for carriage return and then ignore a following line feed should indicate nco Early Concept terminals, which ignore a line feed immediately after an am wrap, should indicate xn. If an erase-eol is required to get rid of standout (instead of merely writing on top of it), xs should be given. Teleray terminals, where tabs tum all characters moved over to blanks, should indicate xt. Other specific terminal problems may be corrected by adding more capabilities of the forrnxx. Other capabilities include is, an initialization string for the terminal, and if, the name of a file containing long initialization strings. These strings are expected to properly clear and then set the tabs on the terminal, if the terminal has settable tabs. If both are given, is is printed before if. This is useful where if is lusrllibltabsetlstd but is clears the tabs first. Similar Terminals If there are two very similar terminals, one can be defined as being just like the other with certain exceptions. The string capability tc FOR:PRO 3-40 9/83 TERMCAP(5) Fortune Systems TERMCAP(5) can be given with the name of the similar terminal. This capability must be last and the combined length of the two entries must not exceed 1024. Since tennlib routines search the entry from left to right, and since the tc capability is replaced by the corresponding entry, the capabilities given at the left override the ones in the similar terminal. A capability can be cancelled with xx@ where xx is the capability. For example, the entry hn 2621nl:ks@:ke@:tc=2621: defines a 2621nl that does not have the ks or ke capabilities, and hence does not tum on the function key labels when in visual mode. This is useful for different modes for a terminal, or for different user pre ferences. FILES letdtermcap file containing terminal descriptions SEE ALSO ex(l), more(l). tset(l), ul(l), vi(l), curses(3), termcap(3). LIMITATIONS Ex allows only 256 characters for string capabilities, and the routines in termcap(3) do not check for overflow of this buffer. The total length of a single entry (excluding only escaped newlines) must not exceed 1024. The ma, vs, and ve entries are specific to the vi program. Not all programs support all entries. There are entries that are not supported by any program. 9/83 3-41 FOR:PRO TRANS (5) Fortune Systems TRANS (5) NAME trans - translation table file DESCRIPTION Translation table files contain labeled strings. They are often used to lookup a string associated with a particular label. For example, the label" INSERT-DISK" might have a string value of "Please insert the flexible disk and press < return> . " Software that needs to have a diskette inserted can lookup the label "INSERT-DISK" and display the string that is found. If the translation table is changed, a different message would be displayed. This happens without any change to the software which is doing the lookup and displaying the message. Much of Fortune Systems' software uses translation tables. This often allows a single program to work in different environments. Only the translation table needs to be changed. The translation table file consists of two parts. The first contains the labels and the offsets into the file of the corresponding values. The second part conains these values. Both the labels and the string values are terminated by the null character. SEE ALSO printstring(l) LIMITATIONS The file is normally generated by a string compiler which is currently not available to Fortune customers. FOR:PRO 3-42 9/83 TTYS(5) Fortune Systems TTYS(5) NAME ttys - terminal initialization data DESCRIPTION The ttys file is read by the l1'zit program and specifies which terminal special files are to have a process created for them which allows people to log in. It contains one line per special file. The first character of a line is either 'a' or '1'; the former causes the line to be ignored, the latter causes it to be effective. The second character is used as an argument to getty(8), which performs such tasks as baud-rate recognition, reading the login name, and calling login. For normal lines, the character is 'a'; other characters can· be used, for example, with hard-wired terminals where speed recognition is unnecessary or which have special characteristics. (Getty has to be fixed in such cases.) The remainder of the line is the terminal's entry in the device directory, /dev. FILES /etdttys SEE ALSO login(l), getty(8), init(8). 9/83 3-43 FOR:PRO TTYTVPE(5) Fortune Systems TTYTVPE(5) NAME tty type - data base of terminal types by port SYNOPSIS /etc/ttytype DESCRIPTION Ttytype is a database containing, for each tty port on the system, the kind of terminal that is attached to it. There is one line per port, containing the terminal kind (as a name listed in termcap (5», a space, and the name of the tty, minus /dev/. This information is read by tset(l) and by login(l) to initialize the TERM variable at login time. SEE ALSO login(l), tset(l). LIMITATIONS Some lines are merely known as "dialup" or "plugboard". FOR:PRO 3-44 9/83 Fortune Systems UTMP(5) UTMP(5) NAME utmp, wtmp - login records SYNOPSIS #include DESCRIPTION The utmp file allows one to discover information about who is currently using the operating system The file is a sequence of entries with the following structure declared in the include file: 1* * Structure of utmp and wtmp files. * * Assuming the number 8 is unwise. *1 struct utmp { char char long }; ut_line[8]; /* tty name */ ut_ name[8]; /* user id */ ut_ time; /* time on */ This structure gives the name of the special file associated with the user's terminal, the user's login name, and the time of the login in the form of time(2). The wtmp file records all log ins and logouts. Its format is exactly like utmp except that a null user name indicates a logout on the associated terminal. Furthermore, the terminal name ,N, indicates that the system was rebooted at the indicated time; the adjacent pair of entries with terminal names " and I}' indicate the systemmaintained time just before and just after a date command has changed the system's idea of the time. Wtmp is maintained by login(l) and init(8). Neither of these programs creates the file, so if it is removed record-keeping is turned off. It is summarized byac(8). FILES /etdutmp /usr/adm/wtmp SEE ALSO login(l), who(l), ac(8), init(8). 9/83 3-45 FOR:PRO Fortune Systems WHL(5) WHL(5) NAME whl - print wheel (font) descriptor file DESCRIPTION A printwheel descriptor file contains descriptions of all the known fonts for a particular printer. Text on a line following a '#' is ignored: #Comment line +init "xxx" #the init string is "xxx" The following items appear in the descriptions below. They have the following meanings: [Name1], [Name2], [Name31, etc. These are strings by which this entry is identified. They can contain any combination of alphabetics and numerics. [pitch] This appears as a fraction of an inch (e.g. 1110, 1115). It must be expressed in terms of integers (1116.8 should appear as 10/168). In a monos paced font, it is the width of a character. In a proportional spaced font, it is the width of an em-space (the widest character). Cps default width] This appears as a fraction of the pitch. It must be expressed in terms of integers. This is used only in a proportional spaced font. It is the most common character width in the font. It is used as the default for any character which does not have an explicit width. [char width] This appears as a fraction of the pitch. It must be expressed in terms of integers. This is used only in a proportional spaced font. It is the width of the character defined on the current line. [videotex] This is the videotex representation of the character being defined. [string] This is the string sent to the printer to display the videotex character. [videotex] and [string] are sequences of characters. [videotex] begins at the beginning of the line, and is terminated by a space or tab. [string] is delimited by'"' at either end. \ sequences recognized as single characters are: \n \r \f FOR:PRO 012 015 014 3-46 9/83 Fortune Systems WHL(5) \t \E \[ \b \ xxx \x WHL(5) 011 033 033 0210 the character whose octal value is xxx the character 'x' where x is any character not listed above. [n particular: \\ '\' 'II' \" \# '#' \> - '>' \+ \ '+' A font description starts with the name line: >[Name1] [Name2] [Name3] ... (etc.) and continues until the name line for the next font or end of file. Next in the file are optional data lines. These can be: +init "[string]" [string] is the character sequence which must be sent in order to select this font. If this line is absent, no init string is sent. +pitch ([pitch]) [pitch] is a fraction of an inch. default pitch is assumed. [f this line is absent, a +ps ([ps default width]) If this line is absent, the font is monospaced. If present, it is proportional spaced. [ps default width] is optional. [f present, it is a fraction of the pitch, and is used as the width of any character not having an entry containing a width. Next in the file are optional character lines. [videotex] "[string]" ([char width]) These describe the character sequence which must be sent to print the character described on this line, and the width of the character. There are four types of videotex characters described in the file. The following list explains each of these types: 1. 9/83 Standard printable ascii (non-overstriking): in the range 040-0177. 3-47 FOR:PRO WHL(5) Fortune Systems WHL(5) entry absent The output string defaults to the ascii character. The character width defaults to Cps default width], or [pitch] if not present. [videotex] "[string]" If [string] is null, this character is not available. Otherwise, the output string is [string], and the character width defaults to Cps default width], or [pitch] if not present. [videotex] ([char width]) The output string defaults to the ascii character. [char width] is a fraction of pitch. [videotex] "[string] " ([char width]) The output string is [string]. [char width] is a fraction of pitch. 2. Non-overstriking supplementary characters: SS2 (031), followed by a character in the range 040-077 or 0120-0177. entry absent This character is not in the font. [videotex] "[string]" The output string is [string]. Character width defaults to Cps default width], or [pitch] if not present. [videotex] "[string]" ([char width]) The output string is [string]. [char width] is a fraction of pitch. 3. Overstriking supplementary characters which can be combined with non-overstriking characters: SS2 (031), followed by a character in the range 0100-0117. entry absent This character is not in the font. [videotex] "[string]" The output string is [string]. Printing this string leaves the position of the printhead unchanged. If printing the character causes the head to advance, the string must end with '\ b'. Since this is an overstrike, it is not considered to have a width. 4. FOR:PRO Overstriking supplementary characters already combined with non-overstriking characters: SS2 (031), followed by a character in the range 0100-0117, followed by a printable ascii character (in the range 040-0177). 3-48 9/83 Fortune Systems WHL(5) WHL(5) entry absent This character is not in the font. [videotex] "[stringJ" The output string is [string]. Character width defaults to [ps default widthJ, or [pitchJ if not present. [videotex] "[stringJ" ([char width]) The output string is [string]. [char width] is a fraction of pitch. In types 3 and 4, all descriptions containing the same overstriking character must appear in adjacent lines within a font description (e.g. a-umlaut, o-umlaut, umlaut alone). EXAMPLE Sample wheel file entry: "# wp print wheel 4 on NEC "# Multilingua1-A 803-020004-702 > Multi lingual 4 +init "i'""0" \177" "#not on wheel #supplementary set "# (Y below indicates that the control character is in # the file, not" that the file contains the two 7! characters' , and 'Y'). YA ,,"N(O\b" # All "YAa " "N' "O\ba" # the "YAe ,,"N'''O\be'' # "YA's "YAi ,,"N'''O\bi'' # must "YAo ""N'''O\OO Ii # be "YAu " "N' "O\bu" # adjacent. "YAc ,,"N'''O\bc'' # "YAj ,,"N'''O\bj'' # "YB "O\b" "" N@ # The first three "YBa ,,"NF"O\ba" "# "YB's are all "YBe " "NF" 0\ be" # that will be seen. "YC ""N> "O\b" " " " # These "YB's will "YBi ""NF"O\bi" # be ignored YBo " NF 0\00" "YBu # due to the " "NF "O\bu" "YBc ,,"NF"O\bc" # intervening "YC. "YBj ,,"NF"O\bj" # This is an error. "YO " " "O\b" \031H ""NX O\b" # \031 is identical to fly \031Ha ,,"NA"O\ba" # \031He ,,"NA"O\be" # \031Hi ,,"NA"O\b"NN"O"# \031Ho ""NA "0\00" # N<" 9/83 3-49 FOR:PRO Fortune Systems WHL(5) \031Hu "YJ IIYJA II YJa IIYK lIyO lIy# lIy! lI y ' IIYa II yz lIy? IIYT 1IyII J yy lIyS lIyv "Y{ "Yi II Yq lIy " IIY6 lIy( IIYR II II II NAil O\bu" II NR O\b" II II II NW 0 II II II II NV 0" II II "I1NEIIO\b" II ND O\b" II "I1NB O" II II II NC 0" II II II NG 0" I1 II N(O" II II II NKO" II "I1NL O" II "I1NM O" II II II NO 0" II II II NP 0 II II II " II NQII 0" "NS II II0" " II NT II0" " NU 0" " II NYII 0 " II II " II NZII 0" " N}. 0" "liN 11 0 " II II "N 0" WHL(5) # II FILES Any files with the .whl extension. SEE ALSO mapvtx(3) FOR:PRO 3-50 9/83 INTRO(8) Fortune Systems INTRO(8) NAME intro - introduction to section 8 DESCRIPTION Section 8 of the Programmer's Manual describes system management programs. These utilities mostly reside in fete and usually must be run by the system manager. Most of the time the system manager will not need to run these programs directly; they are run automatically when the need arises by the fetclrc shell file, or are not needed. See ( re(8).) 9/83 4-1 FOR:PRO 8001(8) Fortune Systems 8001(8) NAME boot -the standalone shell SYNOPSIS Isalboot DESCRIPTION Isa/boot, also known as the "Levell" boot, is the 32:16'5 equivalent of the standalone shell. It is a standalone program which normally resides in boot partition 0 of every hard and some floppy disks used on the 32:16. When booting up, a level 0 boot program (usually in ROM), reads in the indicated level 1 boot program (0-7) from the indicated device and drive. The level 1 boot program, usually /sa/boot, then reads in the boot file name stored in the EAROM. This usually is hd02/unix (or fd02/unix). If there is no file name specified, or the specified file does not exist, a prompt appears and the user may type any file. The syntax supplied to boot must be of the form: device/file, where device is one of hd[0-3J[0-7] or fd[O-3J[0-7]. For instance, to get the reconfiguration menu, (see reconf(8)), one can reboot the system, holding the DEL key. First, type the F7 key and hd02/sa/reconf Then type the RETURN key and then the EXECU1E key. The reconfiguration menu will appear. SEE ALSO bootmenu(8) . LIMITATIONS /sa/boot is actually just an image of what is in the boot partition. Changing or removing /sa/boot will not affect normal operation of the 32:16. /sa/boot is a standalone program and cannot be invoked through UNIX. FOR:PRO 4-2 9/83 BOOTCP(8) Fortune Systems BOOTCP(8) NAME bootcp - copy a boot image SYNOPSIS bootcp ifile ofile bootno DESCRIPTION Bootep copies a boot image from ifile to ofile. ifile can be a regular file or a character device. If it is a regular file, it is assumed to be the boot image. If it is a character device, boonoth boot is read. ofiIe can be a regular file or a character device. If it is a regular file, it will contain the boot. If it is a character device, bootnoth boot contains the boot. If the bootno boot exists, it is overwritten. If it doesn't, space for it is found in partition O. In either case the configuration block is updated. SEE ALSO devctl(2), diskconf(S), disktab(S), rdconf(8). DIAGNOSTICS Error messages if the ifile does not exist, if the ifile is not a regular file or a character special file, if the ofiie is not a regular file or a character special file or if the partition 0 doesn't have enough space for the boot. 9/83 4-3 FOR:PRO BOOTMENU (8) Fortune Systems BOOTMENU (8) NAME bootmenu - first power-up menu DESCRIPTION Ute boot menu allows you to decide what the 32:16 does on powerup or reset, which device, drive, and boot program # to used in booting up, the brand(s) of floppy drive(s), the UNIX file name brings up, and the default baud rates used on the front and back ports. Each line of the menu has a short description, the current setting of that field (if appropriate to the command), and the function key which picks that field (highlighted). The EXECUTE key quits the menu and either goes into terminal mode or starts the boot device and drive routine. The HELP key gives a description of how to use each command. F1 F2 F3 F4 F5 F6 F7 F8 F9 FlO Change Front port speed Change Back port speed Change power-up action Change boot device Change boot program number Change floppy drive #0 type Change boot file name Read settings from EAR OM Save settings into EAROM Start system from floppy disk current setting " " EXECUTE Start up system using information on screen HELP For more information The function keys are brightened to indicate they are to be depressed. Pressing F1 to FlO picks one of the possible fields, the chosen field is indicated by showing the description in reverse video. FI-F6 are changed by typing the space key. F7 requires the user to type in a string device/file, followed by RETURN. F8 and F9 do not have settings to change; the underlined message confirms the action was taken. FlO sets the proper settings you need to run the cold boot diskette or the floppy-based unix diskette. The EXECUTE key goes ahead and boots, using the information on the screen but not writing the EAROM. The HELP key shows an alternate menu, giving a slightly longer description of each field. If there is some problem in booting up the "Level I" boot, the boot menu is entered with a flashing error message. DESCRIPTION OF COMMANDS Change Front port speed: Change Back port speed: The Fortune keyboard port (TIYOO) and the port on the back of the machine (TIYOl) are RS-232C serial lines. These can operate at various speeds. The Fortune keyboard should be at 2400 FOR:PRO 4-4 9/83 BOOTMENU (8) Fortune Systems BOOTMENU (8) baud. The back port can be used for various purposes and the speed can be set for however it is used. These are default speeds only. They are in effect whenever the MomROM functions as a terminal, and also under UNIX until they are changed. TTYOO can be set to any baud rate if that port is to be used for operation with other than the Fortune integral keyboard. Change power-up action: Decide what the machine will do when you tum it on. It can boot from the "Boot Device", show the menu, or act as a terminal with another computer connected to ttyOl. Change boot device: Decide from which peripheral and drive number to boot. The 32:16 can boot from the back port, the floppy disk drive, and some of the VO option cards. Booting from the hardware peripherals consists of using data stored on the hardware. Booting from a serial line requires another computer at the other end of the line. Most of the disk drive peripherals can have more than one drive attached to them, and the drives have unique numbers, starting from O. This field also sets which drive on the above-named device will be used. Change boot program number: Each disk drive can have one or more boot programs. This number specifies which boot program should be used to find the 'level 1 boot file'. See bootcp(8). Change floppy drive #n type: The 32:16 can have up to four floppy disk drives attached to it. This allows you to indicate which model of floppy disk drive is connected to each of the four channels. You will notice that there are four drives and only one type shown; drive number n is changed, where n is 0 unless the boot device is set to floppy drive #=1, #2, or #3. You should never have to change this. Read settings from EAROM: This overwrites the current settings on the screen with the contents of the non-volatile part of the EAROM. Save settings into EAROM: This saves the settings on the screen into the permanent part of the EAROM. Start system from floppy disk: This sets the other items on the screen to the necessary settings for running the floppy-based FOS system (such as cold boot disk #1). It also sets the EAROM root device and swap device fields (see reconf(8» to "fd02" and II fd01", respectively. This merely allows you to boot up on floppy-based unix once; it only 9/83 4·5 FOR:PRO BOOTMENU (8) Fortune Systems BOOTMENU (8) changes the volatile portion of the EAR OM. See reconf(8) for a full description of what these fields do. EXECUTE This saves the settings on the screen into the volatile portion of the EAROM. They are only in force until the machine is re'set or powered down, at which time the non-volatile contents of the EAROM are consulted. HELP This replaces the screen with a list of terse reminders of each key's function; it is no replacement for this document. See momrom(8) for information to run the boot menu. DIAGNOSTICS Unexpected processor trap! This is caused by an unexpected processor trap, and could indicate a program bug or an unexpected device interrupt. Probably what happened is that the indicated level 1 boot program is garbage. If this happens, try booting from a floppy; for hard disk systems, use the cold boot floppy. Downloading: This message appears when using terminal mode. Th~ download function has started (because the 32:16 received a D from the back port), and the processor is accepting records from the back port. These messages can appear with the boot menu: EAROM checksum error! The Motherboard EAROM has been changed too many times and needs to be replaced, or the data in the EAROM was accidentally changed. The F9 key should make this message go away; if it doesn't, consult your dealer. Please set boot device The EAROM code for the boot device means nothing. When booting from the floppy: No disk in floppy drive Bad conf block on floppy Empty boot program on floppy Bad boot program on floppy Floppy drive can't seek FOR:PRO 4-6 9/83 BOOTMENU (8) Fortune Systems BOOTMENU (8) Floppy has bad block Floppy does not respond The floppy disk boot routine ran into some problem; The first message is obvious. The last message indicates that the floppy controller may be broken. The rest are explained in boot(8), disk(5) and diskconj(8). Any of the above problems can also occur when booting from the hard disk. OLD VERSIONS Older versions of the motherboard PROMs use "There's something wrong, start over" instead of "Unexpected processor trap," and "EAROM may not work" instead of "EAROM checksum error." SEE ALSO boot(8), momrom(8), reconf(8). 9/83 4-7 ,FOR:PRO CHOWN(8) Fortune Systems CHOWN(8) NAME chown, chgrp - change owner or group SYNOPSIS letc/chown owner file .. . letclchgrp group file .. . DESCRIPTION Chown changes the owner of the files to owner. The owner can be either a decimal UlD or a login name found in the password file. Chgrp changes the group-ID of the fiLes to group. The group can be either a decimal GID or a group name found in the group-ID file. Only the super-user can change owner or group, in order to simplify as yet unimplemented accounting procedures. FILES /etdpasswd /etdgroup SEE ALSO chown(2), group(5), passwd(5). FOR:PRO 4-8 9/83 DSKSELECT (8) Fortune Systems DSKSELECT (8) NAME dskselect - select a disk configuration block SYNOPSIS dskselect file [disktype] DESCRIPTION Dskselect reads the disktab data base and displays the disk type names on the screen after printing the prompt. One of the displayed types can be selected by typing its index. A configuration block of the selected disk is written out to file. If the disktype is given, the user is not prompted and configuration block for that type is written. The letcldisktab file contains the data base of the configuration blocks. SEE ALSO devctl(2), disktab(5), rdconf(8). DIAGNOSTICS Error messages if letc/disktab can not be found, disktype is not in the disktab file or file can not be written. 9/83 4-9 FOR:PRO FORMAT (8) Fortune Systems FORMAT (8) NAME format - formats a floppy or a hard disk SYNOPSIS format [-c conftle] [-kJ [-t track -h head] device DESCRIPTION Format is a disk formatter. It formats the device and writes a new configuration block on it. You must use mkfs if you want to create a new filesystem on the device. OPTIONS -c conftle reads a configuration block from con#le instead of device. -k saves the bad block information present on the disk. This avoids the need to res pare known bad blocks. This option has no effect on an unformatted hard disk. This option, when used on an unformatted floppy disk, will hang the system -t track -h head formats a single track on a head. SEE ALSO mkconf(8), mkfs(8), rdconf(8), diskconf(S), mkfs(8). DIAGNOSTICS Error messages if the conftle or device does not exist, configuration block can not be read or is invalid, configuration block can not written to device, invalid track or head, or if formatting was unsuccessful. FOR:PRO 4-10 9/83 FSCK(8) Fortune Systems FSCK(8) NAME fsck - file system consistency check and interactive repair SYNOPSIS letc/fsck -p [file system ... ] letc/fsck [-n] [-sX] [-SX] [-tfilenameJ [-yJ [file system] ... DESCRIPTION The first form of fock preens a standard set of file systems or the specified file systems. It is normally used in the script letclrc during automatic reboot. In this case fock reads the table letcJfstab to determine which file systems to check. It uses the information there to inspect groups of disks in parallel taking maximum advantage of I/O overlap to check the file systems as quickly as possible. Normally, the root file system is checked on pass I, other "root" ("a" partition) file systems on pass 2, other small file systems on separate passes (e.g. the "d" file systems on pass 3 and the "e" file systems on pass 4), and finally the large user file systems on the last pass, e.g. pass 5. A pass number of 0 in fstab causes a disk to not be checked; similarly partitions which are not shown as to be mounted "rw" or "ro" are not checked. The system takes care that only a restricted class of innocuous inconsistencies can happen unless hardware or software failures intervene. These are limited to the following: Unreferenced inodes Link counts in inodes too large Missing blocks in the free list Blocks in the free list also in files Counts in the super block wrong These are the only inconsistencies which fock with the -p option corrects; if it encounters other inconsistencies, it exits with an abnormal return status and an automatic reboot then fails. For each corrected inconsistency one or more lines are printed identifying the file system on which the correction takes place, and the nature of the correction. After successfully correcting a file system, fock prints the number of files on that file system and the number of used and free blocks. Without the -p option, fock audits and interactively repairs inconsistent conditions for file systems. If the file system is inconsistent the operator is prompted for concurrence before each correction is attempted. It should be noted that a number of the corrective actions are not fixable under the -p option result in some loss of data. The amount and severity of data lost can be determined from the diagnostic output. The default action for each consistency 9/83 4-11 FOR:PRO FSCK(8) Fortune Systems FSCK(8) correction is to wait for the operator to respond yes or no. If the operator does not have write permission fock defaults to a -n action. check, dcheck, [check, and icheckcombined. OPTIONS The following flags are interpreted by fock. -0 Assume a no response to all questions asked by fock; do not open the file system for writing. -sX Ignore the actual free list and (unconditionally) reconstruct a new one by rewriting the super block of the file system The file system should be unmounted while this is done; if this is not possible, care should be taken that the system is quiescent. The -sX option allows for creating an optimal free-list organization: -sBlocks-per-cylinder:Blocks-to-skip (for anything else) If X is not given, the values used when the file system was created are used. -SX Conditionally reconstruct the free list. This option is like -sX above except the free list is rebuilt only if there were no discrepancies discovered in the file system. Using -S forces a no response to aU questions asked by fock. This option is useful for forcing free list reorganization on uncontaminated file systems. -t If fock cannot obtain enough memory to keep its tables, it uses a scratch file. If the -t option is specified, the file named in the next argument is used as the scratch file, if needed. Without the -t flag, fock prompts the operator for the name of the scratch file. The file chosen should not be on the file system being checked, and if it is not a special file or did not already exist, it is removed when fsck completes. -y Assume a yes response to all questions asked by fock; this should be used with great caution as this is a free license to continue after essentially unlimited trouble has been encountered. If no file systems are given to fock then a default list of file systems is read from the file /etc/fstab. Inconsistencies checked are as follows: 1. Blocks claimed by more than one inode or the free list. 2. Blocks claimed by an inode or the free list outside the range of the file system 3. Incorrect link counts. FOR:PRO 4-12 9/83 Fortune Systems FSCK(8) 4. FSCK(8) Size checks: Directory size not 16-byte aligned. 5. Bad inode format. 6. Blocks not accounted for anywhere. 7. Directory checks: File pointing to unallocated inode. [node number out of range. 8. Super block checks: More than 65536 inodes. More blocks for inodes than there are in the file system. 9. Bad free block list format. 10. Total free block and/or free inode count incorrect. Orphaned files and directories (allocated but unreferenced) are, with the operator's concurrence, reconnected by placing them in the lost+found directory. The name assigned is the inode number. The only restriction is that the directory lost+found must preexist in the root of the file system being checked and must have empty slots in which entries can be made. This is accomplished by making lost+found, copying a number of files to the directory, and then removing them (before fock is executed). Checking the raw device is almost always faster, but does not work on /dev/rhd?? FILES /e tdfs tab contains default list of file systems to check. DIAGNOSTICS The diagnostics produced by fock are intended to be self-explanatory. If the root (I) file system has to be modified, the system must be rebooted. SEE ALSO fstab(5), filsys(5), reboot(8). LIMITATIONS Inode numbers for. and.. in each directory should be checked for validity. -b and -g options from check should be available in fock. 9/83 4-13 FOR:PRO GETIV(8) Fortune Systems GETTV(8) NAME getty - set terminal mode SYNOPSIS fete/getty [char1 DESCRIPTION Getty is invoked by init(8) immediately after a terminal is opened, following the making of a connection. While reading the name getty attempts to adapt the system to the speed and type of terminal being used. Init calls getty with an argument specified by the ttys file entry for the terminal line. Arguments other than '0' can be used to make getty treat the line specially. Normally, it sets the speed of the interface to 300 baud, specifies that raw mode is to be used (break on every character), that echo is to be suppressed, and either parity allowed. It prints the 'login:' message. 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 1200 baud and the 'login:' is typed again; a second 'break' changes the speed to 150 baud and the 'login:' is typed again. Successive 'break' characters cycle through the speeds 300, 1200, and 150 baud. The user's name is terminated by a newline or carriage-return character. The latter results in the system being set to treat carriage returns appropriately (see stty(2)). The user's name is scanned to see if it contains all upper-case alphabetic characters; if so the user will be warned that he should not be using all capital letters. If the user again types logs in using all capital letters, the system is told to map any future uppercase characters into the corresponding lowercase characters. Finally, login is called with the user's name as argument. The letter codes and their characteristics follow. If Code is given as argument to getty, then that line is used. If a break is received by code 0, then code Oa is attempted. Code Oa "breaks" to code Ob, then code Oc, then back to code O. Codes Oa, Ob, and Oc are not available as arguments. Similarly, codes 3 and 5 switch to each other. FOR:PRO 4-14 9/83 GETTY (8) Fortune Systems GETTY (8) Code Stty Commands Input speed Output speed 0 ANYP, ECHO ANYP,XTABS, ECHO, CRMOD EVENP,ECHO,FFl,CR2, TABl, NLI ANYP, ECHO,CRMOD,XTABS, LCASE ANYP, ECHO,CRMOD,XTABS, LCASE EVENP,ECHO,FFl,CR2, TABl,NLl ANYP,XTABS, ECHO,CRMOD ANYP,XTABS,ECHO,CRMOD ANYP,ECHO,CRMOD,XTABS ANYP,ECHO ANYP,ECHO ANYP,XTABS, ECHO, CRMOD ANYP,XTABS, ECHO,CRMOD ANYP,XTABS, ECHO,CRMOD ANYP,XTABS, ECHO,CRMOD ANYP,XTABS, ECHO,CRMOD ANYP,XTABS, ECHO,CRMOD ANYP,XTABS, ECHO,CRMOD ANYP, XTABS, ECHO,CRMOD ANYP,XTABS,ECHO,CRMOD ANYP, XTABS, ECHO, CRMOD ANYP,XTABS, ECHO,CRMOD ANYP, XTABS, ECHO,CRMOD ANYP, XTABS, ECHO,CRMOD ANYP,XTABS, ECHO,CRMOD 300 1200 150 110 110 150 9600 1200 300 300 2400 50 75 110 134 150 200 300 600 1200 1800 2400 4800 9600 19200 300 1200 150 110 110 150 9600 1200 300 300 2400 50 75 110 134 150 200 300 600 1200 1800 2400 4800 9600 19200 Oa Ob Oc 1 2 3 4 5 6 a b c d e f g h j k 1 m n SEE ALSO login(I), stty(2), ttys(S), init(8). 9/83 4-15 FOR:PRO HALT (8) Fortune Systems HALT (8) NAME halt - prepare to stop SYNOPSIS fete/halt DESCRIPTION Halt executes any hardware specific functions prior to shutdown, informs the user of its completion and requests that the machine be turned off. It then executes the pause(2) primitive. Halt is not intended to be called directly; rather it is executed from /etdrc. SEE ALSO pause(2), rc(8), shutdown(8). FOR:PRO 4-16, 9/83 INIT(8) Fortune Systems INIT(8) NAME init - process control initialization SYNOPSIS letc/init DESCRIPTION [nit is invoked inside UNIX as the "first" user program Its general role is to first make sure that the system is ready to run, and then create a process for each typewriter on which a user may log in. First it prints a "7" in the count-up sequence (see countup(8)), and reads the system language code from the EAROM (see uconJ(8» and creates the LANGUAGE= environment variable (see environ(S). This is passed in the environment to all user programs. It then forks Ibinfsh to run the shell script lete/re. See rc(8). (If fetdrc exits with nonzero status, or if letdrc is not present, it runs a single user shell on Idevlconsole.) To allow logins, init reads the file letclttys and forks several times to create a process for each terminal specified in the file. Each of these processes opens the appropriate terminal for reading and writing. These channels thus receive file descriptors 0, 1 and 2, the standard input and output and the diagnostic output. After an open succeeds, lete/getty is called with argument as specified by the second character of the ttys file line. Getty reads the user's name and invokes login to log in the user and execute the user's login program (usually the menu shell or /bin/sh, see passwd(S». Ultimately the user's shell will exit. The main path of init, which has been waiting for such an event, wakes up and removes the appropriate entry from the file utmp, which records current users, and makes an entry in fusrladm/wtmp, which maintains a history of log ins and logouts. The wtmp entry is made only if a user logged in successfully on the line. Then the appropriate terminal is reopened and getty is reinvoked. [nit catches the hangup signal (signal 1) and interprets it to mean that init should start over. Everybody logged in is preremptorily logged out. To do this use: 'kill -1 1.' If there are processes outstanding which are deadlocked (due to hardware or software failure),- init will not wait for them all to die (which might take forever), but will time out after 30 seconds. [nit's role is so critical that if it dies, the system will stop with an automatic "Software Error 22". If, at bootstrap time, the lete/init program cannot be exec'd, the system will stop with "Software Error 18". DIAGNOSTICS 9/83 4·17 FOR:PRO INIT(8) Fortune Systems INIT(8) File rr/etc!rc rr missing, running in maintenence mode. The letclrc shell script is gone, and init is forking Ibin/sh so that the system manager can do something. Can't execute rr Ibin/sh rr. Contact your dealer. The program Ibin/sh is gone, or can't run. Can't execute rr/etclgettyrr. Contact your dealer. The program letclgetty is gone, or can't run. Can't open rr letc!ttys rr file The terminal types database is gone. See rc(8) to find out how to run the maintenence mode shell. Can't creat rr/etc!utmp" file The database of currently logged in terminals cannot be maintained. This is not serious, and will not hinder multi-user operation. FILES Idev/console, Idev/tty??, letclutmp, lusr/adrrv'wtmp, letc!ttys, letc!rc SEE ALSO login(l), kill(l), sh(l), uconf(8), environ(5), ttys(S), getty(8), rc(8), reboot(8), halt(8), shutdown(8) FOR:PRO 4-18 9/83 LPD(8) Fortune Systems LPD(8) NAME Ipd - the line printer daemon SYNOPSIS Ipd -p printer -i PID OPTIONS -p n is the printer number, and can be from 0 - 999. The default is 1. -i PID This option indicates that the daemon is to pass the standard input along to the filter. In this case, the daemon will hang until the lock file is unlocked, indicating that the previous daemon has finished. When it runs, the PIO given is checked against the 'P' line in the control file. If they are the same, the job runs; otherwise it releases the lock file, then again hangs until it is unlocked, the assumption being that there is another -i job with a lower priority waiting to run. This option is invoked by giving the -i option to Ipr. The intention is to allow printing of jobs so large that a copy file would require more disk space than is available. DESCRIPTION The line printer daemon is the portion of the printer spooling program which decides which file should be printed next, and what options should be given to the printer filter for each job. It also determines the output device, sets the baudrate, etc. for the output device, and prevents other programs from using the output device. A daemon is responsible for one printer only. Thus, it is possible to have a number of daemons running at the same time, one for each enabled printer. The daemon is normally started by lpr(l) (lpr checks to see if a daemon is active by checking the file "lock" in the appropriate directory; if it is there and is locked (via lockf(2» Ipr simply exits, (unless invoked with the -i option), otherwise it forks and execs Ipd with the appropriate option(s). When it starts, lpd also checks to see if a daemon is active for the printer; if so, it exits unless the -i option was given. The daemon determines which job will print next by examining the control file. If there are two or more jobs vlith the same priority, the one which occurs first in the directory will be printed first. Every job in the queue is examined every time, since priorities may be altered by lpmv(l). When all jobs in the queue have been printed, the daemon exits. This is less of a load on system resources than having a daemon for each printer which wakes up when jobs are submitted. 9/83 4-19 FOR:PRO Fortune Systems LPD(8) LPD(8) After each job, the daemon will write the jobname, the size, the printer and the owner to an accounting file, if the file exists and is writable. CONTROL FILE Each line in the control file is treated as a unit, there is no conception of continuation lines, and each line must be 128 characters or less. The first byte of each line is the control byte, the meanings are listed below. As each file in a job is successfully printed, the 'F', 'P', or'S' is replaced with so that if another atte mpt to print the job is required, only those jobs which were NOT printed are retried. A Gives the full path name of the output filter. a Number of times to try and reprint unsuccessful jobs. B String to be used as the banner on the header page. Passed to the filter as -b. e Indicates that the filter is to be passed the 'W' option. c Indicates that setup is to be done by the filter to enable manual feeding of a page for the sheet feeder. (Not available from Ipr, used only by lpdun.) o The job is to be printed in single sheet mode. Passed to the filter as -d. E The type of terminal the job was invoked from Passed to the filter as -E. e The port the job was invoked from (full pathname). Passed to the filter as -e. F A filename to be passed to the filter as its input file. It is important to note that all lines containing information for the filter must precede the 'F', '5' and 'P' lines, since the filter is invoked as soon as any of these lines are encountered. f The formlength (in lines) to be used for the job. Passed to the filter as -F. e The real group 10 of the user who started the job. H A header page was specifically requested, as opposed to a default header page. Forces the filter to be passed the -0 option. The real user 10 of the user who started the job. A string of options which correspond to keywords in the printcap file, of the form fI:xy=#:ab=#: .... :fI where # will be substuted for the letter 'V' in a printcap formula. Passed to the filter as -I. J The job name, used when sending mail announcing job completion, also passed to the filter, and reported by lpq(l). K The umask of the user who started the job, used only with '5' below. + FOR:PRO '+', 4-20 9/83 LPD(8) L m o P Q p R s 5 u W 9/83 Fortune Systems LPD(8) The owner of the job, passed on to the filter, and used as the person to send mail to, if it is a valid user name, (or looks like a uucp or Arpanet address). Passed to the filter as -0, if a header page is to be printed. The maximum output line length to be used. Passed to the filter as -L. Send mail via mail(l) when the job is completed. overly long lines should be truncated on output. Passed to the filter as -to This job is a piped job, and should be run only if the -i option was given, and the PIO given with it matches the one on this line. See also 'F'. This is the QIO, which is initially the same as the PIO of the Ipr that made the control file. (It may be altered by lpmv(l». The job with the lowest QIO is printed next. This must be the first line in the control file. The type of printer this job is being sent to. Passed to the filter as -Po The number of copies of this job that should be printed. This job is being sent to a sheet feeder, the rest of the string is passed to the filter as the '_5' option. This line is a command to be run, whose output will be passed to the filter. (See also the note under 'F'.) The command is parsed, and if it contains no Bourne shell metacharacters, an attempt is made to run it via exec. The environment of the user who started the job is passed to the execed program (or to the shell). If the exec fails, or the command contains shell metacharacters, the cmd is run as II sh -c cmd II • The umask is set to that on the 'K' line, and the environment is set up from the file whose name is the same as the control file, except that the first letter of the relative portion of the path name is 'e', instead of 'd'. The working directory is set from the 'w' line. The format of the environment file is: 3 digits which give the length of the variable and its value, including the LF at the end; the variable name followed by an '='; the value of the variable; and a LF terminator. This allows environmental variables to contain an arbitrary string, including 8 bit characters. This job is to be printed in transparent mode; the filter should output all characters without altering them or masking them. Passed to the filter as -T. A filename (always a full pathname) to be unlinked when the job is finished (successfully or not). The directory from which the filter should be run, used only with the '5' line. 4-21 FOR:PRO lPD(8) Z Fortune Systems lPD(8) The size to be reported for this file. Jobs for which the daemon can not determine the size (such as piped input with -i, and '5' cmds) report this size in the accounting file. For cases in which the size can be determined, this is added to the real size. FILES lusrlspooVlpd/pr#= spooler directories (#= is the printer number) lusrlspooVlpdlpr#=/[ cd Ie J* Input and control files. letc/devtype For correlation between printer #, printer port, and printer type, etc. lusr/admllpacct If this file exists and is writable by root, a line of statistics is written for each job. (The size of the job is given as zero if the job was a shell script, or there was no file AND the -I option was given. dtinit(l), lprm(l), lpmv(l), lpq(l), lpdun(l), lpr(l), Ipf(8), printcap(5). NOTES See the NOTES section in lpr(l) for a description of how error messages are handled. FOR:PRO 4-22 9/83 Fortune Systems LPF(8) LPF(8) NAME Ipf - the line printer spooler program which actually does output SYNOPSIS Ipf -b banner -d -D name -e -E name -e name -£'=/1 -F # -I string -j name -L # -1=/1 -N name -0 owner -P name -s=/l -S name - T -t -w DESCRIPTION Arguments fall into three classes: required for proper operation, desirable, and optional. Since this program is not intended to be used directly by humans, error checking for invalid/missing arguments is minimal! The intention is that it be started by the line printer daemon Lpd(8). The filter is responsible for extracting printer specific strings and capabilities from /etc/printcap. The program itself is printer independant. If certain strings (carraige return, line feed, formfeed mainly) are not found, or the printer type is not found, defaults are assumed (the ascii characters 013, 012, and 014, respectively). The filter also handles asynchronous signals from the lpdun(1) program, requesting that printing be suspended, restarted, pages be reprinted, etc. The program Lpnn(1) also signals the filter, requesting that the job be terminated. The S[GBAND (most system calls are not interrupted) signal is used. REQUIRED ARGUMENTS -D name name is the relative portion of the output device name, e.g. tty01 for the S[O port. -£n The file descriptor to be used in reading from the daemon, used to verify that the daemon has changed the prstate file as requested. (The file is opened by the daemon, and the descriptor inherited by the filter.) n is ANDED with 077 to determine the actual number. -In n is the file descriptor for the output devicelfile. (The file is opened by the daemon, and the descriptor inherited by the filter.) n is ANDED with 077 to determine the actual number. -sn The file descriptor to be used in sending to the daemon, used to request that the daemon change the prstate file. (The file is opened by the daemon, and the descriptor inherited by the filter.) n is ANDED with 077 to determine the actual number. -N name name is the relative portion of the notification device name, e.g. console. This port is used to notify the operator that human intervention is required, e.g. feeding a new sheet of paper. 9/83 4-23 FOR:PRO Fortune Systems LPF(8) LPF(8) -p name name is the printer type to be used. It should be one that is legal, i.e., in /etdprintcap. DESIRABLE ARGUMENTS -j name name is the job name. It is used on the header page to identify the job. -e name name is the tty port from which the job is started. Error messages are sent to this port. If not given, or not writable, /dev/tty is tried; if /dev/tty is not writable, messages go to stderr. -E name name is the terminal type of the user who started the job. This allows messages to be placed properly on the screen. If not given, type FT is assumed. OPTIONAL ARGUMENTS -b string string is printed in large letters in the center of the header page (if any). It is truncated to 10 letters. -d This option informs the filter that the job is to be printed as single sheets. After each page, the filter will send bells (CTRL G) to the notification port and wait for a signal from Ipdun(l). -F n Form length for the job is set to n lines. The formfeed string is sent every n lines (the default is taken from the state file). -I string This string contains keywords that match entries in /etdprintcap, optionally followed by '=' and a number. This is how the' options of Ipr(l) are implemented. See the 'I' line of the control file in Ipd(8) for the exact format. +' -L n line length in characters; not significant unless -t is also given. -0 name name is printed on the header page at top and bottom It is usually the owner of the job. The presence of this argument is what causes the header page to be printed. If the -b option was not given, this is also used as the banner name. -S string string is the same as the string after the -S option of Ipr(l). It informs the filter that the job is being printed on a printer with a sheet feeder. It has a special significance if the string is "-1" (that is, 'minus one'), which is NOT allowed by Ipr. In this case the filter sends the required strings to the printer to enable a FOR:PRO 4-24 9/83 LPF(8) Fortune Systems LPF(8) new sheet of paper to be fed from the sheet feeder. This is normally done by using the -N option of Ipdun(I). -t truncate lines that are too long (as shown by the -L option or the default in the state file). -T transparent mode. All 8 bits of each character in the input are sent directly to the printer; no processing is done, and no reprinting is possible. Normally, non-printing characters are shown the same as they would be by the -v option of cat(I). -W Expect input to be in a special format, with key letters indicating the action to be taken. This option corresponds to the -C option of Ipr(I). The following options are ignored if this option is given: -t, - T, -L, and -F. Currently, only the word processing formatter uses this format. A listing of the special characters and their meaning follows. The number in parentheses indicates the number of bytes that go with the command. A Software length change. 2 byte arg (12 bits). B Bin number change. 1 byte arg (6 bit). C Software ribbon change. LF terminated string argo o Delay. 1 byte arg (6 bit). E End of page. F Operator forms change. LF terminated string argo H Software character set change. LF terminated string argo Turn off overriding un-interruptible mode. J Turn on overriding un-interruptible mode. L Operator width change. 2 byte arg (12 bits). o Software forms change. LF terminated string argo P Operator length change. 2 byte arg (12 bits). R Operator ribbon change. LF terminated string argo S Re-Schedule this job for later. T Software width change. 2 byte arg (12 bits). W Operator character set change. LF terminated string argo X Transmit n bytes interruptible (count is in following byte) Y Transmit n bytes un-interruptible (count is in following byte) Count for 'X' ana. 'V' commands: @ ABC 0 E F G H I J K L M N 0 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 9/83 4-25 FOR:PRO LPF(8) Fortune Systems LPF(8) P Q R STU V W X Y Z [ ] 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 abc d e f g h i j kim n 0 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 I p q r s t u v w x y z { I } - de I 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 'Ii through '0' Transmit n bytes interruptible abcde fgh j k lmno 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 I 'p' through 'DEL' Transmit n bytes un-interruptible p q r s t u v w x y z { I } - del 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 FILES lusrispoolllpd/pr# spooler directories (# is the printer number) lusrlspoolllpd/pr#/prstate The file containing information about the current state of the printer and the spooler. The lprm, [pmv, and lpdun programs change this file before they signal the filter, so the filter can determine what request was made. See the functional spec for the spooling system for more details about this file. The following printer states are currently understood: o 1 2 3 4 5 6 7 8 10 11 12 13 14 15 FOR:PRO IDLE ACTIVE SUSPEND WAITING FOR SHEET WAITING FOR RIBBON WAITING FOR WHEEL WAITING FOR FORM WAITING FOR LINEWIDTH WAITING FOR PAGELENGTH KILLED INTERRUPIED RESTART RESUME TRANSPARENT (-T option or no pages being saved) SETSHEET (see -S-I) 4-26 9/83 LPF(8) Fortune Systems LPF(8) /etc/printcap For printer specific information SEE ALSO dtinit(l), lpnn(l), lpmv(l), lpq(l), lpdun(l), lpr(l), lpd(8), printcap(5). NOTES See the N01ES section in lpr(l) for a description of how error messages are handled. LIMIT ATIONS Ipf attempts to save pages in memory, so jobs can be restarted up to 9 pages (the actual number is set by Lpdun(l); see it's -m option) before the current one. If there is a very limited amount of memory, this can result in some thrashing if any pages are being saved. The job will still be printed, but very slowly. Ipf does not know about videotext characters. It will pass through sequences in transparent mode or from Fortune:Word, but in normal printing, they will be shown as ""'yx' where x is the escape character. 9/83 4-27 FOR:PRO Fortune Systems MID (8) MID (8) NAME mid - display machine serial 10 number andlor group 10 number SYNOPSIS mid [-5J [-g] [-hJ DESCRIPTION Mid displays the machine serial number and group number. If either the -5 or -g option is specified then only those requested fields will be displayed as described below; otherwise, both numbers will be displayed prefixed with descriptive labels. . Both the serial number and group number are 32-bit numbers which are displayed in "license plate format" (unless the -h option is specified). This format maps a 32-bit number into an ascii string of the form "nnn-CCC-nnn" where n is a digit and C is an alphabetic consonant. OPTIONS -s display the machine serial number in a format suitable for pipelining, i.e. with no descriptive label and immediately followed by a carriage return. -g display the group number in a format suitable for pipe lining. -h use hexadecimal format for displaying numbers. If both the -s and -g options are specified then the serial number and group number will be displayed, in that order, in a form suitable for pipe lining. FOR:PRO 4-28 9/83 MKCONF(8) Fortune Systems MKCONF(8) NAME mkconf - create/change a configuration block SYNOPSIS mkconf -c ifile ofile mkconf -floppy ofile mkconf [ -i ifile] ofiLe mkconf -rigid ofile mkconf [-S size J 0 file DESCRIPTION Mkconf allows you to create a configuration block and save it on a regular file or a disk device. OPTIONS -c Copies the conf block from ifile to ofile. -floppy / -rigid Allows the user to interactively change fields in the configuration block. Cause a reasonable default configuration block to be created for floppy disks and rigid disks, respectively. -i Reads the configuration block from ifile if available or from device and uses that as a starting point. -S Sets the size of the swap partition to size. SEE ALSO devctl(2), diskconf(5), rdconf(8). DIAGNOSTICS Error messages if the device does not exist, if read or write errors occur, or if one of the files does not exist. 9/83 4-29 FOR:PRO MKDEVS(8) Fortune Systems MKDEVS(8) NAME mkdevs - generate canonical device names SYNOPSIS mkdevs -p DESCRIPTION Every 32:16 device driver has a unique set of file names for the devices it gives access. Mkdevs -p prints out a shell script which creates all of these standard device names in /dev, along with permission bits supplied by the driver. The devices are queried via the IOCAUTO command available with devctl(2) or ioctl(2). FILES /dev/* SEE ALSO devctl(2), ioctl(2), intro(4), disk(5). FOR:PRO 4-30 9/83 MKFS(8) Fortune Systems MKFS(8) NAME rnkfs - construct a file system SYNOPSIS lete/mkfs -a special [mn] lete/mkfs special size [mn] lete/mkfs special proto DESCRIPTION Mkfs constructs a file system by writing on the special file special. In the first form the size of the file system is the same as the size of the partition and is taken from the disk configuration block. In the second form of the command a numeric size is given and mkfs builds a file system with a single empty directory on it. The number of inodes is calculated as a function of the file system size. (No boot program is initialized in this form of mkfs.) NOTE: All file systems should have a lost+found directory for fsck(8); this should be created for each file system by running mklost+ found(8) in the root directory of a newly created file system, after the file system is first mounted. The second form of mkfs is sometimes used in bootstrapping. In this form, the file system is constructed according to the directions found in the prototype file 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 sector zero as the bootstrap program. The second token is a number specifying the size of the created file system. Typically it is the number of blocks on the device, perhaps diminished by space for swapping. The next token is the number of i-nodes in the i-list. The next set of tokens comprises 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. The mode token for a file is a six character string. The first character specifies the type of the file. (The characters -bed specify regular, block special, character special and directory files respectively.) The second character of the type is either u or - to specify set-user-id mode or not. The third is g or - for the set-group-id mode. The rest of the mode is a three digit octal number giving the owner, group, and other read, write, execute permissions, see chmod(l). Two decimal number tokens come after the mode; they specify the user and group IO's of the owner of the file. If the file is a regular file, the next token is a pathname whence the contents and size are copied. If the file is a block or character special file, two decimal number tokens follow which give the major and minor device numbers. 9/83 4-31 FOR:PRO MKFS(8) Fortune Systems MKFS(8) If the file is a directory, mkfs makes the entries. and" .. and then reads a list of names and (recursively) file specifications for the entries in the directory. The scan is terminated with the token $. 487255 d--77731 usr d--777 3 1 sh ---755 3 1 /bin/sh ken d--755 6 1 $ bO b--644 3 1 0 0 cO c--644 3 1 0 0 $ $ The arguments m and n specify the interleave factor. They default to 3 and 68 respectively in the first form of the command. In the second form they are taken from the configuration block. Recommended values for m and n are, respectively, 3 and the number or I024-byte blocks per disk cylinder. SEE ALSO dir(5) , filsys(5), format(8), fsck(8), mkconf(8L mklost+found(8), rdconf(8). LIMITATIONS There is no way to specify links. There is no way to specify bad blocks. Lost+ftJUnd is not made automatically. FOR:PRO 4-32 9/83 MKLOST +FOUNO (8) Fortune Systems MKLOST +FOUNO(8) NAME mklost+found - make a lost+found directory for fsck SYNOPSIS /etclmklost+found DESCRIPTION A lost+found directory is created in the current directory containing a number of empty files. These provide empty slots for fsck(8). 1his command should be run immediately after mounting a newly created file system SEE ALSO fsck(8), mkfs(8). LIMITATIONS Should be done automatically by mkfs. 9/83 4-33 FOR:PRO MKNOO(8) Fortune Systems MKNOO(8) NAME' mknod - build special file SYNOPSIS /ete/mknod name [b] [e] major minor DESCRIPTION Mknod makes a special file. The first argument is the name of the entry. The second is b if the special file is block-type (disks, tape) or c if it is character-type (other devices). The last two arguments are numbers specifying the major device type and the minor device (e.g. unit, drive, or line number). The assignment of major device numbers is partly dependent on the order of I/O option boards in the 32:16 expansion slots. The mkdevs program queries each available driver for the "real name" of each device, and this program should never be run. If it is necessary to make an alternate name for a device, i.e. !devltar for /dev/rfd02, the Ln(l) command should be used. SEE ALSO mknod(2), mkdevs(8). FOR:PRO 4-34 9/83 MOMROM(8) Fortune Systems MOM ROM (8) NAME Motherboard Rom - the startup program for the Fortune 32:16 DESCRIPTION The motherboard rom, or momrom, is run when the 32:16 is turned on or the reset button is depressed. It is not a disk file, instead it is part of the 32:16 hardware. To get the boot menu, turn on the machine while holding down the CanceVDel key. The 32:16 contains a small store of non-volatile RAM. The contents remain when the 32:16 is turned off. This storage area, the EAROM (electrically alterable read-only memory), contains information the motherboard rom uses. When momrom runs, it clears the screen, prints "1 n, and then does one of three things: runs UNIX, acts as a simple computer terminal, or shows the boot menu. The first is the usual action; this does the normal startup sequence ("2 345 6 7 8 9" etc.). The second, terminal mode, prints "Terminal mode" on the screen and operates as a simple terminal. It assumes that a remote host is connected to the serial port on the back of the machine. The boot menu allows you to change the action taken and the details of booting up, i.e. whether to boot from the hard disk or the floppy disk, what baud rates the keyboard and back serial ports run at, and similar trivia. For a detailed guide to the boot menu, read bootmenu(8». Also, all of the items in the boot menu can also be changed in the reconfiguration menu programs (reconj(8». Essentially, the boot menu is a stripped-down version of the reconfiguration menu, which only changes the information in the EAROM used in booting up to a stage where the full reconfiguration menu can be run. The keyboard and the built-in CRT is usually used as the system console. However, both the keyboard and back ports can also, when attached to an FIS 1000, be used as the system console. This can be done by changing the "Console location" field in the reconfiguration menu (normally set to CR1) to TTYOO or TTYOl. The next time UNIX comes up, or the machine is powered up or reset, the keyboard port (TTYOO) or the back port (TTY01) is used as the console, instead of the keyboard/CRT combination. If the CANCEL/DEL key is held down on the keyboard right after the machine is turned on or reset, the boot menu appears on the CRT/keyboard console. This overrides the EAROM "Boot action" and "Console location" settings. Also, if an FIS 1000 is attached to the front or back port, and any of the arrow keys are held down immediately after reset or power-up, the boot menu appears on FIS. Until the reconfiguration menu is run, or the machine is again reset or powered up, that terminal is the system console. 9/83 4-35 FOR:PRO MOUNT (8) Fortune Systems MOUNT (8) NAME mount, umount - mount and dismount file system SYNOPSIS letclmount [special name [-rU letclmount -a letc/umount special letclumount -a DESCRIPTION Mount announces to the system that a removable file system is present on the device speciaL. The file name must ex~st already; it must be a directory (unless the root of the mounted file system is not a directory). It becomes the name of the newly mounted root. Umount announces to the system that the removable file system previously mounted on device special is to be removed. These commands maintain a table of mounted devices in letclmtab. If invoked without an argument, mount prints the table. Physically write-protected and magnetic tape file systems must be mounted read-only or errors occur when access times are updated, whether or not any explicit write is attempted. OPTIONS -a For either mount or umount, aU of the file systems described in letcl[stab are attempted to be mounted or unmounted. In this case, special and name are taken from letcl[stab. The speciaL file name from letcl[stab is the block special name. -r Indicates that the file system is to be mounted read-only. FILES letdmtab mount table letdfstab file system table SEE ALSO mount(2), fstab(5), mtab(5). LIMITATIONS Mounting file systems full of garbage crash the system. Mounting a root directory on a non-directory apparently good pathnames invalid. FOR:PRO 4-36 makes some 9/83 PSTAT(8) Fortune Systems PSTAT(8) NAME pstat - print system status SYNOPSIS pstat [-acCfimMpstxwW] [-d dumpfileJ [-u pid] DESCRIPTION Pstat prints miscellaneous information from inside the kerneL The option switches determine what is printed. Most of the options cause pstat to print out data tables from kernel memory. Most of the information is only of use to those working on kernel development, but it can also be useful for analyzing system resource usage patterns. OPTIONS -a With -p or -t, print out the whole table, not just active table slots. -c Print total number of dist blocks, number of clist blocks free, number of characters in free clist blocks, and the freelist wait address. Example: c:lists: 14 total. 14 free. 1736 chars. 1084: nit address -c Print configuration information, i.e. how much memory is plugged in, and what is plugged in to the option slots. Information about an I/O board in an option slot comes from the ROMs on the board. Example: Total Ma.ory =10241 bytes Slot' c:onta.1Ds Crt. Version 1.1 Slot E c:onta.1Ds Bard boot. JersioD 0.0 -f Print the open file table. Example: 100 files. 3 ac:tive LOC FLG CIT 110 15 I 41 HI 42 HI 1 7 9 4 3 9 OFFS 0 34 2886 The headings are: LaC The index of this table entry. FLG Miscellaneous state bits: H open for hole-skipping read P pipe R open for reading 9/83 4-37 FOR:PRO Fortune Systems PSTAT(8) PSTAT(8) W open for writing CNT Number of file descriptors referencing this file table entry. INa The index of the inode table entry for this file. OFFS The file offset, see lseek(2). -i Print the incore inode table. Example: 100 inode•• LoC ruGS 0 1 2 3 T T 4 active 110 1I0DE i l l urn SIZE/DEI 1152 2 40777 45 0 1. 18 6784 1. 18 1239 100170 2 101 4 26272 1. 18 1304 101777 1 54 20623 2 101 8, 0 1. 18 CIT DEllCE 8 1 1 2 The headings are: LaC The index of this table entry. FLAGS Miscellaneous state bits: A access time must be corrected C changed time must be corrected H hole-skipping read is in progess L locked M file system is mounted here P is a pipe T contains a text file U update time (filsys(5» must be corrected W wanted by another process (L flag is on) CNT Number of open file table entries for this inode. DEVICE Major and minor device number of file system in which this inode resides. INa I-number within the device. MODE Mode bits, see chmod(2). NLK Number of links to this inode. FOR:PRO 4-38 9/83 PSTAT(8) Fortune Systems PSTAT(8) UID User ID of owner. SIZE/DEV Number of bytes in an ordinary file, or major and minor device numbers of special file. -m Print total physical memory, amount available for user processes, amount of user memory free, maximum memory allowed per process, number of core freelist slots used out of total number available. Amounts are in increments of 1024 bytes. Example: . . total = 10241, user = 8031. free = 3391. perproc = 2851 coraaap: t/50 -M Print amount of memory available for user processes, total phy- sical memory, and maximum memory allowed per process. Amounts are in increments of 1024 bytes. Example: 8031 user .-cry available out of 10241 total. 2561 uxiJIaDI per process Print the process table. Example: -p 37 processel. 5 active LOe s F PHI SIGIll urn TIll CPU H PCRP pm ppm SIZ ICHU o1 3 0 0 o 127 199 20 0 0 0 2 runout 1 1 1 30 0 o 121 o 20 0 1 0 15 (nit) 101 121 o 20 32 32 2 1 1 30 0 1 42 (nit) 3 1 1 to 0 o 127 50 30 0 29 1 22 (pause) o 121 o 20 0 33 1 15 ttJi.l+56 t 1 0 28 0 LIB TEITP CUT 0 0 0 o ffUe 0 o ff432 0 0 0 t5 o ffUe 0 The headings are: LOC The core address of this table entry. S Run state encoded thus: no process 1 waiting for some event 3 runnable 4 being created 5 being terminated 6 stopped under trace o F 9/83 Miscellaneous state bits (hexadecimal): 1 loaded 2 the scheduler process 4 locked 4-39 FOR:PRO PSTAT(8) PSTAT(8) Fortune Systems 8 swapped out 10 traced 20 used in tracing 4{) locked in by lock(2). PRI Scheduling priority, see nice (2). SIGNAL Signals received (signals 1-32 coded in bits 0-31), UID Real user 10. TIM Time resident in seconds; times over 127 coded as 127. CPU Weighted integral of CPU time, for scheduler. NI Nice level, see nice(2). PGRP Process group number of process (usually process controlling terminal). [0 of the opener of the PID The process 10 number. PPID The process ID of parent process. SIZE Size of process image in clicks (IK bytes). Does not include shared code segment if sharable. WCHAN The event for which the process is waiting or sleeping; if blank, the process is running. This field is either the name of an internal kernel variable, like runout, lbolt, buf[10J, inode[3J, etc., a system call name such as wait or pause (in parentheses), a tty major/minor dev like ttyO,O, any of the above with an offset, as in ttyl, 1 +56, or a hex address in rare cases. LINK Link pointer in list of runnable processes. TEXTP If text is pure, index of text table entry. CLKT Countdown for alarm(2) measured in seconds. -5 Print information about swap space. Example: FOR:PRO 4-40 9/83 Fortune Systems PSTAT(8) PSTAT(8) Strap allocation size is 512 bJtes. Total 3264. total free 2236 Largest free chUDlr: is 2158. snpu.p: 38 slota. 5 used = -t = Print table of tty devices. Example: 7 ttJs STATE: T=TIIIEOUT '=lOPEI O=ISOPEI C--C.lBll 01 B=BUST A=.ISLEEP I=ICLUDE H=HOPCLS S=STOPPED DEY RA' CAl OUT IIODE DEL COL STATE PCBP DISC LOCAL LSTJ.TE eO 0 0 DC o O. 0 0 0 0 46 nttJ 119405 cdS 0 4 DC 6. 0 0 0 0 41 nttJ 119405 o The headiDga are: DEV Major and minor of the device. RAW Number of characters in raw input queue. CAN Number of characters in canonicalized input queue. OUT Number of characters in output queue. MODE Encoded in hexadecimal Things like echo, tab expansion, etc. See tty(4). DEL Number of delimiters (newlines) in canonicalized input queue. COL Calculated column position of output. STATE Miscellaneous state bits: A process is awaiting output B busy doing output C carrier is believed to be on H hangup on close a open S output is stopped T output timeout delay is in progress W waiting for open to complete X open for exclusive use Use stty(l) for complete state. 9/83 4-41 FOR:PRO Fortune Systems PSTAT(8) PSTAT(8) PCRP Process group for which this is controlling terminal. DISC Line discipline in use for terminaL LOCAL Hexadecimal contents of tty. t_Iocallongword. LSTA1E Hexadecimal contents of tty.t_Istate longword. -u print information about a process from its 'upage'; the next argument is the process ID. The 'upage' is a data structure that is part of the data segment of a process and is 2K bytes in this implementation for the Fortune 32:16. Pstat finds the upage in main memory or swap space, wherever it is. If the process ID argument is -1 and dumpfile is the core file of a process that died, this option prints out the information from the upage of the deceased process represented by the core file. -w Print what version of the kernel this is and when it was built. -w Like -w but also tells who built the kernel and where. -x Print the text table with these headings: LaC The index of this table entry. FLAGS Miscellaneous state bits: K locked L loading in progress T ptrace(2) in effect w wanted (L flag is on) W text not yet written on swap device SIZE Size of text segment, measured in clicks (IK bytes). INa Core location of corresponding inode. CNT Number of processes using this text segment. CCNT Number of processes in core using this text segment. FILES Idev/mem default source of tables, kernel data space FOR:PRO 4-42 9/83 PSTAT(8) Fortune Systems PSTAT(8) Idev/hdOl this or some other disk will be the swap device SEE ALSO ps(l), stat(2), filsys(S). K. Thompson, UNIX ImpLementatIOn 9/83 4-43 FOR:PRO RC(8) Fortune Systems RC(8) NAME letdrc - Shell script for system startup DESCRIPTION letclrc is a shell script run by init(8) when the system starts up. If there is a file Itmpl.reboot, then the system is rebooted. If there is a file Itmpl.powerdown, then letclrc goes through an orderly powerdown sequence, which runs any product shutdown scripts, prints "Software shut down complete", unrnounts any file systems in letdfstab (to prevent file system damage), prints "Hardware shut down starting, please wait 60 seconds" places a marker for future use that the file systems are in order, and runs lete/halt, which merely waits for 60 seconds. After 60 seconds of no disk activity, the disk heads are moved to a safe place, otherwise shutting off power could destroy datd. If neither of the two files exist, letclrc attempts to bring up the system It prints the number "8" in the countup sequence (see countup(8», builds all the proper special devices (see mkdevs(8», and then prints "9". Next, the screen is cleared and the user is given 5 seconds to hit the DEL key. If he does, then letclrc goes into maintenence mode and the user is allowed to log in as 'root'. The user then sets the time and date. If the file letcl.fsclean does not exist, it assumed that the system was not brought down with letclshutdown but instead crashed in some fashion. Acting on this assumption, lete/rc runs ' fsck' to clean up any possible file system damage. Lastly, any product startup scripts (/m/rd*.rc) are run. FILES Itmp/.reboot Itmp/. powerdown /m/rd*.rc letd.fsclean letc/mtab letdutmp Ie tdpt mp Idev/console SEE ALSO fsck(8), login(l), mkdevs(8), mount(8), pstat(l), setdt(8), sh(8), sync(8), update(8). FOR:PRO 9/83 RDCONF(8) Fortune Systems RDCONF(8) NAME rdconf - read configuration block SYNOPSIS rdconf [-T I -bJ device ... DESCRIPTION Rdconf reads the configuration block from each device and prints it's contents on the standard output in a human readable form. Device can take several forms and it should be noted that all the programs which manipulate disk drives via devctl(2) use this same form. If device is of the form - {b Ie} ma jor / minor then the appropriate block or character (b or c) device with the respective major/minor pair of numbers will be used in the devctL call. If device does not match this form then it is assumed to be either the name of a device special file or a data file in which case either a devctL is made on the device or the file is read; this way files can be used to store configuration blocks and used anywhere a device could be used. OPTIONS -b causes an image of the configuration structure to be output instead of the human readable text. -T prints out only the typename from the configuration block. Checks are made to see if the configuration block is legitimate and if not diagnostics are produced; this does not, however, prevent the information in the block from being interpreted and printed. SEE ALSO mkconf(8), devctl(2), diskconf(5). DIAGNOSTICS Error messages if a device does not exist or if a read error occurs on a device. 9/83 4-45 FOR:PRO REBOOT (8) Fortune Systems REBOOT (8) NAME reboot - reboot the system SYNOPSIS reboot [-nJ DESCRIPTION Reboot takes down the Fortune System and brings it back up. It asks you to confirm that you want the system to reboot, if the -n flag is not given. OPTIONS -n Does not ask you if you want the system to reboot. DIAGNOSTICS Reboot failed, you must be super-user. WARNING Reboot does not issue a sync(l) command. SEE ALSO sync(l). FOR:PRO 4-46 9/83 SETDT(8) Fortune Systems SETDT(8) NAME setdt - set date and time SYNOPSIS /etc/setdt [e][t#J DESCRIPTION Setdt reads the current time with time(2) and puts it on the screen in human-readable format to be edited. If the time entered is earlier than the current time or more than five days in advance of the current time, the user is told that the time appears to be incorrect and is asked to verify that it is the correct time. When setdt determines the user has entered a reasonable time, or has confirmed the time entered is correct, it prints the time and asks the user to verify that they have entered the correct time. If the Cancel key is pressed any time while the program is running, the current time is printed in the format shown above and the program terminates. OPTIONS e Indicates that European format is desired, rather than American format. The'f' or 'F' keys can be used to toggle between formats once the program has been invoked. t Allows the user to give a time limit in seconds after which the program should time out, e.g. 'setdt t30' gives the user 30 seconds to edit the date, and if the program is still running after 30 seconds it is sent signal 1 (alarm clock). If this option is used it must be the last option given. SEE ALSO date(l), stime(2), time(2), ctime(3). LIMITATIONS If a yes/no question is answered with "no " or "n< EXECUTE > ", this is interpreted as a response of "yes". An hour of "00" is accepted as a valid time in American format. The 'f' and up-arrow keys are not accepted if the cursor is on the right side of the date or time fields. 9/83 4-47 FOR:PRO SETNSWAP (8) Fortune Systems SETNSWAP (8) NAME setnswap - set the 'nswap' variable in the kernel binary file SYNOPSIS setnswap partition-number confblock-file unix-file DESCRIPTION Setnswap reads the configuration block from confblock-file, usually a disk device, and determines the number of blocks in partition-number. It patches this number into the 'nswap' variable in unix-file. LIMITATIONS Setnswap assumes the sector size is 512. FOR:PRO 4-48 9/83 SHUTDOWN (8) Fortune Systems SHUTDOWN (8) NAME shutdown - orderly shutdown SYNOPSIS shutdown DESCRIPTION Shutdown takes down the Fortune Operating System in an orderly fashion. It asks you to confirm that you really want the system to quit. 9/83 4-49 FOR:PRO SYNC (8) Fortune Systems SYNC (8) NAME sync - update the super block SYNOPSIS sync DESCRIPTION Sync executes the sync system primitive. Sync can be called to insure all disk writes have been completed before the processor is halted. See sync(2) for details on the system primitive. SEE ALSO sync(2), halt(8), reboot(8), update(8). FOR:PRO 4-50 9/83 UCONF(8) Fortune Systems UCONF(8) NAME /etduconf - change basic system parameters SYNOPSIS /etc/uconf - UNIX program /sa/reconf - Stand-alone program DESCRIPTION The reconfiguration menu allows you to use the 32:16 with its various peripheral devices. The various fields allow you to decide what the system will do when it powers up, and the size of various operating system resources. /etc/ucon[ can only be run by the system manager. /sa/reconf operates in generally the same way as /etduconf, except it is a stand-alone program, i.e. it runs before UNIX comes up. To run it you must hold down the CANCEL/DEL key when the system is powered up or rebooted, and change the "Boot file name" (F7) field to disk/salreconf, where disk is probably "hd02" for the hard disk or "fd02" for the floppy disk. Type EXECUTE and the reconf menu eventually appears. To leave the menu, type F3, and the level 1 boot program (the ":" prompt) re-appears and you can then bring in UNIX (disk/unix). (See boot(8), bootmenu(8), and momrom(8).) The menu consists of fields and values for the fields. Upon entry to the program the current value of the fields as stored in the EAROM is displayed. Certain of the fields simply have a list of possible values that are cycled through by pushing the space bar. Others require the data to be manually entered; for these entries, the space bar either has no effect or enters a space character in the field. In either case, simply type the key to move on to the next field. Certain of the fields also have associated with them" Used/Total" information. In any case, that information is not crucial, so it can be ignored. The information in some of the fields may also be in overstruck. See the description of "Set params auto?". Field Definitions Power up action: Decide what the machine will do when you tum it on. It can boot from the "Boot Device n, show the menu, or act as a terminal, with another computer connected to ttyOl. Boot Device: Decide from which peripheral to boot. The 32:16 can boot from the back port, the floppy disk drive, or some of the Fortune peripheral options, such as the hard disk controller. Boot drive #: Most of the disk drive peripherals can have more than one drive attached to them, and the drives have unique numbers, 9/83 4-51 FOR:PRO UCONF(8) Fortune Systems UCONF(8) starting from O. 1his sets which actual drive will be used on the above-named boot device. Boot Program: Each disk drive can have up to eight boot programs. This number specifies which boot program will be used. Boot file: This is a file name in the UNIX file system in the boot partition (usually hd02lunix or fd02lunix). Flex drive #1, #2, #3, #4: The 32:16 can have up to four floppy disk drives hooked up to it. This allows you to indicate which model of floppy disk drive is connected to each of the four channels. TTYOO port speed & TTYOI port speeds: The Fortune keyboard port (TTYOO) and the port on the back of the machine (TTY01) are RS-232C serial lines. These can operate at various speeds. The Fortune keyboard should be at 2400 baud. The back port can be used for various purposes and the speed can be set up for whatever it is used. These are default speeds only. They are in effect whenever the MomROM functions as a terminal, and also under UNIX until they are changed. TTYOO can be set to any baud rate if that port is to be used for operation with other than the Fortune integral keyboard. Console location: You may want to run a standard video-display terminal or even a printing terminal as the console. This item allows you to use ttyOO or tty01 for this purpose. Typically, you would figure out an appropriate speed for the terminal, and plug it into ttyOl. Timezone: This allows you to tell the UNIX time-keeping system about your timezone. All of the world's timezones (except Saudi Arabia) are available here, in either verbal or numerical form. Daylight savings: This field allows you to tell the UNIX time-keeping system whether or not daylight savings time ever applies in your hemisphere; the system uses Daylight Savings at the appropriate time of the year. Line frequency: Sets the line frequency of the of the ambient AC power supply. If you are in America, this is 60 hertz; otherwise, it is probably 50 hertz. If this is set wrong the integral CRT will flicker. Language: The language field indicates the natural language used in this machine's application software. It controls the LANGUAGE= environment variable. Floating point?: The 32:16 supports floating point software using a large emulator in the kernel, and some of the software distributed by Fortune needs this package. You should set this field to YES unless you know that you don't need it. Hex number: This field is not used in the 2.0 release, but is included for future use. FOR:PRO 4-52 9/83 UCONF(8) Fortune Systems UCONF(8) Now we come to the really interesting part of the menu. The next eight fields allow you to change how well UNIX performs under various loads. If you are confused by any of this, change the "Set params auto?" field to YES. It automatically calculates generally acceptable values to use for the fields that are overstruck when the "Set params auto?" field is set to YES. Number buffers: Unix performs disk-handling through intermediate in and out boxes called buffers. The more file-handling (disk activity) occurs, the more the buffers are used. If you are performing much activity on a certain few disk files, for instance a data-base, increasing the number of buffers might have cause an improvement. Number inodes: There is an in-core inode required for every active (open) file, and the number of inodes limits the number of active files. These in-core structures are also another kind of buffer cache. If you are dealing with many files, increasing the number of in-core inodes can also have an effect on performance. It should also be increased if the "Software Error 142" message ever appears on the console. Number files: There is a also file structure in core for every open file. The number of file structures limits the total number of files that can be open at one time. Having more of them will not help performance. But not having enough of them could make it so you can't get anything done. Increase this number if the "Software Error 129" message ever appears on the console. Number clists: Clists are to terminals as buffers are to disk files. Increasing these to large amounts is only useful when running the 32:16 with much va activity to printers, networks, or terminals other than the integral CRT. Number processes: Every program that runs is a process. Many programs, to work effectively, use 2 or more processes. and the 32:16 can only run so many processes. If you try to run too many programs at once, you will get the message "No more processes" (or something similar) from the shell; this means you need room for more processes. Max process size: The largest amount of memory (the most critical system resource) that a process can use up. The number you enter is multiplied by 1024 bytes. Set params auto? If this is set to YES, the operating system ignores the above eight fields, and instead uses rules of thumb. It does a pretty good job, and you should only need to control these fields if you always use your system in a certain way. It bases its estimation of the above fields based on the total memory on your system and on your estimate of the number of users that will be using the system If this field is set to YES, the values of the fields are displayed 9/83 4-53 FOR:PRO UCONF(8) Fortune Systems UCONF(8) crossed out, meaning that those values are ignored and the automatically calculated parameters used instead. Appx. # of users: This is a guess as to how many users you will have using your 32:16. This number is useful to UNIX in "Set params auto?". Note that if you want to just increase everything proportionately, but aren't really increasing the number of users on the system, you can still just make this number larger. The numbers which are ignored when this field is set to YES are struck out in the menu, when the field is so set. This field does not control how many people are allowed to log in. /etc/uconf also displays certain system resource usage parameters: the ram usage, swap space usage, and the actual system parameters listed above "Set params auto" which can be changed. These numbers are already tuned to run well with a general mix of applications, but if you wish to fine-tune these numbers for a specific type of computing load, this display is of aid. Please note that setting any of these too low crashes UNIX or otherwise hinders the system from working well. Also, the pstat(1) program helps identify performance problems. Saving your changes, or what does that bottom line mean? The settings in the configuration menu are stored in a special kind of computer memory called an EAROM (electrically alterable read-only memory). This memory has two levels: one whose contents goes away when the computer is turned off (known as volatile memory), and another one whose contents is permanent (non-volatile). Isalreconf allows you to save your changes in one or the other; letduconf only saves things in the permanent area, and these changes do not take effect until Unix comes up again. The F1 key puts your changes in non-volatile memory, so that whenever you tum the system off and on, the changes stay in effect. There is an important problem here: Every time that you SAVE your changes with F1 into non-volatile memory, the EAROM degrades. The "EAROM has been changed # times" line at the bottom records only this, not changes to the volatile part. After the EAROM has been changed around 1000 times, it can fail. When this happens, a flashing message (see below) appears at the bottom of the screen, This does not necessarily mean that the EAROM has gone bad, it may also mean that the data in the EAROM may not have been properly maintained. The F2 key throws away any changes you may have done, and reads what was in the EAROM when you last powered up. This is useful if you made a change and didn't really mean it. In the stand-alone version, typing the F3 key causes the changes you made to be used on this boot-up only, they are not saved in the FOR:PRO 4-54 9/83 UCONF(8) Fortune Systems UCONF(8) non-volatile portion of the EAROM, and the level 1 boot prompt (":") appears. Turning the 32:16 off and on again (or pushing the reset button) causes the configuration menu to revert to its old state. In the stand-alone version, the F4 key indicates that the contents of the screen are used on the next boot-up only, but the program goes back to the beginning of the boot-up process (before the "1 II appears) instead of merely going back to the level 1 boot prompt (": "). In letdreconf, the F3 key merely exits the program and F4 does nothing. FILES bootmenu(8) SEE ALSO boot(8), bootmenu(8), momrom(8), pstat(8). DIAGNOSTICS EAROM checksum error! This message appears when the earom has either gotten old and started to malfunction, or it was aCcidentally altered by a program malfunction. The Fl key should make this error go away. If it doesn't, consult your dealer. A checksum is computed from the data in the EAROM and is then stored in the EAROM. If this checksum is incorrect, the EAROM may have shuffled off this mortal coil, or may have been improperly altered by a program bug. 9/83 4-55 FOR:PRO UPDATE (8) Fortune Systems UPDATE (8) NAME update - periodically update the super block SYNOPSIS fete/update DESCRIPTION Update is a program that executes the sync(2) 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. This program has been subsumed into the kernel, and does not need to be run. SEE ALSO sync(l), sync(2), init(8). LIMITATIONS With update running, if the machine is powered down just as the sync is executed, a file system can be damaged. FOR:PRO 4-56 9/83
Source Exif Data:
File Type : PDF File Type Extension : pdf MIME Type : application/pdf PDF Version : 1.3 Linearized : No XMP Toolkit : Adobe XMP Core 4.2.1-c043 52.372728, 2009/01/18-15:56:37 Create Date : 2011:01:21 14:37:25-08:00 Modify Date : 2011:01:21 15:14:26-08:00 Metadata Date : 2011:01:21 15:14:26-08:00 Producer : Adobe Acrobat 9.4 Paper Capture Plug-in Format : application/pdf Document ID : uuid:819ac410-46ef-4bfb-8528-3d2aac9edc24 Instance ID : uuid:6e4e43f4-0a58-42b7-9643-f4feb9a1ac59 Page Layout : SinglePage Page Mode : UseNone Page Count : 345EXIF Metadata provided by EXIF.tools