Code:
char *img_basename(filename)
char *filename;
{
  char *new, *part;
  int len, dex;

  len = strlen(filename);  dex = len - 1;
  while (dex > -1) {
    if (filename[dex] == '/') {
      break;
    } else {
      dex--;
    }
  }
  dex++;
  part = &(filename[dex]);
  len = strlen(part);
  new = (char *) malloc ((unsigned) ((len + 1) * sizeof (char)));
  strcpy(new, part);
  return(new);
}
tis if (filename[dex] == '/') is for filename with spaces??
and wat wil b copied in new wit tis....... strcpy(new, part);