C Program Inventory System

Code a menu to mimimally maintain one catalog file as a C program. Make an add option to one table and print table option for as many tables as you have people in your group. I am expecting each person to code the add option for one table (so if your team has 3 people, you will have add and print options for 3 tables, and if you are working alone, you only need to add and print one table). There will also be an option to list all files in your project directory. (Note that I am using the word table to refer to your catalog file.)

Special design requirements:

The program must take in one argument of a string. That name should print at the top of the menu.

The menu has to repeat until the user chooses to exit.

Sample menu:

System name is : My Catalog

Please enter your selection:

  1. add an entry to table1
  2. print table 1 slowly
  3. interrupt printing table 1
  4. list all contents of your project directory (groups of only 1 person can skip this).
  5. exit

Note on add: You can just ask for the user to enter the entire line, and then just append what the user writes to the table. It is okay if you do not verify that the addition is, indeed, new.

--------------------------

Locking: Before adding one of your files, verify that the file is not locked. Use fcntl's lock, and then release the lock when you are done adding. (see lockdemo at http://beej.us/guide/bgipc/output/html/multipage/flocking.html) To test, have one program in the middle of adding and start up another session, and find you cannot add but instead get a nice message asking you to try again later.

-----------------

Challenges with the select menu:

----------------

Optional: Each table should have its own source file, so you will need to include a make file. I am expecting more than one .c and .h file, with one for each person coding. Include all files together in the one main menu program. Information on make files can be found at ppt makefiles

Use the following files, though you can name them appropriately for your project:

-----------------------

Not including this semester:

Get all your filenames from environment variables you create. Include a short shell script that sets these environment variables and exports them so child processes can use them. In your own environment, you might want to put these into your .bashrc so you don't have to re-enter them. If the variable is not set, display an error that tells the user what the filenames should be.

Use git change management