On Thu, Jun 11, 2020 at 09:36:18AM +0200, Pavel Stehule wrote: > st 10. 6. 2020 v 0:30 odesÃlatel Justin Pryzby <pry...@telsasoft.com> napsal: > > > + /* ignore empty rows */ > > > + if (*line != '\0') > > > > Maybe: if line=='\0': continue > > We should also support comments.
Comment support is still missing but easily added :) I tried this patch and it works for my purposes. Also, your getline is dynamically re-allocating lines of arbitrary length. Possibly that's not needed. We'll typically read "+t schema.relname", which is 132 chars. Maybe it's sufficient to do char buf[1024]; fgets(buf); if strchr(buf, '\n') == NULL: error(); ret = pstrdup(buf); In any case, you could have getline return a char* and (rather than following GNU) no need to take char**, int* parameters to conflate inputs and outputs. I realized that --filter has an advantage over the previous implementation (with multiple --exclude-* and --include-*) in that it's possible to use stdin for includes *and* excludes. By chance, I had the opportunity yesterday to re-use with rsync a regex that I'd previously been using with pg_dump and grep. What this patch calls "--filter" in rsync is called "--filter-from". rsync's --filter-from rejects filters of length longer than max filename, so I had to split it up into multiple lines instead of using regex alternation ("|"). This option is a close parallel in pg_dump. -- Justin