- Changed all the perror() calls to fprintf(stderr, ....) calls
- Replaced the mkdir system call with the mkdir() API
- Added a function to do recursive calls to mkdir() to create
  intermediate directories, if any.