]> git.donarmstrong.com Git - lilypond.git/blob - stepmake/bin/ntpwd.py
Make distributed tarball from Git file list
[lilypond.git] / stepmake / bin / ntpwd.py
1 """Winnt access into /etc/passwd via account name"""
2
3 import sys
4 import string
5
6 def getpwname( name, pwfile='/etc/passwd' ):
7   "Get password record that matches the specified name"
8   try:
9     _fd = open( pwfile, 'r' )
10   except:
11     sys.stderr.write("Error unable to locate" + pwfile + "\n")
12     sys.stderr.write("Consult gnu-win32 command mkpasswd\n")
13     sys.exit(1)
14
15   _data = _fd.read()
16   _fd.close()
17     
18   for _line in string.split(_data, '\n'):
19     _record=string.split( _line, ':' );
20     if _record[0] == name:
21       return _record
22   return ()
23
24 def _test():
25   pw = getpwname( 'jeff' )
26   print pw[4]
27
28 if __name__ == '__main__':
29     _test()