view Mac/Python/macguesstabsize.c @ 1590:ac2e5cc29949 legacy-trunk

Added tests for missing host to open_http and open_gopher
author Guido van Rossum <guido@python.org>
date Mon, 18 Apr 1994 09:39:56 +0000
parents 877073b9f8c3
children cf29c09f07b6
line wrap: on
line source

#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;
}