strcat(config2,"TIMIDITY.CFG",sizeof(config2)-strlen(config2)-1);
strncat(config2,"TIMIDITY.CFG",sizeof(config2)-strlen(config2)-1);
int main(int argc, char **argv)#endif{    int c, err, i;    int nfiles;    char **files;    int main_ret;    int longind;#if defined(DANGEROUS_RENICE) && !defined(__W32__) && !defined(main)    /*     * THIS CODES MUST EXECUT BEGINNING OF MAIN FOR SECURITY.     * DONT PUT ANY CODES ABOVE.     */#include <sys/resource.h>    int uid;#ifdef sun    extern int setpriority(int which, id_t who, int prio);    extern int setreuid(int ruid, int euid);#endif    uid = getuid();    if(setpriority(PRIO_PROCESS, 0, DANGEROUS_RENICE) < 0)    {	perror("setpriority");	fprintf(stderr, "Couldn't set priority to %d.", DANGEROUS_RENICE);    }    setreuid(uid, uid);#endif#if defined(REDIRECT_STDOUT)    memcpy(stdout, fopen(REDIRECT_STDOUT, "a+"), sizeof(FILE));    printf("TiMidity++ start\n");fflush(stdout);#endif#ifdef main    {	static int maincnt = 0;	if(maincnt++ > 0)	{	    argv++;	    argc--;	    while(argv[0][0] == '-') {		argv++;		argc--;	    }	    ctl->pass_playing_list(argc, argv);	    return 0;	}    }#endif#ifdef IA_DYNAMIC    {#ifdef XP_UNIX	argv[0] = "netscape";#endif /* XP_UNIX */	dynamic_interface_id = 0;	dl_init(argc, argv);    }#endif /* IA_DYNAMIC */    if((program_name=pathsep_strrchr(argv[0]))) program_name++;    else program_name=argv[0];    if(strncmp(program_name,"timidity",8) == 0);    else if(strncmp(program_name,"kmidi",5) == 0) set_ctl("q");    else if(strncmp(program_name,"tkmidi",6) == 0) set_ctl("k");    else if(strncmp(program_name,"gtkmidi",6) == 0) set_ctl("g");    else if(strncmp(program_name,"xmmidi",6) == 0) set_ctl("m");    else if(strncmp(program_name,"xawmidi",7) == 0) set_ctl("a");    else if(strncmp(program_name,"xskinmidi",9) == 0) set_ctl("i");    if(argc == 1 && !strchr(INTERACTIVE_INTERFACE_IDS, ctl->id_character))    {	interesting_message();	return 0;    }    timidity_start_initialize();#if defined ( IA_W32GUI ) || defined ( IA_W32G_SYN )    if(CoInitialize(NULL)==S_OK)      CoInitializeOK = 1;    w32g_initialize();#ifdef IA_W32GUI	/* Secondary TiMidity Execute */	/*	FirstLoadIniFile(); */	if(w32gSecondTiMidity(SecondMode,argc,argv)==FALSE){		return 0;	}#endif#endif    for(c = 1; c < argc; c++)    {	if(directory_p(argv[c]))	{	    char *p;	    p = (char *)safe_malloc(strlen(argv[c]) + 2);	    strcpy(p, argv[c]);	    canonicalize_path(p);	    argv[c] = p;	}    }    if((err = timidity_pre_load_configuration()) != 0)	return err;    optind = longind = 0;    while ((c = getopt_long(argc, argv, optcommands, longopts, &longind)) > 0)	if ((err = set_tim_opt_long(c, optarg, longind)) != 0)	    break;    err += timidity_post_load_configuration();    /* If there were problems, give up now */    if(err || (optind >= argc &&	       !strchr(INTERACTIVE_INTERFACE_IDS, ctl->id_character)))    {	if(!got_a_configuration)	{#ifdef __W32__	    char config1[1024];	    char config2[1024];	    memset(config1, 0, sizeof(config1));	    memset(config2, 0, sizeof(config2));#if defined ( IA_W32GUI ) || defined ( IA_W32G_SYN )	    {		extern char *ConfigFile;		strncpy(config1, ConfigFile, sizeof(config1) - 1);	    }#else	    /* !IA_W32GUI */	    GetWindowsDirectory(config1, 1023 - 13);	    strcat(config1, "\\TIMIDITY.CFG");#endif	    if(GetModuleFileName(NULL, config2, 1023))	    {		char *strp;		config2[1023] = '\0';		if(strp = strrchr(config2, '\\'))		{		    *(++strp)='\0';		    strcat(config2,"TIMIDITY.CFG",sizeof(config2)-strlen(config2)-1);		}	    }	    ctl->cmsg(CMSG_FATAL, VERB_NORMAL,		      "%s: Can't read any configuration file.\nPlease check "		      "%s or %s", program_name, config1, config2);#else	    ctl->cmsg(CMSG_FATAL, VERB_NORMAL,		      "%s: Can't read any configuration file.\nPlease check "		      CONFIG_FILE, program_name);#endif /* __W32__ */	}	else	{	    ctl->cmsg(CMSG_ERROR, VERB_NORMAL,		      "Try %s -h for help", program_name);	}#if !defined ( IA_W32GUI ) && !defined ( IA_W32G_SYN ) /* Try to continue if it is Windows version */	return 1; /* problems with command line */#endif    }    timidity_init_player();    nfiles = argc - optind;    files  = argv + optind;    if(nfiles > 0 && ctl->id_character != 'r' && ctl->id_character != 'A' && ctl->id_character != 'W' && ctl->id_character != 'P')	files = expand_file_archives(files, &nfiles);    if(dumb_error_count)	sleep(1);#ifndef IA_W32GUI    main_ret = timidity_play_main(nfiles, files);#ifdef IA_W32G_SYN    if(CoInitializeOK)      CoUninitialize();#endif /* IA_W32G_SYN */#else	w32gLoadDefaultPlaylist();    main_ret = timidity_play_main(nfiles, files);	if(save_playlist_once_before_exit_flag) {		save_playlist_once_before_exit_flag = 0;		w32gSaveDefaultPlaylist();	}    w32gSecondTiMidityExit();    if(CoInitializeOK)      CoUninitialize();#endif /* IA_W32GUI */    free_instruments(0);    free_global_mblock();    free_all_midi_file_info();	free_userdrum();	free_userinst();    tmdy_free_config();	free_effect_buffers();	for (i = 0; i < MAX_CHANNELS; i++) {free_drum_effect(i);}    return main_ret;}