コード例 #1
0
///////////////////////////////////////////////////////////////////////////
//
//      US_Startup() - Starts the User Mgr
//
///////////////////////////////////////////////////////////////////////////
void
US_Startup(void)
{
	int     i;

	if (US_Started)
		return;

	harderr(USL_HardError); // Install the fatal error handler

	US_InitRndT(true);              // Initialize the random number generator

	USL_ReadConfig();               // Read config file

	for (i = 1;i < _argc;i++)
	{
		switch (US_CheckParm(_argv[i],ParmStrings2))
		{
		case 0:
			if (grmode == EGAGR)
				compatability = true;
			break;
		case 1:
			compatability = false;
			break;
		}
	}

	US_Started = true;
}
コード例 #2
0
ファイル: CUPSETUP.C プロジェクト: MegaGod/TW
void cupsetup( int argc, char *argv[] ) {
	register int i;

	progname = argv[0];

	/* Sorry for the pointer, but easy to expand argument, Suttipong */
	while ( ( --argc > 0 ) && ( ( i = ( *++argv )[0] ) == '/' || i == '-' ) ) {
		strupr( ++argv[0] );
		while ( i = *( argv[0]++ ) ) {
			switch ( i ) {
			case 'H':
				scrmode = HERCMONO;
				break;

			case 'E':/* e alone = ega, em = ega monochrome */
				scrmode = EGA;
				break;

			case 'M':/* m alone = mcga */
				if ( scrmode == EGA ) {
					scrmode = EGAMONO;
				} else {
					scrmode = MCGA;
				}
				break;
			case 'V':
				scrmode = VGA;
				break;
			case 'A':
				scrmode = ATT400;
				break;
			case 'L':/* /HL for Hercules, left-justified  */
				herc_align = 0;
				break;
			case 'N':
			case 'W':
			case 'P':
				break;
			default:  usage( );
			}
		}
	}

	if ( argc >= 1 && ( file_exist( argv[0] ) ||
		strchr( argv[0], '*' ) || strchr( argv[0], '?' ) ) ) {
		placekey( RETKEY );
		while ( i = *argv[0]++ ) {
			placekey( i );
		}
		placekey( RETKEY );
	}

	set_directory( );
	readoption( AUTO_FIND );
	readscrfont( dfont, "NORMAL.FON", cup_dir );
	readscrfont( ditalicfont, "ITALIC.FON", cup_dir );

	harderr( handler );
	filename[0] = '\0';
}
コード例 #3
0
ファイル: id_us_1.c プロジェクト: joncampbell123/16
///////////////////////////////////////////////////////////////////////////
//
//	US_Startup() - Starts the User Mgr
//
///////////////////////////////////////////////////////////////////////////
void
US_Startup(void)
{
	int	i,n;

	if (US_Started)
		return;

	harderr(USL_HardError);	// Install the fatal error handler

	US_InitRndT(true);		// Initialize the random number generator

	for (i = 1;i < _argc;i++)
	{
		switch (US_CheckParm(_argv[i],ParmStrings2))
		{
		case 0:
			compatability = true;
			break;
		case 1:
			compatability = false;
			break;
		}
	}

	// Check for TED launching here
	for (i = 1;i < _argc;i++)
	{
		n = US_CheckParm(_argv[i],ParmStrings);
		switch(n)
		{
		 case 0:
		   tedlevelnum = atoi(_argv[i + 1]);
		   if (tedlevelnum >= 0)
		     tedlevel = true;
		   break;

		 case 1:
		   NoWait = true;
		   break;
		}
	}

	US_Started = true;
}
コード例 #4
0
ファイル: vpftable.c プロジェクト: LucHermitte/ossim
/*************************************************************************
 *
 *N  vpfopencheck
 *
 *::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 *
 *   Purpose:
 *P
 *     This function tries its darndest to open a file.  It initially calls
 *     fopen with the given filename and mode.  If that doesn't work and
 *     the file is not on the hard disk, it displays a message asking the
 *     user to enter the correct disk in the drive, waits for either a retry
 *     or a cancel response, and, if told to retry, tries again.  This
 *     process is repeated until either the file is opened or the user
 *     requests cancel.
 *E
 *::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 *
 *   Parameters:
 *A
 *    filename <input> == (char *) full path name of the file to be opened.
 *    mode     <input> == (char *) mode of the file.
 *    diskname <input> == (char *) descriptive name of the disk the file is
 *                                 on.
 *    return  <output> == (FILE *) file pointer newly associated with
 *                                 filename.
 *E
 *::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 *
 *   History:
 *H
 *    Barry Michaels    May 1991                       DOS Turbo C
 *    Dave Flinn        July 1991     Updated for UNIX
 *E
 *************************************************************************/
