aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/fossil/Clog.c
diff options
context:
space:
mode:
authorDavid du Colombier <0intro@gmail.com>2013-09-23 23:00:39 +0200
committerDavid du Colombier <0intro@gmail.com>2013-09-23 23:00:39 +0200
commit6f4d00ee45693290fae042b27536b54f77b96acd (patch)
tree60ad31bf16ed2000661c02345dd2a63851588a5d /src/cmd/fossil/Clog.c
parentfea86f063930ea187f1c77e93207ac8d39125520 (diff)
downloadplan9port-6f4d00ee45693290fae042b27536b54f77b96acd.tar.gz
plan9port-6f4d00ee45693290fae042b27536b54f77b96acd.tar.bz2
plan9port-6f4d00ee45693290fae042b27536b54f77b96acd.zip
fossil: import from plan 9
R=rsc https://codereview.appspot.com/7988047
Diffstat (limited to 'src/cmd/fossil/Clog.c')
-rw-r--r--src/cmd/fossil/Clog.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/cmd/fossil/Clog.c b/src/cmd/fossil/Clog.c
new file mode 100644
index 00000000..95755345
--- /dev/null
+++ b/src/cmd/fossil/Clog.c
@@ -0,0 +1,40 @@
+#include "stdinc.h"
+#include "9.h"
+
+/*
+ * To do: This will become something else ('vprint'?).
+ */
+int
+consVPrint(char* fmt, va_list args)
+{
+ int len, ret;
+ char buf[256];
+
+ len = vsnprint(buf, sizeof(buf), fmt, args);
+ ret = consWrite(buf, len);
+
+ while (len-- > 0 && buf[len] == '\n')
+ buf[len] = '\0';
+ /*
+ * if we do this, checking the root fossil (if /sys/log/fossil is there)
+ * will spew all over the console.
+ */
+ if (0)
+ syslog(0, "fossil", "%s", buf);
+ return ret;
+}
+
+/*
+ * To do: This will become 'print'.
+ */
+int
+consPrint(char* fmt, ...)
+{
+ int ret;
+ va_list args;
+
+ va_start(args, fmt);
+ ret = consVPrint(fmt, args);
+ va_end(args);
+ return ret;
+}