From enlightenment-cvs-bounces@lists.sourceforge.net  Wed Aug 13 01:29:50 2008
Return-Path: <enlightenment-cvs-bounces@lists.sourceforge.net>
X-Original-To: enlightenment-cvs@e.kevb.net
Delivered-To: enlightenment-cvs@e.kevb.net
Received: from lists-outbound.sourceforge.net (lists-outbound.sourceforge.net [66.35.250.225])
	by e.kevb.net (Postfix) with ESMTP id B6F19EC8014
	for <enlightenment-cvs@e.kevb.net>; Wed, 13 Aug 2008 01:29:49 -0400 (EDT)
Received: from sc8-sf-list1-new.sourceforge.net (sc8-sf-list1-new-b.sourceforge.net [10.3.1.93])
	by sc8-sf-spam2.sourceforge.net (Postfix) with ESMTP
	id 67976FCAD; Tue, 12 Aug 2008 22:29:48 -0700 (PDT)
Received: from sc8-sf-mx2-b.sourceforge.net ([10.3.1.92]
	helo=mail.sourceforge.net)
	by sc8-sf-list1-new.sourceforge.net with esmtp (Exim 4.43)
	id 1KT8vb-00028d-9b for enlightenment-cvs@lists.sourceforge.net;
	Tue, 12 Aug 2008 22:29:47 -0700
Received: from [69.72.137.146] (helo=cvs.caoslinux.org)
	by mail.sourceforge.net with esmtp (Exim 4.44) id 1KT8vZ-0007QE-US
	for enlightenment-cvs@lists.sourceforge.net;
	Tue, 12 Aug 2008 22:29:47 -0700
Received: by cvs.caoslinux.org (Postfix, from userid 30052)
	id C4C1FA30A2; Wed, 13 Aug 2008 01:29:43 -0400 (EDT)
To: enlightenment-cvs@lists.sourceforge.net
Subject: E CVS: weather englebass
From: Enlightenment CVS <noreply@cvs.enlightenment.org>
Message-Id: <20080813052943.C4C1FA30A2@cvs.caoslinux.org>
Date: Wed, 13 Aug 2008 01:29:43 -0400 (EDT)
X-Spam-Score: 0.0 (/)
X-Spam-Report: Spam Filtering performed by sourceforge.net.
	See http://spamassassin.org/tag/ for more details.
	Report problems to
	http://sf.net/tracker/?func=add&group_id=1&atid=200001
X-BeenThere: enlightenment-cvs@lists.sourceforge.net
X-Mailman-Version: 2.1.8
Precedence: list
Reply-To: enlightenment-devel@lists.sourceforge.net
List-Id: CVS commits list for the Enlightenment project
	<enlightenment-cvs.lists.sourceforge.net>
List-Unsubscribe: <https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs>,
	<mailto:enlightenment-cvs-request@lists.sourceforge.net?subject=unsubscribe>
List-Archive: <http://sourceforge.net/mailarchive/forum.php?forum_name=enlightenment-cvs>
List-Post: <mailto:enlightenment-cvs@lists.sourceforge.net>
List-Help: <mailto:enlightenment-cvs-request@lists.sourceforge.net?subject=help>
List-Subscribe: <https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs>,
	<mailto:enlightenment-cvs-request@lists.sourceforge.net?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: enlightenment-cvs-bounces@lists.sourceforge.net
Errors-To: enlightenment-cvs-bounces@lists.sourceforge.net

Enlightenment CVS committal

Author  : englebass
Project : e_modules
Module  : weather

Dir     : e_modules/weather


Modified Files:
	e_mod_main.c 


Log Message:
Better check for missing http_proxy env.

===================================================================
RCS file: /cvs/e/e_modules/weather/e_mod_main.c,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -3 -r1.63 -r1.64
--- e_mod_main.c	18 May 2008 16:24:43 -0000	1.63
+++ e_mod_main.c	13 Aug 2008 05:29:43 -0000	1.64
@@ -57,7 +57,9 @@
 {
    const char *host;
    int port;
-} proxy; 
+} proxy = {
+   NULL, 0
+}; 
 
 /* Module Function Protos */
 static void _weather_cb_mouse_down (void *data, Evas * e, Evas_Object * obj,
@@ -442,31 +444,36 @@
 static void
 _weather_get_proxy (void)
 {
-  char env[128];
+  char *env;
 
-  snprintf (env, sizeof (env), "%s", getenv ("http_proxy"));
-  if (!env[0]) snprintf (env, sizeof (env), "%s", getenv ("HTTP_PROXY"));
+  env = getenv ("http_proxy");
+  if ((!env) || (!*env)) env = getenv ("HTTP_PROXY");
+  if ((!env) || (!*env)) return;
   if (strncmp (env, "http://", 7)) return;
 
   char *host = NULL;
   char *p;
   int port = 0;
 
+  env = strdup(env);
   host = strchr (env, ':');
   host += 3;
   p = strchr (host, ':');
   if (p)
-	{
-	  *p = 0;
-	  p++;
-	  if (sscanf (p, "%d", &port) != 1)
-	    port = 0;
-	}
+    {
+      *p = 0;
+      p++;
+      if (sscanf (p, "%d", &port) != 1)
+          port = 0;
+    }
+  // FIXME: A proxy doesn't necessarily need a port
   if ((host) && (port))
-	{
-	  proxy.host = evas_stringshare_add (host);
-	  proxy.port = port;
-	}
+    {
+      if (proxy.host) evas_stringshare_del(proxy.host);
+      proxy.host = evas_stringshare_add (host);
+      proxy.port = port;
+    }
+  free(env);
 }
 
 static int



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs
