added inputFlags as checkVersion parameter
This commit is contained in:
parent
a11415b949
commit
7c86692363
@ -1,7 +1,9 @@
|
|||||||
#ifndef WHY2_MISC_H
|
#ifndef WHY2_MISC_H
|
||||||
#define WHY2_MISC_H
|
#define WHY2_MISC_H
|
||||||
|
|
||||||
void checkVersion(); //THIS FUNCTION CHECKS IF LATEST VERSION OF WHY2 IS USED
|
#include <why2/flags.h>
|
||||||
|
|
||||||
|
void checkVersion(inputFlags flags); //THIS FUNCTION CHECKS IF LATEST VERSION OF WHY2 IS USED
|
||||||
void generateTextKeyChain(char key[], int *textKeyChain, int textKeyChainSize); //GENERATES ARRAY FOR ENCRYPTION/DECRYPTION
|
void generateTextKeyChain(char key[], int *textKeyChain, int textKeyChainSize); //GENERATES ARRAY FOR ENCRYPTION/DECRYPTION
|
||||||
int countIntLength(int number); //RETURNS LENGTH OF number
|
int countIntLength(int number); //RETURNS LENGTH OF number
|
||||||
|
|
||||||
|
@ -8,10 +8,9 @@
|
|||||||
|
|
||||||
#include <why2/flags.h>
|
#include <why2/flags.h>
|
||||||
|
|
||||||
void
|
void checkVersion(inputFlags flags)
|
||||||
checkVersion()
|
|
||||||
{
|
{
|
||||||
if (getSkipCheck()) return;
|
if (flags.skipCheck) return;
|
||||||
|
|
||||||
//FILE-CHECK VARIABLES
|
//FILE-CHECK VARIABLES
|
||||||
int notFoundBuffer = 0;
|
int notFoundBuffer = 0;
|
||||||
@ -43,11 +42,11 @@ checkVersion()
|
|||||||
|
|
||||||
if (notFoundBuffer == NOT_FOUND_TRIES)
|
if (notFoundBuffer == NOT_FOUND_TRIES)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s'%s' not found!\n", CLEAR_SCREEN, VERSIONS_NAME);
|
if (!flags.noOutput) fprintf(stderr, "%s'%s' not found!\n", CLEAR_SCREEN, VERSIONS_NAME);
|
||||||
exit(DOWNLOAD_FAILED);
|
exit(DOWNLOAD_FAILED);
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("%s'%s' not found (%dx)! Trying again in a second.\n", CLEAR_SCREEN, VERSIONS_NAME, notFoundBuffer);
|
if (!flags.noOutput) printf("%s'%s' not found (%dx)! Trying again in a second.\n", CLEAR_SCREEN, VERSIONS_NAME, notFoundBuffer);
|
||||||
sleep(1);
|
sleep(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,7 +66,7 @@ checkVersion()
|
|||||||
//CHECK FOR TEXT IN buffer
|
//CHECK FOR TEXT IN buffer
|
||||||
if (strcmp(buffer, "") == 0)
|
if (strcmp(buffer, "") == 0)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "You probably aren't connected to internet! This release could be unsafe!\n\n");
|
if (!flags.noOutput) fprintf(stderr, "You probably aren't connected to internet! This release could be unsafe!\n\n");
|
||||||
|
|
||||||
//WAIT FOR 5 SECONDS
|
//WAIT FOR 5 SECONDS
|
||||||
sleep(5);
|
sleep(5);
|
||||||
@ -82,7 +81,7 @@ checkVersion()
|
|||||||
|
|
||||||
if (strcmp(VERSION, json_object_get_string(active)) != 0)
|
if (strcmp(VERSION, json_object_get_string(active)) != 0)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Your version isn't latest! This release could be unsafe! (%s/%s)\n\n", VERSION, json_object_get_string(active));
|
if (!flags.noOutput) fprintf(stderr, "Your version isn't latest! This release could be unsafe! (%s/%s)\n\n", VERSION, json_object_get_string(active));
|
||||||
|
|
||||||
//WAIT FOR 5 SECONDS
|
//WAIT FOR 5 SECONDS
|
||||||
sleep(5);
|
sleep(5);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user