Files
dotfiles/slstatus/components/weather.c
T
2024-11-06 00:35:34 +07:00

22 lines
324 B
C

#include <stdio.h>
#include <string.h>
#include "../slstatus.h"
#include "../util.h"
#define WTTR_TEMP "/tmp/wttr"
const char *weather()
{
FILE *wttr = fopen(WTTR_TEMP, "r");
char temp[10];
memset(&temp, '\0', 10);
fgets(temp, 10, wttr);
fclose(wttr);
temp[strlen(temp)-1] = '\0';
return bprintf("%s", temp);
}