mirror of
https://github.com/python/cpython.git
synced 2025-11-01 10:45:30 +00:00
Initial revision
This commit is contained in:
parent
718581a522
commit
ce9739ba76
5 changed files with 720 additions and 0 deletions
13
Mac/Python/macgetmtime.c
Normal file
13
Mac/Python/macgetmtime.c
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
#include "::unixemu:stat.h"
|
||||
|
||||
/* Interfaced used by import.c */
|
||||
|
||||
long
|
||||
getmtime(path)
|
||||
char *path;
|
||||
{
|
||||
struct stat st;
|
||||
if (stat(path, &st) != 0)
|
||||
return -1L;
|
||||
return st.st_mtime;
|
||||
}
|
||||
27
Mac/Python/macguesstabsize.c
Normal file
27
Mac/Python/macguesstabsize.c
Normal file
|
|
@ -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;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue