summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2016-12-08 11:09:10 +0100
committerTobias Klauser <tklauser@distanz.ch>2016-12-08 11:12:13 +0100
commitf474c5031e5b8c5833342a504c6e33941a5103f0 (patch)
tree3e797a93eea85fe6c82c20f1f762bfc4f4c0d39d
parentbf0df3ec1875df4b167aedd0fff25e7e56408b6b (diff)
all: Remove unused longindex parameter to getopt_long()
All tools (except mausezahn) use getopt_long() and pass a pointer to a local opt_index variable for the longindex parameter. However, this variable is never read afterwards. According to getopt(3) it's perfectly fine to pass NULL as the longindex parameter instead, so do that. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
-rw-r--r--astraceroute.c4
-rw-r--r--bpfc.c6
-rw-r--r--curvetun.c4
-rw-r--r--flowtop.c4
-rw-r--r--ifpps.c4
-rw-r--r--netsniff-ng.c4
-rw-r--r--trafgen.c4
7 files changed, 15 insertions, 15 deletions
diff --git a/astraceroute.c b/astraceroute.c
index 9600921..98b97e4 100644
--- a/astraceroute.c
+++ b/astraceroute.c
@@ -929,7 +929,7 @@ static int main_trace(struct ctx *ctx)
int main(int argc, char **argv)
{
- int c, opt_index, ret;
+ int c, ret;
struct ctx ctx;
setfsuid(getuid());
@@ -949,7 +949,7 @@ int main(int argc, char **argv)
ctx.bind_addr = NULL;
while ((c = getopt_long(argc, argv, short_options, long_options,
- &opt_index)) != EOF) {
+ NULL)) != EOF) {
switch (c) {
case 'h':
help();
diff --git a/bpfc.c b/bpfc.c
index a45bc98..bf14147 100644
--- a/bpfc.c
+++ b/bpfc.c
@@ -82,7 +82,7 @@ static void __noreturn version(void)
int main(int argc, char **argv)
{
- int ret, verbose = 0, c, opt_index, bypass = 0, format = 0;
+ int ret, verbose = 0, c, bypass = 0, format = 0;
bool invoke_cpp = false;
char **cpp_argv = NULL;
size_t cpp_argc = 0;
@@ -94,8 +94,8 @@ int main(int argc, char **argv)
if (argc == 1)
help();
- while ((c = getopt_long(argc, argv, short_options,
- long_options, &opt_index)) != EOF) {
+ while ((c = getopt_long(argc, argv, short_options, long_options,
+ NULL)) != EOF) {
switch (c) {
case 'h':
help();
diff --git a/curvetun.c b/curvetun.c
index cf47510..61ddc85 100644
--- a/curvetun.c
+++ b/curvetun.c
@@ -546,7 +546,7 @@ static int main_server(char *home, char *dev, char *port, int udp,
int main(int argc, char **argv)
{
- int ret = 0, c, opt_index, udp = 0, ipv4 = -1, daemon = 1, log = 1;
+ int ret = 0, c, udp = 0, ipv4 = -1, daemon = 1, log = 1;
char *port = NULL, *stun = NULL, *dev = NULL, *home = NULL, *alias = NULL;
enum working_mode wmode = MODE_UNKNOW;
@@ -556,7 +556,7 @@ int main(int argc, char **argv)
home = fetch_home_dir();
while ((c = getopt_long(argc, argv, short_options, long_options,
- &opt_index)) != EOF) {
+ NULL)) != EOF) {
switch (c) {
case 'h':
help();
diff --git a/flowtop.c b/flowtop.c
index 0a15b6a..4f8cbcf 100644
--- a/flowtop.c
+++ b/flowtop.c
@@ -1717,13 +1717,13 @@ static void *collector(void *null __maybe_unused)
int main(int argc, char **argv)
{
pthread_t tid;
- int ret, c, opt_index, what_cmd = 0;
+ int ret, c, what_cmd = 0;
setfsuid(getuid());
setfsgid(getgid());
while ((c = getopt_long(argc, argv, short_options, long_options,
- &opt_index)) != EOF) {
+ NULL)) != EOF) {
switch (c) {
case '4':
what_cmd |= INCLUDE_IPV4;
diff --git a/ifpps.c b/ifpps.c
index df6fe42..55c247b 100644
--- a/ifpps.c
+++ b/ifpps.c
@@ -1338,7 +1338,7 @@ static int term_main(const char *ifname, uint64_t ms_interval,
int main(int argc, char **argv)
{
short ifflags = 0;
- int c, opt_index, ret, promisc = 0;
+ int c, ret, promisc = 0;
unsigned int cpus, top_cpus = 5;
uint64_t interval = 1000;
char *ifname = NULL;
@@ -1354,7 +1354,7 @@ int main(int argc, char **argv)
setfsgid(getgid());
while ((c = getopt_long(argc, argv, short_options, long_options,
- &opt_index)) != EOF) {
+ NULL)) != EOF) {
switch (c) {
case 'h':
help();
diff --git a/netsniff-ng.c b/netsniff-ng.c
index ce37e10..bbffe72 100644
--- a/netsniff-ng.c
+++ b/netsniff-ng.c
@@ -1286,7 +1286,7 @@ static void __noreturn version(void)
int main(int argc, char **argv)
{
char *ptr;
- int c, i, j, cpu_tmp, opt_index, ops_touched = 0, vals[4] = {0};
+ int c, i, j, cpu_tmp, ops_touched = 0, vals[4] = {0};
bool prio_high = false, setsockmem = true;
void (*main_loop)(struct ctx *ctx) = NULL;
struct ctx ctx;
@@ -1296,7 +1296,7 @@ int main(int argc, char **argv)
srand(start_time);
while ((c = getopt_long(argc, argv, short_options, long_options,
- &opt_index)) != EOF) {
+ NULL)) != EOF) {
switch (c) {
case 'd':
case 'i':
diff --git a/trafgen.c b/trafgen.c
index 553dfa5..efd83ef 100644
--- a/trafgen.c
+++ b/trafgen.c
@@ -977,7 +977,7 @@ int main(int argc, char **argv)
{
bool slow = false, invoke_cpp = false, reseed = true, cpustats = true;
bool prio_high = false, set_irq_aff = true, set_sock_mem = true;
- int c, opt_index, vals[4] = {0}, irq;
+ int c, vals[4] = {0}, irq;
uint64_t gap = 0;
unsigned int i;
char *confname = NULL, *ptr;
@@ -1001,7 +1001,7 @@ int main(int argc, char **argv)
ctx.reserve_size = 512 * (1 << 10);
while ((c = getopt_long(argc, argv, short_options, long_options,
- &opt_index)) != EOF) {
+ NULL)) != EOF) {
switch (c) {
case 'h':
help();