From 80b49635d9fec0f2402cddbbad79795fa30eec1c Mon Sep 17 00:00:00 2001 From: FlatTV Date: Wed, 15 Aug 2012 11:50:51 +0200 Subject: [PATCH] use curl for localhost --- build.sh | 2 +- http.c | 11 +++++++---- parser.c | 2 ++ tuxwetter.c | 4 ++-- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/build.sh b/build.sh index 023da09..df7b811 100644 --- a/build.sh +++ b/build.sh @@ -1 +1 @@ -arm-cx2450x-linux-gnueabi-gcc -g -o tuxwetter tuxwetter.c gfx.c io.c text.c parser.c php.c http.c jpeg.c fb_display.c resize.c pngw.c gif.c -L$PREFIX/lib -I$PREFIX/include -I$PREFIX/include/freetype2 -I$PREFIX/include/freetype2 -O2 -lfreetype -lz -ljpeg -lpng -lungif gifdecomp.c +arm-cx2450x-linux-gnueabi-gcc -g -o tuxwetter tuxwetter.c gfx.c io.c text.c parser.c php.c http.c jpeg.c fb_display.c resize.c pngw.c gif.c -L$PREFIX/lib -I$PREFIX/include -I$PREFIX/include/freetype2 -O2 -lfreetype -lz -ljpeg -lpng -lgif -DWWEATHER gifdecomp.c diff --git a/http.c b/http.c index 32197fc..a333489 100644 --- a/http.c +++ b/http.c @@ -55,8 +55,10 @@ int HTTP_downloadFile(char *URL, char *downloadTarget, int showprogress, int tmo { CURL *curl; CURLcode res=-1; - char *pt1,*pt2,*pt3=NULL,*tstr=NULL,*surl=URL,myself[25]; - FILE *headerfile,*netfile; + //char *pt1,*pt2,*pt3=NULL,myself[25]; + char *tstr=NULL,*surl=URL; + FILE *headerfile; + //FILE *netfile; int i=strlen(URL),y; for(y=0; y<4; y++) // change HTTP to lower case @@ -76,7 +78,7 @@ int HTTP_downloadFile(char *URL, char *downloadTarget, int showprogress, int tmo curl = curl_easy_init(); if(curl) { - pt1=strstr(URL,"localhost"); +/* pt1=strstr(URL,"localhost"); if(!pt1) { pt1=strstr(URL,"127.0.0.1"); @@ -110,7 +112,7 @@ int HTTP_downloadFile(char *URL, char *downloadTarget, int showprogress, int tmo } } } - speed=tmo; +*/ speed=tmo; while(res && repeats--) { curl_easy_setopt(curl, CURLOPT_URL, surl); @@ -123,6 +125,7 @@ int HTTP_downloadFile(char *URL, char *downloadTarget, int showprogress, int tmo curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, (ctimo)?ctimo:(30+tmo*45)); curl_easy_setopt(curl, CURLOPT_TIMEOUT, (tmo+1)*60); curl_easy_setopt(curl, CURLOPT_FAILONERROR, 0); + curl_easy_setopt(curl, CURLOPT_VERBOSE, 1); if(proxyadress && strstr(URL,"//127.0.0.1/")==NULL && strstr(URL,"//localhost/")==NULL) { curl_easy_setopt(curl, CURLOPT_PROXY, proxyadress); diff --git a/parser.c b/parser.c index cb9b938..7bfe681 100644 --- a/parser.c +++ b/parser.c @@ -373,6 +373,7 @@ int parser(char *citycode, char *trans, int metric, int inet, int ctmo) data[bc][cc] = toupper(gettemp); else data[bc][cc] = gettemp; + //printf("#2 data[%d][%d] = %c(%d)\n",bc,cc,gettemp,gettemp); cc++; d_flag=1; if(cc == MAXMEM-1) rec = 0; @@ -386,6 +387,7 @@ int parser(char *citycode, char *trans, int metric, int inet, int ctmo) if ((gettemp == '<' || gettemp == ']') && d_flag) { data[bc][cc] = '\0'; + //printf("data[%d] = %s\n",bc,data[bc]); bc++; cc = 0; rec = 0; diff --git a/tuxwetter.c b/tuxwetter.c index 19a390b..7f21e75 100644 --- a/tuxwetter.c +++ b/tuxwetter.c @@ -44,7 +44,7 @@ #include "resize.h" #include "gifdecomp.h" -#define P_VERSION "3.03" +#define P_VERSION "3.04" #ifndef HAVE_DREAMBOX_HARDWARE char CONVERT_LIST[]="/var/tuxbox/config/tuxwetter/convert.list"; @@ -1229,7 +1229,7 @@ time_t atime; struct tm *sltime; char tun[2]="C",sun[5]="km/h",dun[3]="km",pun[5]="mbar",cun[20]; - if(var_screeninfo.xres < 800) + if (var_screeninfo.xres < 1280) slim=1; clear_screen(); -- 2.39.5