if (0)
{
char p[256];
p[0] = ':';
strcpy(p+1, path);
if (p[ strlen(p)-1 ] != ':')
	strcat(p, ":");
strcpy(path, p);
}

{
char p[256];
p[0] = ':';
strcpy(p+1, path);
strcpy(path, p);
}

if (0)
printf("[rmdir] default_dir_id %lx\n", default_dir_id);

/* remove any working dir info */
if (0)
{
	long dirid;
	CInfoPBRec iopb;
	int index;
	
	/* first get dir id */
	iopb.hFileInfo.ioNamePtr = pname(path);
	iopb.hFileInfo.ioVRefNum = default_vrefnum;
	iopb.hFileInfo.ioDirID = default_dir_id;
	
	iopb.hFileInfo.ioFDirIndex = 0;
	result = PBGetCatInfo(&iopb, FALSE);
	
	if (result != noErr)
		return result;

	dirid = iopb.hFileInfo.ioDirID;

	/* then scan wd's */
	for (index = 1;; index++)
		{
		WDPBRec wd_iopb;

		wd_iopb.ioVRefNum = default_vrefnum;
		wd_iopb.ioNamePtr = (StringPtr)0;
		wd_iopb.ioWDProcID = 0;
		wd_iopb.ioWDVRefNum = 0;
		wd_iopb.ioWDIndex = index;
		result = PBGetWDInfo(&wd_iopb, FALSE);
printf("[rmdir] index %d, result %d, got dirid %lx, want %lx\n",
index, result, wd_iopb.ioWDDirID, dirid);
		if (result != noErr)
			break;
		
		if (wd_iopb.ioWDDirID == dirid)
			{
printf("[rmdir] got wd, index %d\n", index);
			PBCloseWD(&wd_iopb, FALSE);
			}
		}
}
