mirror of
https://dev.iopsys.eu/bbf/icwmp.git
synced 2026-03-11 03:28:31 +01:00
deviceinfo: get value of the devicelog param
This commit is contained in:
parent
b9f05ce88c
commit
f3798c76e2
1 changed files with 14 additions and 1 deletions
|
|
@ -133,7 +133,20 @@ int get_device_info_uptime(char *refparam, struct dmctx *ctx, char **value)
|
|||
|
||||
int get_device_devicelog (char *refparam, struct dmctx *ctx, char **value)
|
||||
{
|
||||
*value = dmstrdup("TOCODE"); //TODO
|
||||
*value = "";
|
||||
char buff[1024];
|
||||
int len = klogctl(3 , buff, 1024); /* read ring buffer */
|
||||
if (len <= 0)
|
||||
return 0;
|
||||
buff[len] = '\0';
|
||||
char *p = buff;
|
||||
while (*p++) { //TODO to optimize, we can avoid this if the '<' and '>' does not cause problem in the tests.
|
||||
if (*p == '<')
|
||||
*p = '(';
|
||||
else if (*p == '>')
|
||||
*p = ')';
|
||||
}
|
||||
*value = dmstrdup(buff); // MEM WILL BE FREED IN DMMEMCLEAN
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue