From 0976db30e01f8debffe29297920902b36dd94c9a Mon Sep 17 00:00:00 2001 From: dvorakmortonxd Date: Tue, 26 May 2026 00:48:48 +0200 Subject: [PATCH] gotta go sleep now im tired, ive tried to make the intro to the DvorakMSDOS but its very early rn --- dvorakmsdos.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/dvorakmsdos.c b/dvorakmsdos.c index e9cffc2..62f015c 100644 --- a/dvorakmsdos.c +++ b/dvorakmsdos.c @@ -1,6 +1,58 @@ #include "dvorakmsdos.h" #include +#ifdef _WIN32 + #include + #define GETCH() _getch() +#else + #include + #include + #include + #include + #define GETCH() getch() + char getch(); +#endif void msmain() { - printf("Hello World!\n"); + #ifndef _WIN32 + while (1) { + char GETCH(); + struct winsize w; + ioctl(STDOUT_FILENO, TIOCGWINSZ, &w); + // we now use w.ws_col as width and w.ws_row as height + int repeat = 0; + for (int height=w.ws_row; height>1; height--) { + for (int width=w.ws_col; width>0; width--) { + if ((w.ws_col/2+11 >= width && width >= w.ws_col/2-11) && (w.ws_row/2+3 >= height && height >= w.ws_row/2-2)) { + if ((w.ws_row/2+3 == height) && repeat == 0) { + printf("Welcome To DvorakMSDOS!"); + repeat++; + } else if ((w.ws_row/2+2 == height) && repeat == 1) { + printf("Username: "); + repeat++; + } else if ((w.ws_row/2+1 == height) && repeat == 2) { + printf("Password: ████████████████████████████████████████████████████████████████████"); + repeat++; + } + } else { + printf("█"); + } + } + } + printf("Enter your username: "); + char username[13]; + while (username != "admin") { + fflush(stdout); + while (getchar() != '\n') {} + scanf(" %12[^\n]", username); + if (username == "admin") { + return; + } + } + system("clear"); + fflush(stdout); // this forces the buffer to print NOW, fixing the "bug" in which it prints out everything AFTER the next line (scanf) + } + #else + printf("fuck you for using windows get out of here and run this on a better unix system") // ofcourse this is temporary + return; + #endif } \ No newline at end of file