30 lines
589 B
C
30 lines
589 B
C
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include "enum_functions.h"
|
|
#include "log_trace.h"
|
|
|
|
void enumtostr(char *scode, int code)
|
|
{
|
|
char line[128];
|
|
FILE *fd;
|
|
|
|
snprintf(scode, 10, "%d", code);
|
|
|
|
fd = fopen("/usr/lib/rmps/resources/enum_codes", "r");
|
|
if (fd == NULL) {
|
|
log_trace(ERROR, "Failed to fetch error enum code!");
|
|
return;
|
|
}
|
|
while (fgets(line, sizeof(line), fd) != NULL)
|
|
if (strstr(line, scode) != NULL) {
|
|
sprintf(scode, "%s", line);
|
|
break;
|
|
}
|
|
strncpy( scode,
|
|
memchr(scode, '\"', strlen(scode)),
|
|
strlen(scode) );
|
|
fclose(fd);
|
|
return;
|
|
}
|