mirror of https://github.com/a0rtega/pafish
Added command line option `-q` that disables the last `getchar()` for unattended analysis.
Changed command return value to match the analysis result; with the following scheme: - Everything `OK` -> 0 - Something `suspicious` but nothing `traced` -> 1 - Something `traced` -> 2
This commit is contained in:
parent
33c836c913
commit
c54d7516fd
BIN
pafish.exe
BIN
pafish.exe
Binary file not shown.
|
@ -6,6 +6,8 @@
|
|||
|
||||
#include "common.h"
|
||||
|
||||
int analysis_result = 0;
|
||||
|
||||
void init_cmd_colors() {
|
||||
HANDLE handler = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
SetConsoleTextAttribute(handler, FOREGROUND_INTENSITY);
|
||||
|
@ -27,6 +29,7 @@ void print_traced() {
|
|||
SetConsoleTextAttribute(handler, 207);
|
||||
printf("traced!\n");
|
||||
SetConsoleTextAttribute(handler, FOREGROUND_INTENSITY);
|
||||
analysis_result = 2;
|
||||
}
|
||||
|
||||
void print_not_traced() {
|
||||
|
@ -41,6 +44,9 @@ void print_suspicious() {
|
|||
SetConsoleTextAttribute(handler, 207);
|
||||
printf("suspicious\n");
|
||||
SetConsoleTextAttribute(handler, FOREGROUND_INTENSITY);
|
||||
if (analysis_result == 0) {
|
||||
analysis_result = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void write_log(char msg[]) {
|
||||
|
|
|
@ -16,4 +16,6 @@ void write_log(char msg[]);
|
|||
|
||||
void write_trace(char product[]);
|
||||
|
||||
extern int analysis_result;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -263,6 +263,9 @@ int main(int argc, char *argv[])
|
|||
|
||||
write_log("End");
|
||||
|
||||
fflush(stdin); getchar();
|
||||
return 0;
|
||||
fflush(stdin);
|
||||
if (argc != 2 || strcmp(argv[1], "-q") != 0) {
|
||||
getchar();
|
||||
}
|
||||
return analysis_result;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue