+#endif
+ return (GOOD);
+ }
+ }
+ /* NOTREACHED */
+}
+
+static int
+extractattr(char *path)
+{
+ while (spcl.c_flags & DR_EXTATTRIBUTES) {
+ switch (spcl.c_extattributes) {
+ case EXT_MACOSFNDRINFO:
+#ifdef DUMP_MACOSX
+ (void)extractfinderinfoufs(path);
+#else
+ msg("MacOSX not supported in this version, skipping\n");
+ skipfile();
+#endif
+ break;
+ case EXT_MACOSRESFORK:
+#ifdef DUMP_MACOSX
+ (void)extractresourceufs(path);
+#else
+ msg("MacOSX not supported in this version, skipping\n");
+ skipfile();
+#endif
+ break;
+ case EXT_XATTR: {
+ char xattr[XATTR_MAXSIZE];
+
+ if (readxattr(xattr) == GOOD) {
+ xattr_extract(path, xattr);
+ break;
+ }
+ }
+ default:
+ msg("unexpected inode extension %ld, skipping\n", spcl.c_extattributes);
+ skipfile();
+ break;
+ }
+ }
+ return GOOD;
+}
+
+#ifdef DUMP_MACOSX
+int
+extractfinderinfoufs(char *name)
+{
+ int err;
+ char oFileRsrc[MAXPATHLEN];
+ int flags;
+ mode_t mode;
+ struct timeval timep[2];
+ u_int32_t uid;
+ u_int32_t gid;
+ char path[MAXPATHLEN], fname[MAXPATHLEN];
+
+ curfile.name = name;
+ curfile.action = USING;
+ timep[0].tv_sec = curfile.dip->di_atime.tv_sec;
+ timep[0].tv_usec = curfile.dip->di_atime.tv_usec;
+ timep[1].tv_sec = curfile.dip->di_mtime.tv_sec;
+ timep[1].tv_usec = curfile.dip->di_mtime.tv_usec;
+ mode = curfile.dip->di_mode;
+ flags = curfile.dip->di_flags;
+ uid = curfile.dip->di_uid;
+ gid = curfile.dip->di_gid;
+
+ switch (mode & IFMT) {
+
+ default:
+ fprintf(stderr, "%s: (extr. finfoufs) unknown file mode 0%o\n", name, mode);
+ skipfile();
+ return (FAIL);
+
+ case IFDIR:
+ fprintf(stderr, "%s: (extr. finfoufs[IFDIR]) unknown file mode 0%o\n", name, mode);
+ skipfile();
+ return (FAIL);
+
+ case IFLNK:
+ skipfile();
+ return (GOOD);
+
+ case IFREG:
+ Vprintf(stdout, "extract finderinfo file %s\n", name);
+ if (Nflag) {
+ skipfile();
+ return (GOOD);
+ }
+ getfile(xtrfilefinderinfo, xtrskip);
+
+ GetPathFile(name, path, fname);
+ strcpy(oFileRsrc, path);
+ strcat(oFileRsrc, "._");
+ strcat(oFileRsrc, fname);
+
+ if ((err = CreateAppleDoubleFileRes(oFileRsrc, &gFndrInfo.fndrinfo,
+ mode, flags, timep, uid, gid)) != 0) {
+ fprintf(stderr, "%s: cannot create finderinfo: %s\n",
+ name, strerror(errno));
+ skipfile();
+ return (FAIL);
+ }
+ return (GOOD);
+ }
+ /* NOTREACHED */
+}
+
+
+int
+extractresourceufs(char *name)
+{
+ char oFileRsrc[MAXPATHLEN];
+ int flags;
+ mode_t mode;
+ struct timeval timep[2];
+ char path[MAXPATHLEN], fname[MAXPATHLEN];
+ ASDHeaderPtr hp;
+ ASDEntryPtr ep;
+ u_long loff;
+ u_int32_t uid;
+ u_int32_t gid;
+ u_int64_t di_size;
+ char *p;
+ char buf[1024];
+
+ curfile.name = name;
+ curfile.action = USING;
+ timep[0].tv_sec = curfile.dip->di_atime.tv_sec;
+ timep[0].tv_usec = curfile.dip->di_atime.tv_usec;
+ timep[1].tv_sec = curfile.dip->di_mtime.tv_sec;
+ timep[1].tv_usec = curfile.dip->di_mtime.tv_usec;
+ mode = curfile.dip->di_mode;
+ flags = curfile.dip->di_flags;
+ uid = curfile.dip->di_uid;
+ gid = curfile.dip->di_gid;
+ di_size = curfile.dip->di_size;
+
+ switch (mode & IFMT) {
+
+ default:
+ fprintf(stderr, "%s: (extr. resufs) unknown file mode 0%o\n", name, mode);
+ skipfile();
+ return (FAIL);
+
+ case IFDIR:
+ fprintf(stderr, "%s: (extr. resufs [IFDIR]) unknown file mode 0%o\n", name, mode);
+ skipfile();
+ return (FAIL);
+
+ case IFLNK: