# The commands in this file compile and run the linked-list example
# program with any of several widely used Unix shells.
# For shells in the sh family, such as bash:
#
#     $ . ./README_pmem_list.txt
#
# For csh or tcsh:
#
#     % source ./README_pmem_list.txt

echo ''
echo 'compile twice: once for diagnostics, once for debugging'
echo '' ; rm -f list ; gcc -std=c11 -pedantic -Wall -Wextra -O3 -o list list.c pmem.c
echo '- - - - -'
echo '' ; rm -f list ; gcc -std=c11 -pedantic -Wall -Wextra -g  -o list list.c pmem.c
echo ''
echo 'create sparse file whose size is multiple of system page size'
echo ''
rm -f list.bf ; truncate -s `getconf PAGE_SIZE | gawk '{print $1 * 100}'` list.bf
ls -l list.bf
echo ''
echo '---------- run first time'
echo ''
(echo 'wun too' ; echo 'free fore' ; echo '[dump]') | ./list list.bf
echo ''
echo '---------- run second time'
echo ''
(echo fyve ; echo sicks ; echo '[dump]') | ./list list.bf
echo ''
echo 'clean up:  delete temporary files'
rm -f list.bf list
echo ''

