From 3eb69d412e79d7d7db197c9a8592ba944a0af77e Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Tue, 10 Oct 2017 11:24:11 -0500 Subject: Complete rewrite of cut. Handle multipe ranges, add -DFO options, start of utf8 support (not finished yet)... Adds new loopfiles_lines() wrapper to lib.c that calls do_lines from loopfiles. --- lib/lib.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lib/lib.c') diff --git a/lib/lib.c b/lib/lib.c index 70ad0758..fae71566 100644 --- a/lib/lib.c +++ b/lib/lib.c @@ -637,6 +637,19 @@ void loopfiles(char **argv, void (*function)(int fd, char *name)) loopfiles_rw(argv, O_RDONLY|O_CLOEXEC|WARN_ONLY, 0, function); } +// call loopfiles with do_lines() +static void (*do_lines_bridge)(char **pline, long len); +static void loopfile_lines_bridge(int fd, char *name) +{ + do_lines(fd, do_lines_bridge); +} + +void loopfiles_lines(char **argv, void (*function)(char **pline, long len)) +{ + do_lines_bridge = function; + loopfiles(argv, loopfile_lines_bridge); +} + // Slow, but small. char *get_rawline(int fd, long *plen, char end) -- cgit v1.2.3