From 4c4b769ef229957c9919383c13ffe1bbb1d82556 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Fri, 7 Oct 2016 22:08:20 +0000 Subject: [PATCH] [LOGOFF]: Code formatting fixes, including tabs vs. spaces. svn path=/trunk/; revision=72932 --- reactos/base/applications/logoff/logoff.c | 155 +++++++++++----------- 1 file changed, 81 insertions(+), 74 deletions(-) diff --git a/reactos/base/applications/logoff/logoff.c b/reactos/base/applications/logoff/logoff.c index 2e832e3ddd5..73cbb9cf44f 100644 --- a/reactos/base/applications/logoff/logoff.c +++ b/reactos/base/applications/logoff/logoff.c @@ -1,14 +1,14 @@ /* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS logoff utility - * FILE: base/applications/logoff/logoff.c - * PURPOSE: Logoff current session, or another session, potentially on another machine - * AUTHOR: 30.07.2007 - Frode Lillerud + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS logoff utility + * FILE: base/applications/logoff/logoff.c + * PURPOSE: Logoff current session, or another session, potentially on another machine + * AUTHOR: 30.07.2007 - Frode Lillerud */ /* Note - * This application is a lightweight version of shutdown.exe. It is intended to be function-compatible - * with Windows' system32\logoff.exe commandline application. + * This application is a lightweight version of shutdown.exe. It is intended + * to be function-compatible with Windows' system32\logoff.exe application. */ #include @@ -21,7 +21,7 @@ #include "resource.h" -// Commandline argument switches +/* Command-line argument switches */ LPWSTR szRemoteServerName = NULL; BOOL bVerbose; @@ -39,37 +39,45 @@ VOID DisplayError(DWORD dwError) //---------------------------------------------------------------------- // -// Sets flags based on commandline arguments +// Sets flags based on command-line arguments // //---------------------------------------------------------------------- BOOL ParseCommandLine(int argc, WCHAR *argv[]) { - int i; - - //FIXME: Add handling of commandline arguments to select the session number and name, and also name of remote machine - //Example: logoff.exe 4 /SERVER:Master should logoff session number 4 on remote machine called Master. - - for (i = 1; i < argc; i++) { - switch(argv[i][0]){ - case L'-': - case L'/': - // -v (verbose) - if (argv[i][1] == L'v') { - bVerbose = TRUE; - break; //continue parsing the arguments - } - // -? (usage) - else if(argv[i][1] == L'?') { - return FALSE; //display the Usage - } - default: - //Invalid parameter detected - ConResPuts(StdErr, IDS_ILLEGAL_PARAM); - return FALSE; - } - } - - return TRUE; + int i; + + // FIXME: Add handling of command-line arguments to select + // the session number and name, and also name of remote machine. + // Example: logoff.exe 4 /SERVER:Master + // should logoff session number 4 on remote machine called Master. + + for (i = 1; i < argc; i++) + { + switch (argv[i][0]) + { + case L'-': + case L'/': + // -v (verbose) + if (argv[i][1] == L'v') + { + bVerbose = TRUE; + break; + } + // -? (usage) + else if (argv[i][1] == L'?') + { + /* Will display the Usage */ + return FALSE; + } + /* Fall through */ + default: + /* Invalid parameter detected */ + ConResPuts(StdErr, IDS_ILLEGAL_PARAM); + return FALSE; + } + } + + return TRUE; } //---------------------------------------------------------------------- @@ -79,44 +87,43 @@ BOOL ParseCommandLine(int argc, WCHAR *argv[]) //---------------------------------------------------------------------- int wmain(int argc, WCHAR *argv[]) { - /* Initialize the Console Standard Streams */ - ConInitStdStreams(); - - // - // Parse command line - // - if (!ParseCommandLine(argc, argv)) { - ConResPuts(StdOut, IDS_USAGE); - return 1; - } - - // - // Should we log off session on remote server? - // - if (szRemoteServerName) { - if (bVerbose) { - ConResPuts(StdOut, IDS_LOGOFF_REMOTE); - } - - // FIXME: Add Remote Procedure Call to logoff user on a remote machine - ConPuts(StdErr, L"Remote Procedure Call in logoff.exe has not been implemented"); - } - // - // Perform logoff of current session on local machine instead - // - else { - if (bVerbose) { - // Get resource string, and print it. - ConResPuts(StdOut, IDS_LOGOFF_LOCAL); - } - - // Actual logoff - if (!ExitWindowsEx(EWX_LOGOFF, 0)) { - DisplayError(GetLastError()); - return 1; - } - } - - return 0; + /* Initialize the Console Standard Streams */ + ConInitStdStreams(); + + /* Parse command line */ + if (!ParseCommandLine(argc, argv)) + { + ConResPuts(StdOut, IDS_USAGE); + return 1; + } + + /* Should we log off session on remote server? */ + if (szRemoteServerName) + { + if (bVerbose) + ConResPuts(StdOut, IDS_LOGOFF_REMOTE); + + // FIXME: Add Remote Procedure Call to logoff user on a remote machine + ConPuts(StdErr, L"Remote Procedure Call in logoff.exe has not been implemented"); + } + /* Perform logoff of current session on local machine instead */ + else + { + if (bVerbose) + { + /* Get resource string and print it */ + ConResPuts(StdOut, IDS_LOGOFF_LOCAL); + } + + /* Actual logoff */ + if (!ExitWindowsEx(EWX_LOGOFF, 0)) + { + DisplayError(GetLastError()); + return 1; + } + } + + return 0; } + /* EOF */ -- 2.17.1