[comp.sys.m6809] New 2 Pass CC driver

pete@wlbr.EATON.COM (Pete Lyall) (08/13/88)

New 'CC' driver for the C Compiler - Kreider, Lyall, Dickhaus


This is the enhanced CC driver for the Coco3 using Level II. I also
have a slightly newer version that handles abbreviated '-l'
declarations (-l=gfxlib instead of -l=/r/lib/gfxlib.l), but it only
supports the single pass compiler. If someone wants to add those hacks
to this, let me know, and I'll mail them the other source so that they
can retrofit this two-pass compiler version.


#! /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:
#	cc.c
#	cc.h
#	cc.uue
#	ccdevice.a
#	readme
# This archive created: Fri Aug 12 14:26:04 1988
export PATH; PATH=/bin:$PATH
if test -f 'cc.c'
then
	echo shar: will not over-write existing file "'cc.c'"
else
cat << \SHAR_EOF > 'cc.c'
/*
** driver for the C compiler
*/
/*
**  01-23-85  Added -b and -t options. Enabled /nl.
**  ??-??-??  Added -O option to stop compilation after optimization.
**            Prevent optimization of ".a" files.
**  02-15-85  Fix naming conventions if -O is used.
**  ??-??-??  ll option for lex lib
**  07-30-86  P option for special debug and z for debug
**  03-24-87  don't optimize ".o" files, but accept as ".a"
**  03-12-88  Added two pass (CoCo) compiler support.  Bill Dickhaus
*/

#include "cc.h"
#include <module.h>

cleanup()
{
     if (childid)
          kill(childid, 2);
     if (newopath)
     {
          close(1);
          dup(newopath);
     }
     if (thisfilp)
          unlink(thisfilp);
     if (lasfilp)
          unlink(lasfilp);
}


trap(code)
int   code;
{
     cleanup();
     exit(code);
}

