]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Allow relative paths for motd and rules (and anything that uses ReadFile)
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Fri, 27 Oct 2006 07:03:08 +0000 (07:03 +0000)
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Fri, 27 Oct 2006 07:03:08 +0000 (07:03 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5546 e03df62e-2008-0410-955e-edbf42e46eb7

src/configreader.cpp
src/modules/m_check.cpp

index 1059770b456aa6bc7410e49a22126c4abfd273d2..e0e249963f8ed55fb27d2d8d0bbb64d39ddfb3d6 100644 (file)
@@ -1271,7 +1271,21 @@ bool ServerConfig::ReadFile(file_cache &F, const char* fname)
        char linebuf[MAXBUF];
 
        F.clear();
-       file =  fopen(fname, "r");
+       
+       if (*fname != '/')
+       {
+               std::string::size_type pos;
+               std::string confpath = CONFIG_FILE;
+               if((pos = confpath.find("/inspircd.conf")) != std::string::npos)
+               {
+                       /* Leaves us with just the path */
+                       std::string newfile = confpath.substr(0, pos) + std::string("/") + newfile;
+                       file =  fopen(newfile.c_str(), "r");
+                       
+               }
+       }
+       else
+               file =  fopen(fname, "r");
 
        if (file)
        {
index 6a4bcc84f82f3ad46cccf483e4f7ac46ce9b6955..3a8b8dd92f1b53c53f2dffed8d45ee5997358cfb 100644 (file)
@@ -123,7 +123,7 @@ class cmd_check : public command_t
                                /*
                                 * Unlike Asuka, I define a clone as coming from the same host. --w00t
                                 */
-                               snprintf(tmpbuf, MAXBUF, "%d    %s%s (%s@%s) %s ", i->second->GlobalCloneCount(), targchan->GetAllPrefixChars(i->second), i->second->nick, i->second->ident, i->second->dhost, i->second->fullname);
+                               snprintf(tmpbuf, MAXBUF, "%lu    %s%s (%s@%s) %s ", i->second->GlobalCloneCount(), targchan->GetAllPrefixChars(i->second), i->second->nick, i->second->ident, i->second->dhost, i->second->fullname);
                                user->WriteServ(checkstr + " member " + tmpbuf);
                        }
                }