Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Aug 2016 14:15:09 +0000 (UTC)
From:      Sofian Brabez <sbz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r304220 - head/usr.bin/tty
Message-ID:  <201608161415.u7GEF9A6018384@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201608161415.u7GEF9A6018384>