Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
Notes: Programs that produce compiler/linker errors will receive a grade of zero.
What to Submit: For each of the deadlines mentioned above, you should submit via Blackboard
as a single compressed file (i.e., zip): (i) a PDF file with your report, and (ii) your C code (properly
commented). The names and student ids of all team members should be clearly presented at the
beginning of your report.
A. Description. In this project, we will build a simplistic in–memory database accessible
through a naive command–line text–based user interface (i.e., the user types commands in order to
interact with the in–memory database). Your interface should interpret script files, in addition to
accepting one command at a time from the keyboard, and use a user–level library that implements
the in–memory database.
We will start by describing the user interface. The executable of your program must be
named naiveinterface. Your makefile must ensure this. The naiveinterface program must
support the following usage: naiveinterface [scriptfile]. When no arguments are given,
naiveinterface should enter a loop in which it accepts one command at a time as keyboard input
(e.g., using scanf). The user types a command, and then presses ‘return’ on the keyboard
to execute it (i.e., the command will end with a newline character). Your program must block
until the command completes and, if the return code is abnormal, print out a message to that
effect. Alternatively, your program should open the given file (if one is provided) and interpret the
contents as a sequence of commands to execute. You may assume that each line of the script file
corresponds to one command.
Your user interface should accept and support the following commands:
quit: When this command is encountered, naiveinterface should stop processing commands,
prompt the user for confirmation (i.e., “Are you sure you want to exit? All files will
be lost! Y/N”), accept the user input, delete all data structures and intermediate files (if
any) created, and exit.
Output redirection: Your naiveinterface program should allow output to be redirected
to a file (e.g., executing the command srchindx -o ALT indx.txt flightdata > foo.txt
should execute srchindx in the flightdata directory and print its output in file foo.txt).
create: This command is used for creating new files, directories, and links. This is a separate
program that can be executed by naiveinterface, or can be executed from a terminal by
running its executable file. The create program should support the following usage:
– create -f filepath creates an empty, ordinary file whose name is given in the specified
path. The path can be an absolute pathname, a relative pathname, or just a bare
filename, in which case the file should be created in the current directory. The new file
should have permission 0640 specified in octal.
1
– create -d dirpath creates a new directory whose name is given in the specified path.
The new file should have permission 0750 specified in octal.
– create -h oldname linkname creates a hard link. oldname is the path or name of an
existing file, and linkname is the path or name of the hard link to be created.
– create -s oldname linkname creates a symbolic (i.e., soft) link. oldname is the path
or name of an existing file, and linkname is the path or name of the symbolic link to be
created.