Skip to content

Commit

Permalink
change: foe_tool print to stdout if destination filename is obmitted
Browse files Browse the repository at this point in the history
  • Loading branch information
robert-burger committed Jul 31, 2024
1 parent 1903411 commit b2532a3
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions tools/foe_tool/foe_tool.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,17 @@ int main(int argc, char **argv) {
ec_foe_read(&ec, slave, password, first_fn, &string, &fsize, &err);

if (string != NULL) {
if (strcmp(second_fn, ".") == 0) { second_fn = first_fn; }
FILE *f = fopen(second_fn, "wb");
fwrite(string, fsize, 1, f);
fclose(f);

free(string);
if (second_fn == NULL) {
write(1, string, fsize);
write(1, "\n", 1);
} else {
if (strcmp(second_fn, ".") == 0) { second_fn = first_fn; }
FILE *f = fopen(second_fn, "wb");
fwrite(string, fsize, 1, f);
fclose(f);

free(string);
}
} else {
printf("file read was not successfull: data %p, fsize %" PRIu64 ", err %s\n", string, fsize, err);
}
Expand Down

0 comments on commit b2532a3

Please sign in to comment.