X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Feratosthenes%2F_info;fp=ccan%2Feratosthenes%2F_info;h=a09e8d1fb19429beda4eab1e58a7e8606c271f08;hb=c5e84ef2b5687fc35cdffa4768da13674afb8977;hp=0000000000000000000000000000000000000000;hpb=f591ef48f887f6c1608cdd89d78eebacd27e8552;p=ccan diff --git a/ccan/eratosthenes/_info b/ccan/eratosthenes/_info new file mode 100644 index 00000000..a09e8d1f --- /dev/null +++ b/ccan/eratosthenes/_info @@ -0,0 +1,45 @@ +#include "config.h" +#include +#include + +/** + * eratosthenes - Sieve of Eratosthenes + * + * This code implements Eratosthenes' Sieve for efficiently finding + * small prime numbers (in this context anything less than several + * billion is "small"). + * + * Example: + * #include + * + * int main(int argc, char *argv[]) + * { + * struct eratosthenes s; + * unsigned long p; + * + * eratosthenes_init(&s); + * eratosthenes_sieve(&s, atol(argv[1])); + * + * while ((p = eratosthenes_nextprime(&s, p)) != 0) { + * printf("%ld\n", p); + * } + * + * return 0; + * } + * + * License: LGPL (v2.1 or any later version) + * Author: David Gibson + */ +int main(int argc, char *argv[]) +{ + /* Expect exactly one argument */ + if (argc != 2) + return 1; + + if (strcmp(argv[1], "depends") == 0) { + printf("ccan/bitmap\n"); + return 0; + } + + return 1; +}