PKUOS - Pintos
Pintos source browser for PKU Operating System course
|
Go to the source code of this file.
Macros | |
#define | MAX_LEVEL 20 |
Functions | |
static bool | getcwd (char *cwd, size_t cwd_size) |
pwd.c More... | |
int | main (void) |
static bool | get_inumber (const char *file_name, int *inum) |
Stores the inode number for FILE_NAME in *INUM. More... | |
static bool | prepend (const char *prefix, char *dst, size_t *dst_len, size_t dst_size) |
Prepends PREFIX to the characters stored in the final *DST_LEN bytes of the DST_SIZE-byte buffer that starts at DST. More... | |
#define MAX_LEVEL 20 |
|
static |
Stores the inode number for FILE_NAME in *INUM.
Returns true if successful, false if the file could not be opened.
Definition at line 32 of file pwd.c.
References close(), file_name, inumber(), and open().
Referenced by getcwd().
Stores the current working directory, as a null-terminated string, in the CWD_SIZE bytes in CWD.
Prints the absolute name of the present working directory.
Returns true if successful, false on error. Errors include system errors, directory trees deeper than MAX_LEVEL levels, and insufficient space in CWD.
Definition at line 72 of file pwd.c.
References close(), get_inumber(), inumber(), MAX_LEVEL, memmove(), name, open(), prepend(), readdir(), READDIR_MAX_LEN, and strlcpy().
Referenced by main().
int main | ( | void | ) |
Definition at line 13 of file pwd.c.
References EXIT_FAILURE, EXIT_SUCCESS, getcwd(), and printf().
Prepends PREFIX to the characters stored in the final *DST_LEN bytes of the DST_SIZE-byte buffer that starts at DST.
Returns true if successful, false if adding that many characters, plus a null terminator, would overflow the buffer. (No null terminator is actually added or depended upon, but its space is accounted for.)
Definition at line 52 of file pwd.c.
References memcpy(), and strlen().
Referenced by getcwd().