The lab questions in the last three labs will lead towards building a system similar to the one we did for the Unix part. This first lab question though deals only with input and output. See the Requirements section below.
lab10.c
in your favourite editor
so that it implements the functionality described in the Requirements
section below.
submit 2031A Lab10 lab10.c
submit
command can be viewed by
typing man submit
. Your program will receive no arguments. Its task is to receive five commands from the user. For each command, your program will separate the main command from its arguments, and print them out accordingly (see sample run below). As before, your program must present the following prompt before reading each command:
Grock-
There should be a space after the dash.
For this exercise, you can assume that no string entered by the user will be longer than 128 characters.
Following is a sample run that shows the expected behaviour of the program.
% gcc lab10.c % a.out Grock- setdb input.txt Command entered: setdb Arguments entered: input.txt Grock- relnames Command entered: relnames Arguments entered: Grock- cardinality inherit implement aggregate Command entered: cardinality Arguments entered: inherit implement aggregate Grock- say goodbye Command entered: say Arguments entered: goodbye Grock- Command entered: Arguments entered: %