]> git.ipfire.org Git - thirdparty/libbsd.git/commitdiff
man: Add missing man pages
authorGuillem Jover <guillem@hadrons.org>
Wed, 7 Jun 2017 03:00:34 +0000 (05:00 +0200)
committerGuillem Jover <guillem@hadrons.org>
Fri, 9 Jun 2017 03:40:28 +0000 (05:40 +0200)
This adds man pages for byteorder(3), errc(3) and fpurge(3), including
all their aliases.

17 files changed:
COPYING
man/Makefile.am
man/be16dec.3bsd [new file with mode: 0644]
man/be16enc.3bsd [new file with mode: 0644]
man/be32dec.3bsd [new file with mode: 0644]
man/be32enc.3bsd [new file with mode: 0644]
man/be64dec.3bsd [new file with mode: 0644]
man/be64enc.3bsd [new file with mode: 0644]
man/byteorder.3bsd [new file with mode: 0644]
man/errc.3bsd [new file with mode: 0644]
man/fpurge.3bsd [new file with mode: 0644]
man/le16dec.3bsd [new file with mode: 0644]
man/le16enc.3bsd [new file with mode: 0644]
man/le32dec.3bsd [new file with mode: 0644]
man/le32enc.3bsd [new file with mode: 0644]
man/le64dec.3bsd [new file with mode: 0644]
man/le64enc.3bsd [new file with mode: 0644]

diff --git a/COPYING b/COPYING
index 2e4238346cb29ed83ccf7e68478e0b7728e49852..3b943fdc24a9f01fb915ba84e3bc03f0a1044b68 100644 (file)
--- a/COPYING
+++ b/COPYING
@@ -93,9 +93,11 @@ Files:
  include/bsd/timeconv.h
  include/bsd/vis.h
  man/bitstring.3bsd
+ man/errc.3bsd
  man/explicit_bzero.3bsd
  man/fgetln.3bsd
  man/fgetwln.3bsd
+ man/fpurge.3bsd
  man/funopen.3bsd
  man/getbsize.3bsd
  man/heapsort.3bsd
@@ -278,8 +280,9 @@ License: BSD-2-clause-NetBSD
 
 Files:
  include/bsd/sys/endian.h
- man/expand_number.3bsd
+ man/byteorder.3bsd
  man/closefrom.3bsd
+ man/expand_number.3bsd
  man/flopen.3bsd
  man/getpeereid.3bsd
  man/pidfile.3bsd
@@ -302,6 +305,9 @@ Copyright:
  Copyright © 2002 Thomas Moestl <tmm@FreeBSD.org>
  All rights reserved.
  .
+ Copyright © 2002 Mike Barcroft <mike@FreeBSD.org>
+ All rights reserved.
+ .
  Copyright © 2005 Pawel Jakub Dawidek <pjd@FreeBSD.org>
  All rights reserved.
  .
index b531deadd932593c27164c89188b6c8b36c37fc0..19c5c7806677d11733e6aa3102df0bf5027c43a8 100644 (file)
@@ -137,6 +137,12 @@ dist_man_MANS = \
        arc4random_buf.3bsd \
        arc4random_stir.3bsd \
        arc4random_uniform.3bsd \
+       be16dec.3bsd \
+       be16enc.3bsd \
+       be32dec.3bsd \
+       be32enc.3bsd \
+       be64dec.3bsd \
+       be64enc.3bsd \
        bit_alloc.3bsd \
        bit_clear.3bsd \
        bit_decl.3bsd \
@@ -148,8 +154,10 @@ dist_man_MANS = \
        bit_test.3bsd \
        bitstr_size.3bsd \
        bitstring.3bsd \
+       byteorder.3bsd \
        closefrom.3bsd \
        dehumanize_number.3bsd \
+       errc.3bsd \
        expand_number.3bsd \
        explicit_bzero.3bsd \
        fgetln.3bsd \
@@ -157,6 +165,7 @@ dist_man_MANS = \
        flopen.3bsd \
        fmtcheck.3bsd \
        fparseln.3bsd \
