diff options
author | Rob Landley <rob@landley.net> | 2017-10-10 11:24:11 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2017-10-10 11:24:11 -0500 |
commit | 3eb69d412e79d7d7db197c9a8592ba944a0af77e (patch) | |
tree | 677bfb7322356cf50218482fbd9dc925d88bc6c1 /lib | |
parent | 78289203031afc23585035c362beec10db54958d (diff) | |
download | toybox-3eb69d412e79d7d7db197c9a8592ba944a0af77e.tar.gz |
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.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/lib.c | 13 | ||||
-rw-r--r-- | lib/lib.h | 1 |
2 files changed, 14 insertions, 0 deletions
@@ -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) @@ -216,6 +216,7 @@ off_t fdlength(int fd); void loopfiles_rw(char **argv, int flags, int permissions, void (*function)(int fd, char *name)); void loopfiles(char **argv, void (*function)(int fd, char *name)); +void loopfiles_lines(char **argv, void (*function)(char **pline, long len)); long long xsendfile(int in, int out); int wfchmodat(int rc, char *name, mode_t mode); int copy_tempfile(int fdin, char *name, char **tempname); |