changed checkVersion return type to int
it will return exitCode
This commit is contained in:
parent
78e93f6d19
commit
d196818ec0
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
#include <why2/flags.h>
|
#include <why2/flags.h>
|
||||||
|
|
||||||
void checkVersion(inputFlags flags); //THIS FUNCTION CHECKS IF LATEST VERSION OF WHY2 IS USED
|
int 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
|
||||||
void deallocateOutput(outputFlags flags); //DEALLOCATES flags
|
void deallocateOutput(outputFlags flags); //DEALLOCATES flags
|
||||||
void checkKey(char *key, inputFlags flags); //CHECKS IF KEY IS VALID
|
void checkKey(char *key, inputFlags flags); //CHECKS IF KEY IS VALID
|
||||||
|
@ -63,7 +63,7 @@ char *replaceWord(char *string, char *old, char *new) //CODE FROM: https://www.g
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkVersion(inputFlags flags)
|
int checkVersion(inputFlags flags)
|
||||||
{
|
{
|
||||||
if (flags.noCheck) return;
|
if (flags.noCheck) return;
|
||||||
|
|
||||||
@ -98,7 +98,7 @@ void checkVersion(inputFlags flags)
|
|||||||
if (notFoundBuffer == NOT_FOUND_TRIES)
|
if (notFoundBuffer == NOT_FOUND_TRIES)
|
||||||
{
|
{
|
||||||
if (!flags.noOutput) fprintf(stderr, "%s'%s' not found! Exiting...\n", CLEAR_SCREEN, VERSIONS_NAME);
|
if (!flags.noOutput) fprintf(stderr, "%s'%s' not found! Exiting...\n", CLEAR_SCREEN, VERSIONS_NAME);
|
||||||
return noOutput(DOWNLOAD_FAILED);
|
return DOWNLOAD_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!flags.noOutput) 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);
|
||||||
@ -151,7 +151,7 @@ void checkVersion(inputFlags flags)
|
|||||||
if (getuid() != 0)
|
if (getuid() != 0)
|
||||||
{
|
{
|
||||||
if (!flags.noOutput) fprintf(stderr, "You need to be root to update!\t[I DO NOT RECOMMEND USING THIS]\n");
|
if (!flags.noOutput) fprintf(stderr, "You need to be root to update!\t[I DO NOT RECOMMEND USING THIS]\n");
|
||||||
return noOutput(UPDATE_FAILED);
|
return UPDATE_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
//VARIABLES
|
//VARIABLES
|
||||||
@ -179,7 +179,7 @@ void checkVersion(inputFlags flags)
|
|||||||
if (exitCode != 0)
|
if (exitCode != 0)
|
||||||
{
|
{
|
||||||
if (!flags.noOutput) fprintf(stderr, "Updating failed! (cloning)\n");
|
if (!flags.noOutput) fprintf(stderr, "Updating failed! (cloning)\n");
|
||||||
return noOutput(UPDATE_FAILED);
|
return UPDATE_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
//COUNT installCommand LENGTH & ALLOCATE IT
|
//COUNT installCommand LENGTH & ALLOCATE IT
|
||||||
@ -194,7 +194,7 @@ void checkVersion(inputFlags flags)
|
|||||||
if (installCode != 0)
|
if (installCode != 0)
|
||||||
{
|
{
|
||||||
if (!flags.noOutput) fprintf(stderr, "Updating failed! (installing)\n");
|
if (!flags.noOutput) fprintf(stderr, "Updating failed! (installing)\n");
|
||||||
return noOutput(UPDATE_FAILED);
|
return UPDATE_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
goto deallocation; //GREAT SUCCESS!
|
goto deallocation; //GREAT SUCCESS!
|
||||||
@ -244,6 +244,8 @@ void checkVersion(inputFlags flags)
|
|||||||
free(parsedJson);
|
free(parsedJson);
|
||||||
free(active);
|
free(active);
|
||||||
free(buffer);
|
free(buffer);
|
||||||
|
|
||||||
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
void generateTextKeyChain(char *key, int *textKeyChain, int textKeyChainSize)
|
void generateTextKeyChain(char *key, int *textKeyChain, int textKeyChainSize)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user