Path: utzoo!mnetor!uunet!mcvax!botter!star!ast@cs.vu.nl
From: ast@cs.vu.nl (Andy Tanenbaum)
Newsgroups: comp.os.minix
Subject: Status of V1.3
Message-ID: <709@ast.cs.vu.nl>
Date: 9 May 88 21:41:22 GMT
Sender: ast@cs.vu.nl
Reply-To: ast@cs.vu.nl (Andy Tanenbaum)
Organization: VU Informatica, Amsterdam
Lines: 841

I am about to start making up the MINIX 1.3 distribution.  I would like to
get it to Prentice-Hall some time in the summer.  Do not construe that as a
promise.  Version 1.3 will contain many items that have already been posted
here, and many that have not been.  Among other features, 1.3 will have:

  - ELLE: a very nice Emacs-like editor written by Ken Harrenstien
  - spell: an English spelling checker, including a 40,000 word dictionary
  - sed: a stream editor
  - ed: a nonstream editor
  - various small utilities
  - networking software for connecting MINIX machines on an Ethernet
  - support for non-IBM EGA cards
  - support for extended memory on ATs (as RAM disk)
  - support for reading the root file system from hard disk
  - many bug fixes, most of them not posted yet
  - lots more

The number of disks in the distribution has not grown, mostly because I will
cheat.  The V1.3 sources will be compressed and archived.  This saves lots
of space.  To extract the sources you will need to de-archive them and then
decompress the individual files.  A READ_ME file will show the way.  I am not
not going to post any compressed stuff.  The net saving of compressing plus
uuencoding is small, a lot of work for everyone, and very, very sensitive to
transmission errors.  All postings will be plaintext.

I would like to get everyone converted to 1.3.  I am tired about hearing about
bugs in 1.1 that were fixed in 1.2.  To accomplish this goal, three options are
available to readers of this group, representing different work-money 
tradeoffs.  These are:

   1. Watch this group carefully (no money, lots of work).
   2. Buy an upgrade kit from P-H for under $40 (middle).
   3. Buy a new set of disks from P-H for $79.95 (most money, least work).

