1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-27 20:44:56 +00:00

weather: lets make this compliant to prehistoric standards and at the same time working ...

This commit is contained in:
Cesare Tirabassi 2009-07-07 18:08:54 +02:00
parent ce9d9e3298
commit 18ecbef1ae

View File

@ -2801,13 +2801,15 @@ static struct text_object *construct_text_object(const char *s,
char *icao = (char *) malloc(5 * sizeof(char)); char *icao = (char *) malloc(5 * sizeof(char));
char *uri = (char *) malloc(128 * sizeof(char)); char *uri = (char *) malloc(128 * sizeof(char));
char *data_type = (char *) malloc(32 * sizeof(char)); char *data_type = (char *) malloc(32 * sizeof(char));
char *tmp_p;
argc = sscanf(arg, "%4s %31s %d", icao, data_type, &delay); argc = sscanf(arg, "%4s %31s %d", icao, data_type, &delay);
//icao MUST BE upper-case //icao MUST BE upper-case
while (*icao) { tmp_p = icao;
*icao = toupper(*icao); while (*tmp_p) {
icao++; *tmp_p = toupper(*tmp_p);
tmp_p++;
} }
strcpy(uri, "http://weather.noaa.gov/pub/data/observations/metar/stations/"); strcpy(uri, "http://weather.noaa.gov/pub/data/observations/metar/stations/");
@ -4638,6 +4640,7 @@ static void generate_text_internal(char *p, int p_max_size,
#ifdef WEATHER #ifdef WEATHER
OBJ(weather) { OBJ(weather) {
PWEATHER *data = get_weather_info(obj->data.weather.uri, obj->data.weather.delay); PWEATHER *data = get_weather_info(obj->data.weather.uri, obj->data.weather.delay);
static const char *wc[18] = static const char *wc[18] =
{"", "drizzle", "rain", "hail", "soft hail", {"", "drizzle", "rain", "hail", "soft hail",
"snow", "snow grains", "fog", "haze", "smoke", "snow", "snow grains", "fog", "haze", "smoke",