* updated cmake (3.28.5 -> 3.30.5)
[t2sde.git] / misc / output / parse-config
blob3d65c06e43dec5ecfee56f376b0ac2d540584491
1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # T2 SDE: misc/output/parse-config
3 # Copyright (C) 2004 - 2023 The T2 SDE Project
4 # Copyright (C) 1998 - 2003 ROCK Linux Project
5
6 # This Copyright note is generated by scripts/Create-CopyPatch,
7 # more information can be found in the files COPYING and README.
8
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License version 2.
11 # --- T2-COPYRIGHT-NOTE-END ---
13 . misc/output/terminal
15 output_proc() {
16         columns=$1
17         plugins=""
18         for x in $( ls misc/output ); do
19                 if [ -f misc/output/$x/functions.in ]; then
20                         eval "y=\$SDECFG_OUTPUT_$( echo $x | tr a-z A-Z )"
21                         if [ "$y" = 1 ]; then
22                                 . misc/output/$x/functions.in
23                                 plugins="$plugins $x"
24                         fi
25                 fi
26         done
28         while read -r type data; do
29                 # always output to the terminal
30                 for plugin in terminal $plugins; do
31                         eval "echo_${type}_${plugin} $data"
32                 done
33         done
34         exit 0
37 if [ -z "$SDE_OUPUT_PLUGIN_PROC_ACTIVE" ]; then
38         export SDE_OUPUT_PLUGIN_PROC_ACTIVE=1
40         # since the output plugin's stdin is the pipe, we help it out
41         # with the columns for pretty printing output
42         [ "${columns:=$COLUMNS}" ] || columns="$( stty size 2> /dev/null | cut -d' ' -f2 )"
43         [ "$columns" ] || columns=80
44         exec 199> >( output_proc $columns )
47 echo_sched() {
48         local request="$1" tag; shift
49         local nl=$'\n' tc="'"
51         # add each argument, seperated in quotes, after newlines and
52         # tick quotes got escaped
53         for tag; do
54                 tag=${tag//\\\\/\\\\}
55                 tag=${tag//$tc/\\$tc}
56                 tag=${tag//$nl/\\n}
57                 request="$request \$'$tag'"
58         done
60         echo "$request" >&199
63 echo_header()     { echo_sched header     "$@"; }
64 echo_status()     { echo_sched status     "$@"; }
65 echo_warning()    { echo_sched warning    "$@"; }
66 echo_error()      { echo_sched error      "$@"; }
67 echo_pkg_deny()   { echo_sched pkg_deny   "$@"; }
68 echo_pkg_start()  { echo_sched pkg_start  "$@"; }
69 echo_pkg_finish() { echo_sched pkg_finish "$@"; }
70 echo_pkg_abort()  { echo_sched pkg_abort  "$@"; }
71 echo_errorquote() { echo_sched errorquote "$@"; }