lex and gcc
$ ls fileio.cpp fileio.h list.cpp list.h phone.cpp phone.h scrio.cpp scrio.h showheaders test.c $ echo $? 0 $ files="*.cpp *.h *.c" $ echo $? 0 $ echo $files fileio.cpp list.cpp phone.cpp scrio.cpp fileio.h list.h phone.h scrio.h test.c $ echo $? 0 $ cat $files > sum.cpp $ echo $? 0 $ ./showheaders < sum.cpp Uncommented header filename(s): <stdio.h> <string.h> <malloc.h> "phone.h" "fileio.h" "scrio.h" "list.h" <string.h> <curses.h> "phone.h" "scrio.h" "fileio.h" <curses.h> <stdio.h> <stdarg.h> "phone.h" "scrio.h" "list.h" "phone.h" "constants.h" <set.h> <sockets.h> "mj.h" "helper.h" <curses.h> <string.h> <math.h> "queue.h" Commented header filename(s): "list2.h" <ncurses.h> <cursesn.h> <stdio.h> <stdio.h> <stdio.h> "list.h" <stdio.h> $ echo $? 0 $ ./showheaders -uc < sum.cpp Uncommented header filename(s): <stdio.h> <string.h> <malloc.h> "phone.h" "fileio.h" "scrio.h" "list.h" <string.h> <curses.h> "phone.h" "scrio.h" "fileio.h" <curses.h> <stdio.h> <stdarg.h> "phone.h" "scrio.h" "list.h" "phone.h" "constants.h" <set.h> <sockets.h> "mj.h" "helper.h" <curses.h> <string.h> <math.h> "queue.h" Commented header filename(s): "list2.h" <ncurses.h> <cursesn.h> <stdio.h> <stdio.h> <stdio.h> "list.h" <stdio.h> $ echo $? 0 $ ./showheaders -cu < sum.cpp Uncommented header filename(s): <stdio.h> <string.h> <malloc.h> "phone.h" "fileio.h" "scrio.h" "list.h" <string.h> <curses.h> "phone.h" "scrio.h" "fileio.h" <curses.h> <stdio.h> <stdarg.h> "phone.h" "scrio.h" "list.h" "phone.h" "constants.h" <set.h> <sockets.h> "mj.h" "helper.h" <curses.h> <string.h> <math.h> "queue.h" Commented header filename(s): "list2.h" <ncurses.h> <cursesn.h> <stdio.h> <stdio.h> <stdio.h> "list.h" <stdio.h> $ echo $? 0 $ ./showheaders -u -c < sum.cpp Uncommented header filename(s): <stdio.h> <string.h> <malloc.h> "phone.h" "fileio.h" "scrio.h" "list.h" <string.h> <curses.h> "phone.h" "scrio.h" "fileio.h" <curses.h> <stdio.h> <stdarg.h> "phone.h" "scrio.h" "list.h" "phone.h" "constants.h" <set.h> <sockets.h> "mj.h" "helper.h" <curses.h> <string.h> <math.h> "queue.h" Commented header filename(s): "list2.h" <ncurses.h> <cursesn.h> <stdio.h> <stdio.h> <stdio.h> "list.h" <stdio.h> $ echo $? 0 $ ./showheaders -c -u < sum.cpp Uncommented header filename(s): <stdio.h> <string.h> <malloc.h> "phone.h" "fileio.h" "scrio.h" "list.h" <string.h> <curses.h> "phone.h" "scrio.h" "fileio.h" <curses.h> <stdio.h> <stdarg.h> "phone.h" "scrio.h" "list.h" "phone.h" "constants.h" <set.h> <sockets.h> "mj.h" "helper.h" <curses.h> <string.h> <math.h> "queue.h" Commented header filename(s): "list2.h" <ncurses.h> <cursesn.h> <stdio.h> <stdio.h> <stdio.h> "list.h" <stdio.h> $ echo $? 0 $ ./showheaders -u < sum.cpp Uncommented header filename(s): <stdio.h> <string.h> <malloc.h> "phone.h" "fileio.h" "scrio.h" "list.h" <string.h> <curses.h> "phone.h" "scrio.h" "fileio.h" <curses.h> <stdio.h> <stdarg.h> "phone.h" "scrio.h" "list.h" "phone.h" "constants.h" <set.h> <sockets.h> "mj.h" "helper.h" <curses.h> <string.h> <math.h> "queue.h" $ echo $? 0 $ ./showheaders -c < sum.cpp Commented header filename(s): "list2.h" <ncurses.h> <cursesn.h> <stdio.h> <stdio.h> <stdio.h> "list.h" <stdio.h> $ echo $? 0 $ ./showheaders < test.c Uncommented header filename(s): <string.h> <math.h> "queue.h" Commented header filename(s): <stdio.h> <stdio.h> <stdio.h> "list.h" <stdio.h> $ echo $? 0 $