1
0
mirror of git://git.suckless.org/sbase synced 2024-12-22 23:13:44 +00:00
sbase/sponge.c
FRIGN 80d89c400f Audit sponge(1)
Just a little usage()-fix. Mark it as audited in README.
2015-03-01 23:42:16 +01:00

40 lines
576 B
C

/* See LICENSE file for copyright and license details. */
#include <stdio.h>
#include "text.h"
#include "util.h"
static void
usage(void)
{
eprintf("usage: %s file\n", argv0);
}
int
main(int argc, char *argv[])
{
FILE *fp, *tmpfp;
ARGBEGIN {
default:
usage();
} ARGEND;
if (argc != 1)
usage();
if (!(tmpfp = tmpfile()))
eprintf("tmpfile:");
concat(stdin, "<stdin>", tmpfp, "<tmpfile>");
rewind(tmpfp);
if (!(fp = fopen(argv[0], "w")))
eprintf("fopen %s:", argv[0]);
concat(tmpfp, "<tmpfile>", fp, argv[0]);
fclose(fp);
fclose(tmpfp);
return 0;
}