Follow-up Comment #13, bug #62776 (project groff):
[comment #12 comment #12:] > > [comment #10 comment #10:] > [...] > > N.B. Your text lines are unnecessary long. > > When deleting lines from output, (one) "sed -e '/<regex>/d' [...]" is > simpler than (many) "grep -v ... || : ... I still need the ||: to ignore the exit status of mandoc(1), since I don't want to fail for messages that I later filter out. I only want to fail, if there's any remaining byte in stderr after my filtering takes place; thus, the last grep ^ >&2. Regarding the substitution of grep by sed, I don't think there's a clear win: both lines take the same number of bytes ('//d' vs 'p-v'), and both commands are equally well known. Since grep is what I already have, I'll keep it. > > Or (simpler) use a file for the regular expressions, "sed -f <file>", > where the file contains lines with However, the idea of putting these patterns into a file is an interesting thing; I could modify it without having to modify the Makefile (which causes unnecessary rebuilds). That would also reduce the number of fork+exec. > > /<regex/d Since POSIX grep(1) defines -v and -f, I'll do this with grep(1), and then the files will be simpler, as they'll only have to contain the actual patterns, with no 'd' command. > > > >> > > $(_LINT_man_mandoc): $(_MANDIR)/%.lint-man.mandoc.touch: $(MANDIR)/% | $$(@D)/ > > $(info LINT (mandoc) $@) > > ! ($(MANDOC) -man $(MANDOCFLAGS) $< 2>&1 \ > > | $(GREP) -v 'STYLE: lower case character in document title:' \ > > | $(GREP) -v 'UNSUPP: ignoring macro in table:' \ > > | $(GREP) -v 'WARNING: cannot parse date, using it verbatim: TH (date)' \ > > | $(GREP) -v 'WARNING: empty block: UR' \ > > | $(GREP) -v 'WARNING: missing date, using "": TH' \ > > | $(GREP) -v 'WARNING: undefined escape, printing literally: \\\\' \ > > ||:; \ > > ) \ > > | $(GREP) '.' >&2 > > touch $@ > > > > $(_LINT_mdoc_mandoc): $(_MANDIR)/%.lint-mdoc.mandoc.touch: $(MANDIR)/% | $$(@D)/ > > $(info LINT (mandoc) $@) > > ! ($(MANDOC) -mdoc $(MANDOCFLAGS) $< 2>&1 \ > > | $(GREP) -v 'STYLE: operating system explicitly specified: Os ' \ > > | $(GREP) -v 'WARNING: cross reference to self: Xr ' \ > > ||:; \ > > ) \ > > | $(GREP) '.' >&2 > > touch $@ > > > > > > grep(1) is your tool for disabling unwanted diagnostics. ;) > > sed(1) is a better tool. No, grep is even better ;) But thanks for the idea! _______________________________________________________ Reply to this item at: <https://savannah.gnu.org/bugs/?62776> _______________________________________________ Message sent via Savannah https://savannah.gnu.org/