Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
44071d6b
Commit
44071d6b
authored
Mar 08, 1998
by
Richard M. Stallman
Browse files
(read-passwd): Renamed from read-password. New second arg CONFIRM.
parent
94a13fbf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
20 deletions
+31
-20
lisp/subr.el
lisp/subr.el
+31
-20
No files found.
lisp/subr.el
View file @
44071d6b
...
...
@@ -763,27 +763,38 @@ any other non-digit terminates the character code and is then used as input."))
(
setq
first
nil
))
code
))
(
defun
read-passw
or
d
(
prompt
&optional
default
)
"Read a password,
echoing
`.' for each character typed.
(
defun
read-passwd
(
prompt
&optional
confirm
default
)
"Read a password,
prompting with PROMPT. Echo
`.' for each character typed.
End with RET, LFD, or ESC. DEL or C-h rubs out. C-u kills line.
Optional DEFAULT is password to start with."
(
let
((
pass
nil
)
(
c
0
)
(
echo-keystrokes
0
)
(
cursor-in-echo-area
t
))
(
while
(
progn
(
message
"%s%s"
prompt
(
make-string
(
length
pass
)
?.
))
(
setq
c
(
read-char
))
(
and
(
/=
c
?\r
)
(
/=
c
?\n
)
(
/=
c
?\e
)))
(
if
(
=
c
?\C-u
)
(
setq
pass
""
)
(
if
(
and
(
/=
c
?\b
)
(
/=
c
?\177
))
(
setq
pass
(
concat
pass
(
char-to-string
c
)))
(
if
(
>
(
length
pass
)
0
)
(
setq
pass
(
substring
pass
0
-1
))))))
(
message
nil
)
(
or
pass
default
""
)))
Optional argument CONFIRM, if non-nil, then read it twice to make sure.
Optional DEFAULT is a default password to use instead of empty input."
(
if
confirm
(
let
(
success
)
(
while
(
not
success
)
(
let
((
first
(
read-passwd
prompt
nil
default
))
(
second
(
read-passwd
"Confirm password: "
nil
default
)))
(
if
(
equal
first
second
)
(
setq
success
first
)
(
message
"Password not repeated accurately; please start over"
)
(
sit-for
1
))))
success
)
(
let
((
pass
nil
)
(
c
0
)
(
echo-keystrokes
0
)
(
cursor-in-echo-area
t
))
(
while
(
progn
(
message
"%s%s"
prompt
(
make-string
(
length
pass
)
?.
))
(
setq
c
(
read-char
))
(
and
(
/=
c
?\r
)
(
/=
c
?\n
)
(
/=
c
?\e
)))
(
if
(
=
c
?\C-u
)
(
setq
pass
""
)
(
if
(
and
(
/=
c
?\b
)
(
/=
c
?\177
))
(
setq
pass
(
concat
pass
(
char-to-string
c
)))
(
if
(
>
(
length
pass
)
0
)
(
setq
pass
(
substring
pass
0
-1
))))))
(
message
nil
)
(
or
pass
default
""
))))
(
defun
force-mode-line-update
(
&optional
all
)
"Force the mode-line of the current buffer to be redisplayed.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment