usrscript.c

来自「ppc 8245 可编译bsp 包括 uart」· C语言 代码 · 共 77 行

C
77
字号
/* usrScript.c - startup script module *//* Copyright 1992 Wind River Systems, Inc. *//*modification history--------------------01b,18nov96,dbt  ANSIfied function headers (SPR #7427.)		 Replaced variable named new with newFdIn for C++ compatibility.01a,18sep92,jcf  written.*//*DESCRIPTIONThis file is used to execute a startup script of VxWorks shell commands.This file is included by usrConfig.c.SEE ALSO: usrExtra.cNOMANUAL*/#ifndef  __INCusrScriptc#define  __INCusrScriptc #ifdef	INCLUDE_STARTUP_SCRIPT/******************************************************************************** usrStartupScript - make shell read initial startup script file** This routine reads a startup script before the VxWorks* shell comes up interactively.** NOMANUAL*/void usrStartupScript     (    char *fileName    )    {    int old;    int newStdIn;    if (fileName == NULL)        return;    newStdIn = open (fileName, O_RDONLY, 0);    if (newStdIn != ERROR)        {        printf ("Executing startup script %s ...\n", fileName);        taskDelay (sysClkRateGet () / 2);        old = ioGlobalStdGet (STD_IN);  /* save original std in */        ioGlobalStdSet (STD_IN, newStdIn);   /* set std in to script */        shellInit (SHELL_STACK_SIZE, FALSE);    /* execute commands */        /* wait for shell to finish */        do            taskDelay (sysClkRateGet ());        while (taskNameToId (shellTaskName) != ERROR);        close (newStdIn);        ioGlobalStdSet (STD_IN, old);   /* restore original std in */        printf ("\nDone executing startup script %s\n", fileName);        taskDelay (sysClkRateGet () / 2);        }    else        printf ("Unable to open startup script %s\n", fileName);    }#endif	/* INCLUDE_STARTUP_SCRIPT */#endif	/* __INCusrScriptc */

⌨️ 快捷键说明

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