From 31e013efcfd996bed2a22fb1bfa12eed7577294f Mon Sep 17 00:00:00 2001 From: netbenix Date: Mon, 28 Sep 2020 16:29:17 +0200 Subject: [PATCH] Added some fun stuff --- .gitignore | 3 ++- etc/your-reality.c | 38 ++++++++++++++++++++++++++++++++++++++ etc/your-reality.h | 6 ++++++ main.c | 21 ++++++++++----------- makefile | 4 +++- 5 files changed, 59 insertions(+), 13 deletions(-) create mode 100644 etc/your-reality.c create mode 100644 etc/your-reality.h diff --git a/.gitignore b/.gitignore index d45456c..0bc6d3c 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,5 @@ sys_info.o show_dir.o change_dir.o update_check.o -man.o \ No newline at end of file +man.o +your-reality.o \ No newline at end of file diff --git a/etc/your-reality.c b/etc/your-reality.c new file mode 100644 index 0000000..e64d55f --- /dev/null +++ b/etc/your-reality.c @@ -0,0 +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"); +} diff --git a/etc/your-reality.h b/etc/your-reality.h new file mode 100644 index 0000000..06363f3 --- /dev/null +++ b/etc/your-reality.h @@ -0,0 +1,6 @@ +#ifndef _YOUR_REALITY_H +#define _YOUR_REALITY_H + +void yourReality(); + +#endif \ No newline at end of file diff --git a/main.c b/main.c index b15a390..1c94ad1 100644 --- a/main.c +++ b/main.c @@ -15,6 +15,7 @@ #include "utils/sql_test.h" #include "etc/logo.h" #include "etc/man.h" +#include "etc/your-reality.h" #include "utils/logger.h" #include "utils/sys_info.h" #include "utils/update_check.h" @@ -88,18 +89,16 @@ int commandHandler(char *cmd){ } else if(!strcmp(arg[0], "man")){ showManEntry(arg); return 0; - } else if(!strcmp(arg[0], "rainbow")){ - if(FUN_CONTENT){ - while(1){ - printf("\033[0;31m#####"); - printf("\033[0;32m#####"); - printf("\033[0;33m#####"); - printf("\033[0;34m#####"); - printf("\033[0;35m#####"); - } - } else { - return 0; + } else if(!strcmp(arg[0], "rainbow") && FUN_CONTENT){ + while(1){ + printf("\033[0;31m#####"); + printf("\033[0;32m#####"); + printf("\033[0;33m#####"); + printf("\033[0;34m#####"); + printf("\033[0;35m#####"); } + } else if(!strcmp(arg[0], "your-reality") && FUN_CONTENT){ + yourReality(); } else { printf("Unknown command. Please use 'help' for more information.\n"); logger("User entered unknown command."); diff --git a/makefile b/makefile index 7063ab6..407fe6f 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 -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 +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 netbenixCMD: $(OBJ) $(CC) $(CFLAGS) $(ARGS) -o netbenixCMD $(OBJ) $(LDLIBS) @@ -28,3 +28,5 @@ update_check.o: utils/update_check.c $(CC) $(CFLAGS) -c utils/update_check.c man.o: etc/man.c $(CC) $(CFLAGS) -c etc/man.c +your-reality.o: etc/your-reality.c + $(CC) $(CFLAGS) -c etc/your-reality.c \ No newline at end of file