[comp.os.minix] V1.3 posting #1 - USER_GUIDE

ast@cs.vu.nl (Andy Tanenbaum) (05/30/88)

This is the first posting of V1.3.  It contains doc/USER_GUIDE, which
replaces the READ_ME file.  I will also make the following postings
today:

	P1  - USER_GUIDE (this file)
	P2  - /usr/include
	P3  - lib: intro
	P4  - lib: [a-l]*.c diffs
	P5  - lib: [m-z]*.c diffs
	P6  - lib: new files
	P7  - commands: intro
	P8  - commands: diffs [a-m]
	P9  - commands: diffs [n-z]
	P10 - commands: selected new files (smaller ones)

Please install and test this stuff, and post messages about problems, etc.
Sometime in June I hope to post the kernel diffs and networking stuff.
If you have reported a bug and it is not fixed, please report it again,
preferably by posting, rather than by email, so that (1) everyone will be
aware of it, and (2) maybe somebody will try to fix it.  Please note that
I have been very stingy about adding improved FEATURES to programs.  The
fact that 'ls' did not work in V7 like it does in 4.3 is not a bug and I
didn't fix it.  The fact that division by zero gives an infinite stream
of error messages in 1.2 is a bug and I did fix it.  Small, useful utilities
are generally welcome.  Huge ones are less so.

This being said, I am still open to new changes and additions to 1.3,
however, the larger the change, the harder it is to test, and the less like
V7 it is, the less likely I will adopt it.  No concessions are being made to
MS-DOS or any of its compilers.  A number of people have said that the MINIX
C compiler is slow.  Since I don't have (or want) any MS-DOS compiler, I
can't make a comparison, but I did run the following timing test.  I removed
all the .s files from fs and typed: time make.  The 20 compilations plus
the link took 5:57 real time on my Z-248, which has 1.5 MB RAM and an ST-225
hard disk (70 msec access time).  It seems to me that this isn't so awful.
Obviously a PC will be slower, but that should hold proportionally for all
compilers.

Andy Tanenbaum (ast@cs.vu.nl)

------------------------------------ doc/USER_GUIDE ----------------------
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. CONFIGURING MINIX ON A HARD DISK
       When setting up MINIX on a hard disk, the following set of directories
    is recommended, although the MINIX source tree can go elsewhere if desired.
    Be sure to edit the cc.c program to make sure it knows where to find the
    various compiler passes and libraries, which may be in /bin, lib, /usr/bin,
    or /usr/bin.  When a large RAM disk is available, put /bin and /lib on the
    RAM disk, and include the compiler parts in them.  When extracting files
    from the distribution, note carefully that there is a lib directory on the
    /usr diskette (for /lib and /usr/lib) and another one among the sources
    (for /usr/src/minix/lib).  Many of the directories listed below have sub-
    directories.

	/bin			- most common binaries
	/dev			- special files
	/etc			- system administration
	/lib			- most important libraries
	/tmp			- scratch files go here
	/usr			- mount usr file system here
	/usr/bin		- rest of the binaries
	/usr/include		- system include files
	/usr/lib		- rest of the libraries
	/usr/src		- sources go here
	/usr/src/minix		- minix sources go here
	/usr/src/minix/amoeba	- all networking code is here
	/usr/src/minix/commands	- utility program sources
	/usr/src/minix/fs	- file system sources
	/usr/src/minix/h	- operating system header files
	/usr/src/minix/kernel	- kernel and device driver sources
	/usr/src/minix/lib	- libc.a sources
	/usr/src/minix/mm	- memory manager sources
	/usr/src/minix/test	- test programs
	/usr/src/minix/tools	- tools for building new operating systems
	/usr/tmp		- (optional) alternative place for temporaries
	
  6. 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

  7. 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.

  8. 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.

  9. 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.

 10. 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.

 11. 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.

 12. 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.

13. 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.

14. 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".

