|
C-Shell
A simple shell written in C.
|
#include <errno.h>#include <fcntl.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <unistd.h>#include "shelltypes.h"Functions | |
| void | show_error (char *file) |
| int | handle_redirection (struct command *cmd) |
| Handles redirections for a command. | |
| int handle_redirection | ( | struct command * | cmd | ) |
Handles redirections for a command.
Parses the command's arguments and sets the file descriptors for input, output, and error. If a file is not found, the function will print an error message and return -1.
Command arguments are modified in place to remove the redirection symbols and the file names. The file descriptors must be standard input/output/error. Otherwise, the function will print an error message and return -1.
| cmd |
| void show_error | ( | char * | file | ) |