Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
laffer1 committed Sep 5, 2024
1 parent 358d7aa commit 6b77e4c
Show file tree
Hide file tree
Showing 25 changed files with 39 additions and 56 deletions.
1 change: 0 additions & 1 deletion lib/libutil/_secure_path.3
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
.\" 5. Modifications may be freely made to this file providing the above
.\" conditions are met.
.\"
.\"
.Dd May 10, 2020
.Dt _SECURE_PATH 3
.Os
Expand Down
2 changes: 0 additions & 2 deletions lib/libutil/_secure_path.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
*/

#include <sys/cdefs.h>
__FBSDID("$FreeBSD: stable/11/lib/libutil/_secure_path.c 139012 2004-12-18 12:31:12Z ru $");

#include <sys/types.h>
#include <sys/stat.h>

Expand Down
4 changes: 1 addition & 3 deletions lib/libutil/auth.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
* SPDX-License-Identifier: BSD-2-Clause
*
* Simple authentication database handling code.
*
Expand Down Expand Up @@ -31,8 +31,6 @@
*/

#include <sys/cdefs.h>
__MBSDID("$FreeBSD: src/lib/libutil/auth.c,v 1.6 2003/06/14 18:42:37 markm Exp $");

#include <stdlib.h>

#include <libutil.h>
Expand Down
13 changes: 10 additions & 3 deletions lib/libutil/expand_number.3
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD: stable/11/lib/libutil/expand_number.3 354034 2019-10-24 19:14:37Z jhb $
.\"
.Dd July 20, 2019
.Dd June 13, 2023
.Dt EXPAND_NUMBER 3
.Os
.Sh NAME
Expand Down Expand Up @@ -63,6 +61,15 @@ The suffixes are:
.It Li P Ta No peta Ta 1125899906842624
.It Li E Ta No exa Ta 1152921504606846976
.El
.Pp
For historical reasons, the
.Fn expand_number
function accepts and ignores a single
.Dq B
suffix at the end of the
.Fa buf
string.
However, the usage of this suffix is discouraged.
.Sh RETURN VALUES
.Rv -std
.Sh ERRORS
Expand Down
18 changes: 15 additions & 3 deletions lib/libutil/expand_number.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2007 Eric Anderson <[email protected]>
* Copyright (c) 2007 Pawel Jakub Dawidek <[email protected]>
Expand Down Expand Up @@ -28,8 +28,6 @@
*/

#include <sys/cdefs.h>
__FBSDID("$FreeBSD: stable/11/lib/libutil/expand_number.c 331722 2018-03-29 02:50:57Z eadler $");

#include <sys/types.h>
#include <ctype.h>
#include <errno.h>
Expand Down Expand Up @@ -76,6 +74,8 @@ expand_number(const char *buf, uint64_t *num)
shift = 10;
break;
case 'b':
shift = 0;
break;
case '\0': /* No unit. */
*num = number;
return (0);
Expand All @@ -85,6 +85,18 @@ expand_number(const char *buf, uint64_t *num)
return (-1);
}

/*
* Treat 'b' as an ignored suffix for all unit except 'b',
* otherwise there should be no remaining character(s).
*/
endptr++;
if (shift != 0 && tolower((unsigned char)*endptr) == 'b')
endptr++;
if (*endptr != '\0') {
errno = EINVAL;
return (-1);
}

