Work 7: The Executor Arrives

posted Nov 18, 2016, 6:40 AM by JonAlf Dyrland-Weaver

With your table buddy, write a c program that runs a command line program that may have arguments. It should work as follows:
  • Prompts the user for a program to run via the command line.
  • Reads in that line (using fgets) and parses it to be used by one of the exec functions.
  • Runs the command using exec
  • You do not need to fork off a separate process and wait, the purpose of this assignment is only to parse a single line of input and run a program once.
Example output:
$ ./a.out 
What would you like to do? ls -l
total 72
-rwxr-xr-x  1 dw  staff  8904 Nov  9 23:18 a.out
-rw-r--r--  1 dw  staff   520 Nov  9 23:33 executor.c
-rw-r--r--  1 dw  staff   294 Nov  9 23:10 executor.c~
-rw-r--r--  1 dw  staff   294 Nov  7 14:03 launcher.c
-rw-r--r--  1 dw  staff   301 Nov  7 11:16 launcher.c~
-rw-r--r--  1 dw  staff   740 Nov  7 13:41 procfun.c
-rw-r--r--  1 dw  staff   734 Nov  7 10:41 procfun.c~

github link:

(The executor was Darth Vader's flagship, for more information on the title itself see here)