summaryrefslogtreecommitdiffstats
path: root/games/factor
diff options
context:
space:
mode:
authorpjanzen <pjanzen@openbsd.org>1998-08-19 07:39:48 +0000
committerpjanzen <pjanzen@openbsd.org>1998-08-19 07:39:48 +0000
commit1ed0e75d51eaf94b122dcac31a3948479297571d (patch)
tree73e163e6d84be288a56a35c4aa809dd138cdd931 /games/factor
parentMake kvm_mkdb work again (diff)
downloadwireguard-openbsd-1ed0e75d51eaf94b122dcac31a3948479297571d.tar.xz
wireguard-openbsd-1ed0e75d51eaf94b122dcac31a3948479297571d.zip
tags, formatting, ANSI-fication, prototypes, de-typos, and the occasional
initialization, removal of unused variable, or other minor fix. Most changes are from or inspired by NetBSD.
Diffstat (limited to 'games/factor')
-rw-r--r--games/factor/factor.612
-rw-r--r--games/factor/factor.c5
2 files changed, 10 insertions, 7 deletions
diff --git a/games/factor/factor.6 b/games/factor/factor.6
index d21be552a8e..3171170c31d 100644
--- a/games/factor/factor.6
+++ b/games/factor/factor.6
@@ -1,4 +1,4 @@
-.\" $NetBSD: factor.6,v 1.4 1995/03/23 08:28:05 cgd Exp $
+.\" $OpenBSD: factor.6,v 1.2 1998/08/19 07:40:27 pjanzen Exp $
.\"
.\" Copyright (c) 1989, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -50,14 +50,14 @@
.Nd
factor a number, generate primes
.Sh SYNOPSIS
-.Nm factor
+.Nm
.Op Ar number ...
.br
.Nm primes
.Op Ar start Op Ar stop
.Sh DESCRIPTION
The
-.Nm factor
+.Nm
utility will factor integers between -2147483648 and 2147483647 inclusive.
When a number is factored, it is printed, followed by a
.Dq \: ,
@@ -67,14 +67,14 @@ If a factor divides a value more than once, it will be printed
more than once.
.Pp
When
-.Nm factor
+.Nm
is invoked with one or more arguments,
each argument will be factored.
.Pp
When
-.Nm factor
+.Nm
is invoked with no arguments,
-.Nm factor
+.Nm
reads numbers, one per line, from standard input, until end of file or error.
Leading white-space and empty lines are ignored.
Numbers may be preceded by a single - or +.
diff --git a/games/factor/factor.c b/games/factor/factor.c
index 3407b3587a0..d79e19e6efd 100644
--- a/games/factor/factor.c
+++ b/games/factor/factor.c
@@ -1,3 +1,4 @@
+/* $OpenBSD: factor.c,v 1.5 1998/08/19 07:40:28 pjanzen Exp $ */
/* $NetBSD: factor.c,v 1.5 1995/03/23 08:28:07 cgd Exp $ */
/*
@@ -46,7 +47,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)factor.c 8.3 (Berkeley) 3/30/94";
#else
-static char rcsid[] = "$NetBSD: factor.c,v 1.5 1995/03/23 08:28:07 cgd Exp $";
+static char rcsid[] = "$OpenBSD: factor.c,v 1.5 1998/08/19 07:40:28 pjanzen Exp $";
#endif
#endif /* not lint */
@@ -69,12 +70,14 @@ static char rcsid[] = "$NetBSD: factor.c,v 1.5 1995/03/23 08:28:07 cgd Exp $";
* If no args are given, the list of numbers are read from stdin.
*/
+#include <sys/types.h>
#include <err.h>
#include <ctype.h>
#include <errno.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
+#include <unistd.h>
#include "primes.h"