/*page*/
main(argc, argv)
int   argc;
char  **argv;
{
     char  **emp;
     int suffix, j, m, deltmpflg;
     register char  *p;

     j = 0;
     while ((--argc > 0) && (++j < 100))
     {
          if (*(p = *++argv) == '-')
          {
               while (*++p)
               {
                    switch (*p)
                    {
                    case 'a' :             /* stop at asm (no .r) (D) */
                         aflag = TRUE;
                         break;

                    case 'b' :              /* use different "cstart" */
                         bflag = TRUE;
                         if (*(p + 1) != '=')
                              break;
                         strcpy(mainline, (p + 2));
                         goto saver;

                    case 'c' :                /* include comments (C) */
                         cflag = TRUE;
                         break;

                    case 'd' :        /* make identifier (define) (C) */
                         if (*(p + 1) == '\0')
                              goto saver;
                         *--p = '-';
                         *(p + 1) = 'D';
                         macarray[maccnt++] = p;
                         goto saver;

                    case 'e' :                  /* set edition number */
                         emp = &edition;
                         goto emcommon;

                    case 'f' :                /* set outfile path (L) */
                         if (*++p != '=')
                              goto saver;
                         strcpy(objname, (p + 1));
                         if (objname[0] == '\0')
                              goto saver;
                         ++fflag;
                         suffix = findsuff(objname);
                         if (suffix == 'c' || suffix == 'r')
                              error("Suffix '.%c' not allowed for output", suffix);
                         goto saver;
                         /*page*/
                    case 'l' :               /* specify a library (L) */
                         if (*(p + 1) == 'l')
                         {
                              llflg++;
                              goto saver;
                         }
                         else
                              if (*(p + 1) != '=')
                                   goto saver;
                         if (libcnt == 4)
                              error("Too many libraries");
                         *--p = '-';
                         libarray[libcnt++] = p;
                         goto saver;

                    case 'm' :                     /* set memory size */
                         emp = &xtramem;
                         *p &= 0x5f;
emcommon:
                         if ((*(p + 1)))
                         {
                              *--p = '-';
                              *emp = p;
                         }
                         goto saver;

                    case 'M' :         /* ask linker for link map (L) */
                         mflag = TRUE;
                         break;

                    case 'n' :              /* give module a name (L) */
                         *--p = '-';
                         modname = p;
                         goto saver;

                    case 'o' :                    /* no optimizer (O) */
                         oflag = FALSE;
                         break;

                    case 'O' :             /* stop after optimization */
                         o2flg = TRUE;
                         break;

                    case 'P' :
                         p2flg = TRUE;         /* fall to set pflag too */

                    case 'p' :                    /* add profiler (C) */
                         pflag = TRUE;
                         break;

                    case 'q' :                      /* use quiet mode */
                         qflag = TRUE;
                         freopen("c.errors", "w", stderr);
                         break;

                    case 'r' :                /* stop at .r (no link) */
                         rflag = TRUE;
                         if (*++p != '=')
                             goto saver;
                         strcpy(rlib, (p + 1));
                         if (rlib[0] == '\0')
                             goto saver;
                         strcat(rlib, "/");
                         goto saver;
                         /*page*/
                    case 's' :               /* no stack checking (C) */
                         sflag = TRUE;
                         break;

                    case 'S' :     /* ask linker for symbol table (L) */
                         s2flg = TRUE;
                         break;

                    case 't' :            /* use transendental library */
                         tflag = TRUE;
                         break;

                    case 'T' :              /* use alternate (or NO) tmpdir*/
                         if (*(p + 1) != '=')
                         {
                              tmpdir = FALSE;
                              break;
                         }
                         else
                              {
                              strcpy(tmpname, (p + 2));
                              strcat(tmpname,"/");
                         }
                         goto saver;

                    case 'w' :    /* waste the compile for error check */
                         nullflag = TRUE;
                         break;

                    case 'x' :    /* use the work dir for main library */
                         xflag = TRUE;
                         break;

                    case 'z' :
                         zflag = TRUE;
                         break;

                    default  :
                         error("unknown flag : -%c\n", *p);
                    }  /* end of switch */
               }  /* end of inner while */
saver:
               continue;
          }  /* end of if */
          else
          {
               switch (suffix = findsuff(*argv))
               {
               case 'r' :
                    rsufflg = 1;
               case 'a' :
               case 'c' :
               case 'o' :
                    suffarray[filcnt] = suffix;
                    namarray[filcnt] = *argv;
                    ++filcnt;
                    break;

               default  :
                    error("%s : no recognised suffix", *argv);
               }  /* end of switch */
          }  /* end of else */
     }  /* end of outer while */
     /*page*/
     /*   command line now parsed, start real work   */
     logo();                                            /* identify us */
     if (filcnt == 0)
     {
          fprintf(stderr, "no files!\n");
          exit (0);
     }

     if ((aflag + rflag) > 1)
          error("incompatible flags");

     if (fflag)
          if (filcnt >1)
               if (aflag || rflag)
                    error("%s : output name not applicable", objname);

     if (fflag == 0)
          strcpy(objname, ((filcnt == 1) ? namarray[0] : "output"));


     if((tmpdir) && (*tmpname == '\0'))
          for(loopcnt=0;loopcnt<sizeof(tmproot)/sizeof(char *);loopcnt++)
               if(access(tmproot[loopcnt],0x83) == 0)
               {
                    strcpy(tmpname, tmproot[loopcnt]);
                    strcat(tmpname,"/");
                    break;   
               }

     strcat(tmpname, tmptail);

     mktemp(tmpname);
     strcat(tmpname, ".m"); /* add a suffix for chgsuff */

     intercept(trap);
     dummy();

     for (j = 0; j < filcnt; ++j)         /* for each file on cmd line */
     {
          fprintf(stderr, "'%s'\n", namarray[j]);
          if (suffarray[j] == 'c')
          {
               deltmpflg = 1;          /* is C prog so prep and compile it */
               strcpy(destfile, tmpname);
               chgsuff(destfile, 'm'); 
               frkprmp = parmbuf;
               if (cflag)
                    splcat("-l");                        /* wants comments */
               if (edition)
                    splcat(edition);           /* explicit edition number */
               for (m = 0; m < maccnt; )
                    splcat(macarray[m++]);           /* tack on "defines" */
               splcat(namarray[j]);            /* and now the file name */
               newopath = dup(1);
               close(1);
               if ((creat(destfile, 3)) != 1)
                    error("can't create temporary file for '%s'", namarray[j]);
               trmcat();
               thisfilp = 0;
               lasfilp = destfile;
               runit("c.prep", 1);
               close(1);
               dup(newopath);
               close(newopath);
               newopath = 0;
               /*page*/

               /* now compile it */

               if (TWOPASS)
               {
                    strcpy(srcfile, destfile);
                    frkprmp = parmbuf;
                    thisfilp = srcfile;
                    splcat(srcfile);
                    if (sflag)
                        splcat("-s"); /* no stack checking */
                    strcpy(destfile, tmpname);
                    chgsuff(destfile, 'a');
                    strcpy(ofn, "-o=");
                    strcat(ofn, destfile);
                    splcat(ofn);
                    if (pflag)
                        splcat("-p"); /* profiler code */
                    trmcat();
                    lasfilp = destfile;
                    runit("c.pass1", 0);
                    unlink(srcfile);
               }

               strcpy(srcfile, destfile);
               frkprmp = parmbuf;
               thisfilp = srcfile;
               splcat(srcfile);
               if (sflag)
                    splcat("-s");                    /* no stack checking */
               if (nullflag)
               {
                    if (!TWOPASS)
                        splcat("-n");                 /* waste the output */
                    strcpy(destfile, "/nil");
                    deltmpflg = 0;
               }
               else
               {
                    if (aflag)
                    {
                         if (fflag)
                              strcpy(destfile, objname); /* explicit obj name */
                         else
                              {
                              strcpy(destfile, namarray[j]);
                              chgsuff(destfile, 'a');
                              }
                    }
                    else
                         chgsuff(destfile, 'i');
               }

               strcpy(ofn, "-o=");
               strcat(ofn, destfile);
               splcat(ofn);
               if (pflag)
                    splcat("-p");                  /* wants profiler code */
               trmcat();
               lasfilp = destfile;
               if (TWOPASS)
                   runit("c.pass2", 0);
               else
                   runit("c.comp", 0);
               unlink(srcfile);
          }

          else
               deltmpflg = 0;
          /*page*/
          /* now assemble and perhaps optimize it */
          if (aflag || nullflag || (suffarray[j] == 'r'))
               lasfilp = 0;                   /* is .r so no work to do */
          else
          {
               /* don't optimize ".a" or ".o" files */
               if ((suffarray[j] == 'a') || (suffarray[j] == 'o'))
               {
                    strcpy(srcfile, namarray[j]);
                    thisfilp = 0;
               }
               else
               {
                    strcpy(srcfile, destfile);
                    thisfilp = srcfile;
                    if (oflag)
                    {
                         frkprmp = parmbuf;            /* yes,  optimize it */
                         splcat(srcfile);
                         if ((filcnt == 1) && (o2flg == 0))
                         {
                              strcpy(destfile, tmpname);
                              chgsuff(destfile, 'm');
                         }
                         else
                         {
                              if (fflag && o2flg)
                                  strcpy(destfile, objname);
                              else
                              {
                                  chgsuff(namarray[j], 'o');
                                  strcpy(destfile, namarray[j]);
                              }
                         }
                         splcat(destfile);
                         trmcat();
                         lasfilp = destfile;
                         runit("c.opt", 0);
                         if (deltmpflg)
                              unlink(srcfile);
                         strcpy(srcfile, destfile);
                         thisfilp = srcfile;
                    }
               }
               if (o2flg == 0)
               {
                    frkprmp = parmbuf;
                    splcat(srcfile);
                    if ((filcnt == 1) && (rflag == 0))
                    {
                         strcpy(destfile, tmpname);
                         chgsuff(destfile, 'r');
                    }
                    else
                    {
                         if (fflag && rflag)
                         {
                             strcpy(destfile, rlib);
                             strcat(destfile, objname);
                         }
                         else
                         {
                             chgsuff(namarray[j], 'r');
                             strcpy(destfile, rlib);
                             strcat(destfile, namarray[j]);
                         }
                    }
                    strcpy(ofn, "-o=");
                    strcat(ofn, destfile);
                    splcat(ofn);
                    trmcat();
                    lasfilp = destfile;
                    runit(ASSEMBLER, 0);
                    if (deltmpflg)
                         unlink(srcfile);
               }
          }
     } /* end of for each file */
     if (nullflag || aflag || rflag || o2flg)
          exit (0);
     /*page*/
     /* now link all together */
     frkprmp = parmbuf;
     if ((p = chkccdev()) == 0)
          error("Cannot find default system drive");
     if (bflag)
          strcpy(ofn, mainline);      /* use cstart.r or whatever */
     else
          strcat(strcat(strcpy(ofn, p), "/lib/"), mainline); /* global */
     splcat(ofn);
     if ((filcnt == 1) && (suffarray[0] != 'r'))
          splcat(thisfilp = destfile);
     else
          for (thisfilp = 0, j = 0; j < filcnt; ++j)
              splcat(namarray[j]);
     strcpy(ofn, "-o=");
     if (fflag == 0)
          chgsuff(objname, 0);
     strcat(ofn, objname);
     splcat(ofn);
     for (j = 0; j < libcnt; j++)
          splcat(libarray[j]);
     if (llflg)
     {
          strcat(strcat(strcpy(ofn, "-l="), p), "/lib/lexlib.l");
          splcat(ofn);
     }

     if (p2flg)
     {
          strcat(strcat(strcpy(ofn, "-l="), p), "/lib/dbg.l");
          splcat(ofn);
     }
     strcpy(ofn, "-l=");
     if (xflag == 0)
          strcat(strcat(ofn, p), "/lib/");
     strcat(ofn, (tflag) ? "clibt.l" : "clib.l");
     splcat(ofn);
     if (modname)
          splcat(modname);
     if (xtramem)
          splcat(xtramem);
     if (edition)
          splcat(edition);
     if (mflag)
          splcat("-m");
     if (s2flg)
          splcat("-s");
     trmcat();
     lasfilp = 0;
     runit(LINKER, 0);
     cleanup();
}

/*page*/
runit(cmd, code)
char  *cmd;
int   code;
{
     /*   fprintf(stderr, "   %-6s:\n", cmd); */
     fprintf(stderr, "   %-6s:  %s", cmd, parmbuf);
     if (zflag)
          return;
     if ((childid = os9fork(cmd, frkprmsiz, parmbuf, 1, 1, 0)) < 0)
          error("cannot execute %s", cmd);
     wait(&childstat);
     childid = 0;
     if (childstat > code)
          trap(childstat);
}


chkccdev()
{
     char *s, c;
     register char  *p;
     struct mod_exec *q;
     struct mod_config  *r;

     if ((q = modlink("ccdevice", 4, 0)) != -1)
     {
          strcpy(devnam1, (char *)q + q->m_data);
          munlink(q);
          return (devnam1);
     }
     else
          {
          if ((r = modlink("Init", 0x0c, 0)) != -1)
          {
               s = (char *)r + r->m_sysdrive;
               p = devnam1;
               while ((c = *s++) > 0)
                    *p++ = c;
               *p++ = (c & 0x7f);
               *p = 0;
               munlink(r);
               return (devnam1);
          }
     }
     return (0);
}


error(format, arg)
char  *format,   *arg;
{
     logo();                             /* print logo if not done yet */
     fprintf(stderr, format, arg);
     putc('\n', stderr);
     trap(0);
}


