cputnik: use %lld instead of %Ld when getting meminfo

This commit is contained in:
snow 2020-05-30 20:06:38 -07:00
parent ea844727f7
commit 1b475f8666
2 changed files with 7 additions and 5 deletions

View file

@ -1,7 +1,7 @@
CFLAGS = -Wall -Os
INCS = -I/usr/X11R6/include/X11
LIBS = -L/usr/X11R6/lib -lXpm -lXext -lX11
INCS = -I/usr/X11R7/include/
LIBS = -L/usr/X11R7/lib -lXpm -lXext -lX11 -R/usr/X11R7/lib
INSTALL_PREFIX = /usr/local

View file

@ -41,15 +41,17 @@ char temp[BUFFER_SIZE];
while(fscanf(fp_memory, "%s", temp)!=EOF) {
if(!strncmp(temp,"MemTotal:", 9))
fscanf(fp_memory, "%Ld", &m_total);
fscanf(fp_memory, "%lld", &m_total);
if(!strncmp(temp,"MemFree:", 8))
fscanf(fp_memory, "%Ld", &m_free);
fscanf(fp_memory, "%lld", &m_free);
if(!strncmp(temp,"Cached:", 7))
fscanf(fp_memory, "%Ld", &m_cached);
fscanf(fp_memory, "%lld", &m_cached);
}
printf("m_total: %ld, m_free: %ld, m_cached: %ld\n", m_total, m_free, m_cached);
*free = (int)(((float)(m_total - m_free - m_cached) / m_total) * 100.0);
}