Source code of Windows XP (NT5)
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
/*++
Copyright (c) 1998 Microsoft Corporation
Module Name:
TODO: cmntool.c
Abstract:
<TODO: fill in abstract>
Author:
TODO: <full name> (<alias>) <date>
Revision History:
<full name> (<alias>) <date> <comments>
--*/
#include "pch.h"
HANDLE g_hHeap; HINSTANCE g_hInst;
BOOL WINAPI MigUtil_Entry (HINSTANCE, DWORD, PVOID);
BOOL pCallEntryPoints ( DWORD Reason ) { HINSTANCE Instance;
//
// Simulate DllMain
//
Instance = g_hInst;
//
// Initialize the common libs
//
if (!MigUtil_Entry (Instance, Reason, NULL)) { return FALSE; }
//
// TODO: Add others here if needed (don't forget to prototype above)
//
return TRUE; }
BOOL Init ( VOID ) { g_hHeap = GetProcessHeap(); g_hInst = GetModuleHandle (NULL);
return pCallEntryPoints (DLL_PROCESS_ATTACH); }
VOID Terminate ( VOID ) { pCallEntryPoints (DLL_PROCESS_DETACH); }
VOID HelpAndExit ( VOID ) { //
// This routine is called whenever command line args are wrong
//
_ftprintf ( stderr, TEXT("Command Line Syntax:\n\n")
//
// TODO: Describe command line syntax(es), indent 2 spaces
//
TEXT(" cmntool [/F:file]\n")
TEXT("\nDescription:\n\n")
//
// TODO: Describe tool, indent 2 spaces
//
TEXT(" cmntool is a stub!\n")
TEXT("\nArguments:\n\n")
//
// TODO: Describe args, indent 2 spaces, say optional if necessary
//
TEXT(" /F Specifies optional file name\n")
);
exit (1); }
INT __cdecl _tmain ( INT argc, PCTSTR argv[] ) { INT i; PCTSTR FileArg;
//
// TODO: Parse command line here
//
for (i = 1 ; i < argc ; i++) { if (argv[i][0] == TEXT('/') || argv[i][0] == TEXT('-')) { switch (_totlower (_tcsnextc (&argv[i][1]))) {
case TEXT('f'): //
// Sample option - /f:file
//
if (argv[i][2] == TEXT(':')) { FileArg = &argv[i][3]; } else if (i + 1 < argc) { FileArg = argv[++i]; } else { HelpAndExit(); }
break;
default: HelpAndExit(); } } else { //
// Parse other args that don't require / or -
//
// None
HelpAndExit(); } }
//
// Begin processing
//
if (!Init()) { return 0; }
//
// TODO: Do work here
//
//
// End of processing
//
Terminate();
return 0; }
|