vnstatd.c (vnstat-2.8) | : | vnstatd.c (vnstat-2.9) | ||
---|---|---|---|---|
/* | /* | |||
vnStat daemon - Copyright (C) 2008-2021 Teemu Toivola <tst@iki.fi> | vnStat daemon - Copyright (C) 2008-2022 Teemu Toivola <tst@iki.fi> | |||
This program is free software; you can redistribute it and/or modify | This program is free software; you can redistribute it and/or modify | |||
it under the terms of the GNU General Public License as published by | it under the terms of the GNU General Public License as published by | |||
the Free Software Foundation; version 2 dated June, 1991. | the Free Software Foundation; version 2 dated June, 1991. | |||
This program is distributed in the hope that it will be useful, | This program is distributed in the hope that it will be useful, | |||
but WITHOUT ANY WARRANTY; without even the implied warranty of | but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
GNU General Public License for more details. | GNU General Public License for more details. | |||
skipping to change at line 248 | skipping to change at line 248 | |||
printf(" -d, --daemon fork process to background\n"); | printf(" -d, --daemon fork process to background\n"); | |||
printf(" -n, --nodaemon stay in foreground attached to the terminal\n\n"); | printf(" -n, --nodaemon stay in foreground attached to the terminal\n\n"); | |||
printf(" -s, --sync sync interface counters on first u pdate\n"); | printf(" -s, --sync sync interface counters on first u pdate\n"); | |||
printf(" -D, --debug show additional debug and disable daemon\n"); | printf(" -D, --debug show additional debug and disable daemon\n"); | |||
printf(" -?, --help show this help\n"); | printf(" -?, --help show this help\n"); | |||
printf(" -v, --version show version\n"); | printf(" -v, --version show version\n"); | |||
printf(" -p, --pidfile <file> select used pid file\n"); | printf(" -p, --pidfile <file> select used pid file\n"); | |||
printf(" -u, --user <user> set daemon process user\n"); | printf(" -u, --user <user> set daemon process user\n"); | |||
printf(" -g, --group <group> set daemon process group\n"); | printf(" -g, --group <group> set daemon process group\n"); | |||
printf(" -t, --timestamp add timestamp to prints when runni ng in foreground\n"); | ||||
printf(" --config <config file> select used config file\n"); | printf(" --config <config file> select used config file\n"); | |||
printf(" --noadd prevent startup if database has no interfaces\n"); | printf(" --noadd prevent startup if database has no interfaces\n"); | |||
printf(" --alwaysadd [mode] automatically start monitoring all new interfaces\n"); | printf(" --alwaysadd [mode] automatically start monitoring all new interfaces\n"); | |||
printf(" --initdb create empty database and exit\n\n "); | printf(" --initdb create empty database and exit\n\n "); | |||
printf("See also \"man vnstatd\".\n"); | printf("See also \"man vnstatd\".\n"); | |||
} | } | |||
void parseargs(DSTATE *s, int argc, char **argv) | void parseargs(DSTATE *s, int argc, char **argv) | |||
{ | { | |||
skipping to change at line 278 | skipping to change at line 279 | |||
currentarg++; | currentarg++; | |||
} else if ((strcmp(argv[currentarg], "-D") == 0) || (strcmp(argv[ currentarg], "--debug") == 0)) { | } else if ((strcmp(argv[currentarg], "-D") == 0) || (strcmp(argv[ currentarg], "--debug") == 0)) { | |||
debug = 1; | debug = 1; | |||
} else if ((strcmp(argv[currentarg], "-d") == 0) || (strcmp(argv[ currentarg], "--daemon") == 0)) { | } else if ((strcmp(argv[currentarg], "-d") == 0) || (strcmp(argv[ currentarg], "--daemon") == 0)) { | |||
s->rundaemon = 1; | s->rundaemon = 1; | |||
s->showhelp = 0; | s->showhelp = 0; | |||
} else if ((strcmp(argv[currentarg], "-n") == 0) || (strcmp(argv[ currentarg], "--nodaemon") == 0)) { | } else if ((strcmp(argv[currentarg], "-n") == 0) || (strcmp(argv[ currentarg], "--nodaemon") == 0)) { | |||
s->showhelp = 0; | s->showhelp = 0; | |||
} else if ((strcmp(argv[currentarg], "-s") == 0) || (strcmp(argv[ currentarg], "--sync") == 0)) { | } else if ((strcmp(argv[currentarg], "-s") == 0) || (strcmp(argv[ currentarg], "--sync") == 0)) { | |||
s->sync = 1; | s->sync = 1; | |||
} else if ((strcmp(argv[currentarg], "-t") == 0) || (strcmp(argv[ | ||||
currentarg], "--timestamp") == 0)) { | ||||
cfg.timestampprints = 1; | ||||
} else if ((strcmp(argv[currentarg], "-u") == 0) || (strcmp(argv[ currentarg], "--user") == 0)) { | } else if ((strcmp(argv[currentarg], "-u") == 0) || (strcmp(argv[ currentarg], "--user") == 0)) { | |||
if (currentarg + 1 < argc) { | if (currentarg + 1 < argc) { | |||
strncpy_nt(s->user, argv[currentarg + 1], 33); | strncpy_nt(s->user, argv[currentarg + 1], 33); | |||
if (debug) | if (debug) | |||
printf("Requested user: \"%s\"\n", s->use r); | printf("Requested user: \"%s\"\n", s->use r); | |||
currentarg++; | currentarg++; | |||
} else { | } else { | |||
printf("Error: User for --user missing.\n"); | printf("Error: User for --user missing.\n"); | |||
exit(EXIT_FAILURE); | exit(EXIT_FAILURE); | |||
} | } | |||
End of changes. 3 change blocks. | ||||
1 lines changed or deleted | 5 lines changed or added |