Class around PixMap objects that allows more python-like access. By Joe Strout.
[python/dscho.git] / Lib / dos-8x3 / test_fcn.py
blob10144c3031206f265ae52cef8a884770cbafe801
1 #! /usr/bin/env python
2 """Test program for the fcntl C module.
3 Roger E. Masse
4 """
5 import struct
6 import fcntl
7 import FCNTL
8 import os, sys
9 from test_support import verbose
11 filename = '/tmp/delete-me'
13 # the example from the library docs
14 f = open(filename,'w')
15 rv = fcntl.fcntl(f.fileno(), FCNTL.F_SETFL, os.O_NONBLOCK)
16 if verbose:
17 print 'Status from fnctl with O_NONBLOCK: ', rv
19 if sys.platform in ('netbsd1',
20 'freebsd2', 'freebsd3',
21 'bsdos2', 'bsdos3', 'bsdos4'):
22 lockdata = struct.pack('lxxxxlxxxxlhh', 0, 0, 0, FCNTL.F_WRLCK, 0)
23 elif sys.platform in ['aix3', 'aix4']:
24 lockdata = struct.pack('hhlllii', FCNTL.F_WRLCK, 0, 0, 0, 0, 0, 0)
25 else:
26 lockdata = struct.pack('hhllhh', FCNTL.F_WRLCK, 0, 0, 0, 0, 0)
27 if verbose:
28 print 'struct.pack: ', `lockdata`
30 rv = fcntl.fcntl(f.fileno(), FCNTL.F_SETLKW, lockdata)
31 if verbose:
32 print 'String from fcntl with F_SETLKW: ', `rv`
34 f.close()
35 os.unlink(filename)