Fortune for sink's current commit: Curse − 凶
|9 months ago|
|.gitignore||9 months ago|
|LICENSE||9 months ago|
|Makefile||9 months ago|
|README.md||9 months ago|
|comp_features.h||9 months ago|
|sink.c||9 months ago|
sink - sinks all input into
Small and fast util that re-routes
stdout (and optionally,
stderr) of a program to
/dev/null without needing to spawn a (sub-)shell.
Can be useful in some situations (see example below.)
Command usage is in the form of:
./sink [<program name> [<arguments...>]].
$ sink cat sink.c # Identical to `>>/dev/null 0>&1 cat sink.c`, but will not cause cat to error on `stdin` being a redirect to an output stream.
When invoked with
execve()s into the program (if it exists or is found in
<arguments....> and a passed-through
envp (see below in Compiler flags on changing this behaviour.)
make && sudo make install to build with full optimisations and install
sudo make uninstall to remove.)
To build for debugging, run
Set the following to the environment variable
FEATURES when invoking
make to build with the speficied features' behaviour (e.g.
FEATURES=NO_SEARCH_PATH\ NO_ENV make.)
When a debug-mode splash screen is printed, the features the binary was compiled with are also printed.
REPLACE_STDERR- Re-route the child program's
stderrstream to the sink as well. By default, it is passed through as default.
NO_SEARCH_PATH- Prevent the program looking up its argument in the
envppassthrough to the
DEBUG_IGNORE_SPLASH- Do not print project and version info in debug builds on startup.
The program must have been built before installation, and installation and uninstallation must be done as root.
make install will install
$(DESTDIR)$(PREFIX)/bin. You can override this by setting
PREFIX=/path/to/usr make install
To install a different target, for example,
make debug && sudo make install OUTPUT=sink-debug (
OUTPUT is the binary name.)
NOTE: You must specify the same
OUTPUT value for
make uninstall if done this way.
If building on a VPS, you may want to run
TARGET_ARCH= make instead of
make, to build for generic CPU instead of the default native target for optimised (
By default, the program is entirely statically linked. To override this, run
SHARED=yes make, for any building target.
To build optimised without stripping the symbol table, run
make release or
For installing without stripping the symbol table, run
sudo make install STRIP=true; the effect is the same as
STRIP=: which does not work for the
release: optimised build. output:
debug: unoptimised build with debuginfo. output:
clean: remove all previous object and binary output files
PREFIX- The installation path prefix. Defaults to
/usr/localif not set.
SHARED- set to "yes" to prevent passing
TARGET_ARCH- target arch (
-march=), or set
TARGET_ARCH=to force set to generic target. (default [release only]:
COMMON_FLAGS- passthrough to cc
LDFLAGS- passthrough to ld
DEBUG_LDFLAGS- passthrough to cc / ld on target
RELEASE_LDFLAGS- passthrough to cc / ld on target
Make overridable only
STRIP- Strip command for default output (stripped release) target (
make sink). set
make STRIP=:to prevent stripping entirely. (NOTE: When using
STRIP=:will not work, instead, paradoxically, set
STRIP=true, they have the same effect for all targets)
OUTPUT- The name of the output binary from the default target, and the binary that
uninstalltargets look for.
GPL'd with <3