⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 autostart.c

📁 TCP-IP红宝书源代码
💻 C
字号:
/* autostart.c -- autostart */

#include <conf.h>    
#include <systypes.h>
#include <sunromvec.h>
#include <kernel.h>    
#include <string.h>

int fautostart;
int boottime   = TRUE;

/* experimental value, only approxiamte */
#define LOOPSPERSECOND 526300

/*
 * autostart - set the flag 'fautostart' to TRUE if the program should
 *    proceed, or false if it should return to monitor.  Decision
 *   made according to arg[1] on the boot command line:
 *          "-a" or "-a0" -- start now
 *          "-aN          -- start after about N seconds
 *          anything else -- return to monitor
 */
void
autostart(void)
{
    int delay;
    
    register struct bootparam *bp = *romp->v_bootparam;
    char *arg;

    if (! boottime) {
	fautostart = TRUE;
	return;
    }
    boottime = FALSE;
    fautostart = FALSE;
    
    arg = bp->bp_argv[1];

    if ( (arg != NULL) && (*arg != NULL) && (strncmp(arg,"-a",2) == 0)) {
	/* delay start */
	if (sscanf(arg,"-a%d",&delay) == 1)
	    for (delay *= LOOPSPERSECOND ;delay > 0; --delay) /* null */ ;
	
	fautostart = TRUE;
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -