summaryrefslogtreecommitdiffstats
path: root/text-utils/line.c
diff options
context:
space:
mode:
Diffstat (limited to 'text-utils/line.c')
-rw-r--r--text-utils/line.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/text-utils/line.c b/text-utils/line.c
new file mode 100644
index 000000000..d4bb86ddb
--- /dev/null
+++ b/text-utils/line.c
@@ -0,0 +1,38 @@
+/*
+ * line - read one line
+ *
+ * Gunnar Ritter, Freiburg i. Br., Germany, December 2000.
+ *
+ * Public Domain.
+ */
+
+#ident "@(#)line.c 1.7 (gritter) 7/5/02"
+
+#include <stdio.h>
+#include <unistd.h>
+
+static int status; /* exit status */
+
+static void
+doline(int fd)
+{
+ char c;
+
+ for (;;) {
+ if (read(fd, &c, 1) <= 0) {
+ status = 1;
+ break;
+ }
+ if (c == '\n')
+ break;
+ putchar(c);
+ }
+ putchar('\n');
+}
+
+int
+main(int argc, char **argv)
+{
+ doline(0);
+ return status;
+}