You need to write a C program (location: task-1/solution-1.c) that will take a single command line argument. The command line argument will be the name of a file. The file will contain a sequence of Unix/Linux commands for file manipulations: one command in each line. Your program needs to execute each of these commands. For this task, you must not use system(); instead, you have to use fork(), execvp(), wait()/waitpid() functions.
For each command, your program will spawn a process using fork() which will carry out the given file operation using exec() (or one of its variants). You can use execvp(). See this link ([1]) for exec() man-page and this link ([2]) for a pictorial description of its family.
Assumptions: You can safely assume that each line will have a maximum of 1024 characters including the newline character at the end of the line. The file contains only two types of commands: (1) cp < source-file-path> < destination-path>, and (2) mv < source-file-path> < destination-path>.
Error checking: Your program should do appropriate error checking. In case of an error, your program must print the following error message: "An error has occurred\n" and then exit with the error code 1, e.g., using exit(1).