From owner-freebsd-ports@FreeBSD.ORG Sun May 26 22:43:24 2013 Return-Path: Delivered-To: freebsd-ports@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 84D052BA for ; Sun, 26 May 2013 22:43:24 +0000 (UTC) (envelope-from erichsfreebsdlist@alogt.com) Received: from alogt.com (alogt.com [69.36.191.58]) by mx1.freebsd.org (Postfix) with ESMTP id 563D186 for ; Sun, 26 May 2013 22:43:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=alogt.com; s=default; h=Content-Transfer-Encoding:Content-Type:Mime-Version:References:In-Reply-To:Message-ID:Subject:To:From:Date; bh=x+1PqO2rW5C873SP0+fWtpPGruSnVbZMevm08oLELCA=; b=xrMFG+k71Kk8qn6X5YaEDvCtBpoImOCDcApK+dWYRE56e/RreUdBposMuCtXa543mC4COr2enb51rTXTebmof71I8FuUNxb+DGE/LP/QPNGTNK5Q8f82Jh4gu6Rh7zVK5n+RyMd9jOzkF9iFswHs+w2BsC1KB/Tjf04GwAeVtSA=; Received: from [122.129.203.50] (port=50413 helo=X220.ovitrap.com) by sl-508-2.slc.westdc.net with esmtpsa (SSLv3:DHE-RSA-AES128-SHA:128) (Exim 4.80) (envelope-from ) id 1Ugjes-0039o4-0D for freebsd-ports@freebsd.org; Sun, 26 May 2013 16:43:22 -0600 Date: Mon, 27 May 2013 05:43:13 +0700 From: Erich Dollansky To: freebsd-ports@freebsd.org Subject: Re: Proper way to access executable's "environment"? Message-ID: <20130527054313.372869c1@X220.ovitrap.com> In-Reply-To: <20130526172015.GA1334@albert.catwhisker.org> References: <20130526172015.GA1334@albert.catwhisker.org> X-Mailer: Claws Mail 3.9.0 (GTK+ 2.24.6; amd64-portbld-freebsd10.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - sl-508-2.slc.westdc.net X-AntiAbuse: Original Domain - freebsd.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - alogt.com X-Get-Message-Sender-Via: sl-508-2.slc.westdc.net: authenticated_id: erichsfreebsdlist@alogt.com X-Source: X-Source-Args: X-Source-Dir: X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 May 2013 22:43:24 -0000 Hi, On Sun, 26 May 2013 10:20:15 -0700 David Wolfskill wrote: > So I started looking at code that I had reason to expect would do this > correctly -- src/usr.bin/env/env.c, for starters -- and saw that while > piewm's twm.c declares main as: > > int > main(int argc, char **argv, char **environ) > { I use this concept since decades but with different names. Could it be a problem of overlapping names? > ... > > and proceeds to use environ as a pointer to a NULL-terminated list > of strings, env.c declares: > > extern char **environ; The advantage would be - and also the disadvantage - that every piece of the code could have access to the environment. That's why I moved away from it. Erich