docs: Update the uptime man pages

Three functions in the same manpage but use the so commands
to refer to the main man page.
This commit is contained in:
Craig Small 2020-05-18 21:10:03 +10:00
parent 9f751a7538
commit 2b6ad61f3c
3 changed files with 28 additions and 69 deletions

View File

@ -1,4 +1,4 @@
.\" (C) Copyright 2016 Craig Small <csmall@enc.com.au> .\" (C) Copyright 2016-2020 Craig Small <csmall@dropbear.xyz>
.\" .\"
.\" %%%LICENSE_START(LGPL_2.1+) .\" %%%LICENSE_START(LGPL_2.1+)
.\" This manual is free software; you can redistribute it and/or .\" This manual is free software; you can redistribute it and/or
@ -16,23 +16,30 @@
.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA .\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
.\" %%%LICENSE_END .\" %%%LICENSE_END
.\" .\"
.TH PROCPS_UPTIME 3 2016-05-01 "libproc-2" .TH PROCPS_UPTIME 3 2020-05-18 "libproc-2"
.\" Please adjust this date whenever revising the manpage. .\" Please adjust this date whenever revising the manpage.
.\" .\"
.SH NAME .SH NAME
procps_uptime \- procps_uptime, procps_sprint, procps_uptime_sprint_short \-
provide the uptime and idle time in seconds provide the uptime and idle time in seconds
.SH SYNOPSIS .SH SYNOPSIS
.nf
.B #include <proc/procps.h> .B #include <proc/procps.h>
.sp .PP
.BI "int procps_uptime(double * " uptime_secs ", double * " idle_secs ");" .BI "int procps_uptime(double * " uptime_secs ", double * " idle_secs ");"
.B char *procps_uptime_sprint(void);
.B char *procps_uptime_sprint_short(void);
.sp .sp
Link with \fI\-lprocps\fP. Link with \fI\-lprocps\fP.
.SH DESCRIPTION .SH DESCRIPTION
The function
.BR procps_uptime () .BR procps_uptime ()
fills the location of the two double points with the current sytem uptime returns the uptime and idle time of the system. Either the
and idle time. \fIuptime_secs\fR or \fIidle_secs\fR can be \fBNULL\fR in which case that
variable will not be returned.
The \fBsprint\fR variety of the functions return a human-readable
string of the uptime and other statistics.
.SH RETURN VALUE .SH RETURN VALUE
.BR procps_uptime () .BR procps_uptime ()
returns 0 on success. On failure, it returns 0 on success. On failure, it
@ -44,6 +51,17 @@ Unable to parse the uptime file.
.BR procps_uptime () .BR procps_uptime ()
may also return any (negated) value that \fBfopen\fR() may set errno to. may also return any (negated) value that \fBfopen\fR() may set errno to.
.BR procps_uptime_sprint_short ()
return a string from a statically allocated buffer which displays uptime.
.BR procps_uptime_sprint ()
also displays users and load average in the buffer. The formats are the
same as
.BR uptime (1)
with and without the
.B \-p
option.
.SH FILES .SH FILES
.TP .TP
.I /proc/uptime .I /proc/uptime
@ -54,5 +72,6 @@ The raw values for uptime and idle time.
first appeared in libproc-2 version 0.0. first appeared in libproc-2 version 0.0.
.SH SEE ALSO .SH SEE ALSO
.BR uptime (1),
.BR fopen (3), .BR fopen (3),
.BR proc (5). .BR proc (5).

View File

@ -1,61 +1 @@
.\" (C) Copyright 2016 Craig Small <csmall@enc.com.au> .so man3/procps_uptime.3
.\"
.\" %%%LICENSE_START(LGPL_2.1+)
.\" This manual is free software; you can redistribute it and/or
.\" modify it under the terms of the GNU Lesser General Public
.\" License as published by the Free Software Foundation; either
.\" version 2.1 of the License, or (at your option) any later version.
.\"
.\" This manual is distributed in the hope that it will be useful,
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
.\" Lesser General Public License for more details.
.\"
.\" You should have received a copy of the GNU Lesser General Public
.\" License along with this library; if not, write to the Free Software
.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
.\" %%%LICENSE_END
.\"
.TH PROCPS_uptime_sprint_SPRINT 3 2016-04-16 "libproc-2"
.\" Please adjust this date whenever revising the manpage.
.\"
.SH NAME
procps_uptime_sprint \-
provide the uptime and idle time in seconds
.SH SYNOPSIS
.B #include <proc/procps.h>
.sp
.B char procps_uptime_sprint(void);
.br
.B char procps_uptime_sprint_short(void);
.sp
Link with \fI\-lprocps\fP.
.SH DESCRIPTION
The functions
.BR procps_uptime_sprint ()
and
.BR procps_uptime_sprint_short ()
return a string from a statically allocated buffer which displays uptime
and other system statistics. This format is similar to
.BR w (1)
.SH RETURN VALUE
Both functions return a formatted string on success and NULL on failure.
.PP
.B procps_uptime_sprint
returns a string displaying the uptime, number of users and load average.
.PP
.B procps_uptime_sprint_short
returns a string displaying the uptime only.
.SH VERSIONS
.B procps_uptime_sprint()
and
.B procps_uptime_sprint_short()
first appeared in libproc-2 version 0.0.
.SH SEE ALSO
.BR fopen (3),
.BR procps_loadavg (3),
.BR procps_uptime (3),
.BR proc (5).

View File

@ -1 +1 @@
.so man3/procps_uptime_sprint.1 .so man3/procps_uptime.3