comparison main.c @ 640:51dd01786d25 dev-1_5_0

Update to work with changed th_args API.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 22 Nov 2014 23:38:57 +0200
parents 02e1307e2a62
children c8e5949a8961
comparison
equal deleted inserted replaced
639:02e1307e2a62 640:51dd01786d25
109 }; 109 };
110 110
111 111
112 /* Arguments 112 /* Arguments
113 */ 113 */
114 optarg_t optList[] = 114 static const th_optarg_t optList[] =
115 { 115 {
116 { 0, '?', "help", "Show this help", OPT_NONE }, 116 { 0, '?', "help", "Show this help and be so very much verbose that it almost hurts you", OPT_NONE },
117 { 1, 'v', "verbose", "Be more verbose", OPT_NONE }, 117 { 1, 'v', "verbose", "Be more verbose", OPT_NONE },
118 { 2, 'p', "port", "Connect to port", OPT_ARGREQ }, 118 { 2, 'p', "port", "Connect to port", OPT_ARGREQ },
119 { 3, 's', "server", "Server to connect to", OPT_ARGREQ }, 119 { 3, 's', "server", "Server to connect to", OPT_ARGREQ },
120 { 4, 'C', "color", "Initial color in RGB hex 000000", OPT_ARGREQ }, 120 { 4, 'C', "color", "Initial color in RGB hex 000000", OPT_ARGREQ },
121 { 6, 'D', "daemon", "A pseudo-daemon mode for logging", OPT_NONE }, 121 { 6, 'D', "daemon", "A pseudo-daemon mode for logging", OPT_NONE },
125 {10, 'P', "proxy", "Set proxy data, see below for syntax", OPT_ARGREQ }, 125 {10, 'P', "proxy", "Set proxy data, see below for syntax", OPT_ARGREQ },
126 126
127 {13, 'r', "room", "Connect to room (main, pit)", OPT_ARGREQ }, 127 {13, 'r', "room", "Connect to room (main, pit)", OPT_ARGREQ },
128 }; 128 };
129 129
130 const int optListN = (sizeof(optList) / sizeof(optList[0])); 130 static const int optListN = sizeof(optList) / sizeof(optList[0]);
131 131
132 132
133 void argShowHelp(void) 133 void argShowHelp(void)
134 { 134 {
135 int i; 135 int i;
136 th_print_banner(stdout, th_prog_name, "[options] <username> <password>"); 136 th_print_banner(stdout, th_prog_name, "[options] <username> <password>");
137 137
138 th_args_help(stdout, optList, optListN); 138 th_args_help(stdout, optList, optListN, 0);
139 139
140 printf( 140 printf(
141 "\n" 141 "\n"
142 "Supported proxy types are SOCKS 4/4A and SOCKS 5.\n" 142 "Supported proxy types are SOCKS 4/4A and SOCKS 5.\n"
143 "(Only user/pass auth and no auth supported, no GSSAPI!)\n" 143 "(Only user/pass auth and no auth supported, no GSSAPI!)\n"
2155 } 2155 }
2156 } 2156 }
2157 2157
2158 // Parse command line arguments 2158 // Parse command line arguments
2159 argsOK = th_args_process(argc, argv, optList, optListN, 2159 argsOK = th_args_process(argc, argv, optList, optListN,
2160 argHandleOpt, argHandleFile, FALSE); 2160 argHandleOpt, argHandleFile, 0);
2161 2161
2162 if (optUserNameCmd != NULL) 2162 if (optUserNameCmd != NULL)
2163 { 2163 {
2164 THMSG(1, "Username set on commandline.\n"); 2164 THMSG(1, "Username set on commandline.\n");
2165 optUserName = optUserNameCmd; 2165 optUserName = optUserNameCmd;