diff options
author | cheusov <cheusov@pkgsrc.org> | 2012-05-12 15:15:35 +0000 |
---|---|---|
committer | cheusov <cheusov@pkgsrc.org> | 2012-05-12 15:15:35 +0000 |
commit | 391d971736d40bbe63bed5a8fddbef1706e3d0f4 (patch) | |
tree | 63e40e6255ddf785b8a29f59219e7fd6e6f7882c /textproc/colorit | |
parent | c7d617d121818a85f0b22ffce7b96669bbc70ce9 (diff) | |
download | pkgsrc-391d971736d40bbe63bed5a8fddbef1706e3d0f4.tar.gz |
colorit is a simple utility for colorizing input texts
Diffstat (limited to 'textproc/colorit')
22 files changed, 600 insertions, 0 deletions
diff --git a/textproc/colorit/DESCR b/textproc/colorit/DESCR new file mode 100644 index 00000000000..1376361b5fb --- /dev/null +++ b/textproc/colorit/DESCR @@ -0,0 +1,2 @@ +colorit(1) is a simple utility for colorizing text input +using escape sequences. diff --git a/textproc/colorit/MESSAGE b/textproc/colorit/MESSAGE new file mode 100644 index 00000000000..5c65d0ea54a --- /dev/null +++ b/textproc/colorit/MESSAGE @@ -0,0 +1,9 @@ +=========================================================================== +$NetBSD: MESSAGE,v 1.1.1.1 2012/05/12 15:15:35 cheusov Exp $ + +How to use example files: +- cp -Rp ${PREFIX}/share/examples/colorit/.colorit.d ~ +- cp ${PREFIX}/share/examples/colorit/colorit_* ~ +- echo '. ~/colorit_aliases' >> ~/.shrc + +=========================================================================== diff --git a/textproc/colorit/Makefile b/textproc/colorit/Makefile new file mode 100644 index 00000000000..794cd6c8187 --- /dev/null +++ b/textproc/colorit/Makefile @@ -0,0 +1,33 @@ +# $NetBSD: Makefile,v 1.1.1.1 2012/05/12 15:15:35 cheusov Exp $ + +.include "../../textproc/dict-server/Makefile.common" + +PKGNAME= ${DISTNAME:S/dictd/colorit/} +CATEGORIES= textproc +COMMENT= Utility for coloring output + +LICENSE= public-domain + +USE_TOOLS+= gawk:run + +INSTALLATION_DIRS+= bin ${PKGMANDIR}/man1 ${EGDIR} ${EGDIR}/.colorit.d + +EGDIR= ${PREFIX}/share/examples/colorit + +DISTINFO_FILE= ${.CURDIR}/../../textproc/dict-server/distinfo +PATCHDIR= ${.CURDIR}/../../textproc/dict-server/patches + +do-build: + set -e; cd ${WRKSRC}; \ + sed 's|@sysconfdir@|${PKG_SYSCONFDIR}|' colorit.in > colorit; \ + sed 's|@SYSCONFDIR@|${PKG_SYSCONFDIR}|' colorit.1.in > colorit.1; \ + chmod +x colorit + +do-install: + set -e; cd ${WRKSRC}; \ + ${INSTALL_SCRIPT} colorit ${DESTDIR}${PREFIX}/bin; \ + ${INSTALL_MAN} colorit.1 ${DESTDIR}${PREFIX}/${PKGMANDIR}/man1; \ + cp ${.CURDIR}/files/colorit_* ${DESTDIR}${EGDIR}/; \ + cp -R ${.CURDIR}/files/.colorit.d ${DESTDIR}${EGDIR}/ + +.include "../../mk/bsd.pkg.mk" diff --git a/textproc/colorit/PLIST b/textproc/colorit/PLIST new file mode 100644 index 00000000000..4b76fd974ed --- /dev/null +++ b/textproc/colorit/PLIST @@ -0,0 +1,21 @@ +@comment $NetBSD: PLIST,v 1.1.1.1 2012/05/12 15:15:35 cheusov Exp $ +bin/colorit +man/man1/colorit.1 +share/examples/colorit/.colorit.d/aptget +share/examples/colorit/.colorit.d/changelog +share/examples/colorit/.colorit.d/colors +share/examples/colorit/.colorit.d/configure +share/examples/colorit/.colorit.d/dict +share/examples/colorit/.colorit.d/diff +share/examples/colorit/.colorit.d/gcc +share/examples/colorit/.colorit.d/ldbunittest +share/examples/colorit/.colorit.d/ls +share/examples/colorit/.colorit.d/make +share/examples/colorit/.colorit.d/patch +share/examples/colorit/.colorit.d/ps +share/examples/colorit/.colorit.d/pstree +share/examples/colorit/.colorit.d/stardict +share/examples/colorit/.colorit.d/ts +share/examples/colorit/.colorit.d/wdiff +share/examples/colorit/colorit_aliases +share/examples/colorit/colorit_funcs diff --git a/textproc/colorit/files/.colorit.d/aptget b/textproc/colorit/files/.colorit.d/aptget new file mode 100644 index 00000000000..7653d539cc8 --- /dev/null +++ b/textproc/colorit/files/.colorit.d/aptget @@ -0,0 +1,16 @@ +include(HOME/.colorit.d/colors) + +changequote([[, ]]) +changequote([[``]], [['']]) + +mark "^E:.*$" fg_ltred col_normal +mark "Could not connect to" fg_ltred col_normal +mark "Failed to fetch" fg_ltred col_normal + +mark "Preparing to replace" fg_yellow col_normal + +mark "Unpacking" fg_yellow col_normal +mark "Setting up" fg_yellow col_normal +mark "Setting up" fg_yellow col_normal + +mark "[[:alpha:]][[:alnum:]]+ [[:digit:]][[:alnum:].-]+" fg_white col_normal diff --git a/textproc/colorit/files/.colorit.d/changelog b/textproc/colorit/files/.colorit.d/changelog new file mode 100644 index 00000000000..ac05f4912c6 --- /dev/null +++ b/textproc/colorit/files/.colorit.d/changelog @@ -0,0 +1,10 @@ +include(HOME/.colorit.d/colors) + +changequote([[, ]]) +changequote([[``]], [['']]) + +mark "^[[:alnum:]].*$" fg_white col_normal +mark "^[[:space:]]--.*" fg_yellow col_normal +mark "_[[:alnum:]]+_" fg_yellow col_normal +mark "^[*][[:space:]]" fg_white col_normal +mark "^--------------+" fg_white col_normal diff --git a/textproc/colorit/files/.colorit.d/colors b/textproc/colorit/files/.colorit.d/colors new file mode 100644 index 00000000000..9613f86b505 --- /dev/null +++ b/textproc/colorit/files/.colorit.d/colors @@ -0,0 +1,33 @@ +define(`fg_black', `\033[0;30m') +define(`fg_red', `\033[0;31m') +define(`fg_green', `\033[0;32m') +define(`fg_brown', `\033[0;33m') +define(`fg_blue', `\033[0;34m') +define(`fg_purple', `\033[0;35m') +define(`fg_cyan', `\033[0;36m') +define(`fg_licyan', `\033[0;37m') + +define(`fg_gray', `\033[1;30m') +define(`fg_ltred', `\033[1;31m') +define(`fg_ltgreen', `\033[1;32m') +define(`fg_yellow', `\033[1;33m') +define(`fg_ltblue', `\033[1;34m') +define(`fg_ltpurple', `\033[1;35m') +define(`fg_ltcyan', `\033[1;36m') +define(`fg_white', `\033[1;37m') + +define(`bg_black', `\033[0;40m') +define(`bg_red', `\033[0;41m') +define(`bg_green', `\033[0;42m') +define(`bg_yellow', `\033[0;43m') +define(`bg_blue', `\033[0;44m') +define(`bg_purple', `\033[0;45m') +define(`bg_cyan', `\033[0;46m') +define(`bg_white', `\033[0;47m') + +define(`col_underline', `\033[04m') +define(`col_brighten', `\033[01m') + +define(`col_normal', `\033[1;0m') + +#define(`fg_white', `\033[1m') diff --git a/textproc/colorit/files/.colorit.d/configure b/textproc/colorit/files/.colorit.d/configure new file mode 100644 index 00000000000..b88d44de2ab --- /dev/null +++ b/textproc/colorit/files/.colorit.d/configure @@ -0,0 +1,7 @@ +include(HOME/.colorit.d/colors) + +changequote([[, ]]) +changequote([[``]], [['']]) + +mark " no *$" fg_white col_normal +mark "^[.] *$" "fg_white .---------------------------------------------------" col_normal diff --git a/textproc/colorit/files/.colorit.d/dict b/textproc/colorit/files/.colorit.d/dict new file mode 100644 index 00000000000..65a75ef4546 --- /dev/null +++ b/textproc/colorit/files/.colorit.d/dict @@ -0,0 +1,38 @@ +include(HOME/.colorit.d/colors) + +changequote([[, ]]) +changequote([[``]], [['']]) + +mark "From.*" fg_white col_normal +mark "^ +_[IVXLC]+" fg_white col_normal +mark "^ +[0-9]+[.>]" fg_white col_normal +mark "^ +[0-9]+[:]" fg_green col_normal +mark "_[^ ]+[.]" fg_ltblue col_normal + +mark [{][^{}]+[}] fg_yellow col_normal +mark ^[[:space:]][0-9][0-9]?[:).] col_brighten fg_cyan +mark NAME fg_white col_normal +mark SYNOPSIS fg_white col_normal +mark "([[:upper:]]+ )?DESCRIPTION" fg_white col_normal +mark RETURN.*VALUE fg_white col_normal +mark ERRORS fg_white col_normal +mark APPLICATION.*USAGE fg_white col_normal +mark SEE.*ALSO fg_white col_normal +mark EXAMPLES fg_white col_normal +mark DERIVATION fg_white col_normal +mark FUTURE.DIRECTIONS fg_white col_normal +mark OPTIONS fg_white col_normal +mark OPERANDS fg_white col_normal +mark "INPUT FILES" fg_white col_normal +mark "OUTPUT FILES" fg_white col_normal +mark "ENVIRONMENT VARIABLES" fg_white col_normal +mark HISTFILE fg_white col_normal +mark STDIN fg_white col_normal +mark STDOUT fg_white col_normal +mark STDERR fg_white col_normal +mark " ENV( |$)" fg_white col_normal +mark "ASYNCHRONOUS EVENTS" fg_white col_normal + +mark w?(void|long|char|unsigned|int)([[:space:]_]).*; fg_cyan col_normal + +mark `ine bg_` `fg_green+ +<green>` `</green>+ +col_normal` diff --git a/textproc/colorit/files/.colorit.d/diff b/textproc/colorit/files/.colorit.d/diff new file mode 100644 index 00000000000..c869efce857 --- /dev/null +++ b/textproc/colorit/files/.colorit.d/diff @@ -0,0 +1,17 @@ +include(HOME/.colorit.d/colors) + +changequote([[, ]]) +changequote([[``]], [['']]) + +# for unified output format +mark "^Index:.*$" fg_white col_normal +mark "^==============+" fg_white col_normal +mark "^[-][-][-].*$" fg_white col_normal +mark "^[+][+][+].*$" fg_white col_normal +mark "^[+].*$" fg_green col_normal +mark "^[-].*$" fg_red col_normal + +# for default output format +mark "^[>].*$" fg_green col_normal +mark "^[<].*$" fg_red col_normal +mark "^[0-9].*$" fg_white col_normal diff --git a/textproc/colorit/files/.colorit.d/gcc b/textproc/colorit/files/.colorit.d/gcc new file mode 100644 index 00000000000..b39883ee77c --- /dev/null +++ b/textproc/colorit/files/.colorit.d/gcc @@ -0,0 +1 @@ +include(HOME/.colorit.d/make) diff --git a/textproc/colorit/files/.colorit.d/ldbunittest b/textproc/colorit/files/.colorit.d/ldbunittest new file mode 100644 index 00000000000..7be2051d724 --- /dev/null +++ b/textproc/colorit/files/.colorit.d/ldbunittest @@ -0,0 +1,40 @@ +# +# COLORING OF LDB UNIT TEST OUTPUT +# +# Instructions: +# +# 1) place this file in your home directory +# 2) add the below code to your ~/.alias file +# +# if test -f ~/.colorit.d/ldbunittest; then +# +# UNIT_TEST_PROG=`which run_ldb_unit_test.rb` +# +# function run_ldb_unit_test.rb (){ +# if test -t 2; then +# "$UNIT_TEST_PROG" "$@" 3>&1 2>&1 1>&3 | colorit -P - -c ~/.colorit.d/ldbunittest 3>&1 2>&1 1>&3 +# awk "BEGIN {exit ${PIPESTATUS[0]}}" +# else +# "$UNIT_TEST_PROG" "$@" +# fi +# } +# +# fi +# + + +include(HOME/.colorit.d/colors) + +changequote([[, ]]) +changequote([[``]], [['']]) + +mark "^case_(start|end)" fg_white col_normal +mark "^(input|etalon|actual)(_(start|end))?" fg_yellow col_normal +mark "^(source file|description|state|id)" fg_green col_normal + +mark "\tFAILED$" fg_red col_normal +mark "^Failures: [1-9].*" fg_red col_normal +mark "^Tests:.+" fg_red col_normal + +mark "\tSUCCESS$" fg_green col_normal +mark "^Failures: 0" fg_green col_normal diff --git a/textproc/colorit/files/.colorit.d/ls b/textproc/colorit/files/.colorit.d/ls new file mode 100644 index 00000000000..4a32823b9c3 --- /dev/null +++ b/textproc/colorit/files/.colorit.d/ls @@ -0,0 +1,64 @@ +include(HOME/.colorit.d/colors) + +changequote([[, ]]) +changequote([[``]], [['']]) + +# color by permission +define(color_by_permission, `` +mark "(^$1.*[0-9][0-9]:?[0-9][0-9][[:space:]]+)([^[:space:]]+)" $2 col_normal +'') + +# d--------- +color_by_permission(d........., fg_white) + +# s--------- +color_by_permission(s........., fg_purple) + +# l--------- i.e. symbolic link +color_by_permission(l........., fg_green) + +# [bc]--------- +color_by_permission(b........., fg_red) +color_by_permission(c........., fg_red) + +# ---x------ i.e. executables +color_by_permission(...x......, fg_cyan) + +# color by extension +define(color_by_extension, `` +mark "([[:space:]][^[:space:]]+[.]$1[[:space:]]*$)" $2 col_normal +'') + +# archives +color_by_extension(ar, fg_red) +color_by_extension(tar, fg_red) +color_by_extension(gz, fg_red) +color_by_extension(bz2, fg_red) +color_by_extension(tbz, fg_red) +color_by_extension(tgz, fg_red) + +color_by_extension(rpm, fg_red) +color_by_extension(deb, fg_red) + +color_by_extension(arj, fg_red) +color_by_extension(taz, fg_red) +color_by_extension(lzh, fg_red) +color_by_extension(zip, fg_red) +color_by_extension(z, fg_red) +color_by_extension(Z, fg_red) + +# Windows executables +color_by_extension(cmd, fg_ltgreen) +color_by_extension(exe, fg_ltgreen) +color_by_extension(com, fg_ltgreen) +color_by_extension(bat, fg_ltgreen) + +# pictures and video +color_by_extension(jpg, fg_brown) +color_by_extension(gif, fg_brown) +color_by_extension(bmp, fg_brown) +color_by_extension(png, fg_brown) +color_by_extension(xbm, fg_brown) +color_by_extension(xpm, fg_brown) +color_by_extension(tif, fg_brown) +color_by_extension(xwd, fg_brown) diff --git a/textproc/colorit/files/.colorit.d/make b/textproc/colorit/files/.colorit.d/make new file mode 100644 index 00000000000..ec26e72a530 --- /dev/null +++ b/textproc/colorit/files/.colorit.d/make @@ -0,0 +1,51 @@ +include(HOME/.colorit.d/colors) + +changequote([[, ]]) +changequote([[``]], [['']]) + +# ICCc error messages +mark "[[:digit:]]+ of .*$" fg_red col_normal + +mark "warning.*: " fg_yellow col_normal + +mark "^[^ :]* " fg_white col_normal +mark " no$" fg_white col_normal + +mark "warning: " fg_yellow col_normal +mark "line [0-9]+: warning.*$" fg_yellow col_normal + +mark "^b?yacc: .*never reduced" fg_yellow col_normal +mark "^b?yacc: .*conflicts." fg_ltred col_normal +mark "^b?yacc: .*is untyped" fg_ltred col_normal + +mark "^[^.]*[.]y contains .*useless.*$" fg_yellow col_normal +mark "^byacc: 2 rules never reduced" fg_yellow col_normal + + +mark "syntax error" fg_ltred col_normal +mark "error:" fg_ltred col_normal +mark "No such file or directory" fg_ltred col_normal +mark "command not found" fg_ltred col_normal +mark "No rule to make target" fg_ltred col_normal +mark "no such directory" fg_ltred col_normal +mark "no such file" fg_ltred col_normal +mark "failed" fg_ltred col_normal +mark "FAILED" fg_ltred col_normal +mark "invalid" fg_ltred col_normal + +mark "undefined reference to" fg_ltred col_normal +mark "^conflicts:" fg_ltred col_normal + +mark "No input files" fg_ltred col_normal +mark "undefined reference to" fg_ltred col_normal +mark "^conflicts:.*$" fg_ltred col_normal +mark "^byacc:.*conflicts" fg_ltred col_normal +mark "^byacc:.*undefined" fg_ltred col_normal +mark "too few arguments" fg_ltred col_normal +mark "Aborted" fg_ltred col_normal +mark "[(]core dumped[)]" fg_ltred col_normal + +mark "^[^ ]*:[[:digit:]]+: " fg_ltblue col_normal +mark "^[^()]+[(][^()]+[)]:" fg_ltblue col_normal + +mark "^[^ :]* " fg_white col_normal diff --git a/textproc/colorit/files/.colorit.d/patch b/textproc/colorit/files/.colorit.d/patch new file mode 100644 index 00000000000..1061d567077 --- /dev/null +++ b/textproc/colorit/files/.colorit.d/patch @@ -0,0 +1,9 @@ +include(HOME/.colorit.d/colors) + +changequote([[, ]]) +changequote([[``]], [['']]) + +mark "^(---|\+\+\+).*$" fg_white col_normal +mark "^@@.*$" fg_blue col_normal +mark "^-.*$" fg_ltred col_normal +mark "^\+.*$" fg_green col_normal diff --git a/textproc/colorit/files/.colorit.d/ps b/textproc/colorit/files/.colorit.d/ps new file mode 100644 index 00000000000..a6543a8f70f --- /dev/null +++ b/textproc/colorit/files/.colorit.d/ps @@ -0,0 +1,7 @@ +include(HOME/.colorit.d/colors) + +changequote([[, ]]) +changequote([[``]], [['']]) + +mark "[(][(][^()]*[)][)]" fg_white col_normal +mark "[)][)][^()]+_[JNL][^()]+[(][(]" fg_red col_normal diff --git a/textproc/colorit/files/.colorit.d/pstree b/textproc/colorit/files/.colorit.d/pstree new file mode 100644 index 00000000000..9163eb3c51d --- /dev/null +++ b/textproc/colorit/files/.colorit.d/pstree @@ -0,0 +1,7 @@ +include(HOME/.colorit.d/colors) + +changequote([[, ]]) +changequote([[``]], [['']]) + +mark "^[^_]*$" fg_white col_normal +mark "_.*$" fg_ltblue col_normal diff --git a/textproc/colorit/files/.colorit.d/stardict b/textproc/colorit/files/.colorit.d/stardict new file mode 100644 index 00000000000..bc61b3b5dbd --- /dev/null +++ b/textproc/colorit/files/.colorit.d/stardict @@ -0,0 +1,22 @@ +include(HOME/.colorit.d/colors) + +changequote([[, ]]) +changequote([[``]], [['']]) + +# color by permission +define(color_by_permission, `` +mark "(^$1.*[0-9][0-9]:?[0-9][0-9][[:space:]]+)([^[:space:]]+)" $2 col_normal +'') + +color_by_permission(...x......, fg_cyan) + +# color by extension +define(color_by_extension, `` +mark "([[:space:]][^[:space:]]+[.]$1[[:space:]]*$)" $2 col_normal +'') + +# archives +color_by_extension(ar, fg_red) + +############################################################ +mark "<b>[^<>]*</b>" fg_white col_normal diff --git a/textproc/colorit/files/.colorit.d/ts b/textproc/colorit/files/.colorit.d/ts new file mode 100644 index 00000000000..7b89ef9d313 --- /dev/null +++ b/textproc/colorit/files/.colorit.d/ts @@ -0,0 +1,6 @@ +include(HOME/.colorit.d/colors) + +changequote([[, ]]) +changequote([[``]], [['']]) + +mark "_[^_]+($| )" fg_white col_normal diff --git a/textproc/colorit/files/.colorit.d/wdiff b/textproc/colorit/files/.colorit.d/wdiff new file mode 100644 index 00000000000..e5e27e684ce --- /dev/null +++ b/textproc/colorit/files/.colorit.d/wdiff @@ -0,0 +1,7 @@ +include(HOME/.colorit.d/colors) + +changequote([[, ]]) +changequote([[``]], [['']]) + +mark "\[[-]([^-]|-[^\]])*[-]\]" fg_red col_normal +mark "[{][+]([^+]|[+][^}])*[+][}]" fg_green col_normal diff --git a/textproc/colorit/files/colorit_aliases b/textproc/colorit/files/colorit_aliases new file mode 100644 index 00000000000..688eede489d --- /dev/null +++ b/textproc/colorit/files/colorit_aliases @@ -0,0 +1,22 @@ +# source this file from .shrc, .kshrc, .bashrc etc. in order to +# make utilities colorful + +# coloured utils +if true; then + . ~/colorit_funcs + + alias cvs_diff=colored_cvs_diff + alias cvs_wdiff=colored_cvs_wdiff + alias cvs_patch=colored_cvs_patch + alias diff=colored_diff + alias ls=colored_ls + alias g++=colored_gpp + alias gcc=colored_gcc + alias mkcmake=colored_mkcmake + alias make=colored_make + alias gmake=colored_gmake + alias bmake=colored_bmake + alias apt-get=colored_apt_get +else + alias cvs_diff='cvs diff' +fi diff --git a/textproc/colorit/files/colorit_funcs b/textproc/colorit/files/colorit_funcs new file mode 100644 index 00000000000..4f226bfe925 --- /dev/null +++ b/textproc/colorit/files/colorit_funcs @@ -0,0 +1,178 @@ +# Shell functions for generating colored output +# usage: alias ls=colored_ls +# alias diff=colored_diff +# alias make=colored_make +# ... + +: ${PROG_COLORIT=colorit} + +: ${PROG_MAKE=make} +: ${PROG_GMAKE=gmake} +: ${PROG_BMAKE=bmake} +: ${PROG_MKCMAKE=mkcmake} +: ${PROG_GPP=g++} +: ${PROG_GCC=gcc} +: ${CVS_PATCH=cvs_patch} +: ${CVS_WDIFF=cvs_wdiff} +: ${PROG_DIFF=diff} +: ${PROG_LS=ls} +: ${PROG_APT_GET=apt-get} +: ${PROG_NIH=nih} + +: ${COLORIT_ROOT=${HOME}/.colorit.d} + +colored_make (){ + if test -t 1 -a -f ${COLORIT_ROOT}/make; then + "$PROG_MAKE" "$@" 3>&1 2>&1 1>&3 | + ${PROG_COLORIT} -P - -c ${COLORIT_ROOT}/make 3>&1 2>&1 1>&3 + + __pipe_status_first + else + "$PROG_MAKE" "$@" + fi +} + +colored_gmake (){ + if test -t 1 -a -f ${COLORIT_ROOT}/make; then + "$PROG_GMAKE" "$@" 3>&1 2>&1 1>&3 | + ${PROG_COLORIT} -P - -c ${COLORIT_ROOT}/make 3>&1 2>&1 1>&3 + + __pipe_status_first + else + "$PROG_GMAKE" "$@" + fi +} + +colored_bmake (){ + if test -t 1 -a -f ${COLORIT_ROOT}/make; then + "$PROG_BMAKE" "$@" 3>&1 2>&1 1>&3 | + ${PROG_COLORIT} -P - -c ${COLORIT_ROOT}/make 3>&1 2>&1 1>&3 + + __pipe_status_first + else + "$PROG_BMAKE" "$@" + fi +} + +colored_mkcmake (){ + if test -t 1 -a -f ${COLORIT_ROOT}/make; then + "$PROG_MKCMAKE" "$@" 3>&1 2>&1 1>&3 | + ${PROG_COLORIT} -P - -c ${COLORIT_ROOT}/make 3>&1 2>&1 1>&3 + + __pipe_status_first + else + "$PROG_MKCMAKE" "$@" + fi +} + +colored_gpp (){ + if test -t 1 -a -f ${COLORIT_ROOT}/gcc; then + "$PROG_GPP" "$@" 3>&1 2>&1 1>&3 | + ${PROG_COLORIT} -P - -c ${COLORIT_ROOT}/gcc 3>&1 2>&1 1>&3 + + __pipe_status_first + else + "$PROG_GPP" "$@" + fi +} + +colored_gcc (){ + if test -t 1 -a -f ${COLORIT_ROOT}/gcc; then + "$PROG_GCC" "$@" 3>&1 2>&1 1>&3 | + ${PROG_COLORIT} -P - -c ${COLORIT_ROOT}/gcc 3>&1 2>&1 1>&3 + + __pipe_status_first + else + "$PROG_GCC" "$@" + fi +} + +colored_cvs_diff (){ + if test -t 1 -a -f ${COLORIT_ROOT}/diff; then + cvs diff "$@" | + ${PROG_COLORIT} -P - -c ${COLORIT_ROOT}/diff + + __pipe_status_first + else + cvs diff "$@" + fi +} + +colored_cvs_patch (){ + if test -t 1; then + "$CVS_PATCH" "$@" | + ${PROG_COLORIT} -P - -c ${COLORIT_ROOT}/diff + + __pipe_status_first + else + "$CVS_PATCH" "$@" + fi +} + +colored_cvs_wdiff (){ + if test -t 1 -a -f ${COLORIT_ROOT}/wdiff; then + "$CVS_WDIFF" "$@" | + ${PROG_COLORIT} -P - -c ${COLORIT_ROOT}/wdiff + + __pipe_status_first + else + "$CVS_WDIFF" "$@" + fi +} + +colored_diff (){ + if test -t 1 -a -f ${COLORIT_ROOT}/diff; then + "$PROG_DIFF" -u --exclude '.#*' --exclude '*~' --exclude CVS "$@" | + ${PROG_COLORIT} -P - -c ${COLORIT_ROOT}/diff + + __pipe_status_first + else + "$PROG_DIFF" -u --exclude '.#*' --exclude '*~' --exclude CVS "$@" + fi +} + +colored_ls (){ + if test -t 1 -a -f ${COLORIT_ROOT}/ls; then + "$PROG_LS" "$@" | + ${PROG_COLORIT} -P - -c ${COLORIT_ROOT}/ls + + __pipe_status_first + else + "$PROG_LS" "$@" + fi +} + +colored_apt_get (){ + if test "_$USER" != "_root"; then + PREF=sudo + fi + + if test -t 1 -a -f ${COLORIT_ROOT}/aptget; then + $PREF "$PROG_APT_GET" "$@" 3>&2 2>&1 1>&3 | + ${PROG_COLORIT} -P - -c ${COLORIT_ROOT}/aptget 3>&2 2>&1 1>&3 + else + $PREF "$PROG_APT_GET" "$@" + fi + + unset PREF +} + +colored_configure (){ + if test -r ./config; then + __configure=./config + elif test -r ./configure; then + __configure=./configure + else + echo "cannot find ./config or ./configure" + return 1 + fi + + if test -t 1 -a -f ${COLORIT_ROOT}/configure; then + sh "$__configure" "$@" | + ${PROG_COLORIT} -P - -c ~/.colorit.d/configure + + __pipe_status_first + else + sh "$__configure" "$@" + fi +} |