3be6ef0659
We've been maintaining top(1) for a long time, and the upstream hasn't existed/been used in similarly as long. Make it clear that we own top(1) Tested with 'make universe'. Everything passed except MIPS which failed for unrelated reasons. Install also tested for amd64. Reviewed by: sbruno No objections: imp, mmacy Differential Revision: https://reviews.freebsd.org/D15387
42 lines
477 B
C
42 lines
477 B
C
/*
|
|
* Prime number generator. It prints on stdout the next prime number
|
|
* higher than the number specified as argv[1].
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include <math.h>
|
|
|
|
main(argc, argv)
|
|
|
|
int argc;
|
|
char *argv[];
|
|
|
|
{
|
|
double i, j;
|
|
int f;
|
|
|
|
if (argc < 2)
|
|
{
|
|
exit(1);
|
|
}
|
|
|
|
i = atoi(argv[1]);
|
|
while (i++)
|
|
{
|
|
f=1;
|
|
for (j=2; j<i; j++)
|
|
{
|
|
if ((i/j)==floor(i/j))
|
|
{
|
|
f=0;
|
|
break;
|
|
}
|
|
}
|
|
if (f)
|
|
{
|
|
printf("%.0f\n", i);
|
|
exit(0);
|
|
}
|
|
}
|
|
}
|