summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2014-01-22 23:31:16 -0800
committerH. Peter Anvin <hpa@linux.intel.com>2014-01-22 23:31:16 -0800
commitb389f71193a134ba459bacaa7794287a0884b6d7 (patch)
tree888671c41607ea13cb8d854a4f8cacc1dc6fd185
parent511f9f904c70d218f26a2721c2e700b2ef84fc48 (diff)
downloadtest16-b389f71193a134ba459bacaa7794287a0884b6d7.tar.gz
test16-b389f71193a134ba459bacaa7794287a0884b6d7.tar.xz
test16-b389f71193a134ba459bacaa7794287a0884b6d7.zip
conio: separate out write() from puts()
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
-rw-r--r--lib16/conio.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/lib16/conio.c b/lib16/conio.c
index a02441a..4e4526e 100644
--- a/lib16/conio.c
+++ b/lib16/conio.c
@@ -1,15 +1,22 @@
#include <string.h>
#include <sys16.h>
-void puts(const char *s)
+int write(int fd, const void *buf, unsigned int count)
{
int rv;
- /* XXX: should loop over this */
asm volatile("int $0x80"
: "=a" (rv)
: "a" (4), /* __NR_write */
"b" (1),
- "c" (_KPTR(s)),
- "d" (strlen(s)));
+ "c" (_KPTR(buf)),
+ "d" (count));
+
+ return rv;
+}
+
+void puts(const char *s)
+{
+ /* XXX: should loop over this */
+ write(1, s, strlen(s));
}