copy from http://sourceforge.net/projects/cctool/