From owner-svn-src-all@freebsd.org Tue Aug 16 14:15:10 2016 Return-Path: Delivered-To: svn-src-all@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 C86C0BBC443; Tue, 16 Aug 2016 14:15:10 +0000 (UTC) (envelope-from sbz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 98BCE19B3; Tue, 16 Aug 2016 14:15:10 +0000 (UTC) (envelope-from sbz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7GEF9Co018385; Tue, 16 Aug 2016 14:15:09 GMT (envelope-from sbz@FreeBSD.org) Received: (from sbz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7GEF9A6018384; Tue, 16 Aug 2016 14:15:09 GMT (envelope-from sbz@FreeBSD.org) Message-Id: <201608161415.u7GEF9A6018384@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbz set sender to sbz@FreeBSD.org using -f From: Sofian Brabez Date: Tue, 16 Aug 2016 14:15:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r304220 - head/usr.bin/tty X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2016 14:15:10 -0000 Author: sbz (ports committer) Date: Tue Aug 16 14:15:09 2016 New Revision: 304220 URL: https://svnweb.freebsd.org/changeset/base/304220 Log: tty: Use proper definition of exit status code and stdin macro Reviewed by: bapt, bdrewery Differential Revision: https://reviews.freebsd.org/D6828 Modified: head/usr.bin/tty/tty.c Modified: head/usr.bin/tty/tty.c ============================================================================== --- head/usr.bin/tty/tty.c Tue Aug 16 13:08:03 2016 (r304219) +++ head/usr.bin/tty/tty.c Tue Aug 16 14:15:09 2016 (r304220) @@ -63,17 +63,18 @@ main(int argc, char *argv[]) case '?': default: usage(); + /* NOTREACHED */ } - t = ttyname(0); + t = ttyname(STDIN_FILENO); if (!sflag) puts(t ? t : "not a tty"); - exit(t ? 0 : 1); + exit(t ? EXIT_SUCCESS : EXIT_FAILURE); } static void usage(void) { - fprintf(stderr, "usage: tty [-s]\n"); + fprintf(stderr, "usage: %s [-s]\n", getprogname()); exit(2); }