Chris Cox has released a new version of his Impress tclet. You can read about it here.
If you don't have the TCL/TK plugin installed, don't panic, it's available from the nice people at Sun Labs.
If you want to play around with the Add Password applet, and perhaps even extend its functionality, you can download the code here. Or you can just cut and paste the code below. Make sure, however, that if you use this commercially, that you give Chris Cox credit for it somewhere.
#!/usr/bin/wish option add *Listbox*font {-*-courier-medium-r-*-*-*-120-*-*-m-*-*-*} proc readPw {l} { global Passwords set fgrp [open /etc/group r] while {[gets $fgrp line] >= 0} { if {[string index $line 0] == "#"} { continue } set groupentry [split $line ":"] set Group([lindex $groupentry 2]) \ [lindex $groupentry 0] } close $fgrp set fpw [open /etc/passwd r] while {[gets $fpw line] >= 0} { if {[string index $line 0] == "#"} { continue } set pwdentry [split $line ":"] if {[info exists Group([lindex $pwdentry 3])]} { set group $Group([lindex $pwdentry 3]) } else { set group [lindex $pwdentry 3] } set fpwdentry [format "%-12s %-12s %-38s %-25s %-20s"\ [lindex $pwdentry 0] $group \ [lindex $pwdentry 4] [lindex $pwdentry 5] \ [lindex $pwdentry 6]] set Passwords($fpwdentry) $pwdentry $l insert end $fpwdentry } close $fpw } proc newField {root label name} { global fieldvars frame ${root}.f${name} label ${root}.l${name} -text ${label} entry ${root}.e${name} -textvar ${name} pack ${root}.l${name} -side left -in ${root}.f${name} pack ${root}.e${name} -side right -in ${root}.f${name} lappend fieldvars ${name} return ${root}.f${name} } proc setPw {pwd} { global Passwords username userid groupname groupid gcos \ home shell set username [lindex $pwd 0] set userid [lindex $Passwords($pwd) 2] set groupname [lindex $pwd 1] set groupid [lindex $Passwords($pwd) 3] set gcos [lindex $Passwords($pwd) 4] set home [lindex $Passwords($pwd) 5] set shell [lindex $Passwords($pwd) 6] } proc showPw {} { if {! [winfo exists .showpw] } { toplevel .showpw frame .showpw.l frame .showpw.r lappend left [newField .showpw "Username:" username] lappend left [newField .showpw "User id:" userid] lappend left [newField .showpw "Groupname:" groupname] lappend left [newField .showpw "Group id:" groupid] lappend right [newField .showpw "GCOS:" gcos] lappend right [newField .showpw "Home:" home] lappend right [newField .showpw "Shell:" shell] eval pack $left -in .showpw.l -fill x eval pack $right -in .showpw.r -fill x pack .showpw.l .showpw.r -in .showpw -side left \ -expand true } wm deiconify .showpw raise .showpw } frame .top scrollbar .v -orient v -command ".pw yview" scrollbar .h -orient h -command ".pw xview" frame .dummy -width [winfo reqwidth .v] \ -height [winfo reqheight .h] listbox .pw -width 80 -selectmode single \ -xscrollcommand ".h set" -yscrollcommand ".v set" pack .pw -side left -fill both -in .top -expand true pack .v -side left -fill y -in .top pack .top -side top -expand true -fill both pack .h -side left -fill x -expand true pack .dummy -side left bind .pw |
Copyright © 1996, 1997 North Texas Linux Users Group. All rights reserved.
http://www.ntlug.org/archive/tp/tcltk/index.html