mirror of
https://github.com/pi-hole/FTL.git
synced 2024-10-26 16:52:18 +02:00
78f615201a
For greater portability, we now use the macros EXIT_SUCCESS and EXIT_FAILURE for the conventional status value for success and failure, respectively. They are declared in stdlib.h
70 lines
1.4 KiB
C
70 lines
1.4 KiB
C
/* Pi-hole: A black hole for Internet advertisements
|
|
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
|
* Network-wide ad blocking via your own hardware.
|
|
*
|
|
* FTL Engine
|
|
* Argument parsing routines
|
|
*
|
|
* This file is copyright under the latest version of the EUPL.
|
|
* Please see LICENSE file for your rights under this license. */
|
|
|
|
#include "FTL.h"
|
|
#include "version.h"
|
|
|
|
bool debug = false;
|
|
bool debugthreads = false;
|
|
bool debugclients = false;
|
|
bool debugGC = false;
|
|
bool runtest = false;
|
|
void parse_args(int argc, char* argv[])
|
|
{
|
|
int i;
|
|
for(i=0; i < argc; i++) {
|
|
if((strcmp(argv[i], "d") == 0) || (strcmp(argv[i], "debug") == 0))
|
|
debug = true;
|
|
|
|
if(strcmp(argv[i], "debugthreads") == 0)
|
|
{
|
|
debug = true;
|
|
debugthreads = true;
|
|
}
|
|
|
|
if(strcmp(argv[i], "debugclients") == 0)
|
|
{
|
|
debug = true;
|
|
debugclients = true;
|
|
}
|
|
|
|
if(strcmp(argv[i], "debugGC") == 0)
|
|
{
|
|
debug = true;
|
|
debugGC = true;
|
|
}
|
|
|
|
if(strcmp(argv[i], "test") == 0)
|
|
killed = 1;
|
|
|
|
if(strcmp(argv[i], "version") == 0)
|
|
{
|
|
printf("%s\n",GIT_VERSION);
|
|
exit(EXIT_SUCCESS);
|
|
}
|
|
|
|
if(strcmp(argv[i], "tag") == 0)
|
|
{
|
|
printf("%s\n",GIT_TAG);
|
|
exit(EXIT_SUCCESS);
|
|
}
|
|
|
|
// pihole-FTL running
|
|
// will test if another pihole-FTL process is running
|
|
// and exits even if not (instead of starting a new one)
|
|
if(strcmp(argv[i], "running") == 0)
|
|
{
|
|
runtest = true;
|
|
}
|
|
|
|
// Other arguments are ignored
|
|
}
|
|
}
|