Mercurial > cpython-lru_cache-weakref
view Mac/Python/macguesstabsize.c @ 4566:6403c94de50d legacy-trunk
Added safeguard against failure in __del__.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Wed, 27 Nov 1996 19:39:58 +0000 |
| parents | 9588c238e660 |
| children | d6b292a33cfe |
line wrap: on
line source
#include <Types.h> #include <Files.h> #include <OSUtils.h> #include <Resources.h> #include <string.h> /* Interface used by parsetok.c */ guesstabsize(path) char *path; { Str255 s; int refnum; Handle h; int tabsize = 0; s[0] = strlen(path); memcpy(s+1, path, s[0]); refnum = OpenResFile(s); if (refnum == -1) return 0; UseResFile(refnum); h = GetIndResource('ETAB', 1); if (h != 0) { tabsize = (*(short**)h)[1]; } CloseResFile(refnum); return tabsize; }
