Go to the documentation of this file.
45 if (
uname(&uts) != -1)
47 printf(
"\r\n%s %s\r\n\r\nlogin: ",
56 static char line[1024];
60 while (total <
sizeof(line) - 1)
63 read(0, line + total, 1);
95 const char *sh_argv[] = {
"/bin/sh", 0 };
size_t strlen(const char *str)
Calculate the length of a string.
C int errno
The lvalue errno is used by many functions to return error values.
virtual ~Login()
Destructor.
void printPrompt() const
Print the login program prompt.
POSIX-compatible application.
const ArgumentContainer & arguments() const
Get program arguments.
int open(const char *path, int oflag,...)
Open file relative to directory file descriptor.
void setDescription(const String &desc)
Set program description.
ssize_t read(int fildes, void *buf, size_t nbyte)
Read from a file.
Login(int argc, char **argv)
Constructor.
int uname(struct utsname *name)
Get the name of the current system.
int printf(const char *format,...)
Output a formatted string to standard output.
int close(int fildes)
Close a file descriptor.
char * strerror(int errnum)
The strerror function maps the number in errnum to a message string.
unsigned int Size
Any sane size indicator cannot go negative.
int forkexec(const char *path, const char *argv[])
Create a new process and execute program.
#define O_RDWR
Open for reading and writing.
const char * getUsername() const
Read username from standard input.
ProcessID pid_t
Used for process IDs and process group IDs.
Result registerPositional(const char *name, const char *description, Size count=1)
Register a positional argument.
ArgumentParser & parser()
Get program arguments parser.
#define ERROR(msg)
Output an error message.
virtual Result exec()
Execute the application.
char sysname[UTSBUF]
Name of this implementation of the operating system.
pid_t waitpid(pid_t pid, int *stat_loc, int options)
Wait for a child process to stop or terminate.
#define O_RDONLY
Open for reading only.
char release[UTSBUF]
Current release level of this implementation.