KVS/include/arg_checks.h
kxtzownsu a0b118bbbb kvs: optimize stuff
changelog:
- make hex_utils includes work across C files
- have Makefile use `build/$(ARCH)` instead of `build/bin/binary-$(ARCH)`
- small bugfixes
- add is_ti50.c & place for future tools
- global KERNVER_TYPE variable (if kernver.h is included)
2024-12-29 08:19:20 +00:00

41 lines
617 B
C

// credit to Hannah / ZegLol for making this!
#ifndef ARG_CHECKS_H
#define ARG_CHECKS_H
#include <stddef.h>
#include <string.h>
int gargc;
char **gargv;
char *fval(const char *arg, int param)
{
for (int i = 0; i < gargc; i++) {
if (!strcmp(gargv[i], arg)) return gargv[i + param];
}
return "";
}
bool fbool(const char *arg)
{
for (int i = 0; i < gargc; i++) {
if (!strcmp(gargv[i], arg)) return true;
}
return false;
}
char *fequals(const char *arg)
{
for (int i = 0; i < gargc; i++) {
if (!memcmp(gargv[i], arg, strlen(arg) - 1))
return gargv[i] + strlen(arg) + 1;
}
return "";
}
#endif