diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2005-12-13 22:21:33 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2005-12-13 22:21:33 +0000 |
commit | 0cd941ed304ebc793916d58f49ab6032f68257e7 (patch) | |
tree | c487b0023c778a168af6b882318258b81a7de5f1 /src | |
parent | ff3f693c894d2a7f689d3f85f5aa0efa47135df4 (diff) |
De-messified GetRevision
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2383 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r-- | src/inspircd.cpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 6d664389d..042cad1a7 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -215,14 +215,19 @@ void DeleteOper(userrec* user) std::string GetRevision() { - char Revision[] = "$Revision$"; - char *s1 = Revision; - char *savept; - char *v2 = strtok_r(s1," ",&savept); - s1 = savept; - v2 = strtok_r(s1," ",&savept); - s1 = savept; - return std::string(v2); + /* w00t got me to replace a bunch of strtok_r + * with something nicer, so i did this. Its the + * same thing really, only in C++. It places the + * text into a std::stringstream which is a readable + * and writeable buffer stream, and then pops two + * words off it, space delimited. Because it reads + * into the same variable twice, the first word + * is discarded, and the second one returned. + */ + std::stringstream Revision("$Revision$"); + std::string single; + Revision >> single >> single; + return single; } |