+       fpurge.3bsd \
        funopen.3bsd \
        getbsize.3bsd \
        getmode.3bsd \
@@ -164,6 +173,12 @@ dist_man_MANS = \
        getprogname.3bsd \
        heapsort.3bsd \
        humanize_number.3bsd \
+       le16dec.3bsd \
+       le16enc.3bsd \
+       le32dec.3bsd \
+       le32enc.3bsd \
+       le64dec.3bsd \
+       le64enc.3bsd \
        md5.3bsd \
        mergesort.3bsd \
        nlist.3bsd \
diff --git a/man/be16dec.3bsd b/man/be16dec.3bsd
new file mode 100644 (file)
index 0000000..bce31af
--- /dev/null
@@ -0,0 +1 @@
+.so man3/byteorder.3bsd
diff --git a/man/be16enc.3bsd b/man/be16enc.3bsd
new file mode 100644 (file)
index 0000000..bce31af
--- /dev/null
@@ -0,0 +1 @@
+.so man3/byteorder.3bsd
diff --git a/man/be32dec.3bsd b/man/be32dec.3bsd
new file mode 100644 (file)
index 0000000..bce31af
--- /dev/null
@@ -0,0 +1 @@
+.so man3/byteorder.3bsd
diff --git a/man/be32enc.3bsd b/man/be32enc.3bsd
new file mode 100644 (file)
index 0000000..bce31af
--- /dev/null
@@ -0,0 +1 @@
+.so man3/byteorder.3bsd
diff --git a/man/be64dec.3bsd b/man/be64dec.3bsd
new file mode 100644 (file)
index 0000000..bce31af
--- /dev/null
@@ -0,0 +1 @@
+.so man3/byteorder.3bsd
diff --git a/man/be64enc.3bsd b/man/be64enc.3bsd
new file mode 100644 (file)
index 0000000..bce31af
--- /dev/null
@@ -0,0 +1 @@
+.so man3/byteorder.3bsd
diff --git a/man/byteorder.3bsd b/man/byteorder.3bsd
new file mode 100644 (file)
index 0000000..ddb010f
--- /dev/null
@@ -0,0 +1,83 @@
+.\" Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 29, 2002
+.Dt BYTEORDER 3
+.Os
+.Sh NAME
+.Nm be16enc , be16dec , be32enc , be32dec , be64enc , be64dec ,
+.Nm le16enc , le16dec , le32enc , le32dec , le64enc , le64dec
+.Nd byte order operations
+.Sh SYNOPSIS
+.In sys/endian.h
+.Ft uint16_t
+.Fn be16dec "const void *"
+.Ft uint32_t
+.Fn be32dec "const void *"
+.Ft uint64_t
+.Fn be64dec "const void *"
+.Ft uint16_t
+.Fn le16dec "const void *"
+.Ft uint32_t
+.Fn le32dec "const void *"
+.Ft uint64_t
+.Fn le64dec "const void *"
+.Ft void
+.Fn be16enc "void *" uint16_t
+.Ft void
+.Fn be32enc "void *" uint32_t
+.Ft void
+.Fn be64enc "void *" uint64_t
+.Ft void
+.Fn le16enc "void *" uint16_t
+.Ft void
+.Fn le32enc "void *" uint32_t
+.Ft void
+.Fn le64enc "void *" uint64_t
+.Sh DESCRIPTION
+.Pp
+The
+.Fn be16enc ,
+.Fn be16dec ,
+.Fn be32enc ,
+.Fn be32dec ,
+.Fn be64enc ,
+.Fn be64dec ,
+.Fn le16enc ,
+.Fn le16dec ,
+.Fn le32enc ,
+.Fn le32dec ,
+.Fn le64enc ,
+and
+.Fn le64dec
+functions encode and decode integers to/from byte strings on any alignment
+in big/little endian format.
+.Sh SEE ALSO
+.Xr byteorder 3
+.Sh HISTORY
+.Pp
+The encode/decode functions first appeared in
+.Fx 5.1 .
diff --git a/man/errc.3bsd b/man/errc.3bsd
new file mode 100644 (file)
index 0000000..1b1579f
--- /dev/null
@@ -0,0 +1,175 @@
+.\"    $OpenBSD: err.3,v 1.20 2014/04/23 16:26:33 jmc Exp $
+.\"
+.\" Copyright (c) 1993
+.\"    The Regents of the University of California.  All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\" 3. Neither the name of the University nor the names of its contributors
+.\"    may be used to endorse or promote products derived from this software
+.\"    without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.Dd $Mdocdate: April 23 2014 $
+.Dt ERRC 3
+.Os
+.Sh NAME
+.Nm errc ,
+.Nm verrc ,
+.Nm warnc ,
+.Nm vwarnc
+.Nd formatted error messages
+.Sh LIBRARY
+.ds str-Lb-libbsd Utility functions from BSD systems (libbsd, \-lbsd)
+.Lb libbsd
+.Sh SYNOPSIS
+.In err.h
+.Ft void
+.Fn errc "int status" "int code" "const char *fmt" "..."
+.Ft void
+.Fn verrc "int status" "int code" "const char *fmt" "va_list args"
+.Ft void
+.Fn warnc "int code" "const char *fmt" "..."
+.Ft void
+.Fn vwarnc "int code" "const char *fmt" "va_list args"
+.Sh DESCRIPTION
+The
+.Fn err
+and
+.Fn warn
+family of functions display a formatted error message on the standard
+error output.
+In all cases, the last component of the program name, followed by
+a colon
+.Pq Sq \&:
+character and a space, are output.
+The text that follows depends on the function being called.
+The
+.Fa fmt
+specification (and associated arguments) may be any format allowed by
+.Xr printf 3
+or
+.Dv NULL .
+If the
+.Fa fmt
+argument is not
+.Dv NULL ,
+the formatted error message is output.
+.Pp
+The functions all output an error message string affiliated with
+an error value (see
+.Xr strerror 3 ) ,
+preceded by a colon character and a space if
+.Fa fmt
+is not
+.Dv NULL .
+That is, the output is as follows:
+.Bd -literal -offset indent
+progname: fmt: error message string
+.Ed
+.Pp
+if
+.Fa fmt
+is not
+.Dv NULL ,
+or:
+.Bd -literal -offset indent
+progname: error message string
+.Ed
+.Pp
+if it is.
+.Pp
+The argument
+.Fa code
+is used as the error value instead of the current value of the global variable
+.Va errno .
+.Pp
+In all cases, the output is followed by a newline character.
+.Pp
+The
+.Fn errc ,
+and
+.Fn verrc
+functions do not return, but exit with the value of the argument
+.Fa status .
+.Sh EXAMPLES
+Display the current
+.Va errno
+information string and exit:
+.Bd -literal -offset indent
+if ((p = malloc(size)) == NULL)
+       err(1, NULL);
+if ((fd = open(file_name, O_RDONLY, 0)) == -1)
+       err(1, "%s", file_name);
+.Ed
+.Pp
+Display an error message and exit:
+.Bd -literal -offset indent
+if (tm.tm_hour < START_TIME)
+       errx(1, "too early, wait until %s", start_time_string);
+.Ed
+.Pp
+Warn of an error:
+.Bd -literal -offset indent
+if ((fd = open(raw_device, O_RDONLY, 0)) == -1)
+       warnx("%s: %s: trying the block device",
+           raw_device, strerror(errno));
+if ((fd = open(block_device, O_RDONLY, 0)) == -1)
+       err(1, "%s", block_device);
+.Ed
+.Sh SEE ALSO
+.Xr err 3
+.Xr exit 3 ,
+.Xr perror 3 ,
+.Xr printf 3 ,
+.Xr strerror 3
+.Sh HISTORY
+The functions
+.Fn errc ,
+.Fn verrc ,
+.Fn warnc ,
+and
+.Fn vwarnc
+first appeared in
+.Fx 3.0 ,
+.Nx 7.0
+and
+.Ox 5.6 .
+.Sh CAVEATS
+It is important never to pass a string with user-supplied data as a
+format without using
+.Ql %s .
+An attacker can put format specifiers in the string to mangle the stack,
+leading to a possible security hole.
+This holds true even if the string has been built
+.Dq by hand
+using a function like
+.Fn snprintf ,
+as the resulting string may still contain user-supplied conversion specifiers
+for later interpolation by the
+.Fn err
+and
+.Fn warn
+family of functions.
+.Pp
+Always be sure to use the proper secure idiom:
+.Bd -literal -offset indent
+errc(1, 0, "%s", string);
+.Ed
diff --git a/man/fpurge.3bsd b/man/fpurge.3bsd
new file mode 100644 (file)
index 0000000..d4d0b89
--- /dev/null
@@ -0,0 +1,79 @@
+.\"    $OpenBSD: fflush.3,v 1.12 2015/11/04 21:30:13 tedu Exp $
+.\"
+.\" Copyright (c) 1990, 1991, 1993
+.\"    The Regents of the University of California.  All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" Chris Torek and the American National Standards Committee X3,
+.\" on Information Processing Systems.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\" 3. Neither the name of the University nor the names of its contributors
+.\"    may be used to endorse or promote products derived from this software
+.\"    without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.Dd $Mdocdate: November 4 2015 $
+.Dt FPURGE 3
+.Os
+.Sh NAME
+.Nm fpurge
+.Nd flush a stream
+.Sh LIBRARY
+.ds str-Lb-libbsd Utility functions from BSD systems (libbsd, \-lbsd)
+.Lb libbsd
+.Sh SYNOPSIS
+.In stdio.h
+.Ft int
+.Fn fpurge "FILE *stream"
+.Sh DESCRIPTION
+The function
+.Fn fpurge
+erases any input or output buffered in the given
+.Fa stream .
+For output streams this discards any unwritten output.
+For input streams this discards any input read from the underlying object
+but not yet obtained via
+.Xr getc 3 ;
+this includes any text pushed back via
+.Xr ungetc 3 .
+.Sh RETURN VALUES
+Upon successful completion 0 is returned.
+Otherwise,
+.Dv EOF
+is returned and the global variable
+.Va errno
+is set to indicate the error.
+.Sh ERRORS
+.Bl -tag -width Er
+.It Bq Er EBADF
+.Fa stream
+is not an open stream.
+.El
+.Sh SEE ALSO
+.Xr fclose 3 ,
+.Xr fopen 3 ,
+.Xr setvbuf 3
+.Sh HISTORY
+The
+.Fn fpurge
+function first appeared in
+.Bx 4.4 Lite .
diff --git a/man/le16dec.3bsd b/man/le16dec.3bsd
new file mode 100644 (file)
index 0000000..bce31af
--- /dev/null
@@ -0,0 +1 @@
+.so man3/byteorder.3bsd
diff --git a/man/le16enc.3bsd b/man/le16enc.3bsd
new file mode 100644 (file)
index 0000000..bce31af
--- /dev/null
@@ -0,0 +1 @@
+.so man3/byteorder.3bsd
diff --git a/man/le32dec.3bsd b/man/le32dec.3bsd
new file mode 100644 (file)
index 0000000..bce31af
--- /dev/null
@@ -0,0 +1 @@
+.so man3/byteorder.3bsd
diff --git a/man/le32enc.3bsd b/man/le32enc.3bsd
new file mode 100644 (file)
index 0000000..bce31af
--- /dev/null
@@ -0,0 +1 @@
+.so man3/byteorder.3bsd
diff --git a/man/le64dec.3bsd b/man/le64dec.3bsd
new file mode 100644 (file)
index 0000000..bce31af
--- /dev/null
@@ -0,0 +1 @@
+.so man3/byteorder.3bsd
diff --git a/man/le64enc.3bsd b/man/le64enc.3bsd
new file mode 100644 (file)
index 0000000..bce31af
--- /dev/null
@@ -0,0 +1 @@
+.so man3/byteorder.3bsd