chgsuff(s, c)
char  *s, c;
{
     register char  *p = s;

     while(*p++)
          ;
     if (*(p - 3) != '.')
          return;
     if (c == '\0')
          *(p - 3) = 0;
     else
          *(p - 2) = c;
}



findsuff(p)
register char *p;
{
     int   j;
     char  c;

     j = 0;
     while (c = *p++)
          if (c == '/')
               j = 0;
          else
               j++;
     if (j <= 29 && j > 2 && *(p - 3) == '.')
          return (*(p - 2) | 0x40);
     else
          return (0);
}


splcat(s)
char  *s;
{
     register char *p = s;

     *frkprmp++ = 0x20;
     while (*frkprmp++ = *p++)
          ;
     --frkprmp;
}


trmcat()
{
     *frkprmp++ = '\n';
     *frkprmp = '\0';
     frkprmsiz = frkprmp - parmbuf;
}


dummy()
{
}


logo()
{
     if (hello == 0)
          fprintf(stderr, "\n cc version %d.%d.%d\n", VERSION, MAJREV, MINREV);
}

















SHAR_EOF
fi # end of overwriting check
if test -f 'cc.h'
then
	echo shar: will not over-write existing file "'cc.h'"
else
cat << \SHAR_EOF > 'cc.h'
#include <stdio.h>

#define  VERSION     2
#define  MAJREV      2
#define  MINREV      1

#define  TWOPASS     TRUE    /* change to FALSE for one pass compiler */
#define  ASSEMBLER   "rma"   /* change to "c.asm" if not dev pak */
#define  LINKER      "rlink" /* change to "c.link" if not dev pak */

