home *** CD-ROM | disk | FTP | other *** search
- /*=============================================================================
-
- The INSTALL program source code, object code, sample script files,
- executable program, and documentation are subject to copyright
- protection under the laws of the United States and other countries.
-
- This software is licensed, not sold, and may only be redistributed
- in executable format and only in accordance with the provisions of
- the INSTALL Source Code License Agreement.
-
- INSTALL is Copyright(C) 1987-1990 by Knowledge Dynamics Corp
- Highway Contract 4 Box 185-H, Canyon Lake, TX (USA) 78133-3508
- 512-964-3994 (Voice) 512-964-3958 (24-hr FAX)
-
- All rights reserved worldwide.
-
- ===============================================================================
-
- FILENAME:
- main.c
-
- AUTHOR:
- eric jon heflin
-
- PUBLIC FUNCTIONS:
- main() - Master INSTALL function
-
- LOCAL FUNCTIONS:
- catcher() - Ctrl-Break handler
-
- DESCRIPTION:
- This file contains the master function to control the installation
- process.
-
- PORTABILITY:
- compiler specific
-
- REVISION HISTORY:
- DATE: AUTHOR: DESCRIPTION OF CHANGES:
- 891030 allyn jordan Beginning of detailed documentation.
- 900102 ejh Cosmetic changes.
-
- ==============================================================================*/
-
- #define MAIN_C
-
- #include "install.h"
- #include <signal.h>
- #include "switches.h"
- #include <string.h>
- #if defined(__MICROSOFTC__) || defined(__TURBOC__)
- #include <dos.h>
- #endif
-
- static void catcher(int);
- void get_mem(void); /* defined in init.c */
-
- static void catcher(sig)
- int sig;
- {
- signal(SIGINT, catcher); /* reestablish this fun as handler */
- wputs(yes_w, "Do you wish to terminate installation (Y/N)?");
- if (put_yes(yes_w))
- bye();
- if (sig == 1)
- sig = 1; /* quiet lint */
- }
-
- #if defined(__TURBOC__)
- extern int handler(int, int, int, int);
- #elif defined(__MICROSOFTC__)
- extern void far handler(unsigned, unsigned, unsigned far *);
- #elif !defined(LATTICE)
- #error Critical error handler unimplemented for this compiler
- #endif
- int in = -1;
-
- unsigned osmajor, osminor;
-
- int main(int c, byte **v)
- { /* main */
- project_t project;
- byte location[260];
-
- /* save location of this process */
- strcpy(location, v[0]);
-
- /* hook for a user-defined function */
- usr_1();
-
- /* now, install the compiler-specific critical error handler */
- #if defined(__TURBOC__)
- harderr(handler);
- #elif defined(__MICROSOFTC__) || defined(InstantC)
- _harderr(handler);
- #else
- #error critical error handling has not been implemented for this compiler
- #endif
-
- /* test compile-time requirements */
- validate();
-
- /* clear project structure to zeros */
- memset(&project, 0, sizeof(project_t));
-
- if(c == 2)
- vinit(v[1]);
- else
- vinit(NULL);
-
- /* install our Ctrl-C handler */
- signal(SIGINT, catcher);
-
-
- /* hook for a user-defined function */
- usr_2();
-
- /* initialize vars */
- init(&project);
-
- /* display banner */
- banner();
-
- /* open the script file - use argv[0] if DOS >= 3.00 */
- if (osmajor >= 3)
- in = open_data(&project, location);
- else
- in = open_data(&project, NULL);
-
- /* interpret the script file */
- compile(in, &project);
-
- /* allocate memory for decompression */
- lz_init();
-
- /* allocate memory for file storage */
- get_mem();
-
- /* actually do the installation */
- if (project.terse)
- {
- cls();
- colors(10, 17, "Installing Files - ", WHITE_F | BLUE_B | BRITE);
- colors(10, 36, "Please Wait ...", WHITE_F | BLUE_B | BRITE | FLASH);
- move(2, 1);
- scr_nocur();
- }
- else
- wputs(tty_w, "\nInstalling %s - Please Wait . . .\n", project.name);
-
- /* hook for user-defined function */
- usr_9();
-
- install(&project);
-
- /* hook for user-defined function */
- usr_7();
-
- /* modify CONFIG.SYS and AUTOEXEC.BAT files if needed */
- if (project.autoexec != NULL)
- modify_autoexec(&project);
- if (project.config != NULL)
- modify_config(&project);
-
- /* process the @Finish block (if any) */
- # ifdef ABSORB
- if(osmajor >= 3)
- finish(&project, v[0]);
- else
- finish(&project, NULL);
- # else
- finish(&project, NULL);
- # endif
-
- /* done */
- usr_10();
-
- /*
- putchar(7);
- wputs(message_w, "Installation complete.");
- put_message(message_w);
- */
-
- /* hook for a user-defined function */
- usr_8();
- bye();
- return 0; /* quiet lint */
- } /* main */
-
-
- /* end-of-file */
-