Skip to content
/ rescal Public

A BASIC CLI RESISTOR COLOR CODE INTERPRETER WRITTEN IN C

License

Notifications You must be signed in to change notification settings

msio808/rescal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RESISTOR COLOR CODE CALCULATOR

Image from te.com

🚀 Getting Started

Requirements

► gcc make cmake valgrind

⚙️ Installation

Clone the quizbit repository:

git clone https://github.com/msio808/rescal.git

Change to the project directory:

cd rescal/config/

🤖 Running the project

./build.sh --run

🧪 Debug with GDB

./build.sh --debug

🧪 Debug with Valgrind

./build --memcheck

🗑 Clean generated build files

./build.sh --clean

📂 Folder Structure

.
├── config
│   ├── build.sh
│   └── CMakeLists.txt
├── docs
│   └── README.md
├── include
│   ├── helpers.h
│   └── src.h
├── LICENSE
└── src
    ├── helpers
    │   ├── helpers.c
    │   └── src.c
    └── main.c


⚠ If you want to run the program on windows

  • Comment out the strings.h from the ../include/src.h file.
  • Write your own custom strcasecmp() function.
  • Unlike the strcmp() the strcasecmp() function is case-insensitive.
The code below might help
#include <ctype.h>
#include <stdint.h>

//? Custom implementation of strcasecmp
int strcasecmp(const char *str1, const char *str2) {
    while (*str1 && *str2) {
        const char ch1 = tolower((uint8_t)*str1);
        const char ch2 = tolower((uint8_t)*str2);
        if (ch1 != ch2) {
            return ch1 - ch2;
        }
        str1++;
        str2++;
    }

    return tolower((uint8_t)*str1) - tolower((uint8_t)*str2);
}