summaryrefslogtreecommitdiffstats
path: root/Mac/Python/macguesstabsize.c
blob: 7d1abb7d4a3c46ba3b5148296c19b07cfc962c0b (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
#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;
}