From 2b6ad61f3cac6d29f12d78def83c1a407ad39d6b Mon Sep 17 00:00:00 2001 From: Craig Small Date: Mon, 18 May 2020 21:10:03 +1000 Subject: docs: Update the uptime man pages Three functions in the same manpage but use the so commands to refer to the main man page. --- doc/procps_uptime.3 | 33 ++++++++++++++++----- doc/procps_uptime_sprint.3 | 62 +--------------------------------------- doc/procps_uptime_sprint_short.3 | 2 +- 3 files changed, 28 insertions(+), 69 deletions(-) (limited to 'doc') diff --git a/doc/procps_uptime.3 b/doc/procps_uptime.3 index 61e70fb..20e47d1 100644 --- a/doc/procps_uptime.3 +++ b/doc/procps_uptime.3 @@ -1,4 +1,4 @@ -.\" (C) Copyright 2016 Craig Small +.\" (C) Copyright 2016-2020 Craig Small .\" .\" %%%LICENSE_START(LGPL_2.1+) .\" 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 .\" %%%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. .\" .SH NAME -procps_uptime \- +procps_uptime, procps_sprint, procps_uptime_sprint_short \- provide the uptime and idle time in seconds .SH SYNOPSIS +.nf .B #include -.sp +.PP .BI "int procps_uptime(double * " uptime_secs ", double * " idle_secs ");" +.B char *procps_uptime_sprint(void); +.B char *procps_uptime_sprint_short(void); .sp Link with \fI\-lprocps\fP. .SH DESCRIPTION -The function .BR procps_uptime () -fills the location of the two double points with the current sytem uptime -and idle time. +returns the uptime and idle time of the system. Either the +\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 .BR procps_uptime () returns 0 on success. On failure, it @@ -44,6 +51,17 @@ Unable to parse the uptime file. .BR procps_uptime () 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 .TP .I /proc/uptime @@ -54,5 +72,6 @@ The raw values for uptime and idle time. first appeared in libproc-2 version 0.0. .SH SEE ALSO +.BR uptime (1), .BR fopen (3), .BR proc (5). diff --git a/doc/procps_uptime_sprint.3 b/doc/procps_uptime_sprint.3 index 6aba6ce..c3647c7 100644 --- a/doc/procps_uptime_sprint.3 +++ b/doc/procps_uptime_sprint.3 @@ -1,61 +1 @@ -.\" (C) Copyright 2016 Craig Small -.\" -.\" %%%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 -.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). +.so man3/procps_uptime.3 diff --git a/doc/procps_uptime_sprint_short.3 b/doc/procps_uptime_sprint_short.3 index 3c7bb14..c3647c7 100644 --- a/doc/procps_uptime_sprint_short.3 +++ b/doc/procps_uptime_sprint_short.3 @@ -1 +1 @@ -.so man3/procps_uptime_sprint.1 +.so man3/procps_uptime.3 -- cgit v1.2.1