{
struct taxtable *tt;
long long tr, td;
- if (dec->ano != 2015) {
- return -EINVAL;
- }
tt = table2015;
tr = total_rendimento(dec);
dec->totalrendimento = tr;
return imposto(tt, tr);
}
-void calcula(struct declaracao *dec)
+int calcula(struct declaracao *dec)
{
long long i_simples, i_completa;
+ if (dec->ano != 2015) {
+ return -EINVAL;
+ }
i_simples = imposto_simples(dec);
i_completa = imposto_completa(dec);
dec->pago = total_pago(dec);
dec->devido = i_simples;
}
dec->restituicao = dec->pago - dec->devido;
+ return 0;
}
static int run_calcula(struct declaracao *dec, char **args, int argc)
{
- calcula(dec);
- return 0;
+ return calcula(dec);
}
static struct cmd cmd_calcula = {