version 1.77, 2014/05/06 23:33:04 |
version 1.78, 2014/05/06 23:50:53 |
|
|
char *line, *endline; |
char *line, *endline; |
struct checksum *checksums = NULL, *c = NULL; |
struct checksum *checksums = NULL, *c = NULL; |
int nchecksums = 0; |
int nchecksums = 0; |
int i, j, uselist, count, hasfailed; |
int i, j, rv, uselist, count, hasfailed; |
int *failures; |
int *failures; |
|
|
line = msg; |
line = msg; |
|
|
err(1, "realloc"); |
err(1, "realloc"); |
c = &checksums[nchecksums++]; |
c = &checksums[nchecksums++]; |
if ((endline = strchr(line, '\n'))) |
if ((endline = strchr(line, '\n'))) |
*endline++ = 0; |
*endline++ = '\0'; |
if (sscanf(line, "%255s %1023s = %1023s", |
rv = sscanf(line, "%255s %1023s = %1023s", |
c->algo, buf, c->hash) != 3 || |
c->algo, buf, c->hash); |
buf[0] != '(' || buf[strlen(buf) - 1] != ')') |
if (rv != 3 || buf[0] != '(' || buf[strlen(buf) - 1] != ')') |
errx(1, "unable to parse checksum line %s", line); |
errx(1, "unable to parse checksum line %s", line); |
buf[strlen(buf) - 1] = 0; |
buf[strlen(buf) - 1] = 0; |
strlcpy(c->file, buf + 1, sizeof(c->file)); |
strlcpy(c->file, buf + 1, sizeof(c->file)); |