30 |
|
#include <stdlib.h> |
31 |
|
#include <unistd.h> |
32 |
|
#include <sys/types.h> |
33 |
– |
#include <regex.h> |
33 |
|
#ifdef ALLBSD |
34 |
|
#include <fcntl.h> |
35 |
|
#endif |
265 |
|
|
266 |
|
#endif |
267 |
|
|
268 |
< |
|
268 |
> |
#if defined(LINUX) || defined(CYGWIN) |
269 |
|
char *sg_f_read_line(FILE *f, const char *string){ |
270 |
|
/* Max line length. 8k should be more than enough */ |
271 |
|
static char line[8192]; |
290 |
|
return match_string; |
291 |
|
} |
292 |
|
|
293 |
+ |
long long sg_get_ll_match(char *line, regmatch_t *match){ |
294 |
+ |
char *ptr; |
295 |
+ |
long long num; |
296 |
|
|
297 |
+ |
ptr=line+match->rm_so; |
298 |
+ |
num=atoll(ptr); |
299 |
+ |
|
300 |
+ |
return num; |
301 |
+ |
} |
302 |
+ |
#endif |
303 |
+ |
|
304 |
|
#ifndef HAVE_ATOLL |
305 |
|
static long long atoll(const char *s) { |
306 |
|
long long value = 0; |
437 |
|
strcpy(new, src); |
438 |
|
*dest = new; |
439 |
|
return 0; |
431 |
– |
} |
432 |
– |
|
433 |
– |
long long sg_get_ll_match(char *line, regmatch_t *match){ |
434 |
– |
char *ptr; |
435 |
– |
long long num; |
436 |
– |
|
437 |
– |
ptr=line+match->rm_so; |
438 |
– |
num=atoll(ptr); |
439 |
– |
|
440 |
– |
return num; |
440 |
|
} |
441 |
|
|
442 |
|
#if (defined(FREEBSD) && !defined(FREEBSD5)) || defined(DFBSD) |