summaryrefslogtreecommitdiff
path: root/interliner.c
diff options
context:
space:
mode:
authorMikhail Kobuk <m.kobuk@ispras.ru>2024-04-06 16:00:01 +0300
committerMikhail Kobuk <m.kobuk@ispras.ru>2024-04-06 16:00:01 +0300
commit232c1cb726c809599ce69dbeda7f7f716f106801 (patch)
tree56d7b3f0222f24086bc968dd7d8ee0a4e59b4b7d /interliner.c
downloadlinux-232c1cb726c809599ce69dbeda7f7f716f106801.tar.gz
Pre-EUPM build draft
TODO: convert to fakeroot TODO: separate most modules TODO: revise config TODO: adjust logging TODO: rework patch listing TODO: update patch selection
Diffstat (limited to 'interliner.c')
-rw-r--r--interliner.c78
1 files changed, 78 insertions, 0 deletions
diff --git a/interliner.c b/interliner.c
new file mode 100644
index 0000000..17937df
--- /dev/null
+++ b/interliner.c
@@ -0,0 +1,78 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <fcntl.h>
+#include <unistd.h>
+
+int
+main(int argc, char *argv[])
+{
+ //char *string = NULL;
+ //size_t sz = 0;
+
+ int fd = open("log.log", O_WRONLY | O_CREAT | O_APPEND, 0660);
+ if (fd < 0) {
+ return 1;
+ }
+
+ char msg[100] = "\nnew log =======\n";
+ write(fd, &msg, sizeof(msg));
+
+ char sstring[4096] = {};
+ ssize_t pos = 0;
+
+ int c = getchar();
+ while (c != EOF) {
+ switch (c) {
+ case '\n':
+ sstring[pos] = '\0';
+ printf("\r%s", sstring);
+ fflush(stdout);
+ pos = 0;
+ break;
+ default:
+ sstring[pos++] = c;
+ break;
+ }
+ c = getchar();
+ }
+
+ putchar('\n');
+
+ //while (getline(&string, &sz, stdin) > 0) {
+ // if (!sz) {
+ // continue;
+ // }
+
+ // char *reader = string;
+ // putchar(*reader);
+ // write(fd, reader, 1);
+ // fflush(stdout);
+ // char *writer = string;
+
+ // while ((reader - string) < sz) {
+ // if (*reader == '\n') {
+ // *reader = '\0';
+ // break;
+ // }
+
+ // write(fd, "<", 1);
+ // write(fd, reader, 1);
+ // write(fd, ">", 1);
+ // *(reader++) = *(writer++);
+ // }
+
+ // printf("\r%s", string);
+ // write(fd, "!", 1);
+
+ // free(string);
+ // string = NULL;
+ //}
+
+ close(fd);
+
+ //free(string);
+
+ return 0;
+}