In the course of the next couple of months, I will generate diff listings
for all files that have changed between 1.3 and 1.2.  If you have the original,
unmodified 1.2 sources, you can just turn everything into 1.3 by using Erik
Baalbergen's fix program.  Files that were not in 1.2, will be posted, insofar
as that has not already happened. If they have already been posted, you can fish
them out of one of the archives.  The upgrade kit (#2 above) will just be all
these diffs, on diskette.  You will have to do some work to install them, but
at least you can get a complete set of the diffs in a simple way, and not have
to constantly watch this group, as the diffs will probably be posted in bursts,
not all at once.  

If you have 1.1, you can upgrade to 1.2 by scrounging through the archives; 
I posted all those diffs last year.  Then you can repeat the process with the 
new diffs.  I am not going to make an upgrade kit from 1.1. There are only 24 
hours in a day, and all of them are occupied already, mostly dealing with mail
and news.  In theory, enough information will be in the archives to allow
anyone to do it, but option #3 may be a lot easier for busy people.  Sorry.

Note that the diffs that I post will be based on the original 1.2 distribution,
either from P-H or from 1.1 plus last year's diffs.  If you have made changes
since then, including changes that I have posted, you won't be able to apply
my new diffs using fix.  In some cases, Larry Wall's patch may help.  While I
realize this may be a pain, the original 1.2 distribution is the current base
that everyone should have.  It is the only version that I can count on many
people having.  Needless to say, when you finally get 1.3 going, put a copy 
of it aside on floppy disk, so that if we go through this again with 1.4, you 
will have an original 1.3 to use.

At the end of this file I have included the provisional V1.3 doc/READ_ME and 
doc/man_pages files.  Comments are welcome.  If there is some neat program
that you think should be included and isn't, let me know.  Similarly, if there
are parts of the documentation that you think should be improved, let me know
as well.  I have obviously not included everything that has been posted in 1.3.
I am still picky-picky.  My criteria are size (small is beautiful), simplicity
(if I can't figure it out, it doesn't go in), and closeness to UNIX V7. 
However, I am willing to tolerate some non V7 utilities that meet tests 1 and 2.

As to kernel changes, I am really an old stick in the mud.  The system actually
works pretty well.  I have a Zenith Z-248 (AT clone) at home now, and I run
MINIX on it exclusively.  It is rock solid and plenty fast.  You can try to
convince me to add some shiny new feature you have just devised, but it has to
be pretty important and highly compatible with what there already is.  On
the other hand, changes that remove known bugs without introducing new bugs
are welcome.  Note that this is not quite the same as "Changes that remove
known bugs are welcome."

Thus: ideas are always welcome.  They can either be mailed to me, or, if
discussion is appropriate, posted.

Andy Tanenbaum (ast@cs.vu.nl)

-------------------- Provisional V1.3 doc/READ_ME ----------------------------
The software has undergone some changes since the book was published.  Among
other things, the software has been more oriented toward hard disk users,
it has been ported to the IBM PC-AT (and clones), and also to the Atari ST.
The most significant changes are listed here.

 1. GENERAL
       There were a number of minor changes made to the code after the book
    was printed, as mentioned above.  As a result, line X of file Y in the  
    book may actually appear at X+3, or X-5, etc. on the disk version.  In
    the event of conflict, believe the disk version over the book version.

 2. PC-AT
       The distribution for the PC-AT differs from that for the PC in minor
    ways.  For example, there is no /user diskette.  All the files that would
    normally be on /user fit on /usr.  Furthermore, the number and organization
    of the source diskettes is different, but the same programs are available.
    Two additional special files are present in /dev: /dev/at0 and /dev/at1.
    These should be used to access 1.2M diskettes.  To access 360K diskettes
    on the PC-AT, use /dev/fd0 and /dev/fd1.  Special files are used by
    commands such as mount, mkfs, and df, among others.  For example, to
    copy part of a 1.2M diskette, type dd if=/dev/at0 of=file count=100.
    The difference between /dev/at0 and /dev/fd0 is that in MINIX, special
    files have sizes to prevent access beyond the end.  For /dev/fd0 the
    size is 360K.  For /dev/at0 it is 1.2M.  Finally, the executable binary
    for the PC-AT contains at_wini.c instead of xt_wini.c (see below).

 3. HARD DISK DRIVERS
       MINIX supports the use of the standard IBM hard disks.  Unfortunately,
    IBM chose to use different (and incompatible) disks and controllers on the
    XT and AT.  To find out if MINIX works with your disk, give the command:
		dd if=/dev/hd0 of=/dev/null count=1000
    If this runs to the end without errors, the driver embedded in your
    MINIX binary is appropriate for your controller and drive.  If it gives
    errors, copy kernel/xt_wini.c to wini.c and recompile the operating system.
    If this fails, then try kernel/at_wini.c and recompile it once more.
    Usually, one of these will work.  If neither works, your disk is not
    compatible with either the XT or AT.  You will have to modify the driver.
    You MUST have a kernel/wini.c to recompile the system, even if you do not
    have a hard disk (in which case, either one will do).

 4. INSTALLING MINIX ON A HARD DISK
      After you have made sure that you have a working hard disk driver, as
    described above, proceed as follows. To use MINIX on a hard disk, you need
    a MINIX partition.  You may also have MS-DOS, PC-IX, OS/2, XENIX, or other
    partitions as well if you like.  If you understand about making partitions,
    make one any way you are used to.  Otherwise use the MINIX fdisk program.
       Once you have a partition available for MINIX (the type does not matter
    as MINIX does not check), make a file system by booting MINIX from floppy
    the usual way and run mkfs.  If, for example, you have chosen partition 2,
    which has, say, 40 cylinders (i.e., 40 x 68 = 2720 sectors or 1360 1K
    blocks), type: 
		mkfs /dev/hd2 1360
    to make an empty file system.  However, for partition 1 use 1 block less
    because block 0 is not available (it contains the MS-DOS partition table).
    In other words, a 40 cylinder partition 1 has 1359 blocks but a 40 cylinder
    partition 2 or higher has 1360 blocks. Then mount the file system by typing
		/etc/mount /dev/hd2 /user
    Next, make whatever directories you like, typically bin, lib, and others,
    and copy files to the hard disk.  With the /usr floppy in drive 0, the
    command 
		cp /usr/bin/* /user/bin
    will copy all the binaries from /usr/bin to the hard disk, for example.
       Alternatively, the cpdir program can be used to copy entire trees, e.g.
		cpdir /usr/bin /user/bin
    will create a new directory /user/bin, and put /usr/bin with all its files
    and subdirectories in it.  
       A few of the files in /usr/bin must be owned by the root (instead of 
    bin) and have mode 4755. Check to make sure. These files are:  
		badblocks chgrp df fsck mkdir mv passwd readall rmdir su
       Finally, edit /etc/rc to have the hard disk mounted when the system
    is booted.  A line such as
		/etc/mount /dev/hd2 /usr
    can be used as a replacement for the mount command initially in /etc/rc.
    After editing /etc/rc, mount the root file system diskette and copy it
    to the diskette; otherwise the changes will be lost when the system is
    rebooted.  (There is nothing special about the root file system except
    its size; it can be mounted and written on like any other file system.)
       After these steps have been taken, the system can be booted from
    floppy in the usual way, and the root file system also read in from
    floppy.  The hard disk will automatically be mounted by the /etc/rc.
    The root device remains on the RAM disk, and the boot process still
    goes via floppy (for compatibility and to prevent disaster in the event
    that something goes wrong with the hard disk file system).  Hard disk
    file systems can be checked using fsck, the same as floppies.
       The special file /dev/hd0 refers to the whole disk, without regard to
    partitions, whereas /dev/hd1 ... /dev/hd4 refer to partitions 1 to 4.  If
    you have a second hard disk, you can make /dev/hd5 ... /dev/hd9 with mknod
    (major device 3, minor device 5 ... 9) for the second drive, with hd5 for
    the whole drive, hd6 for partition 1, etc.  Fsck also uses this convention.

  5. PUTTING THE ROOT FILE SYSTEM ON A HARD DISK
       To speed up the boot procedure, you may copy the root file system to
    /dev/hd3 with the commands 
		cp /dev/fd0 /dev/hd3     or    cp /dev/at0 /dev/hd3
    The former is for the PC, the latter is for the AT.  /dev/hd3 must not be
    mounted. When booting, leave the boot diskette in the drive when typing the
    = sign.  MINIX will see that the diskette is not a valid file system, and
    take the root file system from the default device, /dev/hd3.  You can 
    change the choice of default by modifying RAM_IMAGE in fs/main.c

  6. USING MS-DOS AS A DEVELOPMENT SYSTEM
       MINIX is now completely self supporting, so the C86 and PC-IX 
    directories have been deleted.  The only time you might need MS-DOS is
    for formatting blank diskettes.  MINIX does not have a format program.

  7. EDITING LARGE PROGRAMS WITH MINED
       Mined has a limit on the size of programs it can edit.  To edit
     larger ones, they must be broken up with split, edited separately and
     recombined later.  Better yet, use elle, which is a much better editor,
     is emacs compatible, and can handle files as large as the disk.

  8. MKNOD
        MINIX differs from UNIX in that block special files (and even some
    character special files, such as /dev/kmem) can have sizes.  A 360K floppy
    disk special file, such as /dev/fd0 can have size 360K.  Unfortunately, the
    mknod system call (and mknod program) have no way to express the size,
    so it uses size 0, which is equal to infinity.  When you read past the
    end of a block special file WITH a size, the file system returns zero
    bytes.  When you go off the end of a device WITHOUT a size, some drivers
    return end-of-file (e.g., hard disk, RAM disk), but others (e.g., floppy
    disk) return an I/O error code.  Thus if you make a new block special file
    for 2/0 and 2/1 (floppy disk) with mknod (i.e., no size) the command
		cp /dev/fd0 /dev/fd1
    will terminate with an error on block 360 (but it will copy the disk
    perfectly).  The only way to make a special file with a size is by making 
    a file system with mkfs.

  9. NONEXISTENT DEVICES
       If you try to open /dev/fd1 on a system with only one floppy disk drive,
    the system may hang.  To avoid this problem, the first time you log in, go
    to the /dev directory, and rename special files that you do not have to
    something unusual.  For example, if you do not have a hard disk, rename
    hd0 to HARD_DISK_0, hd1 to HARD_DISK_1, etc.  Similarly with one one floppy
    disk, rename fd1 to FLOPPY_DISK_1 to prevent it being typed by accident.
    You can also remove them, but due to the mknod problem described above, you
    can not get them back easily, so it is best just to get them out of the 
    way in case you ever need them again later.

 10. PRINTER
       In order to accommodate buffered and unbuffered printers, the printer
    driver uses a combination of delay loops and interrupts.  The net result
    is that the driver consumes a fair number of CPU cyles when running.  If
    you expect to do a lot of printing, you might want to consider rewriting 
    the printer interrupt handler, pr_char, in assembly code.

 11. DISK SPACE
       The /usr disk as distributed is nearly full.  If you have two floppy
    disk drives, be sure to mount /user on drive 1 and move your working
    directory there.  If you have only 1 floppy disk drive, remove some files
    from /usr/bin to make more space.  If you have a hard disk, there is no
    problem.

12. RUNNING /USER TESTS ON A FLOPPY
       Before running the tests in /user/test, remove the files in 
    /user/commands to create some free space on the disk.  Run the tests as
    superuser.

13. COMMAND LINE LENGTH
       The maximum initial stack size is 1K.  Calls to EXEC which require a
    larger stack will fail.  Thus if you do ls -l * in a large directory,
    the shell may expand the * so that the command line exceeds 1K and the 
    EXEC will fail, resulting in the message "Cannot execute ls".

14. ARCHIVES ON THE DISTRIBUTION DISKETTES
       To save space on the distribution diskettes, some of the sources have
    been compressed and/or archived.  Files ending with .archive can be
    de-archived by typing: ar x file.archive.  Files ending with .Z are
    compressed files, and can be decompressed by typing: compress -d file.Z.
    Some directories contain archives of compressed files, so first remove
    the files from the archive and then decompress the resulting .Z files.  

15. RECOMPILING FSCK AND OTHER LARGE PROGRAMS
      If for some reason you don't like the tools/fsck binary and want to
    recompile it, make sure you have plenty of free space for the compiler's
    temporary files.  On a floppy disk system, this may mean putting fsck on
    an almost empty diskette before compiling it.  When the disk is full, the
    quality of the compiler's error messages deteriorates rapidly.  If you
    are compiling fsck and getting strange results, check for disk space.
    Normally /tmp is used for temporaries, but the -T flag can override that.

16. NEWS GROUP
      If you have access to USENET, you may be interested in knowing that
    there is a news group, comp.os.minix devoted to discussions of MINIX.
    This is one of the largest news groups, with over 10,000 readers.
    If you have access to the Arpanet, Bitnet, or EARN, the news group is
    gatewayed there.  Contact info-minix-request@udel.edu to join.

17. SYSTEM PROBLEMS
      The IBM PC does not have any hardware for checking for stack overflow.
    The user must allocate the amount of stack for each program with chmem
    or use the compiler default (64K - program - data size).  Some programs
    in the distribution have been set to a smaller value, and may, in rare
    instances with certain arguments, hang.  If the system ever gets into a
    situation where it echoes keystrokes, but ignores DEL and CTRL-\ and
    appears otherwise to be hung up, hit F1 to see what is going on.  If
    some process is running and there is no way to interrupt it, hit F9.
    This key is equivalent to the super-user typing:  kill -1 9.  The result
    of F9 is that every process in the system is killed, including update
    and all the shells.  Although drastic, F9 will dehang the system
    instantly.  Log in again and then type /etc/update & to restart update.

18. USE OF EXTENDED MEMORY ON ATs
       If the size of the root file system (either taken from floppy or from
    /dev/hd3, as described above), is 256K or more, MINIX puts the root
    device in extended memory, above 1M, leaving the entire 512K or 640K
    free for MINIX and user programs.  To get full advantage of the extended
    memory, the size of the root file system should be the same as the amount
    of extended memory present.  If the root file system is < 256K, MINIX
    assumes that there is no extended memory, and puts the root file system
    in "low" core (below 640K).  This feature only works on ATs, so PCs must
    never have root file systems >= 256K.

19. SOFTWARE SCROLLING FOR EGA CARDS
       MINIX works with monochrome cards, CGA cards, and IBM EGA cards. 
    However, it does not work with some nonstandard EGA cards.  With these 
    cards, the screen will go blank every 25 lines.  MINIX can be made to work 
    with these EGA cards by recompiling tty.c (or the whole kernel)
    with the -DSOFTSCROLL flag.  For example, add -DSOFTSCROLL to CFLAGS in
    kernel/makefile and re-make the kernel.  Software scrolling is much slower
    than hardware scrolling, so this option should only be used if needed.
    The bootable image in the standard distribution was made by running
         make -DSOFTSCROLL
    in the kernel directory.  It is suggested that you try making a new
    kernel (but not mm or fs) without -DSOFTSCROLL.  If that one works, use 
    it, since it will be faster than the one in the distribution.

20. NEW FLAGS AND FEATURES
       Various programs have acquired new flags and features and new programs
    have been included.  Please read all the files in this directory.

21. ANSI ESCAPE SEQUENCES 
      The escape sequences used by the tty driver for both input and output
    have been changed to the ANSI standard ones.  To manipulate the cursor
    etc., print the following:
	ESC M:		scroll a line backwards (cursor must be on line 1)
	ESC [ y ; x H	move to column x, row y;  (1,1) is upper right corner
	ESC [0J		clear from cursor to end of screen
	ESC [7m		go to reverse video
	ESC [0m		go to normal video

    The 9 numeric pad keys, as well as numeric + and - now generate ESC [ x
    for some x.  Just type them to see which x goes with each key.

22. _CLEANUP NO LONGER NEEDED
       The exit routine has been changed to call _cleanup automatically.
    As a result, programs using stdio no longer have to call it explicitly.
    All calls to _cleanup have been removed from the standard distribution.

23. DISTRIBUTION CHANGES
       The subdirectories PCIX and C86 have been deleted, as mentioned above.
    The subdirectories MINIX have been renamed IBM_PC to avoid confusion with
    files for the ATARI ST (not included here).  Before recompiling anything,
    remove the relevant files from IBM_PC and move them one directory up, e.g.
		cd minix/kernel;  cp IBM_PC/* .      
    In some cases, two makefiles are provided, called pc_makefile and 
    at_makefile.  Copy the appropriate one to makefile, depending on whether 
    you have (1) a PC or XT or (2) an AT.  Delete the inappropriate one.

24. LINKS
       The directory /usr/include now contains several subdirectories and also
    linked files.  If you copy this directory to hard disk, link the following
    files, if possible.

        /usr/include/sgtty.h		to	minix/h/sgtty.h
        /usr/include/signal.h		to	minix/h/signal.h
        /usr/include/minix/callnr.h	to	minix/h/callnr.h
        /usr/include/minix/com.h	to	minix/h/com.h
        /usr/include/minix/const.h	to	minix/h/const.h
        /usr/include/minix/type.h	to	minix/h/type.h
        /usr/include/sys/stat.h		to	minix/h/stat.h
        /usr/include/fs/buf.h		to	minix/fs/buf.h
        /usr/include/fs/const.h		to	minix/fs/const.h
        /usr/include/fs/super.h		to	minix/fs/super.h
        /usr/include/fs/type.h		to	minix/fs/type.h

    In addition, the files dosread, dosdir, and doswrite in /usr/bin should all
    be links to the same file. It determines which it is by looking at argv[0].

25. PASCAL AND MODULA 2 COMPILERS FOR MINIX
       A MINIX compiler for Pascal is available.  A MINIX compiler for Modula 2
    will available during the course of 1988.  Neither is part of the standard
    distribution.  They may be purchased from either of:

	Unipress Software		Transmediair Utrecht B.V.
	2025 Lincoln Highway		Melkweg 3
	Edison, NJ 08817		3721 RG Bilthoven
	USA				Holland
	Tel: (201) 985-8000		Tel: (30) 78 18 20

    These companies also sell the sources to the MINIX C compiler, and the
    Amsterdam Compiler Kit, from which all the compilers have been derived.


-------------------- Provisional V1.3 doc/man_pages -------------------------

Command:	ar - archiver
Syntax:		ar [qrxdpmt][abivulc] [posname] archive file ...
Flags:		(none)
Examples:	ar r libc.a sort.s	# replace sort.s in libc.a
		ar rb a.s libc.a b.s	# insert b.s before a.s in libc.a

     Ar allows groups of files to be put together into a single archive.
It is normally used for libraries of compiled procedures.  The following keys
are allowed:
	  q: quickly append to the end of the archive file.
	  m: move named files. Ar expects 'a', 'b', or 'i' to be specified.
	  r: replace (append when not in archive).
	  d: delete. Ar will delete the name members.
	  t: print the archive's table of contents.
	  p: print the named files (list them on standard output)
	  x: extract

The keys may optionally concatencated with one or more of the following:
	  l: local temporary file for work instead of /tmp/ar.$$$$$
	  v: verbose
	  a: after 'posname'
	  b: before 'posname'
	  i: before 'posname'
	  c: create  (suppresses creation message)
	  u: replace only if dated later than member in archive


Command:	ascii - strip all the pure ASCII lines from a file
Syntax:		ascii [-n] [file]
Flags:		-n Extract the lines containing nonASCII characters
Examples:	ascii file >outf	# put all the ASCII lines on outf
		ascii -n outf	# write nonASCII lines to outf

     Sometimes a file contains some nonASCII characters that are in the way.
This program allows the lines containing only ASCII characters to be grepped
from the file.  With the -n flag, the nonASCII lines are grepped.  No matter
whether the flag is used or not, the program returns an exit status of true
if the file is pure ASCII, and false otherwise.


Command:	badblocks - put a list of bad blocks in a file
Syntax:		badblocks block_special
Flags:		(none)
Example:	badblocks /dev/fd1

     If a device develops bad sectors, it is important to not have them
allocated to important files.  This program makes it possible to collect
up to 7 bad blocks into a file, so they will not be allocated for a "real"
file.  When the program starts up, it asks for a list of bad blocks.  Then
it creates a file whose name is of the form .Bad_xxxxx, where xxxxx is a pid.


Command:	cal - print a calendar
Syntax:		cal [month] year
Flags:		(none)
Example:	cal 3 1987		# print March 1987

     Cal prints a calendar for a month or year.  The year can be between 1
and 9999.  Note that the year 87 is not a synonym for 1987, but is itself a
valid year about 19 centuries ago.  The calendar produced is the one used
by England and her colonies.  Try Sept. 1752, Feb 1900, and Feb 2000.  If
you don't understand what is going on, look up "Calendar, Gregorian" in a
good encyclopedia.


Command:	compress - compress a file using modified Lempel-Ziv coding
Syntax:		compress [-cdfv] [file] ...
Flags:		-c Put output on standard output instead of on file.Z
		-d Decompress instead of compress
		-f Force output even if there is no saving
		-v Verbose mode
Examples:	compress outfile	# compress 1 file
		compress x y z	# compress 3 files to x.Z, y.Z, and z.Z

     The listed files (or standard input, if none are given) are compressed
using the Ziv-Lempel algorithm.  If the output is smaller than the input,
the output is put on file.Z or standard output if no files are listed.


Command:	cpdir - copy a directory and its subdirectories
Syntax:		cpdir [-v] srcdir destdir
Flags:		-v Verbose; cpdir tells what it is doing
Example:	cpdir dir1 dir2	# creat dir2 and copy dir1's files into it

     Cpdir creates the target directory, goes into it, and copies all the
files in the source directory to it.  When it is done, the target directory
contains the same files as the source directory.  Subdirectories are copied
Recursively. Links and special files are ignored.


Command:	diff - print differences between two files
Syntax:		diff file1 file2
Flags:		(none)
Example:	diff file1 file2	# print differences between 2 files

     Diff compares two files and generates a list of lines telling how
the two files differ.  Lines may not be longer than 128 characters.


Command:	diskcheck - check a disk for bad sectors
Syntax:		diskcheck device start count
Flags:		(none)
Examples:	diskcheck /dev/at0 0 1200	# check 1.2 MB floppy
		diskcheck /dev/at0 100 1100	# check floppy from block 100

     Diskcheck checks a disk for bad sectors by reading in each sector,
writing a known bit pattern onto it, reading it back in and comparing with
what was written.  This check is then a second time.  Bad sectors are reported
After each sector is tested, the original sector is restored.


Command:	du - print disk usage
Syntax:		du [-s] dir
Flags:		-s Summary only
Example:	du dir			# list disk space used by files in dir

     Du examines a directory and prints the amount of space occupied by the
files in that directory and its subdirectories.


Command:	ed - editor
Syntax:		ed file
Flags:		(none)
Example:	ed prog.c		# edit prog.c

    Ed is functionally equivalent to the standard V7 editor, ed.  It supports
the following commands:
	
	(.)	a: append
	(.,.)	c: change
	(.,.)	d: delete
		e: edit new file
		f: print name of edited file
	(1,$)	g: global command
	(.)	i: insert
	(.,.+1)	j: join lines together
	(.)	k: mark
	(.)	l: print with special characters in octal
	(.,.)	m: move
	(.,.)	p: print
		q: quit editor
	(.)	r: read in new file
	(.,.)	s: substitute
	(1,$)	v: like g, except select lines that do not match
	(1,$)	w: write out edited file

Many of the commands can take one or two addresses, as indicated above.  The
defaults are shown in parentheses.  Thus 'a' appends to the current line, and
g works on the whole file as default.  The dot refers to the current line.
Below is a sample editing session with comments given following the # symbol.
	ed prog.c		# edit prog.c
	3,20p			# print lines 3 through 20
	/whole/			# find next occurence of 'whole'
	s/whole/while/		# replace 'whole' by 'while'
	g/MAXBUF/s//MAX_BUF/g	# replace 'MAXBUF' by 'MAX_BUF' everywhere
	w			# write the file back
	q			# exit the editor
	

Command:	expr - evaluate experession
Syntax:		expr arg ...
Flags:		(none)
Example:	x=`expr $x + 1`		# add 1 to shell variable x

     Expr computes the value of its argument and writes the result on
standard output.  The valid operators, in order of increasing precedence,
are listed below.  Operators grouped by {...} have the same precedence.
Operators: |, &, {<, <=, ==, !=, >=, >}, {+, -}, *.
     Note that the V7 ":" operator is missing.  Parentheses are permitted.


Command:	factor - factor an integer less than 2**31
Syntax:		factor number
Flags:		(none)
Example:	factor 450180	# print the prime factors of 450180

     Factor prints the prime factors of its argument in increasing order.
Each factor is printed as many times as it appears in the number.


Command:	file - make a guess as to a file's type based on contents
Syntax:		file name ...
Flags:		(none)
Example:	file a.out /usr/include/ar.h	# guess at types

     File reads the first block of a file and tries to make an intelligent
guess about what kind of file it is.  It understands about archives, C
source programs, executable binaries, shell scripts, and English text.


Command:	find - find files meeting a given condition
Syntax:		find directory expression
Flags:		(none)
Examples:	find /  -name a.out -print	# print all a.out paths
		find /usr/ast ! -newer f -ok rm {} \;	# ask before removing
		find /usr -size +20 -exec mv {} /big \; # move files > 20 blks
		find / \( -name a.out -o -name `*.o` \) -exec rm {}\;

     Find descends the file tree starting at the given directory checking
each file in that directory and its subdirectories against a predicate.
If the predicate is true, an action is taken.  The predicates may be
connected by -a (Boolean and), -o (Boolean or) and ! (Boolean negation).
Each predicate is true under the conditions specified below.  The integer n
may also be +n to mean any value greater than n, -n to mean any value less than
n, or just n for exactly n.
  -name s	true if current filename is s (include shell wild cards)
  -size n	true if file size is n blocks
  -inum n	true if the current file's i-node number is n
  -mtime n	true if modification time relative to today (in days) is n
  -links n	true if the number of links to the file is n
  -newer f	true if the file is newer than f
  -perm n	true if the file's permission bits = n (n is in octal)
  -user u	true if the uid = u (a numerical value, not a login name)
  -grogp g	true if the gid = g (a numerical value, not a group name)
  -type x	where x is bcdfug (block, char, dir, regular, setuid, setgid)

Following the expression can be one of the following, telling what to do
when a file is found:
  -print	print the file name on standard output
  -exec		execute a MINIX command, {} stands for the file name
  -ok		prompts before executing the command


Command:	fdisk - partition a hard disk
Syntax:		fdisk file
Flags:		(none)
Example:	fdisk /dev/hd1

     When fdisk starts up, it reads in the partition table and displays it.
It then presents a menu to allow the user to modify partitions, store the
partition table on a file, or load it from a file.  Partitions can be marked
as DOS or non-DOS, and active or not.  MINIX doesn't care what kind of a
partition it uses.  Using fdisk is self-explanatory.  However, be aware that
repartitioning a disk may cause information on it to be lost.


Command:	fix - generate new file from old one and diff listing
Syntax:		fix oldfile difflist >newfile
Flags:		(none)
Example:	fix old difflist >new	# generate new from old and diffs

     Fix accepts a diff listing produced by diff and reconstructs the
new file.  It is common for people to take a file, modify it, and then
send the diff listing between the old and new files to other people.
Using fix, the old file, and the diff listing, it is possible to creat
the new file.  For example:

  diff oldfile newfile >difflist
  fix oldfile difflist >new2

will generate a file new2 that is identical to newfile.


Command:   	fsck - perform file system consistency check
Syntax:	   	fsck [-aclmrs] [device] ...
Flags:	   	-a automatically repair inconsistencies
	   	-c inode ...	check and list only the specified inodes
	 	-l list the files and directories in the filesytem
	  	-m make a new file system
	   	-r prompt user for repairs if inconsistencies are found
	  	-s list the superblock of the file system
Examples: 	fsck /dev/hd4	# check file system on /dev/hd4
	 	fsck -a /dev/at0	# automatically fix errors on /dev/at0
	   	fsck -l /dev/fd0	# list the contents of /dev/fd0
	   	fsck -c 2 3 /dev/hd3	# check and list inodes 2 & 3 on /dev/hd3

     Fsck performs consistency checks on the file systems which reside on the
specified devices.  It may also be used to list the contents of a file system 
or to make a new file system.


Command:	lorder - compute the order for library modules
Syntax:		lorder file ...
Flags:		(none)
Example:	lorder proc1.s proc2.s

     Lorder accepts a series of packed or unpacked .s files and libraries,
and produces a partial ordering suitable for processing by tsort.


Command:	more - pager
Syntax:		more file ...
Flags:		(none)
Example:	more file		# display file on the screen

     More is an alternative to mined as a pager, for people used to the
4.x BSD pager.  This version only implements three commands:
     - display next page
    - display next line
   q        - exit more


Command:	prep - prepare a text file for statistical analysis
Syntax:		prep [file]
Flags:		(none)
Examples:	prep infile >outfile		# prep infile
		prep outfile		# prep infile


     Prep strips off most of the troff commands from a text file and then
outputs all the words, one word per line, in the order they occur in the file.
This file can then be sorted and compared to a dictionary (as a spelling
checker), or used for statistical analyses.

Command:	printenv - print out the current environment
Syntax:		printenv
Flags:		(none)
Example:	printenv		# print the environment

     Printenv prints out the current environment strings, one per line.


Command:	readfs - read a MINIX file system
Syntax:		readfs [-il] block_special [dir]
Flags:		-i Give information about the file, but do not extract files
		-l List the files extracted on standard output
Example:	readfs -l /dev/fd0

     Readfs reads a floppy disk containing a MINIX file system.  It can
extract all the files from it, give a listing of them, or both.  The files
extracted can be put in a user-specified directory (default: current
directory).  If subdirectories are needed, they will be created automatically.


Command:	Spell - print all words in a file not present in the dictionary
Syntax:		spell file
Flags:		(none)
Example:	spell document		# print the spelling errors on stdout

     Spell is the MINIX spelling checker.  It is actually a short shell script.
First, the program prep strips off the roff, nroff, and troff control lines,
and the punctuation, and lists each word on a separate line.  These words are
then sorted.  The resulting output is then compared to the dictionary.  Words
present in the file but not present in the dictionary are listed.  The
dictionary should be located in /usr/lib (or the shell script changed).


Command:	strings - print all the strings in a binary file
Syntax:		strings file ...
Flags:		(none)
Example:	strings a.out		# print the strings in a.out

     Strings looks for sequences of ASCII characters followed by a zero byte.
These are usually strings.  This program is typically used to help identify
unknown binary programs


Command:	test - test for a condition
Syntax:		test expr
Flags:		(none)
Example:	test -r file		# see if file is readable

     Test checks to see if files exist, are readable, etc. and returns
an exit status of zero if true and nonzero if false.  The legal operators are
  -r file  true if the file is readable
  -w file  true if the file is writable
  -x file  true if the file is executable
  -f file  true if the file is not a directory
  -d file  true if the file is a directory
  -s file  true if the file exists and has a size > 0
  -t fd    true if file descriptor fd (default 1) is a terminal
  -z s     true if the string s has zero length
  -n s     true if the string s has nonzero length
  s1 = s2  true if the strings s1 and s2 are identical
  s1 != s2 true if the strings s1 and s2 are different
  m -eq m  true if the integers m and n are numerically equal
                The operators -gt, -ge, -ne, -le, -lt may be used as well

These operands may be combined with -a (Boolean and), -o (Boolean or), !
(negation).  The priority of -a is higher than that of -o.  Parentheses are 
permitted, but must be escaped to keep the shell from trying to interpret them.


Command:	tree - print directory tree under working directory
Syntax:		tree
Flags:		(none)
Example:	tree			# print tree starting at working dir

     Tree prints the tree structure starting at the working directory.  All
the subdirectories are listed, with the depth shown by indentation.


Command:	tsort - topological sort
Syntax:		tsort file
Flags:		(none)
Example:	ar cr libc.a `lorder *.s` | tsort	# build library

     Tsort accepts a file of lines containing ordered pairs and builds a
total ordering from the partial orderings.


Command:	treecmp - recursively list differences in two directory trees
Syntax:		treecmp [-v] dir1 dir2
Flags:		-v (verbose) list all directories processed
Example:	treecmp -v /usr/ast/V1 /usr/ast/V2

     Treecmp recursively descends the directory tree of its first argument
and compares all files to those at the corresponding position in the second
argument.  If the two trees are identical, i.e., all the corresponding
directories and files are the same, there is no output.  Otherwise, a list
of files missing from one of the trees or present in both but whose contents
are not identical in both are printed.


Command:	tty - print the device name of this tty
Syntax:		tty
Flags:		(none)
Example:	tty

     Print the name of the controlling tty.


Command:	whereis - examine system directories for a given file
Syntax:		whereis file
Flags:		(none)
Example:	whereis	stat.h		# prints: /usr/include/sys/stat.h

     Whereis searches a fixed set of system directories, /bin, /lib, /usr/bin,
and others, and prints all occurrences of the argument name in any of them.


Command:	which - examine $PATH to see which file will be executed
Syntax:		which name
Flags:		(none)
Example:	which a.out		# tells which a.out will be executed

     The $PATH shell variable controls the MINIX search rules. If a command
a.out is given, the shell first tries to find an executable file in the working
directory.  If that fails, it looks in various system directories, such as /bin
and /usr/bin.  The which command makes the same search and gives the absolute
path of the program that will be chosen.

Command:	whoami - print current user name
Syntax:		whoami
Flags:		(none)
Example:	whoami			# print user name

     In case you forget who you are logged in as, whoami will tell you.  If
you use 'su' to become somebody else, whoami will give the current effective
user.


Command:	uuencode - encode a binary file to ASCII (e.g., for mailing)
Syntax:		uuencode [input] output
Flags:		(none)
Example:	uuencode infile outfile	# encode infile

     Uuencode takes an input file, typically a binary file, and converts it
to pure ASCII by encoding 3 bytes (24 bits) as 4 bytes in ASCII.  Only 64
different characters are used, all of them valid ASCII characters.


Command:	uudecode - decode a binary file encoded with uuencode
Syntax:		uudecode file 
Flags:		(none)
Example:	uudecode encodedfile 	# re-create the original file

     Uudecode takes an input file, typically a uuencoded binary file, and 
converts it back to the original file.  The decoded file is given the name
that the original file had.  The name information is part of the encoded file.