Update 0.2.6
This commit is contained in:
commit
88f11da06f
13 changed files with 177 additions and 88 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -13,8 +13,5 @@ show_dir.o
|
|||
change_dir.o
|
||||
update_check.o
|
||||
man.o
|
||||
<<<<<<< HEAD
|
||||
math.o
|
||||
=======
|
||||
>>>>>>> f1cf6269f94065bfb8498dd7ef06bfbb61442b80
|
||||
your-reality.o
|
||||
63
README.md
63
README.md
|
|
@ -1,4 +1,4 @@
|
|||
# **netbenixCMD**
|
||||
# netbenixCMD
|
||||
|
||||
A little project of mine to learn C.
|
||||
|
||||
|
|
@ -8,40 +8,59 @@ Tested on: *Ubuntu, Debian, Arch*
|
|||
|
||||
Used libs for Linux: *gtk+3.0, libmysqlclient*
|
||||
|
||||
Version: *0.2.4*
|
||||
Version: *0.2.6*
|
||||
|
||||
## Features:
|
||||
- A help page (OMG!!!)
|
||||
- A little GTK Test
|
||||
- Can detect if you're using linux or not and tell the Architecture you're running on
|
||||
- Can give you a bit of information about your CPU (but just a little bit)
|
||||
- Checks your client version on start with the server
|
||||
|
||||
- A help page (OMG!!!)
|
||||
|
||||
- A little GTK Test
|
||||
|
||||
- Can detect if you're using linux or not and tell the Architecture you're
|
||||
running on
|
||||
|
||||
- Can give you a bit of information about your CPU (but just a little bit)
|
||||
|
||||
- Checks your client version on start with the server
|
||||
|
||||
## Building:
|
||||
|
||||
Install packages:
|
||||
|
||||
- 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```
|
||||
- Arch: ```sudo pacman -S make gcc git gtk3 mariadb-libs pkgconf```
|
||||
- Ubuntu: `sudo apt-get install make gcc git libgtk-3-dev libmysqlclient-dev`
|
||||
|
||||
Clone repository: ```git clone https://github.com/netbenix/netbenixCMD.git```
|
||||
- Debian: `sudo apt-get install make gcc git libgtk-3-dev libmariadbclient-dev
|
||||
libmariadb-dev-compat`
|
||||
|
||||
Go into the cloned directory: ```cd netbenixCMD```
|
||||
- Arch: `sudo pacman -S make gcc git gtk3 mariadb-libs pkgconf`
|
||||
|
||||
Build program: ```make```
|
||||
Clone repository: `git clone https://github.com/netbenix/netbenixCMD.git`
|
||||
|
||||
Go into the cloned directory: `cd netbenixCMD`
|
||||
|
||||
Build program: `make`
|
||||
|
||||
## Usage
|
||||
After building use ```./netbenixCMD``` to start the program
|
||||
|
||||
If you want to use the testing arguments use ```./netbenixCMD <argument>```
|
||||
After building use `./netbenixCMD` to start the program
|
||||
|
||||
If you want to use the testing arguments use `./netbenixCMD <argument>`
|
||||
|
||||
## Arguments
|
||||
- ```--help``` => Displays all arguments
|
||||
- ```--gtk-test``` => Opens the GTK Test Window
|
||||
- ```--sql-test``` => Makes a test connection to a mysql server
|
||||
- ```--sys-info``` => Gives you information about your system
|
||||
- ```--no-version-check``` => Skips the client version check
|
||||
- ```--dev-mode``` => Starts the program in developer mode (right now it just skips version check)
|
||||
|
||||
- `--help` =\> Displays all arguments
|
||||
|
||||
- `--gtk-test` =\> Opens the GTK Test Window
|
||||
|
||||
- `--sql-test` =\> Makes a test connection to a mysql server
|
||||
|
||||
- `--sys-info` =\> Gives you information about your system
|
||||
|
||||
- `--no-version-check` =\> Skips the client version check
|
||||
|
||||
- `--dev-mode` =\> Starts the program in developer mode (right now it just
|
||||
skips version check)
|
||||
|
||||
## Known Bugs
|
||||
- ```sql-test``` sha-256 passwords not working on Debian
|
||||
|
||||
- `sql-test` sha-256 passwords not working on Debian
|
||||
|
|
|
|||
BIN
calc.o
Normal file
BIN
calc.o
Normal file
Binary file not shown.
|
|
@ -26,7 +26,7 @@ void showDirectory(char *arg[]){
|
|||
DIR *d;
|
||||
struct dirent *dir;
|
||||
char path[PATH_MAX];
|
||||
|
||||
;
|
||||
d = opendir(arg[1]); //Try to open directory
|
||||
if(d == NULL){ //Check if directory exists
|
||||
printf("Folder not found.\n");
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
#include <math.h>
|
||||
#include "../utils/logger.h"
|
||||
|
||||
#include "math.h"
|
||||
#include "math_ext.h"
|
||||
|
||||
double Add(double x, double y){
|
||||
return(x + y);
|
||||
|
|
@ -22,3 +22,11 @@ double Div(double x, double y){
|
|||
else
|
||||
return(x / y);
|
||||
}
|
||||
|
||||
double CubeVolume(double a){
|
||||
return pow(a, 3);
|
||||
}
|
||||
|
||||
double SphereVolume(double r){
|
||||
return (4/3*M_PI*pow(r, 3));
|
||||
}
|
||||
|
|
@ -1,9 +1,12 @@
|
|||
#ifndef _MATH_H_
|
||||
#define _MATH_H_
|
||||
#ifndef _MATH_EXT_H_
|
||||
#define _MATH_EXT_H_
|
||||
|
||||
double Add(double x, double y);
|
||||
double Sub(double x, double y);
|
||||
double Mul(double x, double y);
|
||||
double Div(double x, double y);
|
||||
|
||||
double CubeVolume(double a);
|
||||
double SphereVolume(double r);
|
||||
|
||||
#endif
|
||||
3
main.c
3
main.c
|
|
@ -15,10 +15,7 @@
|
|||
#include "utils/sql_test.h"
|
||||
#include "etc/logo.h"
|
||||
#include "etc/man.h"
|
||||
<<<<<<< HEAD
|
||||
#include "etc/math.h"
|
||||
=======
|
||||
>>>>>>> f1cf6269f94065bfb8498dd7ef06bfbb61442b80
|
||||
#include "etc/your-reality.h"
|
||||
#include "utils/logger.h"
|
||||
#include "utils/sys_info.h"
|
||||
|
|
|
|||
BIN
math.o
Normal file
BIN
math.o
Normal file
Binary file not shown.
BIN
math_ext.o
Normal file
BIN
math_ext.o
Normal file
Binary file not shown.
54
utils/calc.c
Normal file
54
utils/calc.c
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#include "calc.h"
|
||||
#include "../etc/math_ext.h"
|
||||
#include "logger.h"
|
||||
|
||||
void startCalc(){
|
||||
logger("Started calculator.");
|
||||
char op;
|
||||
printf("Calculator - Version 0.1\n\n");
|
||||
|
||||
do{
|
||||
printf("\nOperation (h for help): ");
|
||||
scanf("%c", &op);
|
||||
chooseOperation(op);
|
||||
}while(op != 'q');
|
||||
|
||||
|
||||
}
|
||||
|
||||
void chooseOperation(char op){
|
||||
logger("Operation choosen: " + op);
|
||||
|
||||
switch(op){
|
||||
case '1': { OP_1(); break;};
|
||||
case 'h': { listOperations(); break;};
|
||||
case 'q': {/*do nothing bcause auto break*/ break;}
|
||||
default: { /*do none*/ break;};
|
||||
}
|
||||
}
|
||||
|
||||
void listOperations(){
|
||||
printf("Operations List: \n\n");
|
||||
printf("1 - Addition\n");
|
||||
printf("2 - Subtraction\n");
|
||||
printf("3 - Multiply\n");
|
||||
printf("4 - Divide\n");
|
||||
}
|
||||
|
||||
void OP_1(){
|
||||
double x, y;
|
||||
printf("1. Number: \n");
|
||||
scanf("%lf", &x);
|
||||
printf("2. Number: \n");
|
||||
scanf("%lf", &y);
|
||||
printf("\n Result: %lf\n", Add(x,y));
|
||||
}
|
||||
|
||||
int getNumber(){
|
||||
int no;
|
||||
scanf("%d", &no);
|
||||
|
||||
return no;
|
||||
}
|
||||
12
utils/calc.h
Normal file
12
utils/calc.h
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#ifndef _CALC_H_
|
||||
#define _CALC_H_
|
||||
|
||||
void startCalc();
|
||||
void chooseOperation(char op);
|
||||
void listOperations();
|
||||
int getNumber();
|
||||
|
||||
//Operations
|
||||
void OP_1();
|
||||
|
||||
#endif
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
#include "update_check.h"
|
||||
#include "logger.h"
|
||||
|
||||
#define SERVER_IP "127.0.0.1"
|
||||
#define DEFAULT_IP "127.0.0.1"
|
||||
|
||||
int checkForUpdate(char ver[10]){
|
||||
int sock;
|
||||
|
|
@ -19,7 +19,7 @@ int checkForUpdate(char ver[10]){
|
|||
logger("Error while creating socket");
|
||||
}
|
||||
|
||||
server.sin_addr.s_addr = inet_addr(SERVER_IP); //Set the IP address of the server
|
||||
server.sin_addr.s_addr = inet_addr(DEFAULT_IP); //Set the IP address of the server
|
||||
server.sin_family = AF_INET;
|
||||
server.sin_port = htons( 34000 ); //Set the server port
|
||||
|
||||
|
|
|
|||
|
|
@ -2,5 +2,4 @@
|
|||
#define _UPDATE_CHECK_H_
|
||||
|
||||
int checkForUpdate(char ver[10]);
|
||||
|
||||
#endif
|
||||
Reference in a new issue