Compare commits
5 commits
| Author | SHA1 | Date | |
|---|---|---|---|
| af1377bc7c | |||
|
|
bea164468b | ||
|
|
2dc69c670b | ||
|
|
5878d588d8 | ||
|
|
860cd8cd81 |
15 changed files with 531 additions and 529 deletions
37
.gitignore
vendored
37
.gitignore
vendored
|
|
@ -1,18 +1,19 @@
|
||||||
.vscode
|
.vscode
|
||||||
glade/test_window.glade~
|
glade/test_window.glade~
|
||||||
netbenixCMD
|
netbenixCMD
|
||||||
output.log
|
output.log
|
||||||
main.o
|
main.o
|
||||||
logger.o
|
logger.o
|
||||||
help.o
|
help.o
|
||||||
logo.o
|
logo.o
|
||||||
sql_test.o
|
sql_test.o
|
||||||
gtk_test.o
|
gtk_test.o
|
||||||
sys_info.o
|
sys_info.o
|
||||||
show_dir.o
|
show_dir.o
|
||||||
change_dir.o
|
change_dir.o
|
||||||
update_check.o
|
update_check.o
|
||||||
man.o
|
man.o
|
||||||
calc.o
|
calc.o
|
||||||
math_ext.o
|
math_ext.o
|
||||||
your-reality.o
|
your-reality.o
|
||||||
|
clear_screen.o
|
||||||
8
.idea/.gitignore
generated
vendored
Normal file
8
.idea/.gitignore
generated
vendored
Normal file
|
|
@ -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
|
||||||
18
.idea/misc.xml
generated
Normal file
18
.idea/misc.xml
generated
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
|
<component name="MakefileSettings">
|
||||||
|
<option name="linkedExternalProjectsSettings">
|
||||||
|
<MakefileProjectSettings>
|
||||||
|
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||||
|
<option name="modules">
|
||||||
|
<set>
|
||||||
|
<option value="$PROJECT_DIR$" />
|
||||||
|
</set>
|
||||||
|
</option>
|
||||||
|
<option name="version" value="2" />
|
||||||
|
</MakefileProjectSettings>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="MakefileWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
|
||||||
|
</project>
|
||||||
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
|
|
@ -8,7 +8,7 @@ Tested on: *Ubuntu, Debian, Arch*
|
||||||
|
|
||||||
Used libs for Linux: *gtk+3.0, libmysqlclient*
|
Used libs for Linux: *gtk+3.0, libmysqlclient*
|
||||||
|
|
||||||
Version: *0.2.6*
|
Version: *0.3.1*
|
||||||
|
|
||||||
## Features:
|
## Features:
|
||||||
|
|
||||||
|
|
|
||||||
BIN
clear_screen.o
BIN
clear_screen.o
Binary file not shown.
174
etc/man.c
174
etc/man.c
|
|
@ -1,98 +1,78 @@
|
||||||
<<<<<<< HEAD
|
#include <stdio.h>
|
||||||
#include <stdio.h>
|
#include <stdlib.h>
|
||||||
#include <stdlib.h>
|
#include <string.h>
|
||||||
#include <string.h>
|
|
||||||
|
#include "man.h"
|
||||||
#include "man.h"
|
|
||||||
|
// Color Codes:
|
||||||
// Color Codes:
|
// Reset: \033[0m
|
||||||
// Reset: \033[0m
|
// Red: \033[0;31m
|
||||||
// Red: \033[0;31m
|
// Green: \033[0;32m
|
||||||
// Green: \033[0;32m
|
// Yellow: \033[0;33m
|
||||||
// Yellow: \033[0;33m
|
// Blue: \033[0;34m
|
||||||
// Blue: \033[0;34m
|
// Magenta: \033[0;35m
|
||||||
// Magenta: \033[0;35m
|
// Cyan: \033[0;36m
|
||||||
// Cyan: \033[0;36m
|
// BoldRed: \033[1;31m
|
||||||
// BoldRed: \033[1;31m
|
// BoldGreen: \033[1;32m
|
||||||
// BoldGreen: \033[1;32m
|
// BoldYellow: \033[1;33m
|
||||||
// BoldYellow: \033[1;33m
|
// BoldBlue: \033[1;34m
|
||||||
// BoldBlue: \033[1;34m
|
// BoldMagenta: \033[1;35m
|
||||||
// BoldMagenta: \033[1;35m
|
// BoldCyan: \033[1;36m
|
||||||
// BoldCyan: \033[1;36m
|
|
||||||
|
//Main function to start man is at the bottom
|
||||||
//Main function to start man is at the bottom
|
|
||||||
|
//MAN ENTRIES
|
||||||
//MAN ENTRIES
|
|
||||||
//LS
|
//LS
|
||||||
void manEntry_ls(){
|
void manEntry_ls(){
|
||||||
printf("\033[0;33m##################\033[0m\n");
|
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# Manual of \033[0;36m'ls' \033[0;33m#\033[0m\n");
|
||||||
printf("\033[0;33m##################\033[0m\n\n");
|
printf("\033[0;33m##################\033[0m\n\n");
|
||||||
printf("\033[0;33mNAME\033[0m\n");
|
printf("\033[0;33mNAME\033[0m\n");
|
||||||
printf("\t\033[0;36mls - list directory contents\033[0m\n\n");
|
printf("\t\033[0;36mls - list directory contents\033[0m\n\n");
|
||||||
printf("\033[0;33mUSAGE\033[0m\n");
|
printf("\033[0;33mUSAGE\033[0m\n");
|
||||||
printf("\t\033[0;36mls \033[0;35m[DIRECTORY]\033[0m\n\n");
|
printf("\t\033[0;36mls \033[0;35m[DIRECTORY]\033[0m\n\n");
|
||||||
printf("\033[0;33mDESCRIPTION\033[0m\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");
|
printf("\t\033[0;36mList files and directorys in the given directory. Sorts entries alphabetically.\033[0m\n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//CD
|
||||||
|
void manEntry_cd(){
|
||||||
//MAIN FUNCTION
|
printf("\033[0;33m##################\033[0m\n");
|
||||||
void showManEntry(char *arg[]){
|
printf("\033[0;33m# Manual of \033[0;36m'cd' \033[0;33m#\033[0m\n");
|
||||||
if(!strcmp(arg[1], "man")){
|
printf("\033[0;33m##################\033[0m\n");
|
||||||
printf("Coming soon.\n");
|
printf("\033[0;33mNAME\033[0m\n");
|
||||||
} else if(!strcmp(arg[1], "ls")){
|
printf("\t\033[0;36mcd - change directory\033[0m\n\n");
|
||||||
manEntry_ls();
|
printf("\033[0;33mUSAGE\033[0m\n");
|
||||||
} else {
|
printf("\t\033[0;36mcd \033[0;35m[DIRECTORY]\033[0m\n\n");
|
||||||
printf("Entry not found.\n");
|
printf("\033[0;33mDESCRIPTION\033[0m\n");
|
||||||
}
|
printf("\t\033[0;36mChanged the currently selected directory.\033[0m\n\n");
|
||||||
=======
|
}
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
//MAN
|
||||||
#include <string.h>
|
void manEntry_man(){
|
||||||
|
printf("\033[0;33m###################\033[0m\n");
|
||||||
// Color Codes:
|
printf("\033[0;33m# Manual of \033[0;36m'man' \033[0;33m#\033[0m\n");
|
||||||
// Reset: \033[0m
|
printf("\033[0;33m###################\033[0m\n\n");
|
||||||
// Red: \033[0;31m
|
printf("\033[0;33mNAME\033[0m\n");
|
||||||
// Green: \033[0;32m
|
printf("\t\033[0;36mman - manual\033[0m\n\n");
|
||||||
// Yellow: \033[0;33m
|
printf("\033[0;33mUSAGE\033[0m\n");
|
||||||
// Blue: \033[0;34m
|
printf("\t\033[0;36mman \033[0;35m[COMMAND]\033[0m\n\n");
|
||||||
// Magenta: \033[0;35m
|
printf("\033[0;33mDESCRIPTION\033[0m\n");
|
||||||
// Cyan: \033[0;36m
|
printf("\t\033[0;36mShows the manual of given command.\033[0m\n\n");
|
||||||
// BoldRed: \033[1;31m
|
}
|
||||||
// BoldGreen: \033[1;32m
|
|
||||||
// BoldYellow: \033[1;33m
|
|
||||||
// BoldBlue: \033[1;34m
|
|
||||||
// BoldMagenta: \033[1;35m
|
//MAIN FUNCTION
|
||||||
// BoldCyan: \033[1;36m
|
void showManEntry(char *arg[]){
|
||||||
|
if(!strcmp(arg[1], "man")){
|
||||||
//Main function to start man is at the bottom
|
manEntry_man();
|
||||||
|
} else if(!strcmp(arg[1], "ls")){
|
||||||
//MAN ENTRIES
|
manEntry_ls();
|
||||||
//LS
|
} else if(!strcmp(arg[1], "cd")){
|
||||||
void manEntry_ls(){
|
manEntry_cd();
|
||||||
printf("\033[0;33m##################\033[0m\n");
|
} else {
|
||||||
printf("\033[0;33m# Manual of \033[0;36m'ls' \033[0;33m#\033[0m\n");
|
printf("Entry not found.\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");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//MAIN FUNCTION
|
|
||||||
void showManEntry(char *arg[]){
|
|
||||||
if(!strcmp(arg[1], "man")){
|
|
||||||
printf("Coming soon.\n");
|
|
||||||
} else if(!strcmp(arg[1], "ls")){
|
|
||||||
manEntry_ls();
|
|
||||||
} else {
|
|
||||||
printf("Entry not found.\n");
|
|
||||||
}
|
|
||||||
>>>>>>> f1cf6269f94065bfb8498dd7ef06bfbb61442b80
|
|
||||||
}
|
}
|
||||||
|
|
@ -2,6 +2,8 @@
|
||||||
#define _MAN_H_
|
#define _MAN_H_
|
||||||
|
|
||||||
void manEntry_ls();
|
void manEntry_ls();
|
||||||
|
void manEntry_cd();
|
||||||
|
void manEntry_man();
|
||||||
void showManEntry(char *arg[]);
|
void showManEntry(char *arg[]);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -1,79 +1,38 @@
|
||||||
<<<<<<< HEAD
|
#include <stdio.h>
|
||||||
#include <stdio.h>
|
#include <unistd.h>
|
||||||
#include <unistd.h>
|
|
||||||
|
#include "your-reality.h"
|
||||||
#include "your-reality.h"
|
|
||||||
|
//Lyrics from "Your Reality" by Dan Salvato
|
||||||
//Lyrics from "Your Reality" by Dan Salvato
|
|
||||||
|
//fs -> flush & sleep
|
||||||
//fs -> flush & sleep
|
void fs(int milliseconds){
|
||||||
void fs(int milliseconds){
|
fflush(stdout);
|
||||||
fflush(stdout);
|
usleep(milliseconds*1000);
|
||||||
usleep(milliseconds*1000);
|
}
|
||||||
}
|
|
||||||
|
//p -> printf
|
||||||
//p -> printf
|
void p(char* txt){
|
||||||
void p(char* txt){
|
printf(txt);
|
||||||
printf(txt);
|
}
|
||||||
}
|
|
||||||
|
void yourReality(){
|
||||||
void yourReality(){
|
|
||||||
|
printf("\e[?25l");
|
||||||
printf("\e[?25l");
|
p("Loading ");
|
||||||
p("Loading ");
|
for(int i = 0; i < 2; i++){
|
||||||
for(int i = 0; i < 2; i++){
|
//\033[XC => X columns right
|
||||||
//\033[XC => X columns right
|
//\033[XD => X columns left
|
||||||
//\033[XD => X columns left
|
printf("\033[3D "); printf("\033[3D");
|
||||||
printf("\033[3D "); printf("\033[3D");
|
fs(500); printf("."); fs(500); printf("."); fs(500); printf("."); fs(500);
|
||||||
fs(500); printf("."); fs(500); printf("."); fs(500); printf("."); fs(500);
|
|
||||||
|
}
|
||||||
}
|
printf("\n");
|
||||||
printf("\n");
|
printf("\033[0;33mEvery "); fs(350); printf("day, ");
|
||||||
printf("\033[0;33mEvery "); fs(350); printf("day, ");
|
fs(700);
|
||||||
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(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("i "); fs(300); p("can "); fs(300); p("be "); fs(300); p("with "); fs(300); p("you.");
|
|
||||||
|
p("\033[0m");
|
||||||
p("\033[0m");
|
printf("\e[?25h");
|
||||||
printf("\e[?25h");
|
}
|
||||||
}
|
|
||||||
=======
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#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");
|
|
||||||
}
|
|
||||||
>>>>>>> f1cf6269f94065bfb8498dd7ef06bfbb61442b80
|
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,6 @@
|
||||||
<<<<<<< HEAD
|
#ifndef _YOUR_REALITY_H
|
||||||
#ifndef _YOUR_REALITY_H
|
#define _YOUR_REALITY_H
|
||||||
#define _YOUR_REALITY_H
|
|
||||||
|
void yourReality();
|
||||||
void yourReality();
|
|
||||||
|
|
||||||
=======
|
|
||||||
#ifndef _YOUR_REALITY_H
|
|
||||||
#define _YOUR_REALITY_H
|
|
||||||
|
|
||||||
void yourReality();
|
|
||||||
|
|
||||||
>>>>>>> f1cf6269f94065bfb8498dd7ef06bfbb61442b80
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -1,104 +1,101 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!-- Generated with glade 3.36.0 -->
|
<!-- Generated with glade 3.38.2 -->
|
||||||
<interface>
|
<interface>
|
||||||
<requires lib="gtk+" version="3.22"/>
|
<requires lib="gtk+" version="3.22"/>
|
||||||
<object class="GtkWindow" id="window">
|
<object class="GtkWindow" id="window">
|
||||||
<property name="width_request">300</property>
|
<property name="width-request">300</property>
|
||||||
<property name="height_request">230</property>
|
<property name="height-request">230</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can-focus">False</property>
|
||||||
<property name="resizable">False</property>
|
<property name="resizable">False</property>
|
||||||
<property name="window_position">center</property>
|
<property name="window-position">center</property>
|
||||||
<property name="default_width">300</property>
|
<property name="default-width">300</property>
|
||||||
<property name="default_height">230</property>
|
<property name="default-height">230</property>
|
||||||
<property name="icon">../logo.png</property>
|
<property name="icon">../logo.png</property>
|
||||||
<property name="gravity">center</property>
|
<property name="gravity">center</property>
|
||||||
<signal name="focus-in-event" handler="on_window_focus_in_event" swapped="no"/>
|
<signal name="focus-in-event" handler="on_window_focus_in_event" swapped="no"/>
|
||||||
<signal name="focus-out-event" handler="on_window_focus_out_event" swapped="no"/>
|
<signal name="focus-out-event" handler="on_window_focus_out_event" swapped="no"/>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkFixed" id="fixed1">
|
<object class="GtkFixed" id="fixed1">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can-focus">False</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton" id="button1">
|
<object class="GtkButton" id="button1">
|
||||||
<property name="label" translatable="yes">Ok</property>
|
<property name="label" translatable="yes">Ok</property>
|
||||||
<property name="width_request">100</property>
|
<property name="width-request">100</property>
|
||||||
<property name="height_request">31</property>
|
<property name="height-request">31</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can-focus">True</property>
|
||||||
<property name="receives_default">True</property>
|
<property name="receives-default">True</property>
|
||||||
<property name="tooltip_text" translatable="yes">Pink Fluffy Unicorns</property>
|
<property name="tooltip-text" translatable="yes">Pink Fluffy Unicorns</property>
|
||||||
<signal name="clicked" handler="on_button1_clicked" swapped="no"/>
|
<signal name="clicked" handler="on_button1_clicked" swapped="no"/>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="x">135</property>
|
<property name="x">135</property>
|
||||||
<property name="y">183</property>
|
<property name="y">183</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel" id="label">
|
<object class="GtkLabel" id="label">
|
||||||
<property name="width_request">369</property>
|
<property name="width-request">369</property>
|
||||||
<property name="height_request">20</property>
|
<property name="height-request">20</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can-focus">False</property>
|
||||||
<property name="halign">center</property>
|
<property name="halign">center</property>
|
||||||
<property name="valign">center</property>
|
<property name="valign">center</property>
|
||||||
<property name="justify">center</property>
|
<property name="justify">center</property>
|
||||||
<property name="max_width_chars">50</property>
|
<property name="max-width-chars">50</property>
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="font-desc" value="System-ui Bold 10"/>
|
<attribute name="font-desc" value="System-ui Bold 10"/>
|
||||||
<attribute name="stretch" value="normal"/>
|
<attribute name="stretch" value="normal"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="y">57</property>
|
<property name="y">57</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkCheckButton" id="check">
|
<object class="GtkCheckButton" id="check">
|
||||||
<property name="label" translatable="yes">Toggle</property>
|
<property name="label" translatable="yes">Toggle</property>
|
||||||
<property name="width_request">107</property>
|
<property name="width-request">107</property>
|
||||||
<property name="height_request">24</property>
|
<property name="height-request">24</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can-focus">True</property>
|
||||||
<property name="receives_default">False</property>
|
<property name="receives-default">False</property>
|
||||||
<property name="draw_indicator">True</property>
|
<property name="draw-indicator">True</property>
|
||||||
<signal name="toggled" handler="on_gay_check_toggled" swapped="no"/>
|
<signal name="toggled" handler="on_gay_check_toggled" swapped="no"/>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="x">140</property>
|
<property name="x">140</property>
|
||||||
<property name="y">153</property>
|
<property name="y">153</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkSpinner" id="useless_spinner">
|
<object class="GtkSpinner" id="useless_spinner">
|
||||||
<property name="width_request">40</property>
|
<property name="width-request">40</property>
|
||||||
<property name="height_request">40</property>
|
<property name="height-request">40</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can-focus">False</property>
|
||||||
<property name="active">True</property>
|
<property name="active">True</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="x">324</property>
|
<property name="x">324</property>
|
||||||
<property name="y">179</property>
|
<property name="y">179</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLevelBar" id="level">
|
<object class="GtkLevelBar" id="level">
|
||||||
<property name="width_request">100</property>
|
<property name="width-request">100</property>
|
||||||
<property name="height_request">20</property>
|
<property name="height-request">20</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can-focus">False</property>
|
||||||
<property name="max_value">100</property>
|
<property name="max-value">100</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="x">8</property>
|
<property name="x">8</property>
|
||||||
<property name="y">201</property>
|
<property name="y">201</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child type="titlebar">
|
</object>
|
||||||
<placeholder/>
|
</interface>
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
</interface>
|
|
||||||
|
|
|
||||||
366
main.c
366
main.c
|
|
@ -1,181 +1,185 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <gdk/gdk.h>
|
#include <gdk/gdk.h>
|
||||||
#include <gdk/gdkconfig.h>
|
#include <gdk/gdkconfig.h>
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <linux/limits.h>
|
#include <linux/limits.h>
|
||||||
|
|
||||||
#include "commands/help.h"
|
#include "commands/help.h"
|
||||||
#include "commands/show_dir.h"
|
#include "commands/show_dir.h"
|
||||||
#include "commands/change_dir.h"
|
#include "commands/change_dir.h"
|
||||||
#include "utils/gtk_test.h"
|
#include "utils/gtk_test.h"
|
||||||
#include "utils/sql_test.h"
|
#include "utils/sql_test.h"
|
||||||
#include "etc/logo.h"
|
#include "etc/logo.h"
|
||||||
#include "etc/man.h"
|
#include "etc/man.h"
|
||||||
#include "etc/math.h"
|
#include "etc/math_ext.h"
|
||||||
#include "etc/your-reality.h"
|
#include "etc/your-reality.h"
|
||||||
#include "utils/logger.h"
|
#include "utils/logger.h"
|
||||||
#include "utils/sys_info.h"
|
#include "utils/sys_info.h"
|
||||||
#include "utils/update_check.h"
|
#include "utils/update_check.h"
|
||||||
|
#include "utils/calc.h"
|
||||||
|
#include "utils/clear_screen.h"
|
||||||
#define VERSION "0.2.5"
|
|
||||||
|
|
||||||
bool VER_CHECK_ON_START = true;
|
#define VERSION "0.3.1"
|
||||||
bool DEV_MODE = false;
|
|
||||||
bool FUN_CONTENT = false;
|
bool VER_CHECK_ON_START = true;
|
||||||
|
bool DEV_MODE = false;
|
||||||
// Color Codes:
|
bool FUN_CONTENT = false;
|
||||||
// Reset: \033[0m
|
|
||||||
// Red: \033[0;31m
|
// Color Codes:
|
||||||
// Green: \033[0;32m
|
// Reset: \033[0m
|
||||||
// Yellow: \033[0;33m
|
// Red: \033[0;31m
|
||||||
// Blue: \033[0;34m
|
// Green: \033[0;32m
|
||||||
// Magenta: \033[0;35m
|
// Yellow: \033[0;33m
|
||||||
// Cyan: \033[0;36m
|
// Blue: \033[0;34m
|
||||||
// BoldRed: \033[1;31m
|
// Magenta: \033[0;35m
|
||||||
// BoldGreen: \033[1;32m
|
// Cyan: \033[0;36m
|
||||||
// BoldYellow: \033[1;33m
|
// BoldRed: \033[1;31m
|
||||||
// BoldBlue: \033[1;34m
|
// BoldGreen: \033[1;32m
|
||||||
// BoldMagenta: \033[1;35m
|
// BoldYellow: \033[1;33m
|
||||||
// BoldCyan: \033[1;36m
|
// BoldBlue: \033[1;34m
|
||||||
|
// BoldMagenta: \033[1;35m
|
||||||
|
// BoldCyan: \033[1;36m
|
||||||
//Handles the commands
|
|
||||||
int commandHandler(char *cmd){
|
|
||||||
|
//Handles the commands
|
||||||
char *token = strtok(cmd, " ");
|
int commandHandler(char *cmd){
|
||||||
int argc = 1;
|
char *token = strtok(cmd, " ");
|
||||||
char *arg[10];
|
int argc = 1;
|
||||||
int i = 0;
|
char *arg[10];
|
||||||
while( token != NULL ){
|
int i = 0;
|
||||||
arg[i] = token;
|
while( token != NULL ){
|
||||||
token = strtok(NULL, " ");
|
arg[i] = token;
|
||||||
if(token != NULL){
|
token = strtok(NULL, " ");
|
||||||
i++;
|
if(token != NULL){
|
||||||
argc++;
|
i++;
|
||||||
}
|
argc++;
|
||||||
}
|
}
|
||||||
char *p = arg[i];
|
}
|
||||||
p[strlen(p)-1] = 0;
|
char *p = arg[i];
|
||||||
arg[i] = p;
|
p[strlen(p)-1] = 0;
|
||||||
|
arg[i] = p;
|
||||||
//Start to compare the command
|
|
||||||
if(!strcmp(arg[0], "help")){
|
//Start to compare the command
|
||||||
printf("\033[1;34mcd \033[0;35m[dir]\033[0m : change directory\n");
|
if(!strcmp(arg[0], "help")){
|
||||||
printf("\033[1;34mls \033[0;35m[dir]\033[0m : show contents of directory\n");
|
printf("\033[1;34mcd \033[0;35m[dir]\033[0m : change directory\n");
|
||||||
printf("\033[1;34mhelp\033[0m : this help list\n");
|
printf("\033[1;34mls \033[0;35m[dir]\033[0m : show contents of directory\n");
|
||||||
printf("\033[1;34mman \033[0;35m[cmd]\033[0m : manual for the commands\n");
|
printf("\033[1;34mhelp\033[0m : this help list\n");
|
||||||
printf("\033[1;34mversion\033[0m : shows the version\n");
|
printf("\033[1;34mman \033[0;35m[cmd]\033[0m : manual for the commands\n");
|
||||||
printf("\033[1;34mexit\033[0m : exit the program\n");
|
printf("\033[1;34mversion\033[0m : shows the version\n");
|
||||||
return 0;
|
printf("\033[1;34mexit\033[0m : exit the program\n");
|
||||||
} else if(!strcmp(arg[0], "version")){
|
return 0;
|
||||||
|
} else if(!strcmp(arg[0], "version")){
|
||||||
printf("netbenixCMD (Version: \033[1;34m%s\033[0m)\n", VERSION);
|
printf("netbenixCMD (Version: \033[1;34m%s\033[0m)\n", VERSION);
|
||||||
printf("Author: \033[1;34m%s\033[0m\n", "netbenix");
|
printf("Author: \033[1;34m%s\033[0m\n", "netbenix");
|
||||||
printf("Github: \033[1;34mhttps://github.com/netbenix/netbenixCMD\033[0m\n");
|
printf("Github: \033[1;34mhttps://github.com/netbenix/netbenixCMD\033[0m\n");
|
||||||
logger("Showing program version.");
|
logger("Showing program version.");
|
||||||
return 0;
|
return 0;
|
||||||
} else if(!strcmp(arg[0], "exit")){
|
} else if(!strcmp(arg[0], "exit")){
|
||||||
return 1;
|
return 1;
|
||||||
} else if(!strcmp(arg[0], "ls")){
|
} else if(!strcmp(arg[0], "ls")){
|
||||||
showDirectory(arg);
|
showDirectory(arg);
|
||||||
return 0;
|
return 0;
|
||||||
} else if(!strcmp(arg[0], "cd")){
|
} else if(!strcmp(arg[0], "cd")){
|
||||||
changeCurrentWorkDir(arg);
|
changeCurrentWorkDir(arg);
|
||||||
return 0;
|
return 0;
|
||||||
} else if(!strcmp(arg[0], "man")){
|
} else if(!strcmp(arg[0], "man")){
|
||||||
showManEntry(arg);
|
showManEntry(arg);
|
||||||
return 0;
|
return 0;
|
||||||
} else if(!strcmp(arg[0], "rainbow") && FUN_CONTENT){
|
} else if(!strcmp(arg[0], "calc")){
|
||||||
while(1){
|
startCalc();
|
||||||
printf("\033[0;31m#####");
|
return 0;
|
||||||
printf("\033[0;32m#####");
|
} else if(!strcmp(arg[0], "rainbow") && FUN_CONTENT){
|
||||||
printf("\033[0;33m#####");
|
while(1){
|
||||||
printf("\033[0;34m#####");
|
printf("\033[0;31m#####");
|
||||||
printf("\033[0;35m#####");
|
printf("\033[0;32m#####");
|
||||||
}
|
printf("\033[0;33m#####");
|
||||||
} else if(!strcmp(arg[0], "your-reality") && FUN_CONTENT){
|
printf("\033[0;34m#####");
|
||||||
yourReality();
|
printf("\033[0;35m#####");
|
||||||
} else {
|
}
|
||||||
printf("Unknown command. Please use 'help' for more information.\n");
|
} else if(!strcmp(arg[0], "your-reality") && FUN_CONTENT){
|
||||||
logger("User entered unknown command.");
|
yourReality();
|
||||||
return 0;
|
} else {
|
||||||
}
|
printf("Unknown command. Please use 'help' for more information.\n");
|
||||||
}
|
logger("User entered unknown command.");
|
||||||
|
return 0;
|
||||||
//Action starts here
|
}
|
||||||
int main(int argc, char *argv[]){
|
}
|
||||||
char buffer[1024];
|
|
||||||
extern char loggerDirPath[PATH_MAX];
|
//Action starts here
|
||||||
realpath("." , loggerDirPath);
|
int main(int argc, char *argv[]){
|
||||||
logger("================================================");
|
char buffer[1024];
|
||||||
snprintf(buffer, sizeof(buffer), "Starting netbenixCMD (Version: %s)", VERSION);
|
extern char loggerDirPath[PATH_MAX];
|
||||||
logger(buffer);
|
realpath("." , loggerDirPath);
|
||||||
log_Specs(); //Log system specs
|
logger("================================================");
|
||||||
showLogo(); //Show the logo
|
snprintf(buffer, sizeof(buffer), "Starting netbenixCMD (Version: %s)", VERSION);
|
||||||
logger("Logo Displayed.");
|
logger(buffer);
|
||||||
if(argc > 2){
|
log_Specs(); //Log system specs
|
||||||
printf("Too many arguments. Please use --help for more information.\n");
|
clearScreen(); //Clear the screen
|
||||||
snprintf(buffer, sizeof(buffer), "[ERROR] Too many arguments. Argument count: %i", argc-1);
|
showLogo(); //Show the logo
|
||||||
logger(buffer);
|
logger("Logo Displayed.");
|
||||||
}
|
if(argc > 2){
|
||||||
|
printf("Too many arguments. Please use --help for more information.\n");
|
||||||
//Check the startup args
|
snprintf(buffer, sizeof(buffer), "[ERROR] Too many arguments. Argument count: %i", argc-1);
|
||||||
if(argc == 2){
|
logger(buffer);
|
||||||
if(!strcmp(argv[1], "--help")){
|
}
|
||||||
logger("Showing Help.");
|
|
||||||
outputHelp();
|
//Check the startup args
|
||||||
exit(0);
|
if(argc == 2){
|
||||||
} else if (!strcmp(argv[1], "--gtk-test")){
|
if(!strcmp(argv[1], "--help")){
|
||||||
logger("Stating GTK Test.");
|
logger("Showing help.");
|
||||||
createGTKTestWindow();
|
outputHelp();
|
||||||
exit(0);
|
exit(0);
|
||||||
} else if (!strcmp(argv[1], "--sys-info")){
|
} else if (!strcmp(argv[1], "--gtk-test")){
|
||||||
logger("Showing System Information.");
|
logger("Stating GTK test.");
|
||||||
print_Specs();
|
createGTKTestWindow();
|
||||||
exit(0);
|
exit(0);
|
||||||
} else if (!strcmp(argv[1], "--sql-test")){
|
} else if (!strcmp(argv[1], "--sys-info")){
|
||||||
logger("Starting SQL Test.");
|
logger("Showing system information.");
|
||||||
testSQLConnection();
|
print_Specs();
|
||||||
exit(0);
|
exit(0);
|
||||||
} else if (!strcmp(argv[1], "--no-version-check")){
|
} else if (!strcmp(argv[1], "--sql-test")){
|
||||||
VER_CHECK_ON_START = false;
|
logger("Starting SQL test.");
|
||||||
logger("[INFO] Argument 'no-version-check' used.");
|
testSQLConnection();
|
||||||
} else if (!strcmp(argv[1], "--dev-mode")){
|
exit(0);
|
||||||
VER_CHECK_ON_START = false;
|
} else if (!strcmp(argv[1], "--no-version-check")){
|
||||||
DEV_MODE = true;
|
VER_CHECK_ON_START = false;
|
||||||
logger("[INFO] Starting in developer mode.");
|
logger("[INFO] Argument 'no-version-check' used.");
|
||||||
} else if (!strcmp(argv[1], "--time-for-fun")){
|
} else if (!strcmp(argv[1], "--dev-mode")){
|
||||||
FUN_CONTENT = true;
|
VER_CHECK_ON_START = false;
|
||||||
logger("[WARNING] It's time... TO PARTYY.");
|
DEV_MODE = true;
|
||||||
} else {
|
logger("[INFO] Starting in developer mode.");
|
||||||
printf("Argument unknown. Please use --help for more information.\n");
|
} else if (!strcmp(argv[1], "--time-for-fun")){
|
||||||
snprintf(buffer, sizeof(buffer), "[ERROR] Argument unknown. Given argument: %s", argv[1]);
|
FUN_CONTENT = true;
|
||||||
logger(buffer);
|
logger("[WARNING] It's time... TO PARTYY.");
|
||||||
exit(0);
|
} else {
|
||||||
}
|
printf("Argument unknown. Please use --help for more information.\n");
|
||||||
}
|
snprintf(buffer, sizeof(buffer), "[ERROR] Argument unknown. Given argument: %s", argv[1]);
|
||||||
|
logger(buffer);
|
||||||
if(VER_CHECK_ON_START){checkForUpdate(VERSION);} //Check for newer version of client
|
exit(0);
|
||||||
|
}
|
||||||
//If no startup arg is given, start command handler
|
}
|
||||||
int exit = 0;
|
|
||||||
char cmd[128];
|
if(VER_CHECK_ON_START){checkForUpdate(VERSION);} //Check for newer version of client
|
||||||
logger("Starting Command Handler.");
|
|
||||||
while (!exit){
|
//If no startup arg is given, start command handler
|
||||||
char cwp[255];
|
int exit = 0;
|
||||||
printf("\033[0;32m%s> \033[0m", getcwd(cwp, 255));
|
char cmd[128];
|
||||||
fgets(cmd, 128, stdin);
|
logger("Starting Command Handler.");
|
||||||
exit = commandHandler(cmd);
|
while (!exit){
|
||||||
}
|
char cwp[255];
|
||||||
logger("Exiting Command Handler.");
|
printf("\033[0;32m%s> \033[0m", getcwd(cwp, 255));
|
||||||
printf("\n");
|
fgets(cmd, 128, stdin);
|
||||||
logger("Exiting.");
|
exit = commandHandler(cmd);
|
||||||
return 0;
|
}
|
||||||
}
|
logger("Exiting Command Handler.");
|
||||||
|
printf("\n");
|
||||||
|
logger("Exiting.");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
73
makefile
73
makefile
|
|
@ -1,36 +1,37 @@
|
||||||
CC= gcc
|
CC= gcc
|
||||||
ARGS= -export-dynamic -ansi -std=gnu99
|
ARGS= -export-dynamic -ansi -std=gnu99
|
||||||
CFLAGS= $(shell pkg-config --cflags gtk+-3.0) -I/usr/include/mysql
|
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
|
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)
|
||||||
netbenixCMD: $(OBJ)
|
$(CC) $(CFLAGS) $(ARGS) -o netbenixCMD $(OBJ) $(LDLIBS)
|
||||||
$(CC) $(CFLAGS) $(ARGS) -o netbenixCMD $(OBJ) $(LDLIBS)
|
main.o: main.c
|
||||||
main.o: main.c
|
$(CC) $(CFLAGS) -c main.c
|
||||||
$(CC) $(CFLAGS) -c main.c
|
logo.o: etc/logo.c
|
||||||
logo.o: etc/logo.c
|
$(CC) $(CFLAGS) -c etc/logo.c
|
||||||
$(CC) $(CFLAGS) -c etc/logo.c
|
logger.o: utils/logger.c
|
||||||
logger.o: utils/logger.c
|
$(CC) $(CFLAGS) -c utils/logger.c
|
||||||
$(CC) $(CFLAGS) -c utils/logger.c
|
help.o: commands/help.c
|
||||||
help.o: commands/help.c
|
$(CC) $(CFLAGS) -c commands/help.c
|
||||||
$(CC) $(CFLAGS) -c commands/help.c
|
sys_info.o: utils/sys_info.c
|
||||||
sys_info.o: utils/sys_info.c
|
$(CC) $(CFLAGS) $(ARGS) -c utils/sys_info.c
|
||||||
$(CC) $(CFLAGS) $(ARGS) -c utils/sys_info.c
|
gtk_test.o: utils/gtk_test.c
|
||||||
gtk_test.o: utils/gtk_test.c
|
$(CC) $(CFLAGS) -c utils/gtk_test.c
|
||||||
$(CC) $(CFLAGS) -c utils/gtk_test.c
|
sql_test.o: utils/sql_test.c
|
||||||
sql_test.o: utils/sql_test.c
|
$(CC) $(CFLAGS) -c utils/sql_test.c
|
||||||
$(CC) $(CFLAGS) -c utils/sql_test.c
|
show_dir.o: commands/show_dir.c
|
||||||
show_dir.o: commands/show_dir.c
|
$(CC) $(CFLAGS) -c commands/show_dir.c
|
||||||
$(CC) $(CFLAGS) -c commands/show_dir.c
|
change_dir.o: commands/change_dir.c
|
||||||
change_dir.o: commands/change_dir.c
|
$(CC) $(CFLAGS) -c commands/change_dir.c
|
||||||
$(CC) $(CFLAGS) -c commands/change_dir.c
|
update_check.o: utils/update_check.c
|
||||||
update_check.o: utils/update_check.c
|
$(CC) $(CFLAGS) -c utils/update_check.c
|
||||||
$(CC) $(CFLAGS) -c utils/update_check.c
|
man.o: etc/man.c
|
||||||
man.o: etc/man.c
|
$(CC) $(CFLAGS) -c etc/man.c
|
||||||
$(CC) $(CFLAGS) -c etc/man.c
|
math_ext.o: etc/math_ext.c
|
||||||
math.o: etc/math_ext.c
|
$(CC) $(CFLAGS) -c etc/math_ext.c
|
||||||
$(CC) $(CFLAGS) -c etc/math_ext.c
|
your-reality.o: etc/your-reality.c
|
||||||
your-reality.o: etc/your-reality.c
|
$(CC) $(CFLAGS) -c etc/your-reality.c
|
||||||
$(CC) $(CFLAGS) -c etc/your-reality.c
|
calc.o: utils/calc.c
|
||||||
calc.o: utils/calc.c
|
$(CC) $(CFLAGS) -c utils/calc.c
|
||||||
$(CC) $(CFLAGS) -c utils/calc.c
|
clear_screen.o: utils/clear_screen.c
|
||||||
|
$(CC) $(CFLAGS) -c utils/clear_screen.c
|
||||||
28
utils/clear_screen.c
Normal file
28
utils/clear_screen.c
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#if defined(_WIN32)
|
||||||
|
#include <windows.h>
|
||||||
|
#elif defined(__linux__)
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#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
|
||||||
|
}
|
||||||
6
utils/clear_screen.h
Normal file
6
utils/clear_screen.h
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
#ifndef _CLEAR_SCREEN_H_
|
||||||
|
#define _CLEAR_SCREEN_H_
|
||||||
|
|
||||||
|
void clearScreen();
|
||||||
|
|
||||||
|
#endif
|
||||||
Reference in a new issue