summaryrefslogtreecommitdiffstats
path: root/Mac/Python/macguesstabsize.c
blob: ec4af3d699582cdcc0aa2850ec65ac05cc922f39 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#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;
}