Sophie

Sophie

distrib > Mandriva > 2008.1 > x86_64 > media > main-release > by-pkgid > 0f0bbfc8790f56ab7300af178240fdf5 > files > 11

python-utmp-0.7-7mdv2008.1.x86_64.rpm

#!/usr/bin/python
# remove tty given as argument from utmp file

import utmp, sys
from UTMPCONST import *

a = utmp.UtmpRecord()

line = sys.argv[1]

b = a.getutline_dict(line)
if not b:
    print line, "is not occupied, cannot remove."
    sys.exit()
b['ut_type'] = DEAD_PROCESS
b['ut_line'] = ''
b['ut_user'] = ''
a.pututline_dict(b)
a.endutent()