Welcome to Organized, a C project that simulates organizing a chaotic laboratory filled with various hardware components using basic linked list data structures. This project is a hands-on exercise in elementary C programming, emphasizing memory management, linked lists, and sorting algorithms.
In this project, you will organize a disordered laboratory workspace by storing and sorting various hardware components using linked lists. The project challenges you to:
- Store and manage hardware items (such as sensors, actuators, and devices).
- Sort the items based on various criteria like type, name, and ID.
- Implement basic shell commands to interact with the workshop.
The project is divided into two main parts:
- Storing and Handling Hardware: Add, delete, and display hardware items.
- Sorting Hardware: Sort hardware items based on different attributes.
- Linked List Implementation: Store and manipulate hardware items in a linked list.
- Shell Commands: Implement shell commands (
add
,del
,disp
, andsort
) to manage and organize the hardware. - Sorting Algorithms: Sort hardware items by type, name, or ID with optional reverse order.
- Error Handling: Display error messages and exit with code 84 in case of incorrect commands or input.
To set up the project on your local machine:
-
Clone the repository:
git clone https://github.com/ccocytus/organized.git cd organized
-
Compile the project using the provided Makefile:
make
The project provides a simple shell interface where you can enter commands to manage your virtual workshop. The available commands are:
add <TYPE> <NAME>
: Add a new hardware item to the workshop.del <ID>
: Delete a hardware item by its ID.disp
: Display the current list of hardware items.sort <TAG> [-r]
: Sort the hardware items by the specified tag (TYPE
,NAME
, orID
). Use-r
to reverse the order.
./organized
Here’s a sample workflow to get you started:
Workshop » add WIRE usb
WIRE n°0 - “usb” added.
Workshop » add ACTUATOR button, DEVICE recorder
ACTUATOR n°1 - “button” added.
DEVICE n°2 - “recorder” added.
Workshop » disp
DEVICE n°2 - “recorder”
ACTUATOR n°1 - “button”
WIRE n°0 - “usb”
Workshop » sort NAME -r
Workshop » disp
WIRE n°0 - “usb”
DEVICE n°2 - “recorder”
ACTUATOR n°1 - “button”
Workshop » del 1
ACTUATOR n°1 - “button” deleted.
## Compilation
The project is compiled using a `Makefile`. It includes several rules:
- `make`: Compile the project.
- `make clean`: Remove object files.
- `make fclean`: Remove object files and the binary.
- `make re`: Recompile the project from scratch.