direct int  aflag = FALSE,
            bflag = FALSE,
            cflag = FALSE,
            fflag = FALSE,
            llflg = FALSE,
            mflag = FALSE,
            oflag = TRUE,
            o2flg = FALSE,
            pflag = FALSE,
            p2flg = FALSE,
            qflag = FALSE,
            rflag = FALSE,
            sflag = FALSE,
            s2flg = FALSE,
            tflag = FALSE,
            xflag = FALSE,
            zflag = FALSE,
            tmpdir = TRUE,
            
            childid = 0,
            childstat = 0,
            filcnt = 0,
            hello = FALSE,
            libcnt = 0,
            maccnt = 0,
            newopath = 0,
            nullflag = FALSE,
            rsufflg = FALSE,
            loopcnt;

direct char *thisfilp = 0,
            *lasfilp = 0;

direct int  frkprmsiz = 0;
direct char *frkprmp = 0;

char        *tmproot[] = { "/R", "/R0", "/DD/TMP"} ;
char        tmptail[] = "ctmp.XXXXXX";
char        tmpname[64] = "";
char        rlib[60] = "";

char    mainline[20] = "cstart.r";

char        *libarray[4],
            *namarray[100],
            suffarray[100],
            *macarray[100],
            ofn[60],
            *xtramem,
            *modname,
            *edition,
            destfile[60],
            srcfile[60],
            objname[60],
            parmbuf[256],
            devnam1[20];
SHAR_EOF
fi # end of overwriting check
if test -f 'cc.uue'
then
	echo shar: will not over-write existing file "'cc.uue'"
else
cat << \SHAR_EOF > 'cc.uue'
begin 764 cc
MA\T@4@ -$8%: !D+IV/C J:@I\ P'R;X.30@-$!/7Z? 6B;[KN0SA#")!J<T
M$#&-'="NH2<$C=CN8C/) $&NH2<"C<Q/$:/D)P2GP"#W[F+LH2<',(W_J!<!
M"^RA)P4PQ!<! C)D-1"OR0)^$*_) C[,  'MR0)Z,<D"0##DIH#FR0)[P1TG
M5($-)U"!("<$@2PF!*: (/"!(B<$@2<F'J^A;,D">S0"IH"!#2<$H>0F]C4$
M;Q^!#2<BIH @PC ?KZ$P 6S) GN!#2<,@2 G"($L)P2F@"#P;Q\@I##) CXT
M$.S) GHT!C'$C0H7 /)OXF_B%QT ,*D&IZ^I H@0[ZD"?!#OJ0**S/^"'T$T
M$##KK.$B*JRI HHD"JRI H@E'J^I HHY*BHJ*B!35$%#2R!/5D521DQ/5R J
M*BHJ#3",Y,;/- 2& A". &00/XQOXA<<J.RI GRCJ0**.>RI HJCJ0*(.300
M,*LPBS00[*$PR^R$XV+MA!"LY";Q,F0Y-$#,_[@7_X/<)2<.S  "- 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G,__\Y[&(T(! _!R0%S/__-: ?(#4@[:D"?D]?[:D&HSFF8^9E$#\(%@##
M3U\0/P00)0"QKF(G!.<!;X0?B4\YIF/F91 _#18 I#/D,JD _ZY"$*Y$IDE(
M2$A(JDOF3>Y&$#\%$#\&-&"N9A"N:.YJIFVJ;^;H$1 _ S5@$"4 91^)3SDT
M(! _##4@'XE/.30@$#\,'R UH#0@( \T((WO[7XG!\;6-2 6 #H0KF00/QPD
M#,'0)N\?(!"^ $OM*4]?-: T0!\CKF2OJ0:E,(T "! _"35 %@ 5'S)/- :M
MN0:E,F([3^VI HS,__\Y)?5/7SD7  @7^33L8A _!CD /P              
M     0                            $                         
M          ']$'(0=1!Y8W1M<"Y86%A86%@                         
M                                                            
M                                                            
M                     &-S=&%R="YR                )Q #Z !D  IL
M>            0                (  0            !&  (         
M                                                            
M                                                            
M                                                            
M                                         0$! 0$! 0$!$1$1$1$!
M 0$! 0$! 0$! 0$! 0$! 0$P(" @(" @(" @(" @(" @2$A(2$A(2$A(2" @
M(" @("!"0D)"0D(" @(" @(" @(" @(" @(" @(" B @(" @($1$1$1$1 0$
G! 0$! 0$! 0$! 0$! 0$! 0$(" @( $  P!% $, 00  8V, WFPX
 
end
SHAR_EOF
fi # end of overwriting check
if test -f 'ccdevice.a'
then
	echo shar: will not over-write existing file "'ccdevice.a'"
else
cat << \SHAR_EOF > 'ccdevice.a'
*
* cc1, cc2 and c.prep call defdrive() to determine the "system" device
* for pathlists to the DEFS and LIB directories.  The technique used is
* to link to the "Init" module and determine the name of the booted device.
* Unfortunately, this is not always the correct device.  Systems that have
* a hard disk usually boot from the floppy drive (/D0) and change execution
* and data directories to the hard disk (/H0).  This leaves defdrive()
* referring to /D0 instead of /H0 unless the "Init" module has been changed.
*
* Edition 3 and later of cc1, cc2 and c.prep will attempt to link to
* a data module called "ccdevice" and extract the default system drive
* string from there.  If no "ccdevice" module is in memory, they will
* use defdrive() as before to obtain the string.  The following assembly
* code, when assembled and linked, can be loaded into memory (Level II
* systems) or merged to the end of cc1, cc2 and c.prep each (Level I
* systems) to override the call to defdrive().
*
* To assemble and link:
*
* c.asm ccdevice.a -o=ccdevice.r
* c.link ccdevice.r -f=ccdevice
*
* To merge with cc1 (others similar):
*
* merge /h0/cmds/cc1 ccdevice >xxx
* attr xxx pe e
* del -x cc1
* copy xxx /h0/cmds/cc1
* del xxx
*
 psect ccdevice_a,$40,$81,1,0,ccdev
ccdev fcc "/D0" Device name here
 fcb 0 Must have this zero byte
 endsect
SHAR_EOF
fi # end of overwriting check
if test -f 'readme'
then
	echo shar: will not over-write existing file "'readme'"
else
cat << \SHAR_EOF > 'readme'
CC replaces the standard CC1 compiler driver program. CC was originally
written by Carl Kreider with additions by Pete Lyall. I have added the
ability to use the two pass CoCo version of the C compiler. I've also
added support of the -r=pathname option generated by the MAKE utility
from the CoCo OS9 LII Developers Pak.

This version of CC uses a ramdisk, if it is installed, for all the
temporary files, making it much faster. It also supports additional
compiler options like auto-inclusion of the CLIBT.L library, stop after 
optimization (before assembly) and many others. Also included is a data
module, "ccdevice", that causes the compiler to use the device name in the
module (default is D0) as the default location of compiler files (LIB
and DEFS directories).

Included in this archive are the following files:

  cc.h        Header file for cc.c, three defines in this file may need
              to be changed before compilation, see notes below.

  cc.c        C source code for cc.

  cc          Compiled, executable version, set up for the two pass 
              compiler, the rma assembler, and rlink linker.

  ccdevice.a  Source code for the ccdevice data module. Directions for
              assembly are included in the source code. This module must
              be loaded or merged with another module (I merged it with
              cc).

  readme      This file.


The following defines can be changed in cc.h:

#define TWOPASS   TRUE   /* change to FALSE for one pass compiler */
#define ASSEMBLER "rma"  /* change to c.asm if you don't have the dev pak */
#define LINKER  "rlink" /* change to c.link if you don't have the dev pak */


WARNING!

The programs c.pass2, c.opt and rma do not return any kind of error
condition after disk errors. This can cause some rather strange results
if you don't make your ram disk big enough to hold each temporary file.
The compile may seem to be continuing normally, but almost always fails
in the link step. Make sure you have plenty of free space for the temporary
files on you ram disk.


Bill Dickhaus [70325,523]
SHAR_EOF
fi # end of overwriting check
#	End of shell archive
exit 0
-- 
Pete Lyall (OS9 Users Group VP)|  DELPHI: OS9UGVP  |  Eaton Corp.(818)-706-5693
Compuserve: 76703,4230 (OS9 Sysop) OS9 (home): (805)-985-0632 (24hr./1200 baud)
Internet: pete@wlbr.eaton.com            UUCP: {scgvax,jplgodo,voder}!wlbr!pete