home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2000 / MacHack 2000.toast / pc / The Hacks / MacHacksBug / Python 1.5.2c1 / Lib / test / test_fcntl.pyc (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2000-06-23  |  1.1 KB  |  30 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 1.5)
  3.  
  4. '''Test program for the fcntl C module.
  5.    Roger E. Masse
  6. '''
  7. import struct
  8. import fcntl
  9. import FCNTL
  10. import os
  11. import sys
  12. verbose
  13. if sys.platform in ('netbsd1', 'freebsd2', 'freebsd3', 'bsdos2', 'bsdos3', 'bsdos4'):
  14.     lockdata = struct.pack('lxxxxlxxxxlhh', 0, 0, 0, FCNTL.F_WRLCK, 0)
  15. elif sys.platform in [
  16.     'aix3',
  17.     'aix4']:
  18.     lockdata = struct.pack('hhlllii', FCNTL.F_WRLCK, 0, 0, 0, 0, 0, 0)
  19. else:
  20.     lockdata = struct.pack('hhllhh', FCNTL.F_WRLCK, 0, 0, 0, 0, 0)
  21. if verbose:
  22.     print 'struct.pack: ', `lockdata`
  23.  
  24. rv = fcntl.fcntl(f.fileno(), FCNTL.F_SETLKW, lockdata)
  25. if verbose:
  26.     print 'String from fcntl with F_SETLKW: ', `rv`
  27.  
  28. f.close()
  29. os.unlink(filename)
  30.