#!/bin/sh

# disable filename globbing

 echo Content-type: text/html
 echo
BASE=`pwd`
APPLDIR=$BASE/appl
DATADIR=$BASE/data
PATH=$PATH:$BASE/ihd/bin:.
export PATH APPLDIR DATADIR

proce=../../xls/es/proce.dat
ihmq proce H00"^ " H01"^ " H02"^ " H03"^ " H04"^ " H05"^ " d00"^ " d01"^ " d02"^ " d03"^ " d04"^ " |
awk -F"^" '
function trail(txt) { while (substr(txt,length(txt),1)==" ") txt=substr(txt,1,length(txt)-1); return (txt) }
{
for (i=1; i<NF; i++) printf "%s^",trail($i)
 printf "%s\n",trail($i)
} ' > $proce

# |  1 H00 fileno 05 15   0 | 2 H01 barcod 03 00   5 | 3 H02 descri 40 00   8 |
# |  4 H03 unidad 02 51  48 | 5 H04 observ 256 11  50 | 6 H05 status 02 55 306 |

#  7 D00 espess  3   01 |  8 D01 marcas  15  00 |  9 D02 colors  15  00 | 
  10 D03 costos  10  01 | 11 D04 obserc  50  00 | 
awk ' BEGIN { exit }
END {
print "<html>"
print "<head>"
print "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1252\">"
print "<meta name=\"GENERATOR\" content=\"Inhedo 4gt 1.0\">"
print "<meta name=\"ProgId\" content=\"Inhedo Form Generator\">"
print "<META HTTP-EQUIV=\"refresh\" content=\"0;URL=http://xls.inhedo.com/es/Proce.xls\">"
print "</head>"
print "</body>"
print "</head>"
}  '
