2. Write a C program named assignment2_yourname.c and submit the code in blackboard. The program takes as argument a new environment variable in the form var_name=value (e.g., SHELL=/bin/bash) and has...


2. Write a C program named assignment2_yourname.c and submit the code in blackboard.<br>The program takes as argument a new environment variable in the form var_name=value (e.g., SHELL=/bin/bash) and has to print out the following information:<br>• Its PID and its parent process's PID (.n:<br>e.g.<br>My PID is 2554<br>My parent process PID is 2553<br>#######################<br>• Its original environment before setting the new variable (.<br>e.g.<br>My original environment is:<br>TERM=xterm-256color<br>[..]<br>####HHHHHHH############<br>• The updated environment list after setting the new environment variable<br>e.g.,<br>My updated environment is:<br>TERM=xterm-256color<br>SHELL=/bin/bash<br>[.]<br>• The program has to handles the different errors<br>• Usage error - check that the program has one argument of the form var=name and give a usage error if not (.<br>• Check that the set of the environment variable is successful and return errExit if not succesful<br>NOTE: You can build on /tlpi-dist/proc/modify_env.c and you can compile your new program the same way.<br>

Extracted text: 2. Write a C program named assignment2_yourname.c and submit the code in blackboard. The program takes as argument a new environment variable in the form var_name=value (e.g., SHELL=/bin/bash) and has to print out the following information: • Its PID and its parent process's PID (.n: e.g. My PID is 2554 My parent process PID is 2553 ####################### • Its original environment before setting the new variable (. e.g. My original environment is: TERM=xterm-256color [..] ####HHHHHHH############ • The updated environment list after setting the new environment variable e.g., My updated environment is: TERM=xterm-256color SHELL=/bin/bash [.] • The program has to handles the different errors • Usage error - check that the program has one argument of the form var=name and give a usage error if not (. • Check that the set of the environment variable is successful and return errExit if not succesful NOTE: You can build on /tlpi-dist/proc/modify_env.c and you can compile your new program the same way.

Jun 07, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here