You are to submit three files, consisting of one KornShell script and two C source files. Send them as attachments to an email message. The contents are described below.
$ printargs a b c My name is printargs. There were 3 parameters. The last one was c. The first one was a. $You may use the shift command, but you are not to use any loops. Read about the shift command in Chapter 5, and look it up in Appendix B.
#includea header file named do_print.h. It is to contain a definition of the method main(), which is to receive the standard three arguments. main() is to pass the first two arguments to a function named do_print(), and then it is to print each of the environment variables, one per line.
The second source file is to be named do_print.c. It must also
#include do_print.h, and is to contain the definition of
do_print(), which is to print each of the command line arguments
in reverse order before it returns.
$ gcc -g -Wall printargs.c do_print.c -o printargs $ ./printargs you? are How there. Hello, The command line arguments are: Hello, there. How are you? ./printargs _=./printargs TZ= PATH=/usr/users/vickery/bin:/sbin:/usr/sbin:/usr/bin:/usr/ccs/bin:/usr/bin/X11 :/usr/local/:/usr/local/bin:. WINDOWID=4194317 EDITOR=vim LOGNAME=vickery ENV=.kshrc SHELL=/usr/local/bin/ksh DISPLAY=18.104.22.168:0.0 LESS=-EaP?n?f%f .?m(File %i of %m) \ ..?lt%lb/%L:?pt%pB\%:?bt%bB/%B:-...?e (end)? x Next\: %x.. PRINTER=i2 PAGER=less LOGHOST=qcunix1.acc.qc.edu FPATH=:/usr/users/vickery/fun <A long list follows>
For C programs, you are to follow the [ Coding Guidelines ] web page for this course.