--- projects/libstatgrab/src/libstatgrab/tools.c 2003/03/05 12:41:19 1.2 +++ projects/libstatgrab/src/libstatgrab/tools.c 2003/03/07 11:56:44 1.3 @@ -1,5 +1,8 @@ #include #include +#include +#include +#include char *f_read_line(FILE *f, const char *string){ /* Max line length. 8k should be more than enough */ @@ -12,4 +15,24 @@ char *f_read_line(FILE *f, const char *string){ } return NULL; +} + +char *get_string_match(char *line, regmatch_t *match){ + int len=match->rm_eo - match->rm_so; + char *match_string=malloc(len+1); + + match_string=strncpy(match_string, line+match->rm_so, len); + match_string[len]='\0'; + + return match_string; +} + +long long get_ll_match(char *line, regmatch_t *match){ + char *ptr; + long long num; + + ptr=line+match->rm_so; + num=atoll(ptr); + + return num; }