15. 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.  

16. 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.

17. 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.

18. 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.

19. 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.

20. 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.

21. 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.

22. 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.

23. _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.

24. 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.

25. 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].

26. SPACE
    If you are running on a system with limited memory, either 512K RAM
    or no hard disk, you may encounter difficulties trying to recompile the
    system.  However, there are steps you can take to improve the situation.
    First, various passes of the compiler are configured with ample stack
    space.  Using chmem you can reduce this stack space to reduce the program's
    memory requirements.  Be careful about not reducing it too much, or strange
    things will happen.  Second, the compiler flag -T can be used to place
    temporary files in a place other than /tmp.  This flag may be useful if
    /tmp is on the RAM disk, which is too small.  Third, the compiler flag -F
    can be used to run cpp and cem sequentially instead of in parallel.  This
    approach is slower but uses less memory. Fourth, the library, libc.a
    contains several large routines that are rarely used.  By removing these,
    you can reduce the amount of space the library requires. 
    
27. LIBRARY
       Not all the sources in minix/lib have been included in libc.a (to save
    space).  If you have a hard disk and enough space, compare the sources and
    binaries and add the missing files.  Remember to compile all library
    routines with cc -c -LIB file.c.  The -LIB flag is essential for libraries.

28. 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.

ncoverby@ndsuvax.UUCP (/dev/tty) (05/31/88)

In article <762@ast.cs.vu.nl> ast@cs.vu.nl (Andy Tanenbaum) writes:
>This is the first posting of V1.3.

Well, Andy gave me something to do over Memorial Day by posting the first
set of Version 1.3 patches.  I had one problem un-sharing the library diffs,
but that didn't seem to come up in patching.  Last year I got my diffs off
of bitnet, and it was awful.  I did encounter other problems, though.

I was unable to locate the "fgrep.c" or "tty.c" files listed in the "commands"
listing. The tsort.c and lorder.c that I have require several other files
to compile; those were not listed in the commands source directory, I 
don't belive. What should I use? (I have the posting from a few months ago).
Sed.c seems to also be different than the one I have; it also is multiple 
files.

I had lots of trouble patching the diffs for malloc.c (I'm using Larry
Wall's "patch" at patchlevel 9).  I ended up putting in a couple of "hunks"
by hand.  Oh, yes, for anybody using patch, you'll probably want to use
the '-l' (loose) option, especially if you get your patches off of Bitnet.

There were references to the "minix" include directory; my 1.1 didn't have
such a beast (it has /usr/include, kernel disk include and h), and I don't
recall seeing any creation of a "minix" include directory in the 1.2 stuff.
Nor could I find where "lib.h" should go from the "ls"es in Posting 3.    <

When compiling the library, I found that I needed a "-I." on the cc line  <
in run.  This could be because I have the 1.1 C compiler.  Amoeba.c was 
uncompilable because two required header files, amoeba.h and amparam.h    <
are missing.  I assume these will come in the networking stuff.  Fopen.c
gave me problems on line 34 with 'errno' and 'ENOENT' undefined.  I'll    <
have to go grep for those guys... Message.c gave me an error on line 10   <
about not allowing initialization of unions.  Maybe this is because of
my old compiler?  Rand.c had "seed" undefined.   <

I haven't yet taken time to look into these problems; I thought I would
get my bug list out so the rest of you guineapigs could compare it with
your problems.  Check this channel tomorrow for more more of the same, 
and maybe some fixes!

Since Andy is going to stick with pretty much the Minix described in his
book, is anybody working on organizing a "enhanced" Minix consisting of
the enhancements from the nework, like process groups, message queueing,
etc.?
-- 
Glen Overby
Bitnet:  ncoverby@ndsuvax
UUCP: {uunet, ihnp4!umn-cs}!ndsuvax!ncoverby

ncoverby@ndsuvax.UUCP (Glen Overby) (06/01/88)

In article <967@ndsuvax.UUCP> ncoverby@ndsuvax.UUCP (/dev/tty) writes:
>In article <762@ast.cs.vu.nl> ast@cs.vu.nl (Andy Tanenbaum) writes:
>>This is the first posting of V1.3.
>
>  I did encounter other problems, though.

Well, it's been another long day of MAKE and bug swatting.  I figure I've
spent about 4 hours installing the diffs and 8-10 hours compiling (8MHZ
PC/0 wait) thus creating 829KB of new binaries.  Now I know why Andy was
talking about soaking it to the floppy people. 

I fixed all the problems I posted yesterday as well as some new ones.  I
found that all the files which Andy didn't post with the new set of
commands needed changes to some of the includes, notably "stat.h" was
changed to <sys/stat.h> in several places.  I've included diffs below to
make it easy to see (and fix) what I'm talking about.  When I fixed a
problem and re-ran the "run" programs, they had the subtle feature of
wasting lots of my time recompiling everything that had already been
compiled.  Well, the Unix utility Make prevents this. I wrote Makefiles for
the lib and commands directories, and they are included in the shar below.
I still use the "run" file to create my library. 

I didn't see any patches to Mined for the new tty control sequences, so I
kept the old ones from the first battery of 1.2 patches. It wasn't much of
a problem anyway because I use elle. 

Even on my third total recompliation of Minix, I got caught by the sneaky
error in cc.c. I guess I'll never learn!  Check my commands Makefile for a
cute solution to the two versions of cc. Oh, yes, the reason I have
multiple "SRC" and "OBJ" definitions is because Minix's make didn't like it
when I put all of them in one. 

Shar and Enjoy! (betchya inews doesn't complain about ME including more
quoted text than origional text!)

Glen [I still have my Minix 1.1 disks] Overby
Bitnet:  ncoverby@ndsuvax
UUCP: {uunet, ihnp4!umn-cs}!ndsuvax!ncoverby

	Cut along the dotted line; send the top portion in with 
-------	your submission and keep the rest for your records ------------------
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
#	com:Makefile
#	com:chgrp.diff
#	com:compress.diff
#	com:file.diff
#	com:sh:Makefile
#	com:sh:sh4.diff
#	lib:Makefile
#	lib:fopen.diff
#	lib:message.diff
# This archive created: Wed Jun  1 00:34:12 1988
export PATH; PATH=/bin:$PATH
if test -f 'com:Makefile'
then
    echo shar: will not over-write existing file "'com:Makefile'"
else
sed 's/^X//' << \SHAR_EOF > 'com:Makefile'
X# 
X#	Description File for the Minix 1.3 Commands
X#
X#  Add new commands to the "OBJ" define.
X#
X#  The contents of the OBJ define are duplicated on the description line
X#  because Minix's MAKE cannot handle having a macro there.
X#
XCFLAGS= -i -T.
X
XSRC=	ar.c ascii.c badblocks.c basename.c cal.c cat.c cc.c chgrp.c \
X	chmem.c chmod.c chown.c clr.c cmp.c comm.c compress.c cp.c \
X	cpdir.c date.c dd.c df.c diff.c diskcheck.c dosread.c du.c \
X	echo.c ed.c expr.c factor.c fdisk.c fgrep.c file.c find.c \
X	fix.c getlf.c grep.c gres.c head.c kill.c libpack.c \
X	libupack.c ln.c login.c lpr.c ls.c make.c mkdir.c mkfs.c
XSRC1=	mknod.c more.c mount.c mv.c od.c passwd.c pr.c prep.c \
X	printenv.c pwd.c readall.c readfs.c rev.c rm.c rmdir.c \
X	roff.c shar.c size.c sleep.c sort.c split.c strings.c \
X	stty.c su.c sum.c sync.c tail.c tar.c tee.c test.c time.c \
X	touch.c tr.c treecmp.c umount.c uniq.c update.c uudecode.c \
X	uuencode.c wc.c whoami.c
X
XOBJ=	ar ascii badblocks basename cal cat cc512 cc640 chgrp \
X	chmem chmod chown clr cmp comm compress cp \
X	cpdir date dd df diff diskcheck dosread du \
X	echo ed expr factor fdisk fgrep file find \
X	fix getlf grep gres head kill libpack \
X	libupack ln login lpr ls make mkdir mkfs
XOBJ1=	mknod more mount mv od passwd pr prep \
X	printenv pwd readall readfs rev rm rmdir \
X	roff shar size sleep sort split strings \
X	stty su sum sync tail tar tee test time \
X	touch tr treecmp umount uniq update uudecode \
X	uuencode wc whoami
X
Xall:	$(OBJ) $(OBJ1)
X
Xar ascii badblocks basename cal cat cc chgrp \
Xchmem chmod chown clr cmp comm  cp \
Xcpdir date dd df diff diskcheck dosread du \
Xecho ed expr factor fdisk fgrep file find \
Xfix getlf grep gres head kill libpack \
Xlibupack ln login lpr ls make mkdir mkfs:	$@.s
X	cc $(CFLAGS) -o $@ $@.s
X	ln $@ bin
X
Xmknod more mount mv od passwd pr prep \
Xprintenv pwd readall readfs rev rm rmdir \
Xroff shar size sleep sort split strings \
Xstty su sum sync tail tar tee test time \
Xtouch tr treecmp umount uniq update uudecode \
Xuuencode wc whoami :	$@.s
X	cc $(CFLAGS) -o $@ $@.s
X	ln $@ bin
X
X#Yes, both of these must compile cc.s; if it is not, then the #define
X#of MEM{512,640}K doesn't get changed! 
Xcc512:	cc.c
X	cc $(CFLAGS) -DMEM512K -o $@  cc.c
X	ln $@ bin
X
Xcc640:	cc.c
X	cc $(CFLAGS) -DMEM640K -o $@  cc.c
X	ln $@ bin
X
Xcompress:	$@.s
X	cc $(CFLAGS) -o $@ $@.s
X	ln $@ bin/compress
X	ln $@ bin/uncompress
X	ln $@ bin/zcat
X
Xcompress.s:	compress.c
X	cc -S $(CFLAGS) -DMINIX -DAZTEC86 compress.c
X
X
Xcleans:
X	rm ar.s ascii.s badblocks.s basename.s cal.s cat.s cc.s chgrp.s
X	rm chmem.s chmod.s chown.s clr.s cmp.s comm.s compress.s cp.s
X	rm cpdir.s date.s dd.s df.s diff.s diskcheck.s dosread.s du.s
X	rm echo.s ed.s expr.s factor.s fdisk.s fgrep.s file.s find.s
X	rm fix.s getlf.s grep.s gres.s head.s kill.s libpack.s
X	rmlibupack.s ln.s login.s lpr.s ls.s make.s mkdir.s mkfs.s
X	rm mknod.s more.s mount.s mv.s od.s passwd.s pr.s prep.s
X	rm printenv.s pwd.s readall.s readfs.s rev.s rm.s rmdir.s
X	rm roff.s shar.s size.s sleep.s sort.s split.s strings.s
X	rm stty.s su.s sum.s sync.s tail.s tar.s tee.s test.s time.s
X	rm touch.s tr.s treecmp.s umount.s uniq.s update.s uudecode.s
X	rm uuencode.s wc.s whoami.s
X
Xcleanb:
X	rm ar ascii badblocks basename cal cat cc512 cc640 chgrp
X	rm chmem chmod chown clr cmp comm compress cp
X	rm cpdir date dd df diff diskcheck dosread du
X	rm echo ed expr factor fdisk fgrep file find
X	rm fix getlf grep gres head kill libpack
X	rm libupack ln login lpr ls make mkdir mkfs
X	rm mknod more mount mv od passwd pr prep
X	rm printenv pwd readall readfs rev rm rmdir
X	rm roff shar size sleep sort split strings
X	rm stty su sum sync tail tar tee test time
X	rm touch tr treecmp umount uniq update uudecode
X	rm uuencode wc whoami
X
X
SHAR_EOF
fi # end of overwriting check
if test -f 'com:chgrp.diff'
then
    echo shar: will not over-write existing file "'com:chgrp.diff'"
else
sed 's/^X//' << \SHAR_EOF > 'com:chgrp.diff'
X9,12c9,12
X< #include "../include/grp.h"
X< #include "../h/type.h"
X< #include "stat.h"
X< #include "stdio.h"
X---
X> #include <grp.h>
X> #include <minix/type.h>
X> #include <sys/stat.h>
X> #include <stdio.h>
X39c39
X< 			if (chown (argv[i], stbuf.st_uid, grp -> gid) < 0) {
X---
X> 			if (chown (argv[i], stbuf.st_uid, grp -> gr_gid) < 0) {
SHAR_EOF
fi # end of overwriting check
if test -f 'com:compress.diff'
then
    echo shar: will not over-write existing file "'com:compress.diff'"
else
sed 's/^X//' << \SHAR_EOF > 'com:compress.diff'
X326c326
X< #include <stat.h>
X---
X> #include <sys/stat.h>
SHAR_EOF
fi # end of overwriting check
if test -f 'com:file.diff'
then
    echo shar: will not over-write existing file "'com:file.diff'"
else
sed 's/^X//' << \SHAR_EOF > 'com:file.diff'
X3c3
X< #include <blocksize.h>
X---
X> #include <minix/blocksize.h>
X5c5
X< #include <stat.h>
X---
X> #include <sys/stat.h>
SHAR_EOF
fi # end of overwriting check
if test -f 'com:sh:Makefile'
then
    echo shar: will not over-write existing file "'com:sh:Makefile'"
else
sed 's/^X//' << \SHAR_EOF > 'com:sh:Makefile'
X#
X#  $Header: makefile,v 1.2 87/09/02 12:08:19 ncpascal Exp $
X#
X
X# commands/sh/makefile
X
XCFLAGS=  -I. -T.
X
XOBJ= sh1.s sh2.s sh3.s sh4.s sh5.s sh6.s
X
X
Xsh:	$(OBJ) sh.h
X	cc -i -T. -o sh $(OBJ)
X
SHAR_EOF
fi # end of overwriting check
if test -f 'com:sh:sh4.diff'
then
    echo shar: will not over-write existing file "'com:sh:sh4.diff'"
else
sed 's/^X//' << \SHAR_EOF > 'com:sh:sh4.diff'
X2,5c2,5
X< #include "signal.h"
X< #include "errno.h"
X< #include "setjmp.h"
X< #include "stat.h"
X---
X> #include <signal.h>
X> #include <errno.h>
X> #include <setjmp.h>
X> #include <sys/stat.h>
SHAR_EOF
fi # end of overwriting check
if test -f 'lib:Makefile'
then
    echo shar: will not over-write existing file "'lib:Makefile'"
else
sed 's/^X//' << \SHAR_EOF > 'lib:Makefile'
X# 
X#	Description File for the Minix 1.3 Library
X#
X#  Add new files to the "OBJ" define.
X#
X#  The contents of the OBJ define are duplicated on the description line
X#  because Minix's MAKE cannot handle having a macro there.
X#
XCFLAGS= -I.
X
XSRC= abort.c abs.c access.c alarm.c amoeba.c atoi.c atol.c \
X	bcopy.c brk.c brk2.c call.c chdir.c chmod.c chown.c chroot.c \
X	cleanup.c close.c creat.c crypt.c ctime.c ctype.c \
X	doprintf.c dup.c dup2.c exec.c exit.c fclose.c fdopen.c \
X	fflush.c fgets.c fopen.c fork.c fprintf.c fputs.c fread.c
X
XSRC0=	freopen.c fseek.c fstat.c ftell.c fwrite.c getc.c getegid.c \
X	getenv.c geteuid.c getgid.c getgrent.c getpass.c getpid.c \
X	getpwent.c gets.c getuid.c gtty.c index.c ioctl.c isatty.c \
X	itoa.c kill.c link.c lseek.c malloc.c message.c mknod.c mktemp.c
X
XSRC1=	mount.c open.c pause.c perror.c pipe.c popen.c printdat.c \
X	printk.c prints.c putc.c puts.c qsort.c rand.c read.c regexp.c \
X	regsub.c rindex.c scanf.c setbuf.c setgid.c setuid.c signal.c \
X	sleep.c sprintf.c stat.c stb.c stderr.c stime.c strcat.c strcmp.c
X
XSRC3=	strcpy.c strlen.c strncat.c strncmp.c strncpy.c stty.c sync.c \
X	syslib.c system.c termcap.c time.c times.c umask.c umount.c \
X	ungetc.c uniqport.C unlink.c utime.c wait.c write.c 
X
XOBJ=	abort.s abs.s access.s alarm.s atoi.s atol.s \
X	bcopy.s brk.s brk2.s call.s chdir.s chmod.s chown.s chroot.s \
X	cleanup.s close.s creat.s crypt.s ctime.s ctype.s \
X	doprintf.s dup.s dup2.s exec.s exit.s fclose.s fdopen.s \
X	fflush.s fgets.s fopen.s fork.s fprintf.s fputs.s fread.s
X
XOBJ0=	freopen.s fseek.s fstat.s ftell.s fwrite.s getc.s getegid.s \
X	getenv.s geteuid.s getgid.s getgrent.s getpass.s getpid.s \
X	getpwent.s gets.s getuid.s gtty.s index.s ioctl.s isatty.s \
X	itoa.s kill.s link.s lseek.s malloc.s message.s mknod.s mktemp.s
X
XOBJ1=	mount.s open.s pause.s perror.s pipe.s popen.s printdat.s \
X	printk.s prints.s putc.s puts.s qsort.s rand.s read.s regexp.s \
X	regsub.s rindex.s scanf.s setbuf.s setgid.s setuid.s signal.s \
X	sleep.s sprintf.s stat.s stb.s stderr.s stime.s strcat.s strcmp.s
X
XOBJ2=	strcpy.s strlen.s strncat.s strncmp.s strncpy.s stty.s sync.s \
X	syslib.s system.s termcap.s time.s times.s umask.s umount.s \
X	ungetc.s unlink.s utime.s wait.s write.s   
X
X.c.s:
X	cc -c -LIB $(CFLAGS) $<
X
Xall:	$(OBJ) $(OBJ0) $(OBJ1) $(OBJ2)
X
SHAR_EOF
fi # end of overwriting check
if test -f 'lib:fopen.diff'
then
    echo shar: will not over-write existing file "'lib:fopen.diff'"
else
sed 's/^X//' << \SHAR_EOF > 'lib:fopen.diff'
X6a7
X> #include <lib.h>
SHAR_EOF
fi # end of overwriting check
if test -f 'lib:message.diff'
then
    echo shar: will not over-write existing file "'lib:message.diff'"
else
sed 's/^X//' << \SHAR_EOF > 'lib:message.diff'
X10c10
X< message M = {0};
X---
X> message M;	/* others (v1.1) don't allow it at all = {0}; */
SHAR_EOF
fi # end of overwriting check
#	End of shell archive
exit 0
-- 
Glen Overby
Bitnet:  ncoverby@ndsuvax
UUCP: {uunet, ihnp4!umn-cs}!ndsuvax!ncoverby

ast@cs.vu.nl (Andy Tanenbaum) (06/01/88)

In article <967@ndsuvax.UUCP> ncoverby@ndsuvax.UUCP (/dev/tty) writes:
> I had one problem un-sharing the library diffs
Note to others:  It would be helpful to be more specific than this.


>I was unable to locate the "fgrep.c" or "tty.c" files listed in the "commands"
>listing. The tsort.c and lorder.c that I have require several other files
>to compile; those were not listed in the commands source directory, I 
>don't belive. What should I use? (I have the posting from a few months ago).
>Sed.c seems to also be different than the one I have; it also is multiple 
>files.
fgrep and tty are in posting #10.  tty.c needs a subroutine I have lost (help!)
I have slightly lost track of lorder and tsort due to the many fixes. Perhaps
a new posting by the author?
The new sed.c (single file) is a debugged version
of the old multiple file version.  Throw the old one away.



>I had lots of trouble patching the diffs for malloc.c 
The two mallocs are almost unrelated.  The new one is much faster.  It uses
a linear algorithm.  Still, after making the diffs, I ran fix to verify that
the diff output could be fix'ed.  If patch fails, try fix.



>There were references to the "minix" include directory.
It is new.  /usr/include/minix contains links to files in 'h'.  See posting #2.



>Nor could I find where "lib.h" should go
It goes in lib.



>When compiling the library, I found that I needed a "-I." on the cc line  <
>in run.  This could be because I have the 1.1 C compiler.  Amoeba.c was 
>uncompilable because two required header files, amoeba.h and amparam.h    <
You may also need -Di8088.  amoeba.h and amparam.h are in the amoeba dir.
That will come in a couple of weeks.


> Fopen.c gave me problems on line 34 with 'errno' and 'ENOENT' undefined etc
Please try to fix it and post something.



>Since Andy is going to stick with pretty much the Minix described in his
>book, is anybody working on organizing a "enhanced" Minix consisting of
>the enhancements from the nework, like process groups, message queueing,
>etc.?
Somewhat grudgingly, I'm increasingly willing to add non V7 utilities, but
I am hesitant to change the kernel.  It actually works now, and the mean
time to failure on my system is many weeks, if not months.  Johan put
process groups and some other stuff in, although it is currently #ifdef'ed.
As a bare minimum, wait until I post the kernel in a few weeks, and then
see what you want to add.  There have been some many modifications
proposed, many of which are in conflict, and more of which are highly
questionable in a PC environment.  Other proposed changes are nonportable
(protected mode on a 286 won't work well on a PC, or later on a PS/2 model
30; although the PC may die off in a few years, the PS/2 model 30 will be
around until the next century).

In addition, the networking code has had a major impact everywhere.  This
has resulted in a new top-level directory, amoeba, that contains an ersatz
kernel.  Big changes to anything in kernel will also imply parallel changes
to amoeba/kernel.  

To the extent that there are some changes that are universally popular with
everyone except me, there is something to be said for having enough
discussion in this group to try to reach a consensus, and then converge on
a set of changes so that we don't get 12 different ways to use protected
mode.  Preferably such changes should be modular.  Replacing an entire
subroutine is usually cleaner than putting in 3 #ifdefs.  When you see FS
and MM, you will see how Johan put in the Atari stuff.  While no #ifdef'd
code is really readable, by and large what he did can be considered a
good model.  If a new feature can be added by two or three #ifdefs, one of
which contains 3 pages of subroutines at the end of some file, people can
easily compile without the flag or remove the code altogether.

On the other hand, if there are small, working, useful commands or library
routines I have missed, there is a reasonable chance that this is an
oversight.  If somebody in netland is minoring in Library Science, you might
try to collect a list of all commands and subroutines that have been posted
that are not currently in 1.3.  That would be an interesting item to 
discuss on the net.

Andy Tanenbaum (ast@cs.vu.nl)