From 07c61498bd7fa6166029c1ab093a35f82d926667 Mon Sep 17 00:00:00 2001 From: Benjamin Barenblat Date: Tue, 25 Jan 2022 18:23:21 -0500 Subject: skiphead, a program to preserve headers in a pipeline This is a faster, more robust rewrite of a shell script I wrote a few years ago to preserve headers when grepping through program output. I can never remember what the headers are when I run things like 'ps', so being able to say something like 'ps -ef | skiphead grep systemd' is useful. As a bonus, the program detects your locale and automatically displays help and error messages using the correct encoding. --- build.ninja | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 build.ninja (limited to 'build.ninja') diff --git a/build.ninja b/build.ninja new file mode 100644 index 0000000..e63787f --- /dev/null +++ b/build.ninja @@ -0,0 +1,38 @@ +# Copyright 2022 Benjamin Barenblat +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. + +ninja_required_version = 1.3 + +rule cxx + command = g++ -MD -MT $out -MF $out.d -pipe -std=c++20 -Wall -Wextra $ + -Wno-sign-compare -fdiagnostics-show-template-tree -O3 -flto $ + -fstack-protector-strong -Wformat -Werror=format-security -DNDEBUG $ + -ffunction-sections -fdata-sections -c $in -o $out + description = Compiling $out + depfile = $out.d + deps = gcc + +rule link + command = g++ -fuse-ld=gold -flto -Wl,-O2 -Wl,--gc-sections -Wl,--as-needed $ + -o $out $in && strip $out + description = Linking $out + +rule re2c + command = re2c --empty-class error --no-generation-date -W $in -o $out + description = Generating DFAs in $out + +build goldfishlocale.o: cxx goldfishlocale.cc +build skiphead.cc: re2c skiphead.re +build skiphead.o: cxx skiphead.cc +build skiphead: link goldfishlocale.o skiphead.o -- cgit v1.2.3