pidgin/win32/winpidgin.c

changeset 24795
48d838a2e580
parent 24433
a5213aeff14c
child 26999
59b2a8e21382
equal deleted inserted replaced
24794:1f4f77e2e111 24795:48d838a2e580
619 char exe_name[MAX_PATH]; 619 char exe_name[MAX_PATH];
620 HMODULE hmod; 620 HMODULE hmod;
621 char *tmp; 621 char *tmp;
622 int pidgin_argc = __argc; 622 int pidgin_argc = __argc;
623 char **pidgin_argv = __argv; 623 char **pidgin_argv = __argv;
624 int i;
625 BOOL debug = FALSE, help = FALSE, version = FALSE, multiple = FALSE;
624 626
625 /* 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 */
626 if (strstr(lpszCmdLine, "-d") || strstr(lpszCmdLine, "-h") || strstr(lpszCmdLine, "-v")) { 628 for (i = 1; i < __argc; i++) {
629 if (strstr(__argv[i], "-d") || strstr(__argv[i], "--debug"))
630 debug = TRUE;
631 else if (strstr(__argv[i], "-h") || strstr(__argv[i], "--help"))
632 help = TRUE;
633 else if (strstr(__argv[i], "-v") || strstr(__argv[i], "--version"))
634 version = TRUE;
635 else if (strstr(__argv[i], "-m") || strstr(__argv[i], "--multiple"))
636 multiple = TRUE;
637 }
638
639 if (debug || help || version) {
627 /* If stdout hasn't been redirected to a file, alloc a console 640 /* If stdout hasn't been redirected to a file, alloc a console
628 * (_istty() doesn't work for stuff using the GUI subsystem) */ 641 * (_istty() doesn't work for stuff using the GUI subsystem) */
629 if (_fileno(stdout) == -1 || _fileno(stdout) == -2) { 642 if (_fileno(stdout) == -1 || _fileno(stdout) == -2) {
630 LPFNATTACHCONSOLE MyAttachConsole = NULL; 643 LPFNATTACHCONSOLE MyAttachConsole = NULL;
631 if ((hmod = GetModuleHandle("kernel32.dll"))) { 644 if ((hmod = GetModuleHandle("kernel32.dll"))) {
708 winpidgin_set_locale(); 721 winpidgin_set_locale();
709 722
710 winpidgin_add_stuff_to_path(); 723 winpidgin_add_stuff_to_path();
711 724
712 /* If help, version or multiple flag used, do not check Mutex */ 725 /* If help, version or multiple flag used, do not check Mutex */
713 if (!strstr(lpszCmdLine, "-h") && !strstr(lpszCmdLine, "-v")) 726 if (!help && !version)
714 if (!winpidgin_set_running(getenv("PIDGIN_MULTI_INST") == NULL && strstr(lpszCmdLine, "-m") == NULL)) 727 if (!winpidgin_set_running(getenv("PIDGIN_MULTI_INST") == NULL && !multiple))
715 return 0; 728 return 0;
716 729
717 /* Now we are ready for Pidgin .. */ 730 /* Now we are ready for Pidgin .. */
718 if ((hmod = LoadLibrary("pidgin.dll"))) 731 if ((hmod = LoadLibrary("pidgin.dll")))
719 pidgin_main = (LPFNPIDGINMAIN) GetProcAddress(hmod, "pidgin_main"); 732 pidgin_main = (LPFNPIDGINMAIN) GetProcAddress(hmod, "pidgin_main");

mercurial