// Copyright 1992, Alfred J. Heyman and Spectrum Research, Inc.

#define NETCOUNT 1
#pragma check_stack(off)

#include 


extern int _strcpy();
extern int _strcmp();

extern char lockname[];
extern char thisprog[];
extern char drive[];
extern char dir[];
extern char fname[];
extern char ext[];
extern char runname[];
extern int  cadkeyflag;
extern char acadname[];
extern char swapfile[];
extern int  emm_use_flag;

char copyr[]    = { " BIG-SHELL, Copyright (c) 1990-92, Alfred J. Heyman" };
char wderror[]  = { "BIGSHELL ERROR: Write to DISK failed." };
char rderror[]  = { "BIGSHELL ERROR: Read from DISK failed." };
char FNAMEX[]   = { "BSHELL" };
char EXTX[]     = { "OVL"    };
char abortmsg[] = { " ABORTING: CANT RUN OVERLAY BSHELL.OVL" };

acs_cls() {};

open_bigshell()
{ common1();  if(emm_use_flag==0) { sprintstr("Opening BigShell,  PLEASE WAIT."); };
};

close_bigshell()
{ common1();  if(emm_use_flag==0) { sprintstr("Closing BigShell,  PLEASE WAIT."); };
};

common1()
{ clearwindow(0,0,79,0,0x1f);
  setcolor(0x1f);
  gotoxy(0,0);
};

get_acadname()
{  char *exe;
   int  x;

   exe=NULL;
   getenva(&exe,"SHELL_PROG=");
// exe=getenv("SHELL_PROG");             // Find environment variable SHELL_PROG.
   if(exe!=NULL)                         // Was variable present in environment?
     { strcpy(runname,exe); }            // Yes? Then copy value to RUNNAME.
    else
     { strcpy(runname,thisprog); };      // No? Then handle normally.

//--------------------------------------------
// This logic replaces the logic below.....
//--------------------------------------------

   for(x=0 ; ((x < 80) && (runname[x]!=0)) ; x++){};
   x-=10;
   cadkeyflag=0;
   if(strcmp("CADKEY",runname+x)) { cadkeyflag=1; };
   x+=7;
   if(exe==NULL) { strcpy(runname+x,"BIN"); };

//---------------------------------------------
// Removed to eliminate the need for Splitpath & Makepath.
//---------------------------------------------
// _splitpath(runname,drive,dir,fname,ext);    /* Generate path to AutoCAD    */
// if(strcmp("CADKEY",fname)==0)         // Are we running CADKEY?
//   { cadkeyflag = 1; }                 // Yes? Set CADKEY flag.
//  else
//   { cadkeyflag = 0; };                // No? Then RESET it to zero.
// if(exe==NULL) { strcpy(ext,"BIN"); }        /* This change made in 1.04 */
//
// strcpy(acadname,fname);
// _makepath(runname,drive,dir,fname,ext);

   strcpy(swapfile,runname);
};

int trans_elevel(int original)
{ return(original); };