From owner-freebsd-hackers@FreeBSD.ORG Thu Oct 13 11:37:51 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 403A616A423 for ; Thu, 13 Oct 2005 11:37:51 +0000 (GMT) (envelope-from sem@FreeBSD.org) Received: from core.inec.ru (core.inec.ru [213.148.3.226]) by mx1.FreeBSD.org (Postfix) with ESMTP id D0ED243D48 for ; Thu, 13 Oct 2005 11:37:50 +0000 (GMT) (envelope-from sem@FreeBSD.org) Received: from [213.85.81.137] (helo=[192.168.0.3]) by core.inec.ru with esmtp (Exim 4.51 (FreeBSD)) id 1EQ1OL-0000p4-Uw; Thu, 13 Oct 2005 15:36:58 +0400 Message-ID: <434E46FB.1090800@FreeBSD.org> Date: Thu, 13 Oct 2005 15:37:31 +0400 From: Sergey Matveychuk User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051001) X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Michael C. Shultz" References: <200510122033.j9CKX5uo040708@argotsoft.com> <200510121515.14805.ringworm01@gmail.com> In-Reply-To: <200510121515.14805.ringworm01@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: "Mark J. Sommer" , 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 11:37:51 -0000 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.