projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix some compiler warnings.
[tinc]
/
src
/
tincctl.c
diff --git
a/src/tincctl.c
b/src/tincctl.c
index
632e7ac
..
641fb9c
100644
(file)
--- a/
src/tincctl.c
+++ b/
src/tincctl.c
@@
-1,6
+1,6
@@
/*
tincctl.c -- Controlling a running tincd
/*
tincctl.c -- Controlling a running tincd
- Copyright (C) 2007-20
09
Guus Sliepen <guus@tinc-vpn.org>
+ Copyright (C) 2007-20
11
Guus Sliepen <guus@tinc-vpn.org>
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
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
@@
-26,6
+26,8
@@
#include "control_common.h"
#include "rsagen.h"
#include "utils.h"
#include "control_common.h"
#include "rsagen.h"
#include "utils.h"
+#include "tincctl.h"
+#include "top.h"
/* The name this program was run with. */
char *program_name = NULL;
/* The name this program was run with. */
char *program_name = NULL;
@@
-93,6
+95,9
@@
static void usage(bool status) {
" retry Retry all outgoing connections\n"
" reload Partial reload of configuration\n"
" disconnect NODE Close meta connection with NODE\n"
" retry Retry all outgoing connections\n"
" reload Partial reload of configuration\n"
" disconnect NODE Close meta connection with NODE\n"
+#ifdef HAVE_CURSES
+ " top Show real-time statistics\n"
+#endif
"\n");
printf("Report bugs to tinc@tinc-vpn.org.\n");
}
"\n");
printf("Report bugs to tinc@tinc-vpn.org.\n");
}
@@
-296,7
+301,7
@@
static void make_names(void) {
}
}
}
}
-
static
bool recvline(int fd, char *line, size_t len) {
+bool recvline(int fd, char *line, size_t len) {
static char buffer[4096];
static size_t blen = 0;
char *newline = NULL;
static char buffer[4096];
static size_t blen = 0;
char *newline = NULL;
@@
-323,7
+328,7
@@
static bool recvline(int fd, char *line, size_t len) {
return true;
}
return true;
}
-
static
bool sendline(int fd, char *format, ...) {
+bool sendline(int fd, char *format, ...) {
static char buffer[4096];
char *p = buffer;
size_t blen = 0;
static char buffer[4096];
char *p = buffer;
size_t blen = 0;
@@
-517,7
+522,6
@@
int main(int argc, char *argv[], char *envp[]) {
}
bool do_graph = false;
}
bool do_graph = false;
- int dumps = 1;
if(!strcasecmp(argv[optind+1], "nodes"))
sendline(fd, "%d %d", CONTROL, REQ_DUMP_NODES);
if(!strcasecmp(argv[optind+1], "nodes"))
sendline(fd, "%d %d", CONTROL, REQ_DUMP_NODES);
@@
-531,7
+535,6
@@
int main(int argc, char *argv[], char *envp[]) {
sendline(fd, "%d %d", CONTROL, REQ_DUMP_NODES);
sendline(fd, "%d %d", CONTROL, REQ_DUMP_EDGES);
do_graph = true;
sendline(fd, "%d %d", CONTROL, REQ_DUMP_NODES);
sendline(fd, "%d %d", CONTROL, REQ_DUMP_EDGES);
do_graph = true;
- dumps = 2;
printf("digraph {\n");
} else {
fprintf(stderr, "Unknown dump type '%s'.\n", argv[optind+1]);
printf("digraph {\n");
} else {
fprintf(stderr, "Unknown dump type '%s'.\n", argv[optind+1]);
@@
-626,6
+629,13
@@
int main(int argc, char *argv[], char *envp[]) {
return 0;
}
return 0;
}
+#ifdef HAVE_CURSES
+ if(!strcasecmp(argv[optind], "top")) {
+ top(fd);
+ return 0;
+ }
+#endif
+
fprintf(stderr, "Unknown command `%s'.\n", argv[optind]);
usage(true);
fprintf(stderr, "Unknown command `%s'.\n", argv[optind]);
usage(true);