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).

computer science

Description

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 naivedb. Your makefile must ensure this. The naivedb program must support the following usage: naivedb [scriptfile]. When no arguments are given, naivedb 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, naivedb 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 naivedb 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 naivedb, or can be executed from a terminal by running its executable file. The create program should support the following usage:


Related Questions in computer science category