From owner-svn-src-head@freebsd.org Sun Mar 5 20:19:33 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5F696CFAAAF for ; Sun, 5 Mar 2017 20:19:33 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: from mail-yw0-x22a.google.com (mail-yw0-x22a.google.com [IPv6:2607:f8b0:4002:c05::22a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2FC0C116A for ; Sun, 5 Mar 2017 20:19:33 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: by mail-yw0-x22a.google.com with SMTP id p77so108022712ywg.1 for ; Sun, 05 Mar 2017 12:19:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuxi-nl.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=IkvlfS0oX8UBYNHPlOJFXuG2FccafzIsFDy8S6FxT3c=; b=GrxrRolbUUER2e7Ds0tsQb4IB8BOvZwjRun7KTtki2rkV6+kUV2naJFCLoFkMCFJO7 DLY+Z4qghdsN3338xlxRq8X9ulmbd5nm8Sa8Tg0W9Vvz1Z6nFqnFQxWKxkNHgZS0+T7O SdiGq5FXkdMPCPJTsF/5Ht/fB8KqEctpwUVSiQkwWA5410bnep+Oi51wjLrkf9KLT174 wTP7R7rSgwgvAHfVKd+ynEtwq2IeQls43VesRlss3nPvfPuD3B3a7QInvGgQzcKmEZbD j1z/MtrMT/Qd1P3ANk/FKy+AaT+KyTApbd05v5+V0vgon5Pqru/KzqftBizLS2kwvJ85 wXsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=IkvlfS0oX8UBYNHPlOJFXuG2FccafzIsFDy8S6FxT3c=; b=cCleecpP3Sl61UQ/sRhm3hniYqldIHmNKgRFwtnYtZAGfSl1r8hqNjRBxsPkn7e3HI x9r4NX/R7wVJDeAGBqyy/RuwyFpVAjN/EKiPut/UMLOG9L1nRD0SBSrYG35vdet1AkVF ROwvHW7qUTso+VPs3MHfmrbm+XMn1X3PFlerzLIIeAJ1tMjEOyXpirnF+uHNNB1bHeTV 34PxQHd2+3HNPz1VSVED5DRDamNEUAxmdbd4s1pI0NiE2hpvTWCffFuiE8Yv2sL8t9+/ 5Sa68KKniq46GH6Jth8+9oV1Db+hmXGGs+BOO6/lp7w+PhLaEx0av8O/tox8QAiFbGhA W4pA== X-Gm-Message-State: AMke39mZthwYJ8QOXnPIYIbyFIJNp+fhb1V1FCoUg6A01znYw1xdRnRCF6QO1jFKGLOE2+k+nUTkq6oqvF0iiw== X-Received: by 10.13.220.65 with SMTP id f62mr8863290ywe.6.1488745172102; Sun, 05 Mar 2017 12:19:32 -0800 (PST) MIME-Version: 1.0 Received: by 10.129.51.198 with HTTP; Sun, 5 Mar 2017 12:19:01 -0800 (PST) In-Reply-To: References: <201703042238.v24McAD8008837@repo.freebsd.org> From: Ed Schouten Date: Sun, 5 Mar 2017 21:19:01 +0100 Message-ID: Subject: Re: svn commit: r314685 - head/bin/ps To: "Conrad E. Meyer" Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Mar 2017 20:19:33 -0000 Hi Conrad, 2017-03-05 0:08 GMT+01:00 Conrad Meyer : >> - If something is a TTY, then our implementation of the TTY layer >> guarantees that TIOCGWINSZ always works. > > Do you know if it did in 1990 too? It's hard to tell why Marc@ made > this change way back then. I wasn't sure so I left it alone. I can't tell. :-) >> - If we're only interested in testing stdout whether it's a TTY, I >> think it makes little sense to check TIOCGWINSZ on stdin, stderr. >> >> I think there would therefore be very little harm to use something like this: >> >> | if ((cols = getenv("COLUMNS")) != NULL && *cols != '\0') >> | termwidth = atoi(cols); >> | else if ((ioctl(STDOUT_FILENO, TIOCGWINSZ, (char *)&ws) == >> -1 && ws.ws_row == 0) > > Shouldn't this remain || ws.ws_row == 0? Err, yes. ||, not &&. -- Ed Schouten Nuxi, 's-Hertogenbosch, the Netherlands KvK-nr.: 62051717