#!/bin/sh


out='tmp.h'

>$out

echo '/* '                                                      >> $out
echo ' * Copyright (C) 2020,  Paul Sheer. All rights reserved.' >> $out
echo ' * '                                                      >> $out
echo ' * This software is provided without warranty. The author(s) disclaim liability for damages'      >> $out
echo ' * related to this software. All risk is assumed by you.' >> $out
echo ' * '                                                      >> $out
echo ' */'                                                      >> $out

echo ''                                 >> $out
echo '#ifndef DFWMALLOC_H'               >> $out
echo '#define DFWMALLOC_H'               >> $out
echo ''                                 >> $out
echo '#define USE_TLS           1'      >> $out
echo ''                                 >> $out

cat dfwmalloc.c | \
    sed -e '1,/End header/!D' | \
    egrep -v '^([/][*][ ]|[ ][*][ ]|[ ][*][/])' | \
    sed -e 's,[/][*].*[*][/], ,g'       >> $out
echo ''                                 >> $out
echo '#endif    /* DFWMALLOC_H */'       >> $out
echo ''                                 >> $out

cat $out | grep -v '@' | tr '\n' '@' | sed -e 's/@@@*/@@/g' | tr '@' '\n' > dfwmalloc.h
rm -f $out


