FreeNOS
Public Member Functions | Private Member Functions
Login Class Reference

Login program which starts the user shell. More...

#include <Login.h>

Inheritance diagram for Login:
POSIXApplication Application

Public Member Functions

 Login (int argc, char **argv)
 Constructor.
 
virtual ~Login ()
 Destructor.
 
virtual Result exec ()
 Execute the application.
 
- Public Member Functions inherited from POSIXApplication
 POSIXApplication (int argc, char **argv)
 Class constructor.
 
virtual ~POSIXApplication ()
 Class destructor.
 
- Public Member Functions inherited from Application
 Application (int argc, char **argv)
 Class constructor.
 
virtual ~Application ()
 Class destructor.
 
virtual int run ()
 Run the application.
 

Private Member Functions

const char * getUsername () const
 Read username from standard input.
 
void printPrompt () const
 Print the login program prompt.
 

Additional Inherited Members

- Public Types inherited from Application
enum  Result {
  Success , NotFound , IOError , InvalidArgument ,
  ShowUsage , TimedOut , OutOfMemory
}
 Result codes. More...
 
- Protected Member Functions inherited from POSIXApplication
virtual Result output (const char *string) const
 Print text to output.
 
int runProgram (const char *path, const char **argv)
 Runs an external program.
 
- Protected Member Functions inherited from Application
virtual Result initialize ()
 Initialize the application.
 
virtual Result output (String &string) const
 Print string to output.
 
ArgumentParser & parser ()
 Get program arguments parser.
 
const ArgumentParser & parser () const
 Get constant program arguments parser.
 
const ArgumentContainer & arguments () const
 Get program arguments.
 
void setVersion (const String &version)
 Set program version.
 
- Protected Attributes inherited from Application
int m_argc
 Input argument count.
 
char ** m_argv
 Input argument values.
 

Detailed Description

Login program which starts the user shell.

Definition at line 31 of file Login.h.

Constructor & Destructor Documentation

◆ Login()

Login::Login ( int  argc,
char **  argv 
)

Constructor.

Parameters
argcArgument count
argvArgument values

Definition at line 29 of file Login.cpp.

References Application::parser(), ArgumentParser::registerPositional(), and ArgumentParser::setDescription().

◆ ~Login()

Login::~Login ( )
virtual

Destructor.

Definition at line 37 of file Login.cpp.

Member Function Documentation

◆ exec()

Login::Result Login::exec ( )
virtual

Execute the application.

Returns
Result code

Implements Application.

Definition at line 92 of file Login.cpp.

References Application::arguments(), close(), errno, ERROR, forkexec(), getUsername(), O_RDONLY, O_RDWR, open(), printPrompt(), strerror(), strlen(), Application::Success, and waitpid().

◆ getUsername()

const char * Login::getUsername ( ) const
private

Read username from standard input.

Returns
Username of the user.

Definition at line 54 of file Login.cpp.

References printf(), read(), and ZERO.

Referenced by exec().

◆ printPrompt()

void Login::printPrompt ( ) const
private

Print the login program prompt.

Definition at line 41 of file Login.cpp.

References printf(), utsname::release, utsname::sysname, and uname().

Referenced by exec().


The documentation for this class was generated from the following files: