admin file parser now reports line numbers for individual errors
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401438
This commit is contained in:
parent
6617ef3ad8
commit
8d6138fba9
@ -49,6 +49,7 @@ public Plugin:myinfo =
|
||||
new bool:g_LoggedFileName = false; /* Whether or not the file name has been logged */
|
||||
new g_ErrorCount = 0; /* Current error count */
|
||||
new g_IgnoreLevel = 0; /* Nested ignored section count, so users can screw up files safely */
|
||||
new g_CurrentLine = 0; /* Current line we're on */
|
||||
new String:g_Filename[PLATFORM_MAX_PATH]; /* Used for error messages */
|
||||
|
||||
#include "admin-overrides.sp"
|
||||
@ -81,12 +82,15 @@ ParseError(const String:format[], {Handle,String,Float,_}:...)
|
||||
|
||||
VFormat(buffer, sizeof(buffer), format, 2);
|
||||
|
||||
LogError(" (%d) %s", ++g_ErrorCount, buffer);
|
||||
LogError(" (line %d) %s", g_CurrentLine, buffer);
|
||||
|
||||
g_ErrorCount++;
|
||||
}
|
||||
|
||||
InitGlobalStates()
|
||||
{
|
||||
g_ErrorCount = 0;
|
||||
g_IgnoreLevel = 0;
|
||||
g_CurrentLine = 0;
|
||||
g_LoggedFileName = false;
|
||||
}
|
||||
|
@ -187,6 +187,13 @@ public SMCResult:ReadGroups_EndSection(Handle:smc)
|
||||
return SMCParse_Continue;
|
||||
}
|
||||
|
||||
public SMCResult:ReadGroups_CurrentLine(Handle:smc, const String:line[], lineno)
|
||||
{
|
||||
g_CurrentLine = lineno;
|
||||
|
||||
return SMCParse_Continue;
|
||||
}
|
||||
|
||||
static InitializeGroupParser()
|
||||
{
|
||||
if (g_hGroupParser == INVALID_HANDLE)
|
||||
@ -196,6 +203,7 @@ static InitializeGroupParser()
|
||||
ReadGroups_NewSection,
|
||||
ReadGroups_KeyValue,
|
||||
ReadGroups_EndSection);
|
||||
SMC_SetRawLine(g_hGroupParser, ReadGroups_CurrentLine);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -155,6 +155,13 @@ public SMCResult:ReadNewOverrides_EndSection(Handle:smc)
|
||||
return SMCParse_Continue;
|
||||
}
|
||||
|
||||
public SMCResult:ReadOverrides_CurrentLine(Handle:smc, const String:line[], lineno)
|
||||
{
|
||||
g_CurrentLine = lineno;
|
||||
|
||||
return SMCParse_Continue;
|
||||
}
|
||||
|
||||
static InitializeOverrideParsers()
|
||||
{
|
||||
if (g_hOldOverrideParser == INVALID_HANDLE)
|
||||
@ -164,6 +171,7 @@ static InitializeOverrideParsers()
|
||||
ReadOldOverrides_NewSection,
|
||||
ReadOverrides_KeyValue,
|
||||
ReadOldOverrides_EndSection);
|
||||
SMC_SetRawLine(g_hOldOverrideParser, ReadOverrides_CurrentLine);
|
||||
}
|
||||
if (g_hNewOverrideParser == INVALID_HANDLE)
|
||||
{
|
||||
@ -172,6 +180,7 @@ static InitializeOverrideParsers()
|
||||
ReadNewOverrides_NewSection,
|
||||
ReadOverrides_KeyValue,
|
||||
ReadNewOverrides_EndSection);
|
||||
SMC_SetRawLine(g_hNewOverrideParser, ReadOverrides_CurrentLine);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -162,6 +162,13 @@ public SMCResult:ReadUsers_EndSection(Handle:smc)
|
||||
return SMCParse_Continue;
|
||||
}
|
||||
|
||||
public SMCResult:ReadUsers_CurrentLine(Handle:smc, const String:line[], lineno)
|
||||
{
|
||||
g_CurrentLine = lineno;
|
||||
|
||||
return SMCParse_Continue;
|
||||
}
|
||||
|
||||
static InitializeUserParser()
|
||||
{
|
||||
if (g_hUserParser == INVALID_HANDLE)
|
||||
@ -171,6 +178,7 @@ static InitializeUserParser()
|
||||
ReadUsers_NewSection,
|
||||
ReadUsers_KeyValue,
|
||||
ReadUsers_EndSection);
|
||||
SMC_SetRawLine(g_hUserParser, ReadUsers_CurrentLine);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user