cw.c: use C99, and with it simplify main.
cw.c: fix a potential NULL pointer dereference in remove_dir_from_path.