diff options
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -56,6 +56,8 @@ void change_directory(const char *path); void change_ownership(const char *path); +void make_file(const char *path); + void clear(const char *arg); void echo(const char *arg); @@ -73,6 +75,7 @@ struct exec_command CommandsList[] = { {"pwd", print_cdirectory}, {"cd", change_directory}, {"clr", clear}, + {"mkfile", make_file}, {"echo", echo}, {"exit", exit_} }; @@ -190,6 +193,16 @@ void remove_file(const char *path) { } } +void make_file(const char *path) +{ + + FILE *new_file = fopen(path, "w"); + if (new_file == NULL) + { + perror("failed to create the new file"); + } +} + void change_ownership(const char *path) { if (chmod(path,S_IRWXU) != 0) { perror("failed to get ownership of the file"); |
