comparison pidgin/win32/winpidgin.c @ 28616:0506033e8d7c

Patch from Johnson Earls to improve the win32 launcher detection of whether we need to setup the console for stdout. Fixes #10182
author Daniel Atallah <daniel.atallah@gmail.com>
date Thu, 10 Sep 2009 04:11:02 +0000
parents f0874c392052
children 3f33a8fbf871
comparison
equal deleted inserted replaced
28615:4cb882afbd6f 28616:0506033e8d7c
624 int i; 624 int i;
625 BOOL debug = FALSE, help = FALSE, version = FALSE, multiple = FALSE; 625 BOOL debug = FALSE, help = FALSE, version = FALSE, multiple = FALSE;
626 626
627 /* If debug or help or version flag used, create console for output */ 627 /* If debug or help or version flag used, create console for output */
628 for (i = 1; i < __argc; i++) { 628 for (i = 1; i < __argc; i++) {
629 if (strstr(__argv[i], "-d") || strstr(__argv[i], "--debug")) 629 if (strlen(__argv[i]) > 1 && __argv[i][0] == '-') {
630 debug = TRUE; 630 /* check if we're looking at -- or - option */
631 else if (strstr(__argv[i], "-h") || strstr(__argv[i], "--help")) 631 if (__argv[i][1] == '-') {
632 help = TRUE; 632 if (strstr(__argv[i], "--debug") == __argv[i])
633 else if (strstr(__argv[i], "-v") || strstr(__argv[i], "--version")) 633 debug = TRUE;
634 version = TRUE; 634 else if (strstr(__argv[i], "--help") == __argv[i])
635 else if (strstr(__argv[i], "-m") || strstr(__argv[i], "--multiple")) 635 help = TRUE;
636 multiple = TRUE; 636 else if (strstr(__argv[i], "--version") == __argv[i])
637 version = TRUE;
638 else if (strstr(__argv[i], "--multiple") == __argv[i])
639 multiple = TRUE;
640 } else {
641 if (strchr(__argv[i], 'd'))
642 debug = TRUE;
643 else if (strchr(__argv[i], 'h'))
644 help = TRUE;
645 else if (strchr(__argv[i], 'v'))
646 version = TRUE;
647 else if (strchr(__argv[i], 'm'))
648 multiple = TRUE;
649 }
650 }
637 } 651 }
638 652
639 if (debug || help || version) { 653 if (debug || help || version) {
640 /* If stdout hasn't been redirected to a file, alloc a console 654 /* If stdout hasn't been redirected to a file, alloc a console
641 * (_istty() doesn't work for stuff using the GUI subsystem) */ 655 * (_istty() doesn't work for stuff using the GUI subsystem) */
703 portable_mode = TRUE; 717 portable_mode = TRUE;
704 718
705 /* Remove the --portable-mode arg from the args passed to pidgin so it doesn't choke */ 719 /* Remove the --portable-mode arg from the args passed to pidgin so it doesn't choke */
706 pidgin_argv = malloc(sizeof(char*) * pidgin_argc); 720 pidgin_argv = malloc(sizeof(char*) * pidgin_argc);
707 for (; i < __argc; i++) { 721 for (; i < __argc; i++) {
708 if (strstr(__argv[i], "--portable-mode") == NULL) { 722 if (strstr(__argv[i], "--portable-mode") == NULL)
709 pidgin_argv[c] = __argv[i]; 723 pidgin_argv[c++] = __argv[i];
710 c++; 724 else
711 } else
712 pidgin_argc--; 725 pidgin_argc--;
713 } 726 }
714 } 727 }
715 728
716 if (portable_mode) 729 if (portable_mode)