📄 shutdown.c
字号:
/*
* SHUTDOWN.C - Prepare the system for power-down.
*
* PROGRAMMER: Martti Ylikoski
* CREATED: 23.8.1992
*/
static char *VERSION="Version 1.0. Copyright(c) Martti Ylikoski, 1992. " ;
/*
*/
#include <stdio.h>
#define INCL_DOS
#include <os2.h>
#include <param.h>
#include <paramstd.h>
ParamEntry pentry[12] = {
"P", &ParamSetPause, 0,
"F", &ParamSetFold, 0,
"V", &ParamSetVerbose, 1,
"R", &ParamSetReport, 0,
"S", &ParamSetSubDirs, 0,
"?", &ParamSetHelp, 1,
"H", &ParamSetHelp, 1,
"NOD", &ParamSetNoDefault, 0,
"TEST", &ParamSetTest, 0,
"Y", &ParamSetYes, 1,
"N", &ParamSetTest, 1,
"\0", NULL, 0
} ;
ParamBlock params = {
"/-", IGNORECASE | NOPRIORITY | NOTRIGGERSALLOWED ,
pentry
} ;
static char *progname, *fname ;
extern unsigned long pflags ; /* needed because of paramstd */
int main(int argc, char *argv[])
{
ULONG Reserved ;
USHORT rc ;
int c ;
progname = argv[0] ;
ParamHandle(¶ms, &argc, argv) ;
if (pflags & PA_HELP)
{
printf("%s - Prepare the system for power-down.\n", progname) ;
puts(VERSION) ;
puts("SHUTDOWN flushes all buffers to the disk and closes") ;
puts("down the file system.") ;
puts("After this the system can be safely powered off.") ;
puts("Usage: SHUTDOWN [/V] | [/? | /H]") ;
puts("Where,") ;
puts(" /V = Verbose /Y = Yes (No confirm)");
puts(" /H,/? = Help /N = No (No action)") ;
return( 0 ) ;
}
printf("SHUTDOWN - Prepare the system for power-down.\n", progname) ;
puts(VERSION) ;
if (pflags & PA_NO)
{
puts("No action taken (/N -option)") ;
return( 1 ) ;
}
if (pflags & PA_YES)
;
else
{ /* Confirm */
puts("Want to proceed(Y/N)?" ) ;
c = getchar() ;
if ( toupper( c) != 'Y')
{
puts("SHUTDOWN cancelled.") ;
return( 1 ) ;
}
}
if (pflags & PA_VERBOSE)
printf("DosShutdown()") ;
Reserved = 0L ;
rc = DosShutdown( Reserved ) ;
if (rc = 0L)
{
puts("SHUTDOWN completed.") ;
puts("It is now safe to power off the system or restart it") ;
puts("by pressing CONTROL-ALT-DEL") ;
}
else
{
printf("SHUTDOWN reported error %d.", rc) ;
return( rc ) ;
}
return( 0 ) ;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -