FreeNOS
Public Member Functions | Private Member Functions
FileStatus Class Reference

Retrieve file status from the filesystem. More...

#include <FileStatus.h>

Inheritance diagram for FileStatus:
POSIXApplication Application

Public Member Functions

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

Private Member Functions

Result printStatus (const String &file) const
 Concatenate a file. More...
 

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. More...
 
int runProgram (const char *path, const char **argv)
 Runs an external program. More...
 
- Protected Member Functions inherited from Application
virtual Result initialize ()
 Initialize the application. More...
 
virtual Result output (String &string) const
 Print string to output. More...
 
ArgumentParserparser ()
 Get program arguments parser. More...
 
const ArgumentParserparser () const
 Get constant program arguments parser. More...
 
const ArgumentContainerarguments () const
 Get program arguments. More...
 
void setVersion (const String &version)
 Set program version. More...
 
- Protected Attributes inherited from Application
int m_argc
 Input argument count. More...
 
char ** m_argv
 Input argument values. More...
 

Detailed Description

Retrieve file status from the filesystem.

Definition at line 31 of file FileStatus.h.

Constructor & Destructor Documentation

◆ FileStatus()

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

Constructor.

Parameters
argcArgument count
argvArgument values

Definition at line 26 of file FileStatus.cpp.

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

◆ ~FileStatus()

FileStatus::~FileStatus ( )
virtual

Destructor.

Definition at line 33 of file FileStatus.cpp.

Member Function Documentation

◆ exec()

FileStatus::Result FileStatus::exec ( )
virtual

Execute the application.

Returns
Result code

Implements Application.

Definition at line 37 of file FileStatus.cpp.

References Application::arguments(), Vector< T >::count(), ArgumentContainer::getPositionals(), printStatus(), and Application::Success.

◆ printStatus()

FileStatus::Result FileStatus::printStatus ( const String file) const
private

Concatenate a file.

Parameters
fileName of file to concatenate
Returns
Result code

Definition at line 60 of file FileStatus.cpp.

References errno, ERROR, Application::IOError, DeviceID::major, DeviceID::minor, printf(), S_ISBLK, S_ISCHR, S_ISDIR, S_ISREG, stat::st_dev, stat::st_gid, stat::st_ino, stat::st_mode, stat::st_size, stat::st_uid, stat(), strerror(), and Application::Success.

Referenced by exec().


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