added printlist and freelist from scanner.c