gelinive

Créer des profils du manteau neigeux - retour accueil

git clone git://bebou.netlib.re/gelinive
Log | Files | Refs | README |

gelinive.cgi (694B)


      1 #! /bin/sh
      2 
      3 tempdir=$(mktemp -d)
      4 trap "rm -rf $tempdir" EXIT
      5 
      6 read -r delim
      7 cat | head -n-1 > $tempdir/data
      8 
      9 getblock() {
     10 	sed -n "/name=\"$1\"/,/------/ p" $tempdir/data
     11 }
     12 
     13 getvalue() {
     14 	sed -E "s/$delim//;s/$//" |
     15 		grep -av "^$" |
     16 		tail -n+2
     17 }
     18 
     19 uploadfile() {
     20 	grep -aEv "^(Content|------)" | tail -n+2 | sed '$ d' > $tempdir/$1.tsv
     21 }
     22 
     23 titre=$(getblock "titre" | getvalue)
     24 getblock "releve" | uploadfile releve
     25 getblock "temp" | uploadfile temp
     26 
     27 echo "Content-Type: text/html"
     28 echo ""
     29 
     30 < $tempdir/releve.tsv gelinive -t "$titre" -f $tempdir/tab.tsv -c $tempdir/temp.tsv > ../image.png
     31 
     32 echo "<img src='../image.png'>"
     33 
     34 <<. cat
     35 <pre>
     36 q 	P 	n 	h 	e 	d 	R 	H
     37 $(cat $tempdir/tab.tsv)
     38 </pre>
     39 .