diff options
author | David <dbphillipsnz@gmail.com> | 2014-04-30 13:07:39 +1200 |
---|---|---|
committer | David <dbphillipsnz@gmail.com> | 2014-04-30 13:07:39 +1200 |
commit | 4ec5aa223ec7c1e727ea2497936cbab5e3e57463 (patch) | |
tree | 842cf6bbac21617a0361fd5cd1a7dec5c039566b /common.c | |
parent | b7d55116cc2c6a53891ea0d20686c79a6dd803bd (diff) | |
download | paramano-4ec5aa223ec7c1e727ea2497936cbab5e3e57463.tar.xz |
General tidy-up
Diffstat (limited to 'common.c')
-rw-r--r-- | common.c | 18 |
1 files changed, 5 insertions, 13 deletions
@@ -18,16 +18,8 @@ #include "common.h" -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdbool.h> - -#define TRUE true -#define FALSE false - /*********************************************************************** - * Gets integer value from file + * Gets integer value from first line in file **********************************************************************/ int get_int_value_from_file(const char* filename) { @@ -47,7 +39,7 @@ int get_int_value_from_file(const char* filename) /*********************************************************************** - * Return true/false if a file has specified line or not + * Return true/false if a file has specified line of text **********************************************************************/ bool file_has_line(const char *filename, const char *line) { @@ -71,14 +63,14 @@ bool file_has_line(const char *filename, const char *line) /*********************************************************************** - * Fetches first number from a string + * Fetches first number (ie the 35 of "35 123") from a + * string **********************************************************************/ int get_int(const char* string) { - char numbers[] = "1234567890"; char* first_num; - first_num = strpbrk(string, numbers); + first_num = strpbrk(string, "0123456789"); if(first_num) return atoi(first_num); |