|
|
spirofilter - rfcommd - RFCOMM daemon to run filters on clients. |
|
|
 |
git clone git://bitreich.org/rfcommd/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/rfcommd/ (git://bitreich.org) |
|
|
 |
Log |
|
|
 |
Files |
|
|
 |
Refs |
|
|
 |
Tags |
|
|
 |
README |
|
|
 |
LICENSE |
|
|
|
--- |
|
|
|
spirofilter (807B) |
|
|
|
--- |
|
|
|
1 #!/bin/sh |
|
|
|
2 |
|
|
|
3 tmpfile="$(mktemp)" |
|
|
|
4 spirometrydb="/home/david/share/spirometry" |
|
|
|
5 |
|
|
|
6 datetime="$(date +%Y-%m-%d-%H-%M-%S)" |
|
|
|
7 if [ $# -gt 0 ]; |
|
|
|
8 then |
|
|
|
9 infile="$1" |
|
|
|
10 case "${infile}" in |
|
|
|
11 /dev/rfcomm*) |
|
|
|
12 stty -F "${infile}" raw -echo -echoe -echok |
|
|
|
13 ;; |
|
|
|
14 *) |
|
|
|
15 datetime="$(echo $infile \ |
|
|
|
16 | cut -d- -f 2- \ |
|
|
|
17 | cut -d'.' -f 1)" |
|
|
|
18 ;; |
|
|
|
19 esac |
|
|
|
20 else |
|
|
|
21 infile="/dev/stdin" |
|
|
|
22 fi |
|
|
|
23 |
|
|
|
24 cat "${infile}" > "${tmpfile}" |
|
|
|
25 dbpath="${spirometrydb}" |
|
|
|
26 cd "${dbpath}" |
|
|
|
27 outfile="spirometry-$(cat "${tmpfile}" \ |
|
|
|
28 | tr -d '\r' \ |
|
|
|
29 | iconv -f iso8859-1 -t utf-8 \ |
|
|
|
30 | grep -a "^NAME" \ |
|
|
|
31 | sed 's,NAME \([^ ]*\)[ ]*\([^ ]*\)[ ]*#ID \([0-9]*\)[ ]*,\1-\2-\3,' \ |
|
|
|
32 | sed 's, ,_,g; s,/,_,g;')-${datetime}.pcl" |
|
|
|
33 mv "${tmpfile}" "${outfile}" 2>/dev/null |
|
|
|
34 chown david:david "${outfile}" 2>/dev/null |
|
|
|
35 |
|
|
|
36 cat "${outfile}" \ |
|
|
|
37 | sed '/Daten von spirolab III Ver/d' \ |
|
|
|
38 | lpr |
|
|
|
39 |
|