2 * Copyright (C) 2012-2014 Thadeu Lima de Souza Cascardo <cascardo@minaslivre.org>
3 * Copyright (C) 2014 Alexandre Oliva <lxoliva@fsfla.org>
4 * Copyright (C) 2014 Sergio Durigan Junior <sergiodj@sergiodj.net>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 static char *chop(char *str, int off, int len)
33 memcpy(s, str + off, len);
38 int main(int argc, char **argv)
40 struct rnet_decfile *decfile;
45 decfile = rnet_decfile_open(argv[1]);
47 fprintf(stderr, "could not parse file \"%s\": %s\n", argv[1], strerror(errno));
50 fprintf(stdout, "%s\n", rnet_decfile_get_header_field(decfile, "nome"));
51 fprintf(stdout, "%s\n", rnet_decfile_get_header_field(decfile, "hash"));
52 fprintf(stdout, "%s\n", rnet_decfile_get_header_field(decfile, "banco"));
53 fprintf(stdout, "%s\n", rnet_decfile_get_header_field(decfile, "agencia"));
54 fprintf(stdout, "%s\n", rnet_decfile_get_header_field(decfile, "nr_conta"));
55 fprintf(stdout, "%s\n", rnet_decfile_get_header_field(decfile, "nr_dv_conta"));
57 contrib = rnet_decfile_get_line(decfile, 1);
58 end = chop(contrib, 2+11+60+15, 40);
59 fprintf(stdout, "%s\n", end);
61 rnet_decfile_close(decfile);