#! /bin/sh

# sysmask test
../bin/true 2>/dev/null && {
 echo Cannot compile c: security protection unavailable. >&2
 exit
}

echo "$wims_exec_parm" | sed 's/\&#36;/\$/g' >$tmp_dir/test.c
rm -f $tmp_dir/main.c

echo "
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <time.h>

int test(void);

int main(int argc, char *argv[])
{
	time(0);
	return test();
}

#define main test
#include \"test.c\"

" >$tmp_dir/main.c

w_wims_priv_chroot=tmpdir
export w_wims_priv_chroot
ulimit -f 256
bin/ch..root gcc -Wall main.c -lm -o test || exit

[ -s $tmp_dir/test ] || exit

#rm -f $tmp_dir/*.c
ulimit -f 64
bin/ch..root /lib/ld-2.3.2.so ./test

