Luna/apps/src/sym.c

38 lines
547 B
C

#include <stdio.h>
#include <string.h>
#include <unistd.h>
int main()
{
sleep(2);
FILE* syms = fopen("/sys/moon.sym", "r");
if (!syms)
{
perror("fopen");
return 1;
}
char buf[1200];
if (fseek(syms, -1199, SEEK_END) < 0)
{
perror("fseek");
return 1;
}
size_t nread = fread(buf, 1199, 1, syms);
if (ferror(syms))
{
perror("fread");
return 1;
}
buf[nread] = 0;
printf("%s\n", strchr(buf, '\n') + 1);
fclose(syms);
return 0;
}