separate getc/putc from fgetc/fputc
[musl] / src / stdio / putc.c
diff --git a/src/stdio/putc.c b/src/stdio/putc.c
new file mode 100644 (file)
index 0000000..fa89349
--- /dev/null
@@ -0,0 +1,12 @@
+#include "stdio_impl.h"
+
+int putc(int c, FILE *f)
+{
+       if (f->lock < 0 || !__lockfile(f))
+               return putc_unlocked(c, f);
+       c = putc_unlocked(c, f);
+       __unlockfile(f);
+       return c;
+}
+
+weak_alias(putc, _IO_putc);