comparison mcabber/src/main.c @ 1257:05dc45e7c7bb

Add command line option -v (Suggested by Wolfram Schlich)
author Mikael Berthe <mikael@lilotux.net>
date Tue, 26 Jun 2007 20:35:02 +0200
parents ea679e3598a9
children c5c09f8f60b0
comparison
equal deleted inserted replaced
1256:ea679e3598a9 1257:05dc45e7c7bb
245 printf(v_fmt, v); 245 printf(v_fmt, v);
246 scr_LogPrint(LPRINT_LOGNORM|LPRINT_NOTUTF8, v_fmt, v); 246 scr_LogPrint(LPRINT_LOGNORM|LPRINT_NOTUTF8, v_fmt, v);
247 g_free(v); 247 g_free(v);
248 } 248 }
249 249
250 void main_init_pgp(void) 250 static void compile_options(void)
251 {
252 puts("Installation data directory: " DATA_DIR "\n");
253 #ifdef HAVE_UNICODE
254 puts("Compiled with unicode support.");
255 #endif
256 #ifdef HAVE_OPENSSL
257 puts("Compiled with OpenSSL support.");
258 #elif defined HAVE_GNUTLS
259 puts("Compiled with GnuTLS support.");
260 #endif
261 #ifdef HAVE_GPGME
262 puts("Compiled with GPG support.");
263 #endif
264 #ifdef WITH_ASPELL
265 puts("Compiled with Aspell support.");
266 #endif
267 #ifdef DEBUG_ENABLE
268 puts("Compiled with debugging support.");
269 #endif
270 }
271
272 static void main_init_pgp(void)
251 { 273 {
252 #ifdef HAVE_GPGME 274 #ifdef HAVE_GPGME
253 const char *pk, *pp; 275 const char *pk, *pp;
254 char *typed_passwd = NULL; 276 char *typed_passwd = NULL;
255 char *p; 277 char *p;
316 signal(SIGCHLD, sig_handler); 338 signal(SIGCHLD, sig_handler);
317 signal(SIGPIPE, SIG_IGN); 339 signal(SIGPIPE, SIG_IGN);
318 340
319 /* Parse command line options */ 341 /* Parse command line options */
320 while (1) { 342 while (1) {
321 int c = getopt(argc, argv, "hf:"); 343 int c = getopt(argc, argv, "hvf:");
322 if (c == -1) { 344 if (c == -1) {
323 break; 345 break;
324 } else 346 } else
325 switch (c) { 347 switch (c) {
326 case 'h': 348 case 'h':
327 case '?': 349 case '?':
328 printf("Usage: %s [-f mcabberrc_file]\n\n", argv[0]); 350 printf("Usage: %s [-h|-v|-f mcabberrc_file]\n\n", argv[0]);
329 return (c == 'h' ? 0 : -1); 351 return (c == 'h' ? 0 : -1);
352 case 'v':
353 compile_options();
354 return 0;
330 case 'f': 355 case 'f':
331 configFile = g_strdup(optarg); 356 configFile = g_strdup(optarg);
332 break; 357 break;
333 } 358 }
334 } 359 }
335 360
336 if (optind < argc) { 361 if (optind < argc) {
337 fprintf(stderr, "Usage: %s [-f mcabberrc_file]\n\n", argv[0]); 362 fprintf(stderr, "Usage: %s [-h|-v|-f mcabberrc_file]\n\n", argv[0]);
338 return -1; 363 return -1;
339 } 364 }
340 365
341 /* Initialize command system, roster and default key bindings */ 366 /* Initialize command system, roster and default key bindings */
342 cmd_init(); 367 cmd_init();