/* +------------------------------------+
* | Inspire Internet Relay Chat Daemon |
* +------------------------------------+
*
* InspIRCd: (C) 2002-2007 InspIRCd Development Team
* See: http://www.inspircd.org/wiki/index.php/Credits
*
* This program is free but copyrighted software; see
* the file COPYING for details.
*
* ---------------------------------------------------
*/#define _CRT_SECURE_NO_DEPRECATE#include<windows.h>#include<stdio.h>#include<string>#include<time.h>#include"colours.h"usingnamespacestd;voidRun();voidBanner();voidWriteCompileModules();voidWriteCompileCommands();/* detects if we are running windows xp or higher (5.1) */booliswinxp(){OSVERSIONINFOvi;vi.dwOSVersionInfoSize=sizeof(OSVERSIONINFO);GetVersionEx(&vi);if(vi.dwMajorVersion>=5)returntrue;returnfalse;}intget_int_option(constchar*text,intdef){staticcharbuffer[500];intret;printf_c("%s\n[\033[1;32m%u\033[0m] -> ",text,def);fgets(buffer,500,stdin);if(sscanf(buffer,"%u",&ret)!=1)ret=def;printf("\n");returnret;}boolget_bool_option(constchar*text,booldef){staticcharbuffer[500];charret[100];printf_c("%s [\033[1;32m%c\033[0m] -> ",text,def?'y':'n');fgets(buffer,500,stdin);if(sscanf(buffer,"%s",ret)!=1)strcpy(ret,def?"y":"n");printf("\n");return!strncmp(ret,"y",1);}voidget_string_option(constchar*text,char*def,char*buf){staticcharbuffer[500];printf_c("%s\n[\033[1;32m%s\033[0m] -> ",text,def);fgets(buffer,500,stdin);if(sscanf(buffer,"%s",buf)!=1)strcpy(buf,def);printf("\n");}// escapes a string for use in a c++ file
boolescape_string(char*str,size_tsize){size_tlen=strlen(str);char*d_str=(char*)malloc(len*2);size_ti=0;size_tj=0;for(;i<len;++i){if(str[i]=='\\'){d_str[j++]='\\';d_str[j++]='\\';}else{d_str[j++]=str[i];}}d_str[j++]=0;if(j>size){free(d_str);returnfalse;}strcpy(str,d_str);free(d_str);returntrue;}/* gets the svn revision */intget_svn_revision(char*buffer,size_tlen){/* again.. I am lazy :p cbf to pipe output of svn info to us, so i'll just read the file *//*
8
dir
7033
*/charbuf[1000];FILE*f=fopen("..\\.svn\\entries","r");if(!f)gotobad_rev;if(!fgets(buf,1000,f))gotobad_rev;if(!fgets(buf,1000,f))gotobad_rev;if(!fgets(buf,1000,f))gotobad_rev;if(!fgets(buf,1000,f))gotobad_rev;intrev=atoi(buf);if(rev==0)gotobad_rev;sprintf(buffer,"%u",rev);fclose(f);returnrev;bad_rev:strcpy(buffer,"non-svn");if(f)fclose(f);return0;}int__stdcallWinMain(INHINSTANCEhInstance,INHINSTANCEhPrevInstance,INLPSTRlpCmdLine,INintnShowCmd){FILE*j=fopen("inspircd_config.h","r");if(j){if(MessageBox(0,"inspircd_config.h already exists. Remove it and build from clean?","Configure program",MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2)!=IDYES){fclose(j);exit(0);}}AllocConsole();// pipe standard handles to this console
freopen("CONIN$","r",stdin);freopen("CONOUT$","w",stdout);freopen("CONOUT$","w",stderr);Banner();Run();WriteCompileCommands();WriteCompileModules();FreeConsole();return0;}voidBanner(){printf_c("\nWelcome to the \033[1mInspIRCd\033[0m Configuration program! (\033[1minteractive mode\033[0m)\n""\033[1mPackage maintainers: Type ./configure --help for non-interactive help\033[0m\n\n");printf_c("*** If you are unsure of any of these values, leave it blank for ***\n""*** standard settings that will work, and your server will run ***\n""*** using them. Please consult your IRC network admin if in doubt. ***\n\n""Press \033[1m<RETURN>\033[0m to accept the default for any option, or enter\n""a new value. Please note: You will \033[1mHAVE\033[0m to read the docs\n""dir, otherwise you won't have a config file!\n\n");}voidRu