FILE *vpfopencheck( const char *filename,
		    const char *mode,
		    const char * diskname )
{
   FILE *fp;
   char* tmpFilename = (char*) malloc ( strlen(filename) + 1 );
/*
   char *text[] = {"Please insert",
		   "                                        ",
		   "in data drive",
		   "                                                      "};
*/
   ossim_int32 retry = 0;
#ifdef __MSDOS__
   extern char home[255];
   void interrupt (*doshandler)();

   doshandler = getvect(36);
   harderr(vpfhandler);

   strncpy(text[1],diskname,strlen(text[1]));
   strcpy(text[3],filename);
#endif
   fp = NULL;


   /* copy the filename because we might modify it. */
   tmpFilename[strlen(filename)] = '\0'; /* just in case */
   strcpy(tmpFilename, filename);
   
   while (fp == NULL)
   {
      fp = fopen(tmpFilename,mode);
      if (fp == NULL)
      {
#ifdef __MSDOS__
	 if ( toupper(home[0]) != toupper(tmpFilename[0]) )
	    retry = displayerror(text,   4);
	 else
#else
            /* give names ending in dot another chance without the dot */
            if (tmpFilename[strlen(tmpFilename)-1] == '.')
            {
               tmpFilename[strlen(tmpFilename)-1] = '\0';
               retry = TRUE;
            }
            else
#endif
               retry = FALSE;
	 if (!retry) break;
      }
   }

   free(tmpFilename);
   tmpFilename = 0;
   
#ifdef __MSDOS__
   setvect(36,doshandler);
#endif
   return fp;
}
コード例 #5
0
ファイル: DISKERR.C プロジェクト: AnimatorPro/Animator-Pro
void init_de(void)
/* Have TurboC library deal with telling DOS what to do with it's
   critical disk error handler. */
{
harderr(de_handler);
}
コード例 #6
0
ファイル: CTDL.C プロジェクト: dylancarlson/fredcit
/************************************************************************
 *      main() Initialize & start citadel
 ************************************************************************/
void main(int argc, char *argv[])
{
    int i, cfg_ctdl = FALSE;
    long b;
    char init_baud;
    static char prompt[92];
    char *envprompt;

    cfg.bios = 1;
	cit_init_timer();			/* initialize cit_time() and cit_timer()	*/
    cfg.attr = 7;       		/* logo gets white letters                  */
    setscreen();				/* initialize screen system					*/
	memset(&parm,0,sizeof(parm));
    for (i = 1; i < argc; i++) {
        if (argv[i][0] == '/'
        || argv[i][0] == '-') {
            switch (tolower(argv[i][1])) {
#ifndef ATARI_ST
                case 'd':       /* DesqView/TopView     */
                    parm.dv = 1;
                    cPrintf("DesqView/TopView mode\n");
                    break;

                case 'b':       /* baud rate (for shell) */
                    if (argv[i + 1]) {
						b = atol(argv[++i]);
                        for (init_baud = 0; bauds[init_baud]; ++init_baud)
                            if (bauds[init_baud] == b) {
                                parm.baud = init_baud;
                                cPrintf("Initial baud rate fixed at %ld\n", b);
                                break;
							}
                    }
                    break;
				case 'm':
					parm.memcheck = !parm.memcheck;
					break;
#endif
                case 'c':       /* Configure system     */
                    cfg_ctdl = TRUE;
                    break;

                case 'p':       /* pace output          */
                    if (argv[i + 1]) {
                        parm.pace = atoi(argv[++i]);
                        cPrintf("Output pacing %d\n", parm.pace);
                    }
                    break;

                case 's':       /* run in shell from another BBS (door).        */
                    cPrintf("Shell mode\n");
                    parm.door = TRUE;
                    break;
/*#ifndef ATARI_ST*/
#ifndef FLOPPY
                case 'e':       /* use EMS                      */
                    if (_OvrInitEms(0, 0, 0)) {
                        cPrintf("EMS memory initialization failed!\n");
                        parm.ems = 1;
                    }
                    break;
#endif
/*#endif*/
				case 'v':       /* just do events       */
                    parm.events = 1;
                    break;
/*#ifndef ATARI_ST*/
#ifndef FLOPPY
                case 'x':       /* use exteneded memory */
					if (_OvrInitExt(0, 0))
                        cPrintf("Extended memory initialization failed!\n");
                    parm.ext = 1;
                    break;
#endif
/*#endif*/
				case 'l':		/* log in user */
                    if (argv[i + 1]) {
						parm.login = argv[++i];
						cPrintf("Auto-login\n");
					}
					break;

				case 'u':		/* log in user */
                    if (argv[i + 1]) {
						parm.user = argv[++i];
						cPrintf("Auto-login %s\n", parm.user);
					}
					break;
					
                default:
                    cPrintf("\nUnknown commandline switch '%s'.\n", argv[i]);
                    cPrintf("Valid DOS command line switches:\n");
                    cPrintf("    -b baud   Starting baud rate (300-19200)\n");
                    cPrintf("    -c        Read configuration files\n");
                    cPrintf("    -d        DesqView/TopView\n");
#ifndef FLOPPY
                    cPrintf("    -e        Use EMS memory for overlays\n");
#endif
					cPrintf("    -l str    Log in using initials;password in str\n");
					cPrintf("    -m        Memory check during idle time, start\n");
                    cPrintf("    -p num    Set output pacing to num\n");
                    cPrintf("    -s        Run as a shell from another BBS\n");
					cPrintf("    -u 'name' Log in using specifed user name");
                    cPrintf("    -v        Just run cron events\n");
#ifndef FLOPPY
					cPrintf("    -x        Use extended memory for overlays (386/486 only!)\n");
#endif
                    exit(1);
            }
        }
    }

    if (cfg_ctdl)				/* force reconfigure?						*/
        unlink("etc.tab");

    logo();						/* prints out system logo                   */

    if (cit_time() < 607415813L) {
        cPrintf("\n\nPlease set your time and date!\n");
        exit(1);
    }
	/* set prompt for shells */
    envprompt = getenv("PROMPT");
	if (!envprompt)
		envprompt = "$p$g";
    sprintf(prompt, "PROMPT=\r\nType EXIT to return to FredCit\r\n%s", envprompt);
    if (putenv(prompt)) {
        cPrintf("\n\nCan not set DOS prompt!\n");
		delay (5000);
	}
	/* initialize citadel */
    initCitadel();

    if (parm.baud) {
        cfg.initbaud = parm.baud;
        baud(cfg.initbaud);
    }
	if (parm.door) {
		detectflag = 1;
//		carrier();
//		if (haveCarrier) {
//			carrdetect();
//			newCarrier = 1;		/* make hello blurb show up */
//		}
	}
    greeting();

	sysReq = FALSE;

	if (cfg.f6pass[0])
		ConLock = TRUE;

	if (parm.dv) {
		cfg.bios = 1;
		directvideo = 0;
	}

	if (parm.login) {
		normalizeString(parm.login);	/* normalize string in environment */
		login(parm.login,NULL);
	} else if (parm.user && !loggedIn) {
		normalizeString(parm.user);	/* normalize string in environment */
		if (findPerson(parm.user, &lBuf) != ERROR)
			login(lBuf.lbin,lBuf.lbpw);
	}

		/* read in door interface files */
	if (parm.door) {
		readDoorFiles(0);
	}
	/* update25();	*/
	do_idle(0);

	/* install critical error handler */
	harderr(cit_herror_handler);
	
	/* execute main command loop */
    if (!parm.events)
        command_loop();
    else {
        do_cron_loop();
    }

    exitcitadel();
}
コード例 #7
0
ファイル: MAIN.C プロジェクト: mrchurrisky/chaos
int main(int argc, char **argv)
{
	unsigned short grafboard;
	extern int disk_error_handler(int errval, int ax, int bp, int si);
   char *p;

	allocatebuffers();
	if (init_mem_err)
   {
      cprintf("\r\n\r\nSorry, not enough memory to run Toy Universes.\r\n");
      return -1;
   }

	harderr(disk_error_handler);

	/* Find out if we have a VGA or EGA at all. */

	grafboard = QueryGrafix();


	if ((grafboard & 0x200) != 0x200)
	{
		printf("This programs requires EGA capability.\n");
		exit(-1);
	}

	if (grafboard == 0xffff || InitGrafix(-EGA640x350) < 0)
	{
		printf("Metagraphics not installed. Execute the command:\n");
		printf("metashel /i\n");
		printf("and then try again.\n");
		exit(-1);
	}

	vgaflag = -1;

	while (argc > 1)
	{
		if (argv[1][0] == '-')
		{
			switch (argv[1][1])
			{
			case 'e':
				vgaflag = 0;
				break;
         case 'v':
	    vgaflag = 1;
	    break;
			}
		}
		argc--;
		argv++;
	}

	if (vgaflag == -1)
	{
		if ((grafboard & 0x300) == 0x300)
			vgaflag = 1;
		else
			vgaflag = 0;
	}



	Comm = QueryComm();
	if (Comm == MsDriver)
		InitMouse(MsDriver);
	else if (Comm == MsCOM1)
		InitMouse(MsCOM1);
	else if (Comm == MsCOM2)
		InitMouse(MsCOM2);
	else if (Comm & 3)
		InitMouse(COM1);
	/*
	 * Probably wrong. Need to check for MS mouse address in some special
	 * way.
	 */


	randomize();


   p = searchpath("system16.fnt");
   if (p)
      LoadFont(p);
	installmode();

	load_preset_palettes();

	usepalette();

	current_main_item = 0;

	usepalette();
   TWICE(initialize_buttons());

	ShowCursor();
   if (allocatefailflag)
      ErrorBox("Not enough memory for hi-res.");

   /* Lets see if there is enough for a later gif */
   if (!memok(20712L))		    /* Added up mallocs in comprs.c */
           ErrorBox("There may not be enough memory to save or view a Gif.");


   prog_init = 1;

   if (!setjmp(beatit))
   {

	   while (!exitflag)
	   {

		   rebuildflag = 0;

		   if (newcaflag && !donescreenflag)
		   {
			   loadlookuptable(increment, maxstate);
			   newcaflag = 0;
		   }

		   if (newcaoflag)
		   {
	    unsigned char *p1,*p2;
	    static int firsttime = true;

	    switch(caotype)
	    {
	    case CA_HODGE:
	       p1 = (char *)HODGE_colortable;
	       p2 = HODGE_ct;
	       break;
	    case CA_EAT:
	       p1 = (char *)EAT_colortable;
	       p2 = EAT_ct;
	       break;
	    case CA_TUBE:
	       p1 = (char *)TUBE_colortable;
	       p2 = TUBE_ct;
	       break;
	    case CA_NLUKY:
	       p1 = (char *)NLUKY_colortable;
	       p2 = NLUKY_ct;
	       break;
	    }
	    memcpy(vgacolortable,p1,16*3);
	    if (!hasVGA)
	       memcpy(egacolortable,p2,16);


			   if (!firsttime)
	    {
	       TWICE(initialize_numbers());
	    }
	    else
	       firsttime = false;
			   usepalette();


			   newcaoflag = 0;
	    current_main_item = -1;
		   }

		   if (blankflag)
		   {
			   blankbuffers();
			   blankflag = 0;
		   }
		   if (randomizeflag)
		   {
			   carandomize();
			   randomizeflag = 0;
		   }
		   while (!exitflag && !rebuildflag)
		   {

			   if (onestep || !stopped)
			   {
				   if (display_mode == HI)
					   hiresupdate();
				   else
					   loresupdate();
				   if (onestep)
					   onestep--;

			   }
			   if (spinflag && (!stopped || (iteration++ > spinspeed)))
			   {
				   if (spinflag == 1)
					   spinpalette();
				   else
					   revspinpalette();
               iteration = 0;
			   }
			   checkkeyboard();

			   if (newcaflag)
				   rebuildflag = 1;
		   }
	   }
   }
	StopMouse();
	StopEvent();
	grayflag = 0;
	grayscale();
	SetDisplay(TextPg0);
	return exitflag;

}