From owner-freebsd-hackers@FreeBSD.ORG Thu Oct 13 12:25:35 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 3847516A41F; Thu, 13 Oct 2005 12:25:35 +0000 (GMT) (envelope-from msommer@argotsoft.com) Received: from mx1a.swcp.com (mx1a.swcp.com [216.184.2.64]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5294A43D45; Thu, 13 Oct 2005 12:25:34 +0000 (GMT) (envelope-from msommer@argotsoft.com) Received: from taka.swcp.com (taka-216.swcp.com [216.184.2.3]) by mx1a.swcp.com (8.13.3/8.13.3/Debian-6) with ESMTP id j9DCPX2R003953; Thu, 13 Oct 2005 06:25:33 -0600 Received: from argotsoft.com (argotsoft.com [198.59.115.127]) by taka.swcp.com (8.13.3/8.13.1) with ESMTP id j9DCPT3U038315; Thu, 13 Oct 2005 06:25:31 -0600 (MDT) (envelope-from msommer@argotsoft.com) Received: from ATHABASCA (athabasca.argotsoft.com [192.168.3.104]) by argotsoft.com (8.12.3/8.12.3) with ESMTP id j9DCOvuo004348; Thu, 13 Oct 2005 06:25:01 -0600 (MDT) Message-Id: <200510131225.j9DCOvuo004348@argotsoft.com> From: "Mark J. Sommer" To: "'Sergey Matveychuk'" , "'Michael C. Shultz'" Date: Thu, 13 Oct 2005 06:24:56 -0600 MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook, Build 11.0.5510 In-Reply-To: <434E46FB.1090800@FreeBSD.org> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Thread-Index: AcXP7bRbuy5SHOg5S1Gkfq/NP96TygAA0ByA X-Scanned-By: MIMEDefang 2.9 (www dot roaringpenguin dot com slash mimedefang) X-Virus-Scanned: ClamAV 0.87/1131/Wed Oct 12 14:35:32 2005 on av1 X-Virus-Status: Clean X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on kaimen.swcp.com X-Spam-Status: No, hits=-2.4 required=10.0 tests=ALL_TRUSTED autolearn=failed version=3.0.4 X-Spam-Level: X-Mailman-Approved-At: Thu, 13 Oct 2005 13:04:20 +0000 Cc: hackers@FreeBSD.org, 'RW' 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:25:35 -0000 > -----Original Message----- > From: Sergey Matveychuk [mailto:sem@FreeBSD.org] > Sent: 10/13/2005 5:38 AM > To: Michael C. Shultz > Cc: Mark J. Sommer; hackers@FreeBSD.org; RW > Subject: Re: portmanager > > 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. > > -- > Sem. > Completely agree!