aboutsummaryrefslogtreecommitdiffstats
path: root/src/common/stdin.c
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2016-10-04 23:58:10 +0200
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2016-10-04 23:58:10 +0200
commit13be5bd50238daa2be6b42104ba20aeea427655b (patch)
tree3e66986cd1ebbd98f06f61ff45127745fd54bc01 /src/common/stdin.c
parent3fff4bb3172f77b292b0c913749e81bedd3545f3 (diff)
downloadblogc-13be5bd50238daa2be6b42104ba20aeea427655b.tar.gz
blogc-13be5bd50238daa2be6b42104ba20aeea427655b.tar.bz2
blogc-13be5bd50238daa2be6b42104ba20aeea427655b.zip
git-receiver: splitted and tested pre-receive input parser
Diffstat (limited to 'src/common/stdin.c')
-rw-r--r--src/common/stdin.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/common/stdin.c b/src/common/stdin.c
new file mode 100644
index 0000000..2664c3e
--- /dev/null
+++ b/src/common/stdin.c
@@ -0,0 +1,23 @@
+/*
+ * blogc: A blog compiler.
+ * Copyright (C) 2015-2016 Rafael G. Martins <rafael@rafaelmartins.eng.br>
+ *
+ * This program can be distributed under the terms of the BSD License.
+ * See the file LICENSE.
+ */
+
+#include <stdio.h>
+#include "utils.h"
+#include "stdin.h"
+
+
+// splitted in single file to make it easier to test
+char*
+bc_stdin_read(void)
+{
+ int c;
+ bc_string_t *rv = bc_string_new();
+ while (EOF != (c = fgetc(stdin)))
+ bc_string_append_c(rv, c);
+ return bc_string_free(rv, false);
+}