                            Linux port notes
                              Frank Davis
                              June 5, 1994


This file contains some notes and references others might find useful
for porting MS-DOS software to Linux.  Being that Linux comes with no
printed manuals (I get Linux via ftp from sunsite), printed reference
books are *really* useful.


1) References:

   This book is a good source for POSIX examples.  Although there is no
   mention of Linux in the book, I think it is a very good reference:

      W. Richard Stevens, _Advanced Programming in the UNIX Environment_,
        744 pages, Addison-Wesley Publishing Company, Reading, Mass., 1992,
        ISBN 0-201-56317-7.


   Much smaller and more luggable, this book is a good source and has a nice
   POSIX library function summary section (about half the book):

      Donald A. Lewine, _POSIX Programmer's Guide_, 597 pages, O'Reilly &
        Associates, Inc., Sebastopol, California, 1991, ISBN 0-937175-73-0.


   The curses reference I used was:

      Berny Goodheart, _UNIX Curses Explained_, 287 pages, Prentice Hall,
        New York, New York, 1991, ISBN 0-13-931957-3.


   Most all of the Standard C in TDE ported with no problem.  One reference
   manual that has very good material for UNIX as well as PC C compilers is:

      Samuel P. Harbison and Guy L. Steele, Jr., _C:  A Reference Manual_,
        392 pages, Prentice Hall, Englewood Cliffs, New Jersey, 1991,
        ISBN 0-13-110933-2.



2) One of the things that caused a problem in the original port of TDE
   to Linux was the way the command shell handles command line arguments.
   I'm not sure if it's true in all UNIX shells, but the bash shell in
   Linux expands file names.  So, when I thought TDE was expecting 5 or 6
   command line arguments, it actually received 130 arguments.  For example:

                tde -f "this|that" *.c

   The *.c is expanded to about 35-40 command line arguments in a TDE
   source subdirectory.  There wasn't enough room in TDE to store those
   arguments, which caused a malfunction.

   There is no equivalent DOS find first/find next function in POSIX,
   at least as far as I can tell.  So, things like *.h or *.doc will not
   work.  The POSIX readdir( ) function simply reads all directory entries.
   There is a ftw( ) function, which stands for file tree walk, but I
   haven't been able to use it.



3) Normal convention in MS-DOS is to end text lines with <CR><LF>.
   In UNIX, lines are terminated with <LF>.   When MS-DOS text files
   are edited with many UNIX text editors, the <CR> looks like a ^M at
   the end of lines.

   Another problem that I have run into is the way printers handle
   these files, too.  When a UNIX text file is printed on an PC printer,
   the result is often a "stair-step" effect -- lines look like
   descending stairs from left to right.



4) In Linux, there are several files in the /proc directory that contain
   neat system info.  I used the /proc/meminfo file to find the available
   "free" memory, i.e.

                  cat /proc/meminfo

   Free memory reported in meminfo is a worst case.  Linux uses a
   unified memory pool for programs and disk cache.  A large amount
   of memory may be available to TDE in the disk cache buffer, but
   is not reported to the user in the TDE modeline.



5) TDE works much better with ncurses 1.8.5.  Some of the older versions
   of ncurses will work, but the colors may be off.
