2 * Copyright (C) 2015 Thadeu Lima de Souza Cascardo <cascardo@cascardo.eti.br>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 #include "declaracao.h"
29 void conjuge_free(struct declaracao *dec)
32 free(dec->conjuge.cpf);
35 static int conjuge_parse(struct declaracao *dec, char **args)
39 r += set_string(args[1], &dec->conjuge.cpf);
40 r += set_llong(args[2], &dec->conjuge.base);
41 r += set_llong(args[3], &dec->conjuge.imposto);
42 r += set_llong(args[4], &dec->conjuge.isento);
43 r += set_llong(args[5], &dec->conjuge.exclusivo);
44 r += set_llong(args[6], &dec->conjuge.rendpj_exigibilidade_suspensa);
45 r += set_llong(args[7], &dec->conjuge.total);
46 r += set_int(args[8], &dec->conjuge.entregou);
48 if (r < 0 || dec->conjuge.base < 0 || dec->conjuge.imposto < 0 ||
49 dec->conjuge.isento < 0 || dec->conjuge.exclusivo < 0 ||
50 dec->conjuge.rendpj_exigibilidade_suspensa < 0 ||
51 dec->conjuge.total < 0 || dec->conjuge.entregou < 0) {
58 static int run_conjuge(struct declaracao *dec, char **args, int argc)
60 struct conjuge *conjuge;
63 dec_set_error(dec, "Esperados %d argumentos, recebidos %d.\n", 9, argc);
66 r = conjuge_parse(dec, args);
72 void conjuge_salva(struct declaracao *dec, FILE *f)
74 if (!dec->conjuge.cpf)
76 fprintf(f, "conjuge \"%s\" %lld %lld %lld %lld %lld %lld %d\n",
77 dec->conjuge.cpf, dec->conjuge.base,
78 dec->conjuge.imposto, dec->conjuge.isento,
79 dec->conjuge.exclusivo,
80 dec->conjuge.rendpj_exigibilidade_suspensa,
81 dec->conjuge.total, dec->conjuge.entregou);
84 static struct cmd cmd_conjuge = {
89 int conjuge_cmd_init(void)
91 cmd_add(&cmd_conjuge);