summaryrefslogtreecommitdiffstats
path: root/Mac
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1995-08-08 14:10:22 (GMT)
committerGuido van Rossum <guido@python.org>1995-08-08 14:10:22 (GMT)
commit222c8924c113f3b080674f35eb5fdfb986ecd340 (patch)
tree19a89b6531180f0b8a14374b3dd8843f3c0f426a /Mac
parent08d2071accbf0efd86235d9fb7533629d7c42d7c (diff)
downloadcpython-222c8924c113f3b080674f35eb5fdfb986ecd340.zip
cpython-222c8924c113f3b080674f35eb5fdfb986ecd340.tar.gz
cpython-222c8924c113f3b080674f35eb5fdfb986ecd340.tar.bz2
add xstat (extended stat, returns resource fork size and creator/type)
Diffstat (limited to 'Mac')
-rw-r--r--Mac/Modules/macmodule.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/Mac/Modules/macmodule.c b/Mac/Modules/macmodule.c
index 239e1a5..16ab2ff 100644
--- a/Mac/Modules/macmodule.c
+++ b/Mac/Modules/macmodule.c
@@ -411,6 +411,37 @@ mac_stat(self, args)
}
static object *
+mac_xstat(self, args)
+ object *self;
+ object *args;
+{
+ struct macstat st;
+ char *path;
+ int res;
+ if (!getargs(args, "s", &path))
+ return NULL;
+ BGN_SAVE
+ res = macstat(path, &st);
+ END_SAVE
+ if (res != 0)
+ return mac_error();
+ return mkvalue("(llllllllllls#s#)",
+ (long)st.st_mode,
+ (long)st.st_ino,
+ (long)st.st_dev,
+ (long)st.st_nlink,
+ (long)st.st_uid,
+ (long)st.st_gid,
+ (long)st.st_size,
+ (long)st.st_atime,
+ (long)st.st_mtime,
+ (long)st.st_ctime,
+ (long)st.st_rsize,
+ st.st_creator, 4,
+ st.st_type, 4);
+}
+
+static object *
mac_sync(self, args)
object *self;
object *args;
@@ -454,7 +485,6 @@ mac_write(self, args)
}
#endif /* !__MWERKS__ */
-#undef MALLOC_DEBUG
#ifdef MALLOC_DEBUG
static object *
mac_mstats(self, args)
@@ -492,6 +522,7 @@ static struct methodlist mac_methods[] = {
{"rename", mac_rename},
{"rmdir", mac_rmdir},
{"stat", mac_stat},
+ {"xstat", mac_xstat},
{"sync", mac_sync},
{"unlink", mac_unlink},
#ifndef CW4