Implement 'sicslog' command for driver logging

This commit is contained in:
Douglas Clowes
2014-04-23 16:26:18 +10:00
parent 0e0fd86da0
commit a557cf577a
4 changed files with 99 additions and 2 deletions

View File

@@ -82,7 +82,7 @@ static pCaptureEntry pCapture = NULL;
/*------------------------------------------------------------------------*/
#include "outcode.c" /* for pCode */
static char* OutCodeToTxt(OutCode eOut)
const char* OutCodeToTxt(OutCode eOut)
{
switch (eOut) {
case eInternal: return "Int"; /* internal */
@@ -104,10 +104,45 @@ static char* OutCodeToTxt(OutCode eOut)
return "???";
}
const char* OutCodeToText(OutCode eOut)
{
switch (eOut) {
case eInternal: return "Internal";
case eCommand: return "Command";
case eHWError: return "HWError";
case eInError: return "InError";
case eStatus: return "Status";
case eValue: return "Value";
case eStart: return "Start";
case eFinish: return "Finish";
case eEvent: return "Event";
case eWarning: return "Warning";
case eError: return "Error";
case eHdbValue: return "HdbValue";
case eHdbEvent: return "HdbEvent";
case eLog: return "Log";
case eLogError: return "LogError";
}
return "Unknown";
}
int OutCodeFromText(const char *text, OutCode *outcode)
{
int i;
for (i = 0; i < iNoCodes; ++i) {
if (strcasecmp(text, pCode[i]) == 0) {
if (outcode)
*outcode = i;
return i;
}
}
return -1;
}
static unsigned int find_code_bits(const char *p1, const char *p2) {
/* must be outcode, try find it */
int i;
int len = p2 - p1;
size_t len = p2 - p1;
if (len == 3 && strncasecmp(p1, "all", 3))
return ~0;
for (i = 0; i < iNoCodes; ++i) {