Little overall changes
- Changed 'dir' cmd to 'ls' - Added a version check skip - Changed the logo color - Updated README.md
This commit is contained in:
parent
94c62f3d6b
commit
023dcf2d3e
4 changed files with 41 additions and 24 deletions
13
README.md
13
README.md
|
|
@ -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.2*
|
Version: *0.2.3*
|
||||||
|
|
||||||
## Features:
|
## Features:
|
||||||
- A help page (OMG!!!)
|
- A help page (OMG!!!)
|
||||||
|
|
@ -22,7 +22,7 @@ Install packages:
|
||||||
|
|
||||||
- Ubuntu: ```sudo apt-get install make gcc git libgtk-3-dev libmysqlclient-dev```
|
- Ubuntu: ```sudo apt-get install make gcc git libgtk-3-dev libmysqlclient-dev```
|
||||||
- Debian: ```sudo apt-get install make gcc git libgtk-3-dev libmariadbclient-dev libmariadb-dev-compat```
|
- Debian: ```sudo apt-get install make gcc git libgtk-3-dev libmariadbclient-dev libmariadb-dev-compat```
|
||||||
- Arch: ```sudo pacman -S make gcc git gtk3 mariadb-libs```
|
- Arch: ```sudo pacman -S make gcc git gtk3 mariadb-libs pkgconf```
|
||||||
|
|
||||||
Clone repository: ```git clone https://github.com/netbenix/netbenixCMD.git```
|
Clone repository: ```git clone https://github.com/netbenix/netbenixCMD.git```
|
||||||
|
|
||||||
|
|
@ -36,10 +36,11 @@ After building use ```./netbenixCMD``` to start the program
|
||||||
If you want to use the testing arguments use ```./netbenixCMD <argument>```
|
If you want to use the testing arguments use ```./netbenixCMD <argument>```
|
||||||
|
|
||||||
## Arguments
|
## Arguments
|
||||||
- ```--help``` => Displays all arguments
|
- ```--help``` => Displays all arguments
|
||||||
- ```--gtk-test``` => Opens the GTK Test Window
|
- ```--gtk-test``` => Opens the GTK Test Window
|
||||||
- ```--sql-test``` => Makes a test connection to a mysql server
|
- ```--sql-test``` => Makes a test connection to a mysql server
|
||||||
- ```--sys-info``` => Gives you information about your system
|
- ```--sys-info``` => Gives you information about your system
|
||||||
|
- ```--no-version-check``` => Skips the client version check
|
||||||
|
|
||||||
## Known Bugs
|
## Known Bugs
|
||||||
- ```sql-test``` sha-256 passwords not working on Debian
|
- ```sql-test``` sha-256 passwords not working on Debian
|
||||||
|
|
@ -35,13 +35,15 @@ void showDirectory(char *arg[]){
|
||||||
realpath(arg[1], path); //Get the absolute path of the directory
|
realpath(arg[1], path); //Get the absolute path of the directory
|
||||||
if(d){
|
if(d){
|
||||||
while((dir = readdir(d))){
|
while((dir = readdir(d))){
|
||||||
if(dir->d_type == 8){ //IF IS FILE
|
if(strcmp(dir->d_name, ".") && strcmp(dir->d_name, "..")){
|
||||||
|
if(dir->d_type == 8){ //IF IS FILE
|
||||||
printf("\033[1;34m%s\033[0m\n", dir->d_name);
|
printf("\033[1;34m%s\033[0m\n", dir->d_name);
|
||||||
} else if(dir->d_type == 4){ //IF IS DIR
|
} else if(dir->d_type == 4){ //IF IS DIR
|
||||||
printf("\033[1;33m%s\033[0m\n", dir->d_name);
|
printf("\033[1;33m%s\033[0m\n", dir->d_name);
|
||||||
} else { //IF IS !FILE AND !DIR
|
} else { //IF IS !FILE AND !DIR
|
||||||
printf("%s\n", dir->d_name);
|
printf("%s\n", dir->d_name);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
closedir(d); //Close directory
|
closedir(d); //Close directory
|
||||||
}
|
}
|
||||||
|
|
|
||||||
10
etc/logo.c
10
etc/logo.c
|
|
@ -8,9 +8,9 @@ char logo_row5[59] = "|_| |_|\\___|\\__|_.__/ \\___|_| |_|_/_/\\_\\\\____|_| |_
|
||||||
|
|
||||||
//Prints the logo
|
//Prints the logo
|
||||||
void showLogo(){
|
void showLogo(){
|
||||||
printf("\033[0;34m%s\033[0m\n", logo_row1);
|
printf("\033[1;34m%s\033[0m\n", logo_row1);
|
||||||
printf("\033[0;34m%s\033[0m\n", logo_row2);
|
printf("\033[1;34m%s\033[0m\n", logo_row2);
|
||||||
printf("\033[0;34m%s\033[0m\n", logo_row3);
|
printf("\033[1;34m%s\033[0m\n", logo_row3);
|
||||||
printf("\033[0;34m%s\033[0m\n", logo_row4);
|
printf("\033[1;34m%s\033[0m\n", logo_row4);
|
||||||
printf("\033[0;34m%s\033[0m\n\n", logo_row5);
|
printf("\033[1;34m%s\033[0m\n\n", logo_row5);
|
||||||
}
|
}
|
||||||
38
main.c
38
main.c
|
|
@ -17,11 +17,14 @@
|
||||||
#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 "etc/man/man.h"
|
||||||
|
|
||||||
|
|
||||||
#define VERSION "0.2.2"
|
#define VERSION "0.2.3"
|
||||||
#define AUTHOR "netbenix"
|
#define AUTHOR "netbenix"
|
||||||
|
|
||||||
|
bool VER_CHECK_ON_START = true;
|
||||||
|
|
||||||
// Color Codes:
|
// Color Codes:
|
||||||
// Reset: \033[0m
|
// Reset: \033[0m
|
||||||
// Red: \033[0;31m
|
// Red: \033[0;31m
|
||||||
|
|
@ -62,12 +65,13 @@ int commandHandler(char *cmd){
|
||||||
arg[i] = p;
|
arg[i] = p;
|
||||||
|
|
||||||
//Start to compare the command
|
//Start to compare the command
|
||||||
if(!strcmp(arg[0], "list")){
|
if(!strcmp(arg[0], "help")){
|
||||||
printf("\033[1;34mcd\033[0m : change directory\n");
|
printf("\033[1;34mcd \033[0;35m[dir]\033[0m : change directory\n");
|
||||||
printf("\033[1;34mdir\033[0m : show contents of directory\n");
|
printf("\033[1;34mls \033[0;35m[dir]\033[0m : show contents of directory\n");
|
||||||
printf("\033[1;34mlist\033[0m : this list\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");
|
||||||
|
printf("\033[1;34mexit\033[0m : exit the program\n");
|
||||||
return 0;
|
return 0;
|
||||||
} else if(!strcmp(arg[0], "version")){
|
} 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);
|
||||||
|
|
@ -77,14 +81,17 @@ int commandHandler(char *cmd){
|
||||||
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], "dir")){
|
} 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")){
|
||||||
|
showManEntry(arg);
|
||||||
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
printf("Unknown command. Please use 'list' for more information.\n");
|
printf("Unknown command. Please use 'help' for more information.\n");
|
||||||
logger("User entered unknown command.");
|
logger("User entered unknown command.");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -101,7 +108,6 @@ int main(int argc, char *argv[]){
|
||||||
log_Specs(); //Log system specs
|
log_Specs(); //Log system specs
|
||||||
showLogo(); //Show the logo
|
showLogo(); //Show the logo
|
||||||
logger("Logo Displayed.");
|
logger("Logo Displayed.");
|
||||||
checkForUpdate(VERSION); //Check for newer version of client
|
|
||||||
if(argc > 2){
|
if(argc > 2){
|
||||||
printf("Too many arguments. Please use --help for more information.\n");
|
printf("Too many arguments. Please use --help for more information.\n");
|
||||||
snprintf(buffer, sizeof(buffer), "[ERROR] Too many arguments. Argument count: %i", argc-1);
|
snprintf(buffer, sizeof(buffer), "[ERROR] Too many arguments. Argument count: %i", argc-1);
|
||||||
|
|
@ -113,24 +119,33 @@ int main(int argc, char *argv[]){
|
||||||
if(!strcmp(argv[1], "--help")){
|
if(!strcmp(argv[1], "--help")){
|
||||||
logger("Showing Help.");
|
logger("Showing Help.");
|
||||||
outputHelp();
|
outputHelp();
|
||||||
|
exit(0);
|
||||||
} else if (!strcmp(argv[1], "--gtk-test")){
|
} else if (!strcmp(argv[1], "--gtk-test")){
|
||||||
logger("Stating GTK Test.");
|
logger("Stating GTK Test.");
|
||||||
createGTKTestWindow();
|
createGTKTestWindow();
|
||||||
|
exit(0);
|
||||||
} else if (!strcmp(argv[1], "--sys-info")){
|
} else if (!strcmp(argv[1], "--sys-info")){
|
||||||
logger("Showing System Information.");
|
logger("Showing System Information.");
|
||||||
print_Specs();
|
print_Specs();
|
||||||
|
exit(0);
|
||||||
} else if (!strcmp(argv[1], "--sql-test")){
|
} else if (!strcmp(argv[1], "--sql-test")){
|
||||||
logger("Starting SQL Test.");
|
logger("Starting SQL Test.");
|
||||||
testSQLConnection();
|
testSQLConnection();
|
||||||
|
exit(0);
|
||||||
|
} else if (!strcmp(argv[1], "--no-version-check")){
|
||||||
|
VER_CHECK_ON_START = false;
|
||||||
|
logger("[INFO] Argument 'no-version-check' used.");
|
||||||
} else {
|
} else {
|
||||||
printf("Argument unknown. Please use --help for more information.\n");
|
printf("Argument unknown. Please use --help for more information.\n");
|
||||||
snprintf(buffer, sizeof(buffer), "[ERROR] Argument unknown. Given argument: %s", argv[1]);
|
snprintf(buffer, sizeof(buffer), "[ERROR] Argument unknown. Given argument: %s", argv[1]);
|
||||||
logger(buffer);
|
logger(buffer);
|
||||||
|
exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(VER_CHECK_ON_START){checkForUpdate(VERSION);}//Check for newer version of client
|
||||||
|
|
||||||
//If no startup arg is given, start command handler
|
//If no startup arg is given, start command handler
|
||||||
if(argc == 1){
|
|
||||||
int exit = 0;
|
int exit = 0;
|
||||||
char cmd[128];
|
char cmd[128];
|
||||||
logger("Starting Command Handler.");
|
logger("Starting Command Handler.");
|
||||||
|
|
@ -141,7 +156,6 @@ int main(int argc, char *argv[]){
|
||||||
exit = commandHandler(cmd);
|
exit = commandHandler(cmd);
|
||||||
}
|
}
|
||||||
logger("Exiting Command Handler.");
|
logger("Exiting Command Handler.");
|
||||||
}
|
|
||||||
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
exit_app();
|
exit_app();
|
||||||
|
|
|
||||||
Reference in a new issue