FreeCalypso > hg > fc-pcsc-tools
diff simtool/sstlist.c @ 116:9c16cf1a79af
fc-simtool sst: support output redirection
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 19 Feb 2021 07:30:17 +0000 |
parents | 090704d1ddc1 |
children |
line wrap: on
line diff
--- a/simtool/sstlist.c Fri Feb 19 07:26:15 2021 +0000 +++ b/simtool/sstlist.c Fri Feb 19 07:30:17 2021 +0000 @@ -10,7 +10,9 @@ #include "curfile.h" #include "file_id.h" -cmd_sst() +cmd_sst(argc, argv, outf) + char **argv; + FILE *outf; { int rc; unsigned byte, pos, code, nserv, linelen; @@ -48,21 +50,21 @@ if (!(code & 1)) continue; if (linelen > 73) { - putchar('\n'); + putc('\n', outf); linelen = 0; } if (linelen) { - putchar(' '); + putc(' ', outf); linelen++; } - linelen += printf("%u", nserv); + linelen += fprintf(outf, "%u", nserv); if (!(code & 2)) { - putchar('^'); + putc('^', outf); linelen++; } } } if (linelen) - putchar('\n'); + putc('\n', outf); return(0); }