The cat program now runs correctly! Had to deviate from cookbook for ^D functionality (see exception.c:268).