-Filename filename_from_str(const char *str)
-{
- Filename ret;
- Str255 tmp;
-
- /* XXX This fails for filenames over 255 characters long. */
- c2pstrcpy(tmp, str);
- FSMakeFSSpec(0, 0, tmp, &ret.fss);
- return ret;
-}
-
-/*
- * Convert a filename to a string for display purposes.
- * See pp 2-44--2-46 of IM:Files
- *
- * XXX static storage considered harmful
- */
-const char *filename_to_str(const Filename *fn)
-{
- CInfoPBRec pb;
- Str255 dirname;
- OSErr err;
- static char *path = NULL;
- char *newpath;
-
- if (path != NULL) sfree(path);
- path = smalloc(fn->fss.name[0]);
- p2cstrcpy(path, fn->fss.name);
- pb.dirInfo.ioNamePtr = dirname;
- pb.dirInfo.ioVRefNum = fn->fss.vRefNum;
- pb.dirInfo.ioDrParID = fn->fss.parID;
- pb.dirInfo.ioFDirIndex = -1;
- do {
- pb.dirInfo.ioDrDirID = pb.dirInfo.ioDrParID;
- err = PBGetCatInfoSync(&pb);
-
- /* XXX Assume not A/UX */
- newpath = smalloc(strlen(path) + dirname[0] + 2);
- p2cstrcpy(newpath, dirname);
- strcat(newpath, ":");
- strcat(newpath, path);
- sfree(path);
- path = newpath;
- } while (pb.dirInfo.ioDrDirID != fsRtDirID);
- return path;
-}
-
-int filename_equal(Filename f1, Filename f2)