1 /* 2 * builtin_cmd - If the user has typed a built-in command then execute 3 * it immediately. 4 */ 5 int builtin_cmd(char **argv) 6 { 7 return 0; /* not a builtin command */ 8 }
The command is the string in argv[0].
The builtin commands are
- quit
- jobs
- fg
- bg
If the command is "quit", builtin_cmd can just call exit(0)
For the "jobs", command builtin_cmd can also do the work by calling the provided function listjobs.
The other two functions are require some parsing and more work. So another function is called to execute these builtin commands: do_bgfg