PKUOS - Pintos
Pintos source browser for PKU Operating System course
Functions
shell.c File Reference
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <syscall.h>
Include dependency graph for shell.c:

Go to the source code of this file.

Functions

static void read_line (char line[], size_t size)
 Reads a line of input from the user into LINE, which has room for SIZE bytes. More...
 
static bool backspace (char **pos, char line[])
 If *POS is past the beginning of LINE, backs up one character position. More...
 
int main (void)
 

Function Documentation

◆ backspace()

static bool backspace ( char **  pos,
char  line[] 
)
static

If *POS is past the beginning of LINE, backs up one character position.

Returns true if successful, false if nothing was done.

Definition at line 92 of file shell.c.

References printf().

Referenced by read_line().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ main()

int main ( void  )

Definition at line 10 of file shell.c.

References chdir(), exec(), EXIT_SUCCESS, memcmp(), PID_ERROR, printf(), read_line(), strcmp(), and wait().

Here is the call graph for this function:

◆ read_line()

static void read_line ( char  line[],
size_t  size 
)
static

Reads a line of input from the user into LINE, which has room for SIZE bytes.

Handles backspace and Ctrl+U in the ways expected by Unix users. On return, LINE will always be null-terminated and will not end in a new-line character.

< Ctrl+U.

Definition at line 52 of file shell.c.

References backspace(), putchar(), read(), and STDIN_FILENO.

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function: