autostart.c,v

来自「TCP-IP红宝书源代码」· C,V 代码 · 共 68 行

C,V
68
字号
head	1.1;
access;
symbols;
locks
	dls:1.1; strict;
comment	@ * @;


1.1
date	97.09.21.19.29.30;	author dls;	state Dist;
branches;
next	;


desc
@@


1.1
log
@pre-3e code
@
text
@/* autostart.c -- autostart */
#include <conf.h>    
#include <sunromvec.h>
#include <kernel.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
 */
autostart()
{
    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 + =
减小字号Ctrl + -
显示快捷键?