mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-23 06:53:02 +01:00
Merge pull request #223 from louipc/master
Add debug flag and update man page.
This commit is contained in:
commit
ae83725cb6
39
doc/toxic.1
39
doc/toxic.1
@ -1,4 +1,4 @@
|
|||||||
.TH TOXIC 1 "June 2014" "Toxic v__VERSION__" "User Manual"
|
.TH TOXIC 1 "August 2014" "Toxic v__VERSION__" "User Manual"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
Toxic \- CLI client for Tox
|
Toxic \- CLI client for Tox
|
||||||
.SH SYNOPSYS
|
.SH SYNOPSYS
|
||||||
@ -14,29 +14,40 @@ Toxic is an ncurses-based instant messaging client for Tox which formerly
|
|||||||
resided in the Tox core repository, and is now available as a standalone
|
resided in the Tox core repository, and is now available as a standalone
|
||||||
application.
|
application.
|
||||||
.SH OPTIONS
|
.SH OPTIONS
|
||||||
|
.IP "\-4, \-\-ipv4"
|
||||||
|
Force IPv4 connection
|
||||||
|
.IP "\-b, \-\-debug
|
||||||
|
Enable stderr for debugging. Redirect output to avoid breaking
|
||||||
|
the curses interface and better capture messages.
|
||||||
|
.IP "\-c, \-\-config config\-file"
|
||||||
|
Use specified
|
||||||
|
.IP "\-d, \-\-default_locale
|
||||||
|
Use default locale
|
||||||
|
.I config\-file
|
||||||
|
instead of
|
||||||
|
.IR ~/.config/tox/toxic.conf
|
||||||
.IP "\-f, \-\-file data\-file"
|
.IP "\-f, \-\-file data\-file"
|
||||||
Use specified
|
Use specified
|
||||||
.I data\-file
|
.I data\-file
|
||||||
instead of
|
instead of
|
||||||
.IR ~/.config/tox/data
|
.IR ~/.config/tox/data
|
||||||
.IP "\-x, \-\-nodata"
|
.IP "\-h, \-\-help"
|
||||||
Ignore data file
|
Show help message
|
||||||
.IP "\-4, \-\-ipv4"
|
|
||||||
Force IPv4 connection
|
|
||||||
.IP "\-d, \-\-default_locale
|
|
||||||
Use default locale
|
|
||||||
.IP "\-c, \-\-config config\-file"
|
|
||||||
Use specified
|
|
||||||
.I config\-file
|
|
||||||
instead of
|
|
||||||
.IR ~/.config/tox/toxic.conf
|
|
||||||
.IP "\-n, \-\-nodes nodes\-file"
|
.IP "\-n, \-\-nodes nodes\-file"
|
||||||
Use specified
|
Use specified
|
||||||
.I nodes\-file
|
.I nodes\-file
|
||||||
for DHT bootstrap nodes, instead of
|
for DHT bootstrap nodes, instead of
|
||||||
.IR __DATADIR__/DHTnodes
|
.IR __DATADIR__/DHTnodes
|
||||||
.IP "\-h, \-\-help"
|
.IP "\-o, \-\-noconnect"
|
||||||
Show help message
|
Do not connect to the DHT network
|
||||||
|
.IP "\-p, \-\-proxy"
|
||||||
|
Use proxy: Requires [IP] [port]
|
||||||
|
.IP "\-r, \-\-dnslist"
|
||||||
|
Use specified DNSservers file
|
||||||
|
.IP "\-t, \-\-force\-tcp"
|
||||||
|
Force TCP connection (use this with proxies)
|
||||||
|
.IP "\-x, \-\-nodata"
|
||||||
|
Ignore data file
|
||||||
.SH FILES
|
.SH FILES
|
||||||
.IP __DATADIR__/DHTnodes
|
.IP __DATADIR__/DHTnodes
|
||||||
Default list of DHT bootstrap nodes.
|
Default list of DHT bootstrap nodes.
|
||||||
|
13
src/toxic.c
13
src/toxic.c
@ -518,6 +518,7 @@ static void print_usage(void)
|
|||||||
{
|
{
|
||||||
fprintf(stderr, "usage: toxic [OPTION] [FILE ...]\n");
|
fprintf(stderr, "usage: toxic [OPTION] [FILE ...]\n");
|
||||||
fprintf(stderr, " -4, --ipv4 Force IPv4 connection\n");
|
fprintf(stderr, " -4, --ipv4 Force IPv4 connection\n");
|
||||||
|
fprintf(stderr, " -b --debug Enable stderr for debugging\n");
|
||||||
fprintf(stderr, " -c, --config Use specified config file\n");
|
fprintf(stderr, " -c, --config Use specified config file\n");
|
||||||
fprintf(stderr, " -d, --default-locale Use default locale\n");
|
fprintf(stderr, " -d, --default-locale Use default locale\n");
|
||||||
fprintf(stderr, " -f, --file Use specified data file\n");
|
fprintf(stderr, " -f, --file Use specified data file\n");
|
||||||
@ -534,6 +535,7 @@ static void set_default_opts(void)
|
|||||||
{
|
{
|
||||||
arg_opts.use_ipv4 = 0;
|
arg_opts.use_ipv4 = 0;
|
||||||
arg_opts.ignore_data_file = 0;
|
arg_opts.ignore_data_file = 0;
|
||||||
|
arg_opts.debug = 0;
|
||||||
arg_opts.default_locale = 0;
|
arg_opts.default_locale = 0;
|
||||||
arg_opts.use_custom_data = 0;
|
arg_opts.use_custom_data = 0;
|
||||||
arg_opts.no_connect = 0;
|
arg_opts.no_connect = 0;
|
||||||
@ -549,6 +551,7 @@ static void parse_args(int argc, char *argv[])
|
|||||||
{"file", required_argument, 0, 'f'},
|
{"file", required_argument, 0, 'f'},
|
||||||
{"nodata", no_argument, 0, 'x'},
|
{"nodata", no_argument, 0, 'x'},
|
||||||
{"ipv4", no_argument, 0, '4'},
|
{"ipv4", no_argument, 0, '4'},
|
||||||
|
{"debug", no_argument, 0, 'b'},
|
||||||
{"default-locale", no_argument, 0, 'd'},
|
{"default-locale", no_argument, 0, 'd'},
|
||||||
{"config", required_argument, 0, 'c'},
|
{"config", required_argument, 0, 'c'},
|
||||||
{"nodes", required_argument, 0, 'n'},
|
{"nodes", required_argument, 0, 'n'},
|
||||||
@ -559,7 +562,7 @@ static void parse_args(int argc, char *argv[])
|
|||||||
{"proxy", required_argument, 0, 'p'},
|
{"proxy", required_argument, 0, 'p'},
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *opts_str = "4dhotxc:f:n:r:p:";
|
const char *opts_str = "4bdhotxc:f:n:r:p:";
|
||||||
int opt, indexptr;
|
int opt, indexptr;
|
||||||
|
|
||||||
while ((opt = getopt_long(argc, argv, opts_str, long_opts, &indexptr)) != -1) {
|
while ((opt = getopt_long(argc, argv, opts_str, long_opts, &indexptr)) != -1) {
|
||||||
@ -568,6 +571,10 @@ static void parse_args(int argc, char *argv[])
|
|||||||
arg_opts.use_ipv4 = 1;
|
arg_opts.use_ipv4 = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'b':
|
||||||
|
arg_opts.debug = 1;
|
||||||
|
break;
|
||||||
|
|
||||||
case 'c':
|
case 'c':
|
||||||
snprintf(arg_opts.config_path, sizeof(arg_opts.config_path), "%s", optarg);
|
snprintf(arg_opts.config_path, sizeof(arg_opts.config_path), "%s", optarg);
|
||||||
break;
|
break;
|
||||||
@ -704,8 +711,8 @@ int main(int argc, char *argv[])
|
|||||||
Tox *m = init_tox();
|
Tox *m = init_tox();
|
||||||
init_term();
|
init_term();
|
||||||
|
|
||||||
/* Redirect stderr to /dev/null
|
/* enable stderr for debugging */
|
||||||
NOTE: Might not be best solution. Comment out for debugging. */
|
if (!arg_opts.debug)
|
||||||
freopen("/dev/null", "w", stderr);
|
freopen("/dev/null", "w", stderr);
|
||||||
|
|
||||||
if (m == NULL)
|
if (m == NULL)
|
||||||
|
@ -75,6 +75,7 @@ struct arg_opts {
|
|||||||
int ignore_data_file;
|
int ignore_data_file;
|
||||||
int use_ipv4;
|
int use_ipv4;
|
||||||
int force_tcp;
|
int force_tcp;
|
||||||
|
int debug;
|
||||||
int default_locale;
|
int default_locale;
|
||||||
int use_custom_data;
|
int use_custom_data;
|
||||||
int no_connect;
|
int no_connect;
|
||||||
|
Loading…
Reference in New Issue
Block a user