1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-12-23 10:33:25 +01:00

Merge pull request #223 from louipc/master

Add debug flag and update man page.
This commit is contained in:
JFreegman 2014-08-16 02:59:55 -04:00
commit ae83725cb6
3 changed files with 37 additions and 18 deletions

View File

@ -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
Toxic \- CLI client for Tox
.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
application.
.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"
Use specified
.I data\-file
instead of
.IR ~/.config/tox/data
.IP "\-x, \-\-nodata"
Ignore data file
.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 "\-h, \-\-help"
Show help message
.IP "\-n, \-\-nodes nodes\-file"
Use specified
.I nodes\-file
for DHT bootstrap nodes, instead of
.IR __DATADIR__/DHTnodes
.IP "\-h, \-\-help"
Show help message
.IP "\-o, \-\-noconnect"
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
.IP __DATADIR__/DHTnodes
Default list of DHT bootstrap nodes.

View File

@ -518,6 +518,7 @@ static void print_usage(void)
{
fprintf(stderr, "usage: toxic [OPTION] [FILE ...]\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, " -d, --default-locale Use default locale\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.ignore_data_file = 0;
arg_opts.debug = 0;
arg_opts.default_locale = 0;
arg_opts.use_custom_data = 0;
arg_opts.no_connect = 0;
@ -549,6 +551,7 @@ static void parse_args(int argc, char *argv[])
{"file", required_argument, 0, 'f'},
{"nodata", no_argument, 0, 'x'},
{"ipv4", no_argument, 0, '4'},
{"debug", no_argument, 0, 'b'},
{"default-locale", no_argument, 0, 'd'},
{"config", required_argument, 0, 'c'},
{"nodes", required_argument, 0, 'n'},
@ -559,7 +562,7 @@ static void parse_args(int argc, char *argv[])
{"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;
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;
break;
case 'b':
arg_opts.debug = 1;
break;
case 'c':
snprintf(arg_opts.config_path, sizeof(arg_opts.config_path), "%s", optarg);
break;
@ -704,9 +711,9 @@ int main(int argc, char *argv[])
Tox *m = init_tox();
init_term();
/* Redirect stderr to /dev/null
NOTE: Might not be best solution. Comment out for debugging. */
freopen("/dev/null", "w", stderr);
/* enable stderr for debugging */
if (!arg_opts.debug)
freopen("/dev/null", "w", stderr);
if (m == NULL)
exit_toxic_err("failed in main", FATALERR_NETWORKINIT);

View File

@ -75,6 +75,7 @@ struct arg_opts {
int ignore_data_file;
int use_ipv4;
int force_tcp;
int debug;
int default_locale;
int use_custom_data;
int no_connect;