Come on guys, you can't just take OpenBSD manpage and commit it

over someone else's fixes; this is at least offensive.  If you
have problems doing a proper merge, we are here, your fellow
committers.  :-(

Reapply markup fixes from revision 1.2 and fix some more.  Also
fix the $OpenBSD$ tag.
This commit is contained in:
Ruslan Ermilov 2002-03-15 17:46:53 +00:00
parent 5c9f299b01
commit f3a90e8782
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=92350

View File

@ -1,4 +1,4 @@
.\" $OpenBSD: /usr/local/www/cvsroot/OpenBSD/src/lib/libc/gen/readpassphrase.3,v 1.7 2001/12/15 15:37:51 millert Exp $ .\" $OpenBSD: readpassphrase.3,v 1.7 2001/12/15 15:37:51 millert Exp $
.\" .\"
.\" Copyright (c) 2000 Todd C. Miller <Todd.Miller@courtesan.com> .\" Copyright (c) 2000 Todd C. Miller <Todd.Miller@courtesan.com>
.\" All rights reserved. .\" All rights reserved.
@ -34,8 +34,8 @@
.Nm readpassphrase .Nm readpassphrase
.Nd get a passphrase from the user .Nd get a passphrase from the user
.Sh SYNOPSIS .Sh SYNOPSIS
.Fd #include <readpassphrase.h> .In readpassphrase.h
.Ft char * .Ft "char *"
.Fn readpassphrase "const char *prompt" "char *buf" "size_t bufsiz" "int flags" .Fn readpassphrase "const char *prompt" "char *buf" "size_t bufsiz" "int flags"
.Sh DESCRIPTION .Sh DESCRIPTION
The The
@ -53,7 +53,9 @@ In this case it is generally not possible to turn off echo.
.Pp .Pp
Up to Up to
.Fa bufsiz .Fa bufsiz
- 1 characters (one is for the NUL) are read into the provided buffer \- 1 characters (one is for the
.Dv NUL )
are read into the provided buffer
.Fa buf . .Fa buf .
Any additional Any additional
characters and the terminating newline (or return) character are discarded. characters and the terminating newline (or return) character are discarded.
@ -62,14 +64,20 @@ characters and the terminating newline (or return) character are discarded.
takes the following optional takes the following optional
.Fa flags : .Fa flags :
.Pp .Pp
.Bd -literal -offset indent -compact .Bl -tag -width ".Dv RPP_REQUIRE_TTY" -compact
RPP_ECHO_OFF turn off echo (default behavior) .It Dv RPP_ECHO_OFF
RPP_ECHO_ON leave echo on turn off echo (default behavior)
RPP_REQUIRE_TTY fail if there is no tty .It Dv RPP_ECHO_ON
RPP_FORCELOWER force input to lower case leave echo on
RPP_FORCEUPPER force input to upper case .It Dv RPP_REQUIRE_TTY
RPP_SEVENBIT strip the high bit from input fail if there is no tty
.Ed .It Dv RPP_FORCELOWER
force input to lower case
.It Dv RPP_FORCEUPPER
force input to upper case
.It Dv RPP_SEVENBIT
strip the high bit from input
.El
.Pp .Pp
The calling process should zero the passphrase as soon as possible to The calling process should zero the passphrase as soon as possible to
avoid leaving the cleartext passphrase visible in the process's address avoid leaving the cleartext passphrase visible in the process's address
@ -79,7 +87,9 @@ Upon successful completion,
.Fn readpassphrase .Fn readpassphrase
returns a pointer to the null-terminated passphrase. returns a pointer to the null-terminated passphrase.
If an error is encountered, the terminal state is restored and If an error is encountered, the terminal state is restored and
a null pointer is returned. a
.Dv NULL
pointer is returned.
.Sh ERRORS .Sh ERRORS
.Bl -tag -width Er .Bl -tag -width Er
.It Bq Er EINTR .It Bq Er EINTR
@ -88,12 +98,14 @@ The
function was interrupted by a signal. function was interrupted by a signal.
.It Bq Er EINVAL .It Bq Er EINVAL
The The
.Ar bufsiz .Fa bufsiz
argument was zero. argument was zero.
.It Bq Er EIO .It Bq Er EIO
The process is a member of a background process attempting to read The process is a member of a background process attempting to read
from its controlling terminal, the process is ignoring or blocking from its controlling terminal, the process is ignoring or blocking
the SIGTTIN signal or the process group is orphaned. the
.Dv SIGTTIN
signal or the process group is orphaned.
.It Bq Er EMFILE .It Bq Er EMFILE
The process has already reached its limit for open file descriptors. The process has already reached its limit for open file descriptors.
.It Bq Er ENFILE .It Bq Er ENFILE
@ -107,7 +119,7 @@ flag was specified.
The following code fragment will read a passphrase from The following code fragment will read a passphrase from
.Pa /dev/tty .Pa /dev/tty
into the buffer into the buffer
.Fa passbuf. .Fa passbuf .
.Bd -literal -offset indent .Bd -literal -offset indent
char passbuf[1024]; char passbuf[1024];
@ -128,15 +140,15 @@ memset(passbuf, 0, sizeof(passbuf));
.Fn readpassphrase .Fn readpassphrase
will catch the following signals: will catch the following signals:
.Pp .Pp
.Bd -literal -offset indent -compact .Bl -tag -compact
SIGINT .It Dv SIGINT
SIGHUP .It Dv SIGHUP
SIGQUIT .It Dv SIGQUIT
SIGTERM .It Dv SIGTERM
SIGTSTP .It Dv SIGTSTP
SIGTTIN .It Dv SIGTTIN
SIGTTOU .It Dv SIGTTOU
.Ed .El
.Pp .Pp
When one of the above signals is intercepted, terminal echo will When one of the above signals is intercepted, terminal echo will
be restored if it had previously been turned off. be restored if it had previously been turned off.
@ -148,16 +160,16 @@ default action is taken as per
.Xr sigaction 2 . .Xr sigaction 2 .
.Pp .Pp
The The
.Dv SIGTSTP , .Dv SIGTSTP , SIGTTIN ,
.Dv SIGTTIN , and
.Dv SIGTTOU , .Dv SIGTTOU
signals (stop signal generated from keyboard or due to terminal I/O signals (stop signal generated from keyboard or due to terminal I/O
from a background proccess) are treated specially. from a background proccess) are treated specially.
When the process is resumed after it has been stopped, When the process is resumed after it has been stopped,
.Fn readpassphrase .Fn readpassphrase
will reprint the prompt and the user may then enter a passphrase. will reprint the prompt and the user may then enter a passphrase.
.Sh FILES .Sh FILES
.Bl -tag -width /dev/tty -compact .Bl -tag -width ".Pa /dev/tty" -compact
.It Pa /dev/tty .It Pa /dev/tty
.El .El
.Sh SEE ALSO .Sh SEE ALSO
@ -167,7 +179,6 @@ will reprint the prompt and the user may then enter a passphrase.
The The
.Fn readpassphrase .Fn readpassphrase
function is an function is an
.Ox
extension and should not be used if portability is desired. extension and should not be used if portability is desired.
.Sh HISTORY .Sh HISTORY
The The