Author: hbelusca Date: Fri Oct 7 22:08:20 2016 New Revision: 72932
URL: http://svn.reactos.org/svn/reactos?rev=72932&view=rev Log: [LOGOFF]: Code formatting fixes, including tabs vs. spaces.
Modified: trunk/reactos/base/applications/logoff/logoff.c
Modified: trunk/reactos/base/applications/logoff/logoff.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/logoff/lo... ============================================================================== --- trunk/reactos/base/applications/logoff/logoff.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/logoff/logoff.c [iso-8859-1] Fri Oct 7 22:08:20 2016 @@ -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 <stdio.h> @@ -21,7 +21,7 @@
#include "resource.h"
-// Commandline argument switches +/* Command-line argument switches */ LPWSTR szRemoteServerName = NULL; BOOL bVerbose;
@@ -39,37 +39,45 @@
//---------------------------------------------------------------------- // -// Sets flags based on commandline arguments +// Sets flags based on command-line arguments // //---------------------------------------------------------------------- BOOL ParseCommandLine(int argc, WCHAR *argv[]) { - int i; + 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. + // 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; //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; - } - } + 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; + return TRUE; }
//---------------------------------------------------------------------- @@ -79,44 +87,43 @@ //---------------------------------------------------------------------- int wmain(int argc, WCHAR *argv[]) { - /* Initialize the Console Standard Streams */ - ConInitStdStreams(); + /* Initialize the Console Standard Streams */ + ConInitStdStreams();
- // - // Parse command line - // - if (!ParseCommandLine(argc, argv)) { - ConResPuts(StdOut, IDS_USAGE); - return 1; - } + /* 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); - } + /* 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); - } + // 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; - } - } + /* Actual logoff */ + if (!ExitWindowsEx(EWX_LOGOFF, 0)) + { + DisplayError(GetLastError()); + return 1; + } + }
- return 0; + return 0; } + /* EOF */