Implement verbose option.

This commit is contained in:
Nicolás Ortega Froysa 2018-10-18 15:05:01 +02:00
parent eaa238a900
commit e06e40af3b
No known key found for this signature in database
GPG Key ID: FEC70E3BAE2E69BF
2 changed files with 29 additions and 0 deletions

20
src/args.h Normal file
View File

@ -0,0 +1,20 @@
/*
* Copyright (C) 2018 Ortega Froysa, Nicolás <nortega@themusicinnoise.net>
* Author: Ortega Froysa, Nicolás <nortega@themusicinnoise.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once

View File

@ -45,6 +45,8 @@ int main(int argc, char *argv[]) {
mpz_set_ui(tmp, 2); mpz_set_ui(tmp, 2);
llist_add(&prime_list, tmp); llist_add(&prime_list, tmp);
mpz_clear(tmp); mpz_clear(tmp);
if(args.verbose)
puts("2");
} }
mpz_t aux; mpz_t aux;
@ -64,7 +66,14 @@ int main(int argc, char *argv[]) {
item = item->next; item = item->next;
} }
if(is_prime) if(is_prime)
{
llist_add(&prime_list, aux); llist_add(&prime_list, aux);
if(args.verbose)
{
mpz_out_str(stdout, 10, aux);
printf("\n");
}
}
mpz_add_ui(aux, aux, 2); mpz_add_ui(aux, aux, 2);
} }