From 860cd8cd81fe3649142e428936c529a9c492b10c Mon Sep 17 00:00:00 2001 From: netbenix Date: Sat, 8 May 2021 20:13:23 +0200 Subject: [PATCH 1/5] Removed math.o --- .gitignore | 3 --- math.o | Bin 2328 -> 0 bytes 2 files changed, 3 deletions(-) delete mode 100644 math.o diff --git a/.gitignore b/.gitignore index edc5aef..bb9095b 100644 --- a/.gitignore +++ b/.gitignore @@ -14,8 +14,5 @@ change_dir.o update_check.o man.o calc.o -<<<<<<< HEAD math_ext.o -======= ->>>>>>> f1cf6269f94065bfb8498dd7ef06bfbb61442b80 your-reality.o \ No newline at end of file diff --git a/math.o b/math.o deleted file mode 100644 index 217e530046d31d5665f552a415c44aa69f3c83ee..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2328 zcmb_c&1=+95T9*pyRB`r6%WOVLA zghb#B)IEU$JlRpVbtH%4aqgsDo-1Xe} zVFoax30Djk?Q`VZ6f^)-32VefvfEb>SsI5(B^K#vZ;3ABK=&d}i=>wxMrZ6nL!zTO zjREKqcZzV7t@s(A-jct~{19nT|5m;JQ|6Bc`9ht4#e5>jFZn!En-tyECiwn)6M;Zu z=uIX(aG5!gdax@H@AUw&cE*J-G|hnG&!Z+0IQ5_KiiZMty+FI0adAek2Z$ZSMYUu( zfj}638gZ(>&Iw+x$j+NiPMd{+xjC3{GcfAT!_c(_NVpm6LUG>BTaX?}jSUW@(qqHJ z6UJnEa$qoJq@h&22@|E9Ws5Ms@O!S0_shFmzkd7jk#V|nZMXy;<)4NezlU)-{(uxu zJc;T(f$p`p*acm}MZd2|xR}R12^aHtCgEZpRS6gU1+Bc8cgzfG$M$tjShh89YK~QL zK$|li6SPdZ44Pf^o!MeOZxxU$6dg;$Z?&)Nn6o$7zglp$l3grWwzG&iRLRPvv$lzY z`X8cV5o&R>R7_|8824Y$k_$aZ&`fj@z`C0UCHlD&amtMfp7kNd8`&3XL4FYvGJFJa zs`;<^am=NfbdQ2k;TOr@me{|DrSFeI`vt)IA?MTig2J$uL--&rfd%7Ugn=QkC1D o=>JM3#rs7*)s$zC5UenGmYjfaxf;@iR#?8uzka6{=^JwXAL6DVfdBvi From 5878d588d8f94cb14290e7ee53cd74c5fd307204 Mon Sep 17 00:00:00 2001 From: netbenix Date: Sun, 9 May 2021 08:38:48 +0200 Subject: [PATCH 2/5] Added clear screen function for linux and win32 --- .gitignore | 3 ++- main.c | 12 +++++++----- makefile | 6 ++++-- utils/clear_screen.c | 28 ++++++++++++++++++++++++++++ utils/clear_screen.h | 6 ++++++ 5 files changed, 47 insertions(+), 8 deletions(-) create mode 100644 utils/clear_screen.c create mode 100644 utils/clear_screen.h diff --git a/.gitignore b/.gitignore index bb9095b..9baf9aa 100644 --- a/.gitignore +++ b/.gitignore @@ -15,4 +15,5 @@ update_check.o man.o calc.o math_ext.o -your-reality.o \ No newline at end of file +your-reality.o +clear_screen.o \ No newline at end of file diff --git a/main.c b/main.c index 6c07f2f..c47fb25 100644 --- a/main.c +++ b/main.c @@ -21,9 +21,10 @@ #include "utils/sys_info.h" #include "utils/update_check.h" #include "utils/calc.h" +#include "utils/clear_screen.h" -#define VERSION "0.2.6" +#define VERSION "0.3.1" bool VER_CHECK_ON_START = true; bool DEV_MODE = false; @@ -118,6 +119,7 @@ int main(int argc, char *argv[]){ snprintf(buffer, sizeof(buffer), "Starting netbenixCMD (Version: %s)", VERSION); logger(buffer); log_Specs(); //Log system specs + clearScreen(); //Clear the screen showLogo(); //Show the logo logger("Logo Displayed."); if(argc > 2){ @@ -129,19 +131,19 @@ int main(int argc, char *argv[]){ //Check the startup args if(argc == 2){ if(!strcmp(argv[1], "--help")){ - logger("Showing Help."); + logger("Showing help."); outputHelp(); exit(0); } else if (!strcmp(argv[1], "--gtk-test")){ - logger("Stating GTK Test."); + logger("Stating GTK test."); createGTKTestWindow(); exit(0); } else if (!strcmp(argv[1], "--sys-info")){ - logger("Showing System Information."); + logger("Showing system information."); print_Specs(); exit(0); } else if (!strcmp(argv[1], "--sql-test")){ - logger("Starting SQL Test."); + logger("Starting SQL test."); testSQLConnection(); exit(0); } else if (!strcmp(argv[1], "--no-version-check")){ diff --git a/makefile b/makefile index 3b2d376..84498fc 100644 --- a/makefile +++ b/makefile @@ -2,7 +2,7 @@ CC= gcc ARGS= -export-dynamic -ansi -std=gnu99 CFLAGS= $(shell pkg-config --cflags gtk+-3.0) -I/usr/include/mysql LDLIBS= $(shell pkg-config --libs gtk+-3.0) -L/usr/lib/mysql -lmysqlclient -lm -OBJ= main.o logo.o logger.o help.o sys_info.o gtk_test.o sql_test.o show_dir.o change_dir.o update_check.o man.o your-reality.o math_ext.o calc.o +OBJ= main.o logo.o logger.o help.o sys_info.o gtk_test.o sql_test.o show_dir.o change_dir.o update_check.o man.o your-reality.o math_ext.o calc.o clear_screen.o netbenixCMD: $(OBJ) $(CC) $(CFLAGS) $(ARGS) -o netbenixCMD $(OBJ) $(LDLIBS) main.o: main.c @@ -32,4 +32,6 @@ math_ext.o: etc/math_ext.c your-reality.o: etc/your-reality.c $(CC) $(CFLAGS) -c etc/your-reality.c calc.o: utils/calc.c - $(CC) $(CFLAGS) -c utils/calc.c \ No newline at end of file + $(CC) $(CFLAGS) -c utils/calc.c +clear_screen.o: utils/clear_screen.c + $(CC) $(CFLAGS) -c utils/clear_screen.c \ No newline at end of file diff --git a/utils/clear_screen.c b/utils/clear_screen.c new file mode 100644 index 0000000..a3d16c9 --- /dev/null +++ b/utils/clear_screen.c @@ -0,0 +1,28 @@ +#include +#if defined(_WIN32) +#include +#elif defined(__linux__) +#include +#include +#endif + +#include "clear_screen.h" + + +void clearScreen(){ + #if defined(_WIN32) + CONSOLE_SCREEN_BUFFER_INFO csbi; + int rows; + GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi); + rows = csbi.srWindow.Bottom - csbi.srWindow.Top + 1; + for(int i = 0; i < rows; i++){ + printf("\n"); + } + #elif defined(__linux__) + struct winsize w; + ioctl(STDOUT_FILENO, TIOCGWINSZ, &w); + for(int i = 0; i < w.ws_row; i++){ + printf("\n"); + } + #endif +} \ No newline at end of file diff --git a/utils/clear_screen.h b/utils/clear_screen.h new file mode 100644 index 0000000..b7bc8c7 --- /dev/null +++ b/utils/clear_screen.h @@ -0,0 +1,6 @@ +#ifndef _CLEAR_SCREEN_H_ +#define _CLEAR_SCREEN_H_ + +void clearScreen(); + +#endif \ No newline at end of file From 2dc69c670bf50713dd4a0f008de65dbd4be9bc02 Mon Sep 17 00:00:00 2001 From: netbenix Date: Sun, 9 May 2021 09:00:24 +0200 Subject: [PATCH 3/5] Updated gtk-test --- README.md | 2 +- glade/test_window.glade | 61 ++++++++++++++++++++--------------------- 2 files changed, 30 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index 42b34bb..a881d12 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Tested on: *Ubuntu, Debian, Arch* Used libs for Linux: *gtk+3.0, libmysqlclient* -Version: *0.2.6* +Version: *0.3.1* ## Features: diff --git a/glade/test_window.glade b/glade/test_window.glade index b536e3c..a365958 100644 --- a/glade/test_window.glade +++ b/glade/test_window.glade @@ -1,15 +1,15 @@ - + - 300 - 230 - False + 300 + 230 + False False - center - 300 - 230 + center + 300 + 230 ../logo.png center @@ -17,16 +17,16 @@ True - False + False Ok - 100 - 31 + 100 + 31 True - True - True - Pink Fluffy Unicorns + True + True + Pink Fluffy Unicorns @@ -36,14 +36,14 @@ - 369 - 20 + 369 + 20 True - False + False center center center - 50 + 50 @@ -56,12 +56,12 @@ Toggle - 107 - 24 + 107 + 24 True - True - False - True + True + False + True @@ -71,10 +71,10 @@ - 40 - 40 + 40 + 40 True - False + False True @@ -84,11 +84,11 @@ - 100 - 20 + 100 + 20 True - False - 100 + False + 100 8 @@ -97,8 +97,5 @@ - - - From bea164468b1a944028e9b1eee3502b7f3cb6630d Mon Sep 17 00:00:00 2001 From: netbenix Date: Sun, 9 May 2021 16:54:05 +0200 Subject: [PATCH 4/5] Added man entries for man and cd --- etc/man.c | 31 ++++++++++++++++++++++++++++++- etc/man.h | 2 ++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/etc/man.c b/etc/man.c index 752f217..86410d0 100644 --- a/etc/man.c +++ b/etc/man.c @@ -22,6 +22,7 @@ //Main function to start man is at the bottom //MAN ENTRIES + //LS void manEntry_ls(){ printf("\033[0;33m##################\033[0m\n"); @@ -35,14 +36,42 @@ void manEntry_ls(){ printf("\t\033[0;36mList files and directorys in the given directory. Sorts entries alphabetically.\033[0m\n\n"); } +//CD +void manEntry_cd(){ + printf("\033[0;33m##################\033[0m\n"); + printf("\033[0;33m# Manual of \033[0;36m'cd' \033[0;33m#\033[0m\n"); + printf("\033[0;33m##################\033[0m\n"); + printf("\033[0;33mNAME\033[0m\n"); + printf("\t\033[0;36mcd - change directory\033[0m\n\n"); + printf("\033[0;33mUSAGE\033[0m\n"); + printf("\t\033[0;36mcd \033[0;35m[DIRECTORY]\033[0m\n\n"); + printf("\033[0;33mDESCRIPTION\033[0m\n"); + printf("\t\033[0;36mChanged the currently selected directory.\033[0m\n\n"); +} + +//MAN +void manEntry_man(){ + printf("\033[0;33m###################\033[0m\n"); + printf("\033[0;33m# Manual of \033[0;36m'man' \033[0;33m#\033[0m\n"); + printf("\033[0;33m###################\033[0m\n\n"); + printf("\033[0;33mNAME\033[0m\n"); + printf("\t\033[0;36mman - manual\033[0m\n\n"); + printf("\033[0;33mUSAGE\033[0m\n"); + printf("\t\033[0;36mman \033[0;35m[COMMAND]\033[0m\n\n"); + printf("\033[0;33mDESCRIPTION\033[0m\n"); + printf("\t\033[0;36mShows the manual of given command.\033[0m\n\n"); +} + //MAIN FUNCTION void showManEntry(char *arg[]){ if(!strcmp(arg[1], "man")){ - printf("Coming soon.\n"); + manEntry_man(); } else if(!strcmp(arg[1], "ls")){ manEntry_ls(); + } else if(!strcmp(arg[1], "cd")){ + manEntry_cd(); } else { printf("Entry not found.\n"); } diff --git a/etc/man.h b/etc/man.h index 08bcf7c..f6a756b 100644 --- a/etc/man.h +++ b/etc/man.h @@ -2,6 +2,8 @@ #define _MAN_H_ void manEntry_ls(); +void manEntry_cd(); +void manEntry_man(); void showManEntry(char *arg[]); #endif \ No newline at end of file From af1377bc7cdd6774dac7bf63e351f36b9a97c03c Mon Sep 17 00:00:00 2001 From: Liliesh Date: Wed, 18 Mar 2026 18:58:18 +0100 Subject: [PATCH 5/5] Commited uncommited files --- .idea/.gitignore | 8 ++ .idea/misc.xml | 18 ++++ .idea/vcs.xml | 6 ++ etc/man.c | 154 +++++++++++++++--------------- etc/your-reality.c | 76 +++++++-------- etc/your-reality.h | 10 +- glade/test_window.glade | 202 ++++++++++++++++++++-------------------- utils/clear_screen.c | 54 +++++------ utils/clear_screen.h | 10 +- 9 files changed, 285 insertions(+), 253 deletions(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/misc.xml create mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..1c2fda5 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..be0f224 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,18 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..9661ac7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/etc/man.c b/etc/man.c index 86410d0..d5d28e8 100644 --- a/etc/man.c +++ b/etc/man.c @@ -1,78 +1,78 @@ -#include -#include -#include - -#include "man.h" - -// Color Codes: -// Reset: \033[0m -// Red: \033[0;31m -// Green: \033[0;32m -// Yellow: \033[0;33m -// Blue: \033[0;34m -// Magenta: \033[0;35m -// Cyan: \033[0;36m -// BoldRed: \033[1;31m -// BoldGreen: \033[1;32m -// BoldYellow: \033[1;33m -// BoldBlue: \033[1;34m -// BoldMagenta: \033[1;35m -// BoldCyan: \033[1;36m - -//Main function to start man is at the bottom - -//MAN ENTRIES - -//LS -void manEntry_ls(){ - printf("\033[0;33m##################\033[0m\n"); - printf("\033[0;33m# Manual of \033[0;36m'ls' \033[0;33m#\033[0m\n"); - printf("\033[0;33m##################\033[0m\n\n"); - printf("\033[0;33mNAME\033[0m\n"); - printf("\t\033[0;36mls - list directory contents\033[0m\n\n"); - printf("\033[0;33mUSAGE\033[0m\n"); - printf("\t\033[0;36mls \033[0;35m[DIRECTORY]\033[0m\n\n"); - printf("\033[0;33mDESCRIPTION\033[0m\n"); - printf("\t\033[0;36mList files and directorys in the given directory. Sorts entries alphabetically.\033[0m\n\n"); -} - -//CD -void manEntry_cd(){ - printf("\033[0;33m##################\033[0m\n"); - printf("\033[0;33m# Manual of \033[0;36m'cd' \033[0;33m#\033[0m\n"); - printf("\033[0;33m##################\033[0m\n"); - printf("\033[0;33mNAME\033[0m\n"); - printf("\t\033[0;36mcd - change directory\033[0m\n\n"); - printf("\033[0;33mUSAGE\033[0m\n"); - printf("\t\033[0;36mcd \033[0;35m[DIRECTORY]\033[0m\n\n"); - printf("\033[0;33mDESCRIPTION\033[0m\n"); - printf("\t\033[0;36mChanged the currently selected directory.\033[0m\n\n"); -} - -//MAN -void manEntry_man(){ - printf("\033[0;33m###################\033[0m\n"); - printf("\033[0;33m# Manual of \033[0;36m'man' \033[0;33m#\033[0m\n"); - printf("\033[0;33m###################\033[0m\n\n"); - printf("\033[0;33mNAME\033[0m\n"); - printf("\t\033[0;36mman - manual\033[0m\n\n"); - printf("\033[0;33mUSAGE\033[0m\n"); - printf("\t\033[0;36mman \033[0;35m[COMMAND]\033[0m\n\n"); - printf("\033[0;33mDESCRIPTION\033[0m\n"); - printf("\t\033[0;36mShows the manual of given command.\033[0m\n\n"); -} - - - -//MAIN FUNCTION -void showManEntry(char *arg[]){ - if(!strcmp(arg[1], "man")){ - manEntry_man(); - } else if(!strcmp(arg[1], "ls")){ - manEntry_ls(); - } else if(!strcmp(arg[1], "cd")){ - manEntry_cd(); - } else { - printf("Entry not found.\n"); - } +#include +#include +#include + +#include "man.h" + +// Color Codes: +// Reset: \033[0m +// Red: \033[0;31m +// Green: \033[0;32m +// Yellow: \033[0;33m +// Blue: \033[0;34m +// Magenta: \033[0;35m +// Cyan: \033[0;36m +// BoldRed: \033[1;31m +// BoldGreen: \033[1;32m +// BoldYellow: \033[1;33m +// BoldBlue: \033[1;34m +// BoldMagenta: \033[1;35m +// BoldCyan: \033[1;36m + +//Main function to start man is at the bottom + +//MAN ENTRIES + +//LS +void manEntry_ls(){ + printf("\033[0;33m##################\033[0m\n"); + printf("\033[0;33m# Manual of \033[0;36m'ls' \033[0;33m#\033[0m\n"); + printf("\033[0;33m##################\033[0m\n\n"); + printf("\033[0;33mNAME\033[0m\n"); + printf("\t\033[0;36mls - list directory contents\033[0m\n\n"); + printf("\033[0;33mUSAGE\033[0m\n"); + printf("\t\033[0;36mls \033[0;35m[DIRECTORY]\033[0m\n\n"); + printf("\033[0;33mDESCRIPTION\033[0m\n"); + printf("\t\033[0;36mList files and directorys in the given directory. Sorts entries alphabetically.\033[0m\n\n"); +} + +//CD +void manEntry_cd(){ + printf("\033[0;33m##################\033[0m\n"); + printf("\033[0;33m# Manual of \033[0;36m'cd' \033[0;33m#\033[0m\n"); + printf("\033[0;33m##################\033[0m\n"); + printf("\033[0;33mNAME\033[0m\n"); + printf("\t\033[0;36mcd - change directory\033[0m\n\n"); + printf("\033[0;33mUSAGE\033[0m\n"); + printf("\t\033[0;36mcd \033[0;35m[DIRECTORY]\033[0m\n\n"); + printf("\033[0;33mDESCRIPTION\033[0m\n"); + printf("\t\033[0;36mChanged the currently selected directory.\033[0m\n\n"); +} + +//MAN +void manEntry_man(){ + printf("\033[0;33m###################\033[0m\n"); + printf("\033[0;33m# Manual of \033[0;36m'man' \033[0;33m#\033[0m\n"); + printf("\033[0;33m###################\033[0m\n\n"); + printf("\033[0;33mNAME\033[0m\n"); + printf("\t\033[0;36mman - manual\033[0m\n\n"); + printf("\033[0;33mUSAGE\033[0m\n"); + printf("\t\033[0;36mman \033[0;35m[COMMAND]\033[0m\n\n"); + printf("\033[0;33mDESCRIPTION\033[0m\n"); + printf("\t\033[0;36mShows the manual of given command.\033[0m\n\n"); +} + + + +//MAIN FUNCTION +void showManEntry(char *arg[]){ + if(!strcmp(arg[1], "man")){ + manEntry_man(); + } else if(!strcmp(arg[1], "ls")){ + manEntry_ls(); + } else if(!strcmp(arg[1], "cd")){ + manEntry_cd(); + } else { + printf("Entry not found.\n"); + } } \ No newline at end of file diff --git a/etc/your-reality.c b/etc/your-reality.c index e64d55f..127046f 100644 --- a/etc/your-reality.c +++ b/etc/your-reality.c @@ -1,38 +1,38 @@ -#include -#include - -#include "your-reality.h" - -//Lyrics from "Your Reality" by Dan Salvato - -//fs -> flush & sleep -void fs(int milliseconds){ - fflush(stdout); - usleep(milliseconds*1000); -} - -//p -> printf -void p(char* txt){ - printf(txt); -} - -void yourReality(){ - - printf("\e[?25l"); - p("Loading "); - for(int i = 0; i < 2; i++){ - //\033[XC => X columns right - //\033[XD => X columns left - printf("\033[3D "); printf("\033[3D"); - fs(500); printf("."); fs(500); printf("."); fs(500); printf("."); fs(500); - - } - printf("\n"); - printf("\033[0;33mEvery "); fs(350); printf("day, "); - fs(700); - p("I "); fs(450); p("imagine "); fs(350); p("a "); fs(350); p("future "); fs(350); p("where "); fs(750); - p("i "); fs(300); p("can "); fs(300); p("be "); fs(300); p("with "); fs(300); p("you."); - - p("\033[0m"); - printf("\e[?25h"); -} +#include +#include + +#include "your-reality.h" + +//Lyrics from "Your Reality" by Dan Salvato + +//fs -> flush & sleep +void fs(int milliseconds){ + fflush(stdout); + usleep(milliseconds*1000); +} + +//p -> printf +void p(char* txt){ + printf(txt); +} + +void yourReality(){ + + printf("\e[?25l"); + p("Loading "); + for(int i = 0; i < 2; i++){ + //\033[XC => X columns right + //\033[XD => X columns left + printf("\033[3D "); printf("\033[3D"); + fs(500); printf("."); fs(500); printf("."); fs(500); printf("."); fs(500); + + } + printf("\n"); + printf("\033[0;33mEvery "); fs(350); printf("day, "); + fs(700); + p("I "); fs(450); p("imagine "); fs(350); p("a "); fs(350); p("future "); fs(350); p("where "); fs(750); + p("i "); fs(300); p("can "); fs(300); p("be "); fs(300); p("with "); fs(300); p("you."); + + p("\033[0m"); + printf("\e[?25h"); +} diff --git a/etc/your-reality.h b/etc/your-reality.h index 06363f3..7dae4ca 100644 --- a/etc/your-reality.h +++ b/etc/your-reality.h @@ -1,6 +1,6 @@ -#ifndef _YOUR_REALITY_H -#define _YOUR_REALITY_H - -void yourReality(); - +#ifndef _YOUR_REALITY_H +#define _YOUR_REALITY_H + +void yourReality(); + #endif \ No newline at end of file diff --git a/glade/test_window.glade b/glade/test_window.glade index a365958..6ff1c8d 100644 --- a/glade/test_window.glade +++ b/glade/test_window.glade @@ -1,101 +1,101 @@ - - - - - - 300 - 230 - False - False - center - 300 - 230 - ../logo.png - center - - - - - True - False - - - Ok - 100 - 31 - True - True - True - Pink Fluffy Unicorns - - - - 135 - 183 - - - - - 369 - 20 - True - False - center - center - center - 50 - - - - - - - 57 - - - - - Toggle - 107 - 24 - True - True - False - True - - - - 140 - 153 - - - - - 40 - 40 - True - False - True - - - 324 - 179 - - - - - 100 - 20 - True - False - 100 - - - 8 - 201 - - - - - - + + + + + + 300 + 230 + False + False + center + 300 + 230 + ../logo.png + center + + + + + True + False + + + Ok + 100 + 31 + True + True + True + Pink Fluffy Unicorns + + + + 135 + 183 + + + + + 369 + 20 + True + False + center + center + center + 50 + + + + + + + 57 + + + + + Toggle + 107 + 24 + True + True + False + True + + + + 140 + 153 + + + + + 40 + 40 + True + False + True + + + 324 + 179 + + + + + 100 + 20 + True + False + 100 + + + 8 + 201 + + + + + + diff --git a/utils/clear_screen.c b/utils/clear_screen.c index a3d16c9..4a315dc 100644 --- a/utils/clear_screen.c +++ b/utils/clear_screen.c @@ -1,28 +1,28 @@ -#include -#if defined(_WIN32) -#include -#elif defined(__linux__) -#include -#include -#endif - -#include "clear_screen.h" - - -void clearScreen(){ - #if defined(_WIN32) - CONSOLE_SCREEN_BUFFER_INFO csbi; - int rows; - GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi); - rows = csbi.srWindow.Bottom - csbi.srWindow.Top + 1; - for(int i = 0; i < rows; i++){ - printf("\n"); - } - #elif defined(__linux__) - struct winsize w; - ioctl(STDOUT_FILENO, TIOCGWINSZ, &w); - for(int i = 0; i < w.ws_row; i++){ - printf("\n"); - } - #endif +#include +#if defined(_WIN32) +#include +#elif defined(__linux__) +#include +#include +#endif + +#include "clear_screen.h" + + +void clearScreen(){ + #if defined(_WIN32) + CONSOLE_SCREEN_BUFFER_INFO csbi; + int rows; + GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi); + rows = csbi.srWindow.Bottom - csbi.srWindow.Top + 1; + for(int i = 0; i < rows; i++){ + printf("\n"); + } + #elif defined(__linux__) + struct winsize w; + ioctl(STDOUT_FILENO, TIOCGWINSZ, &w); + for(int i = 0; i < w.ws_row; i++){ + printf("\n"); + } + #endif } \ No newline at end of file diff --git a/utils/clear_screen.h b/utils/clear_screen.h index b7bc8c7..41c86c9 100644 --- a/utils/clear_screen.h +++ b/utils/clear_screen.h @@ -1,6 +1,6 @@ -#ifndef _CLEAR_SCREEN_H_ -#define _CLEAR_SCREEN_H_ - -void clearScreen(); - +#ifndef _CLEAR_SCREEN_H_ +#define _CLEAR_SCREEN_H_ + +void clearScreen(); + #endif \ No newline at end of file