copy in from cvs; cvs2svn fucked up big time

git-svn-id: file:///srv/svn/joey/trunk/src/packages/bsdgames@9775 a4a2c43b-8ac3-0310-8836-e0e880c912e2
This commit is contained in:
joey
2003-12-19 19:12:08 +00:00
parent 351c8ca204
commit 51eabc017b
310 changed files with 7852 additions and 5005 deletions

View File

@@ -1,10 +1,11 @@
# $NetBSD: Makefile,v 1.3 1995/03/23 08:35:43 cgd Exp $
# $NetBSD: Makefile,v 1.6 2002/09/18 06:16:41 lukem Exp $
# @(#)Makefile 8.1 (Berkeley) 5/31/93
PROG= primes
SRCS= pattern.c pr_tbl.c primes.c
NOMAN= noman
DPADD= ${LIBM}
LDADD= -lm
NOMAN= # defined
PROG= primes
SRCS= pattern.c pr_tbl.c primes.c
DPADD= ${LIBM}
LDADD= -lm
.include <bsd.prog.mk>

View File

@@ -1,4 +1,30 @@
# Makefrag - makefile fragment for primes
#
# Copyright (c) 1997, 1998, 1999 Joseph Samuel Myers.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY 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.
primes_DEFS := -D_GNU_SOURCE
primes_DIRS := $(GAMESDIR) $(MAN6DIR)
@@ -9,6 +35,3 @@ primes_install: primes_all
$(INSTALL_BINARY) primes/primes $(INSTALL_PREFIX)$(GAMESDIR)/primes
$(HIDE_GAME) primes
$(INSTALL_MANUAL) factor.6 primes.6
primes_check: primes_all
primes/primes 100 200

View File

@@ -1,4 +1,4 @@
/* $NetBSD: pattern.c,v 1.4 1997/10/12 01:04:43 lukem Exp $ */
/* $NetBSD: pattern.c,v 1.5 1999/09/08 21:17:55 jsm Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)pattern.c 8.1 (Berkeley) 5/31/93";
#else
__RCSID("$NetBSD: pattern.c,v 1.4 1997/10/12 01:04:43 lukem Exp $");
__RCSID("$NetBSD: pattern.c,v 1.5 1999/09/08 21:17:55 jsm Exp $");
#endif
#endif /* not lint */

View File

@@ -1,4 +1,4 @@
/* $NetBSD: pr_tbl.c,v 1.4 1997/10/12 01:04:50 lukem Exp $ */
/* $NetBSD: pr_tbl.c,v 1.6 2001/01/20 15:06:34 itojun Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)pr_tbl.c 8.1 (Berkeley) 5/31/93";
#else
__RCSID("$NetBSD: pr_tbl.c,v 1.4 1997/10/12 01:04:50 lukem Exp $");
__RCSID("$NetBSD: pr_tbl.c,v 1.6 2001/01/20 15:06:34 itojun Exp $");
#endif
#endif /* not lint */
@@ -550,4 +550,4 @@ const ubig prime[] = {
};
/* pr_limit - largest prime in the prime table */
const unsigned long *pr_limit = &prime[(sizeof(prime)/sizeof(prime[0]))-1];
const ubig *pr_limit = &prime[(sizeof(prime)/sizeof(prime[0]))-1];

View File

@@ -1,4 +1,4 @@
/* $NetBSD: primes.c,v 1.8 1998/09/13 15:27:29 hubertf Exp $ */
/* $NetBSD: primes.c,v 1.10 2001/01/20 15:06:35 itojun Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -46,7 +46,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993\n\
#if 0
static char sccsid[] = "@(#)primes.c 8.5 (Berkeley) 5/10/95";
#else
__RCSID("$NetBSD: primes.c,v 1.8 1998/09/13 15:27:29 hubertf Exp $");
__RCSID("$NetBSD: primes.c,v 1.10 2001/01/20 15:06:35 itojun Exp $");
#endif
#endif /* not lint */
@@ -232,6 +232,7 @@ primes(start, stop)
char *tab_lim; /* the limit to sieve on the table */
const ubig *p; /* prime table pointer */
ubig fact_lim; /* highest prime for current block */
ubig mod; /* temp storage for mod */
/*
* A number of systems can not convert double values into unsigned
@@ -312,11 +313,11 @@ primes(start, stop)
p = &prime[7]; /* 19 is next prime, pi(19)=7 */
do {
/* determine the factor's initial sieve point */
q = (char *)(start%factor); /* temp storage for mod */
if ((long)q & 0x1) {
q = &table[(factor-(long)q)/2];
mod = start%factor;
if (mod & 0x1) {
q = &table[(factor-mod)/2];
} else {
q = &table[q ? factor-((long)q/2) : 0];
q = &table[mod ? factor-(mod/2) : 0];
}
/* sive for our current factor */
for ( ; q < tab_lim; q += factor) {