Commit Graph

14 Commits

Author SHA1 Message Date
Tony Finch
38281fea3e Fix a performance bug in factor(6).
Check if large factor is prime before applying Pollard's algorithm;
fixes "factor 2147483647111311".  Increase base if p-1 algorithm
reaches 1; fixes "factor 99999999999991".

Testcases from David A Bagley <bagleyd@tux.org>.
Fixes from Joseph Myers <jsm@NetBSD.org>.
Problem rediscovered by an attempt to factor my phone number.

A few other incidental fixes: correct a couple of factually incorrect
comments; use ident string macros; move from 4-clause to 3-clause
BSD licence (University of California copyright).

Obtained from:	NetBSD
2009-11-26 00:38:13 +00:00
Tony Finch
63f7eaa932 Factorize bignums using the Pollard Rho algorithm. The code comes
from NetBSD, altered to retain the FreeBSD -h feature and various
stylistic improvements and avoid regressions. In the absence of
OpenSSL (and therefore bignums) the old code is used.

PR:		43831
Reviewed by:	kris, markm, obrien
Obtained from:	NetBSD
MFC after:	2 weeks
2002-10-09 19:55:04 +00:00
Tony Finch
9a171f4fc4 Style fixes to: #include ordering; use const and static; ANSI functions;
various usage synopses; bogus and/or unnecessary casting; exit values;
use LINE_MAX instead of magic numbers; declare extern variables in a
header; add $FreeBSD$ where missing.

Reviewed by:    markm, obrien
Obtained from:  NetBSD | fanf
2002-10-09 19:38:55 +00:00
Warner Losh
ad64363769 Remove __P
Remove __STDC__ (which means we now use stdarg rather than vararg)
Remove register
Remove main prototype
2002-02-18 05:15:19 +00:00
Peter Pentchev
f6c0e0ef6f Correct a typo: numtiple -> multiple.
PR:		31474
Submitted by:	Eric Yu <ericyu@mail2000.com.tw>
MFC after:	1 week
2001-10-24 12:51:23 +00:00
Bill Fumerola
7b216475bf copyright/sccsid/rcsid cleanup. 1999-11-30 03:50:02 +00:00
Warner Losh
63f8ec6b73 Fix printf errors in the hflag case.
Fix old bug with bogus casing to (long).
Document the true limits of factor on 64-bit architectures.

Submitted by: bde
1999-01-06 19:46:56 +00:00
Warner Losh
be47d628ca added -h flag to allow for hexidecimal output.
Use '0' for base rather than 10 to allow for more flexible input bases.

Inspired by changes in PR 7402, but mostly redone by me to get past
bde filter.

Submitted by: Timo J. Rinne
PR: 7402
1999-01-06 08:14:26 +00:00
Jordan K. Hubbard
01f228ffbe Wargh! Who went and changed all the getopt() comparisons from -1 to
EOF?  The getopt(3) manpage clearly states that the return value is *-1*,
not EOF!  Besides, getopt(3) isn't reading from a file. :)

Noticed-while:	merging to 2.2 (where this is correct).
1998-03-01 05:10:28 +00:00
Andrey A. Chernov
fafd0d1b39 Remove so-called revoke, this game not installed sguid 1997-09-01 11:31:56 +00:00
Eivind Eklund
34a13bf4cb Change games from setuid games to setgid games.
Reviewed by:	maybe@yes.no
Obtained from:	OpenBSD (mostly deraadt@openbsd.org)
1997-09-01 00:34:51 +00:00
Peter Wemm
bdb5b1dbdc Merge from Lite2 (oops, nearly forgot these ones) 1997-03-11 17:25:32 +00:00
Rodney W. Grimes
010f5413b5 Remove trailing whitespace. 1995-05-30 03:37:36 +00:00
Jordan K. Hubbard
554eb505f8 Bring in the 4.4 Lite games directory, modulo man page changes and segregation
of the x11 based games.  I'm not going to tag the originals with bsd_44_lite
and do this in two stages since it's just not worth it for this collection,
and I've got directory renames to deal with that way.  Bleah.
Submitted by:	jkh
1994-09-04 04:03:31 +00:00