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