Mercurial > cpython-lru_cache-weakref
diff Mac/Python/macgetpath.c @ 3411:14991c4331df legacy-trunk
Store default startup options in preference file or
app.
| author | Jack Jansen <jack.jansen@cwi.nl> |
|---|---|
| date | Wed, 21 Feb 1996 16:46:57 +0000 |
| parents | 022474ac2451 |
| children | 67f5d29d405b |
line wrap: on
line diff
--- a/Mac/Python/macgetpath.c Wed Feb 21 15:36:26 1996 +0000 +++ b/Mac/Python/macgetpath.c Wed Feb 21 16:46:57 1996 +0000 @@ -263,3 +263,37 @@ } #endif /* !USE_BUILTIN_PATH */ +void +PyMac_PreferenceOptions(int *inspect, int *verbose, int *suppress_print, + int *unbuffered, int *debugging, int *keep_normal, + int *keep_error) +{ + short oldrh, prefrh; + Handle handle; + int size; + char *p; + + + oldrh = CurResFile(); + prefrh = PyMac_OpenPrefFile(); + handle = GetResource('Popt', PYTHONOPTIONS_ID); + if ( handle == NULL ) { + return; + } + HLock(handle); + size = GetHandleSize(handle); + p = (char *)*handle; + + if ( size > POPT_INSPECT ) *inspect = p[POPT_INSPECT]; + if ( size > POPT_VERBOSE ) *verbose = p[POPT_VERBOSE]; + if ( size > POPT_SUPPRESS ) *suppress_print = p[POPT_SUPPRESS]; + if ( size > POPT_UNBUFFERED ) *unbuffered = p[POPT_UNBUFFERED]; + if ( size > POPT_DEBUGGING ) *debugging = p[POPT_DEBUGGING]; + if ( size > POPT_KEEPNORM ) *keep_normal = p[POPT_KEEPNORM]; + if ( size > POPT_KEEPERR ) *keep_error = p[POPT_KEEPERR]; + + HUnlock(handle); + + CloseResFile(prefrh); + UseResFile(oldrh); +}
