2 * Copyright (C) 2005-2008 MaNGOS <http://getmangos.com/>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #pragma warning(disable:4996)
24 int main(int argc
, char **argv
)
28 if(argc
>= 1 && argv
[1] )
31 if(path
.size() > 0 && (path
[path
.size()-1]!='/' || path
[path
.size()-1]!='\\'))
35 FILE* EntriesFile
= fopen((path
+".svn/entries").c_str(), "r");
37 EntriesFile
= fopen((path
+"_svn/entries").c_str(), "r");
39 std::ostringstream newData
;
43 newData
<< "#ifndef __SVN_REVISION_H__" << std::endl
;
44 newData
<< "#define __SVN_REVISION_H__" << std::endl
;
45 newData
<< " #define SVN_REVISION \"Unknown\"" << std::endl
;
46 newData
<< " #define SVN_DATE \"Unknown\"" << std::endl
;
47 newData
<< " #define SVN_TIME \"Unknown\""<< std::endl
;
48 newData
<< "#endif // __SVN_REVISION_H__" << std::endl
;
57 fgets(buf
,200,EntriesFile
);
58 fgets(buf
,200,EntriesFile
);
59 fgets(buf
,200,EntriesFile
);
60 fscanf(EntriesFile
,"%i",&revision
);
61 fgets(buf
,200,EntriesFile
);
62 fgets(buf
,200,EntriesFile
);
63 fgets(buf
,200,EntriesFile
);
64 fgets(buf
,200,EntriesFile
);
65 fgets(buf
,200,EntriesFile
);
66 fscanf(EntriesFile
,"%10sT%8s",date_str
,time_str
);
68 newData
<< "#ifndef __SVN_REVISION_H__" << std::endl
;
69 newData
<< "#define __SVN_REVISION_H__" << std::endl
;
70 newData
<< " #define SVN_REVISION \"" << revision
<< "\"" << std::endl
;
71 newData
<< " #define SVN_DATE \"" << date_str
<< "\"" << std::endl
;
72 newData
<< " #define SVN_TIME \"" << time_str
<< "\""<< std::endl
;
73 newData
<< "#endif // __SVN_REVISION_H__" << std::endl
;
80 if(FILE* HeaderFile
= fopen("svn_revision.h","rb"))
82 while(!feof(HeaderFile
))
84 int c
= fgetc(HeaderFile
);
93 if(newData
.str() != oldData
)
95 if(FILE* OutputFile
= fopen("svn_revision.h","wb"))
97 fprintf(OutputFile
,"%s",newData
.str().c_str());