if ((number << shift) >> shift != number) {
/* Overflow */
errno = ERANGE;
Expand Down
3 changes: 1 addition & 2 deletions lib/libutil/flopen.3
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.\"-
.\" Copyright (c) 2007 Dag-Erling Coïdan Smørgrav
.\" Copyright (c) 2007 Dag-Erling Smørgrav
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
Expand All @@ -23,7 +23,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\"
.Dd July 28, 2017
.Dt FLOPEN 3
.Os
Expand Down
5 changes: 2 additions & 3 deletions lib/libutil/flopen.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2007-2009 Dag-Erling Coïdan Smørgrav
* Copyright (c) 2007-2009 Dag-Erling Smørgrav
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand All @@ -28,7 +28,6 @@
*/

#include <sys/cdefs.h>

#include <sys/file.h>
#include <sys/stat.h>

Expand Down
1 change: 0 additions & 1 deletion lib/libutil/fparseln.3
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
.\" $NetBSD: fparseln.3,v 1.7 1999/07/02 15:49:12 simonb Exp $
.\" $FreeBSD: stable/11/lib/libutil/fparseln.3 267803 2014-06-23 18:40:21Z joel $
.\"
.\" Copyright (c) 1997 Christos Zoulas. All rights reserved.
.\"
Expand Down
1 change: 0 additions & 1 deletion lib/libutil/fparseln.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
*/

#include <sys/cdefs.h>

#include <sys/types.h>
#include <assert.h>
#include <errno.h>
Expand Down
1 change: 0 additions & 1 deletion lib/libutil/pidfile.3
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\"
.Dd May 10, 2020
.Dt PIDFILE 3
.Os
Expand Down
2 changes: 0 additions & 2 deletions lib/libutil/property.3
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
.\" 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: stable/11/lib/libutil/property.3 236965 2012-06-12 17:02:53Z des $
.\" "
.Dd October 7, 1998
.Dt PROPERTIES 3
Expand Down
5 changes: 1 addition & 4 deletions lib/libutil/property.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
* SPDX-License-Identifier: BSD-2-Clause
*
*
* Simple property list handling code.
Expand Down Expand Up @@ -34,9 +34,6 @@
*/

#include <sys/cdefs.h>
/* $FreeBSD: src/lib/libutil/property.c,v 1.14 2005/11/28 16:30:16 jhb Exp $ */
__MBSDID("$MidnightBSD: src/lib/libutil/property.c,v 1.4 2011/03/19 23:37:16 laffer1 Exp $");

#include <sys/types.h>
#include <ctype.h>
#include <err.h>
Expand Down
1 change: 0 additions & 1 deletion lib/libutil/pty.3
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
.\" 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 June 2, 2018
.Dt PTY 3
Expand Down
8 changes: 2 additions & 6 deletions lib/libutil/pty.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,7 @@
*/

#include <sys/cdefs.h>

#if defined(LIBC_SCCS) && !defined(lint)
#if 0
static char sccsid[] = "@(#)pty.c 8.3 (Berkeley) 5/16/94";
#endif
#endif /* LIBC_SCCS and not lint */
__SCCSID("@(#)pty.c 8.3 (Berkeley) 5/16/94");

#include <sys/types.h>
#include <sys/ioctl.h>
Expand Down Expand Up @@ -100,6 +95,7 @@ forkpty(int *amaster, char *name, struct termios *termp, struct winsize *winp)
return (-1);
switch (pid = fork()) {
case -1:
(void)close(master);
(void)close(slave);
return (-1);
case 0:
Expand Down
1 change: 0 additions & 1 deletion lib/libutil/pw_util.3
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\"
.Dd May 10, 2020
.Dt PW_UTIL 3
.Os
Expand Down
3 changes: 1 addition & 2 deletions lib/libutil/quotafile.3
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.\"-
.\" Copyright (c) 2009 Dag-Erling Coïdan Smørgrav and
.\" Copyright (c) 2009 Dag-Erling Smørgrav and
.\" Marshall Kirk McKusick. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
Expand All @@ -23,7 +23,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\"
.Dd December 28, 2009
.Dt QUOTAFILE 3
.Os
Expand Down
6 changes: 2 additions & 4 deletions lib/libutil/quotafile.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2008 Dag-Erling Coïdan Smørgrav
* Copyright (c) 2008 Dag-Erling Smørgrav
* Copyright (c) 2008 Marshall Kirk McKusick
* All rights reserved.
*
Expand All @@ -26,8 +26,6 @@
* 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: stable/11/lib/libutil/quotafile.c 351730 2019-09-03 04:50:39Z sef $
*/

#include <sys/types.h>
Expand Down
2 changes: 0 additions & 2 deletions lib/libutil/realhostname.3
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD: stable/11/lib/libutil/realhostname.3 230234 2012-01-16 21:25:41Z ghelmer $
.\"
.Dd April 6, 1999
.Dt REALHOSTNAME 3
.Os
Expand Down
3 changes: 1 addition & 2 deletions lib/libutil/realhostname.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 1999 Brian Somers <[email protected]>
* All rights reserved.
Expand Down Expand Up @@ -27,7 +27,6 @@
*/

#include <sys/cdefs.h>

#include <sys/param.h>
#include <sys/socket.h>

Expand Down
1 change: 0 additions & 1 deletion lib/libutil/realhostname_sa.3
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\"
.Dd January 11, 2000
.Dt REALHOSTNAME_SA 3
.Os
Expand Down
4 changes: 1 addition & 3 deletions lib/libutil/stub.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2000 Brian Fundakowski Feldman
* All rights reserved.
Expand Down Expand Up @@ -27,8 +27,6 @@
*/

#include <sys/cdefs.h>
__FBSDID("$FreeBSD: stable/11/lib/libutil/stub.c 331722 2018-03-29 02:50:57Z eadler $");

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
Expand Down
1 change: 0 additions & 1 deletion lib/libutil/trimdomain.3
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\"
.Dd April 7, 1999
.Dt TRIMDOMAIN 3
.Os
Expand Down
3 changes: 1 addition & 2 deletions lib/libutil/trimdomain.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2001 Brian Somers <[email protected]>
* Based on original work by Atsushi Murai <[email protected]>
Expand Down Expand Up @@ -29,7 +29,6 @@
*/

#include <sys/cdefs.h>

#include <sys/param.h>

#include <libutil.h>
Expand Down
1 change: 0 additions & 1 deletion lib/libutil/uucplock.3
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
.\" 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 May 10, 2020
.Dt UUCPLOCK 3
Expand Down
5 changes: 1 addition & 4 deletions lib/libutil/uucplock.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@
*/

#include <sys/cdefs.h>

#ifndef lint
static const char sccsid[] = "@(#)uucplock.c 8.1 (Berkeley) 6/6/93";
#endif /* not lint */
__SCCSID("@(#)uucplock.c 8.1 (Berkeley) 6/6/93");

#include <sys/types.h>
#include <sys/file.h>
Expand Down

0 comments on commit 6b77e4c

Please sign in to comment.