Merge branch 'vendor/DHCPCD'
[dragonfly.git] / share / examples / ppp / login-auth
1 #! /usr/local/bin/wish8.0 -f
2 #
3 # Copyright (c) 1999 Brian Somers <brian@Awfulhak.org>
4 # All rights reserved.
5 #
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions
8 # are met:
9 # 1. Redistributions of source code must retain the above copyright
10 #    notice, this list of conditions and the following disclaimer.
11 # 2. Redistributions in binary form must reproduce the above copyright
12 #    notice, this list of conditions and the following disclaimer in the
13 #    documentation and/or other materials provided with the distribution.
14 #
15 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 # ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 # SUCH DAMAGE.
26 #
27 # $FreeBSD: src/share/examples/ppp/login-auth,v 1.2 1999/08/28 00:19:29 peter Exp $
28 # $DragonFly: src/share/examples/ppp/login-auth,v 1.2 2003/06/17 04:36:57 dillon Exp $
29
30 #
31 # Display a window to request a users password, expecting a login name
32 # as an argument and outputting the password to stdout.
33 #
34
35 set pwidth 11;          # Prompt field width
36 set vwidth 20;          # Value field width
37 set fxpad 7;            # Value field width
38 set fypad 3;            # Value field width
39
40 wm title . "PPP Login";
41
42 # Dump our password to stdout and exit
43 proc done {} {
44   puts [.p.value get];
45   exit 0;
46 }
47
48 frame .l;
49 text  .l.prompt -width $pwidth -height 1 -relief flat;
50       .l.prompt insert 1.0 "Login:";
51 pack  .l.prompt -side left;
52       .l.prompt configure -state disabled;
53 text  .l.value -width $vwidth -height 1;
54       .l.value insert 1.0 $argv;
55 pack  .l.value -side right;
56       .l.value configure -state disabled;
57 pack  .l -side top -padx $fxpad -pady $fypad;
58
59 frame .p;
60 text  .p.prompt -width $pwidth -height 1 -relief flat;
61       .p.prompt insert 1.0 "Password:";
62 pack  .p.prompt -side left;
63       .p.prompt configure -state disabled;
64 entry .p.value -show "*" -width $vwidth;
65 pack  .p.value -side right;
66 bind  .p.value <Return> {done};
67 focus .p.value;
68 pack  .p -side top -padx $fxpad -pady $fypad;
69
70 frame  .b;
71 button .b.ok -default active -text "Ok" -takefocus 0 -command {done};
72 pack   .b.ok -side left;
73 button .b.cancel -default normal -text "Cancel" -takefocus 0 -command {exit 1};
74 pack   .b.cancel -side right;
75 pack   .b -side top -padx $fxpad -pady $fypad;