added inputFlags as checkVersion parameter

This commit is contained in:
Václav Šmejkal 2022-05-06 17:48:28 +02:00
parent a11415b949
commit 7c86692363
2 changed files with 9 additions and 8 deletions

View File

@ -1,7 +1,9 @@
#ifndef 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
int countIntLength(int number); //RETURNS LENGTH OF number

View File

@ -8,10 +8,9 @@
#include <why2/flags.h>
void
checkVersion()
void checkVersion(inputFlags flags)
{
if (getSkipCheck()) return;
if (flags.skipCheck) return;
//FILE-CHECK VARIABLES
int notFoundBuffer = 0;
@ -43,11 +42,11 @@ checkVersion()
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);
}
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);
}
@ -67,7 +66,7 @@ checkVersion()
//CHECK FOR TEXT IN buffer
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
sleep(5);
@ -82,7 +81,7 @@ checkVersion()
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
sleep(5);