Question: Use execve to write a program called myls whose behavior is identical to the ( ) / ( b ) i ( n ) /

Use execve to write a program called myls whose behavior is identical to the()/(b)
i(n)/(l)s program. Your program should accept the same command-line argu-
ments, interpret the identical environment variables, and produce the identical
output.
The ls program gets the width of the screen from the COLUMNS environ-
ment variable. If COLUMNS is unset, then 1 s assumes that the screen is 80
columns wide. Thus, you can check your handling of the environment variables
by setting the COLUMNS environment to something less than 80 :
linux> setenv COLUMNS 40
linux>(.)/(m)yls
:(()/())/( O)utput is 40 columns wide
linux> unsetenv COLUMNS
linux>(.)/(m)yls
:(()/())/( O)utput is now 80 columns wide

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!