diff options
author | Guido van Rossum <guido@python.org> | 1994-01-05 16:17:15 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1994-01-05 16:17:15 (GMT) |
commit | ce9739ba769b465047f644672eda654efed7ad80 (patch) | |
tree | 214d6f651ad0a59eae9aa0c41072cf901837ceca /Mac/Python/macguesstabsize.c | |
parent | 718581a522663c7e5e2c692daaff4e5a399d6e2c (diff) | |
download | cpython-ce9739ba769b465047f644672eda654efed7ad80.zip cpython-ce9739ba769b465047f644672eda654efed7ad80.tar.gz cpython-ce9739ba769b465047f644672eda654efed7ad80.tar.bz2 |
Initial revision
Diffstat (limited to 'Mac/Python/macguesstabsize.c')
-rw-r--r-- | Mac/Python/macguesstabsize.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/Mac/Python/macguesstabsize.c b/Mac/Python/macguesstabsize.c new file mode 100644 index 0000000..7d1abb7 --- /dev/null +++ b/Mac/Python/macguesstabsize.c @@ -0,0 +1,27 @@ +#include <MacHeaders> +#include <string.h> + +/* Interface used by tokenizer.c */ + +guesstabsize(path) + char *path; +{ + char s[256]; + int refnum; + Handle h; + int tabsize = 0; + s[0] = strlen(path); + strncpy(s+1, path, s[0]); + refnum = OpenResFile(s); +/* printf("%s --> refnum=%d\n", path, refnum); */ + if (refnum == -1) + return 0; + UseResFile(refnum); + h = GetIndResource('ETAB', 1); + if (h != 0) { + tabsize = (*(short**)h)[1]; +/* printf("tabsize=%d\n", tabsize); */ + } + CloseResFile(refnum); + return tabsize; +} |