initial commit

This commit is contained in:
2018-09-13 16:25:44 -03:00
commit d34bd8f72e
14 changed files with 350 additions and 0 deletions

19
src/misc.c Normal file
View File

@@ -0,0 +1,19 @@
#include <stdbool.h>
#include <unistd.h>
#include <ctype.h>
#include <stdlib.h>
bool is_float(const char *s, float dest) {
if (s == NULL) {
return false;
}
char *endptr;
dest = (float) strtod(s, &endptr);
if (s == endptr) {
return false;
}
while (isspace((unsigned char ) *endptr)) {
endptr++;
}
return *endptr == '\0';
}