From owner-freebsd-hackers@FreeBSD.ORG Thu Oct 13 12:52:03 2005 Return-Path: X-Original-To: hackers@freebsd.org Delivered-To: freebsd-hackers@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4384316A41F for ; Thu, 13 Oct 2005 12:52:03 +0000 (GMT) (envelope-from ringworm01@gmail.com) Received: from qproxy.gmail.com (qproxy.gmail.com [72.14.204.194]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9392543D8E for ; Thu, 13 Oct 2005 12:51:59 +0000 (GMT) (envelope-from ringworm01@gmail.com) Received: by qproxy.gmail.com with SMTP id e34so98098qbe for ; Thu, 13 Oct 2005 05:51:58 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:from:to:subject:date:user-agent:references:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:message-id; b=YmouQhAE2W/XVLjAc2ZZRHk+7WzC2zRnTloGT+zcnLRG7sRi2qJ8RbvhPTxV6SDrV3CXOrlXoMu3DsErSwUfpc/sCCsebyxhsLpOsW3i8EUabHPt6mURQjOGv66O4H/MnxrKdw8QNApdVN5HZg9YnhI+ygrQjFw5crk8jxobmJQ= Received: by 10.64.183.5 with SMTP id g5mr1033572qbf; Thu, 13 Oct 2005 05:51:58 -0700 (PDT) Received: from ?192.168.1.10? ( [71.102.45.234]) by mx.gmail.com with ESMTP id e10sm4457461qbe.2005.10.13.05.51.57; Thu, 13 Oct 2005 05:51:58 -0700 (PDT) From: "Michael C. Shultz" To: Sergey Matveychuk , "Mark J. Sommer" , hackers@freebsd.org Date: Thu, 13 Oct 2005 05:53:48 -0700 User-Agent: KMail/1.8.2 References: <200510122033.j9CKX5uo040708@argotsoft.com> <200510121515.14805.ringworm01@gmail.com> <434E46FB.1090800@FreeBSD.org> In-Reply-To: <434E46FB.1090800@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200510130553.49557.ringworm01@gmail.com> Cc: Subject: Re: portmanager X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Oct 2005 12:52:03 -0000 On Thursday 13 October 2005 04:37, you wrote: > Michael C. Shultz wrote: > > if ( getenv("TERM") ) > > { > > . . . > > } > > Anyway you should use code like that for the cases: > char *term; > term = getenv("TERM"); > > And check the variable afterwards. It much better than call getenv() twice. > And the first condition would be: > if( term && !strncmp( term, "xterm", 5 ) && isatty(fileno(stdout)) ) > > And some people not recomend use '!' with str[n]cmp(). Using '== 0' is > better. > > It was someting about a code style. Thanks for the good advice! I'll clean it up for the next change. -Mike