Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Dec 2010 18:23:16 +0000 (UTC)
From:      Xin LI <delphij@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r216439 - head/usr.bin/printf
Message-ID:  <201012141823.oBEINGUZ026368@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: delphij
Date: Tue Dec 14 18:23:15 2010
New Revision: 216439
URL: http://svn.freebsd.org/changeset/base/216439

Log:
  When printf is being used as a sh(1) builtin, it can not call
  exit(3) as pointed out by jilles@ so revert to using return(),
  also change the return value back to 1 as requested by bde@.
  
  This is logically a revert of revision 216422.

Modified:
  head/usr.bin/printf/printf.c

Modified: head/usr.bin/printf/printf.c
==============================================================================
--- head/usr.bin/printf/printf.c	Tue Dec 14 17:39:10 2010	(r216438)
+++ head/usr.bin/printf/printf.c	Tue Dec 14 18:23:15 2010	(r216439)
@@ -53,7 +53,6 @@ static const char rcsid[] =
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <sysexits.h>
 #include <unistd.h>
 
 #ifdef SHELL
@@ -123,7 +122,7 @@ main(int argc, char *argv[])
 
 	if (argc < 1) {
 		usage();
-		/* NOTREACHED */
+		return (1);
 	}
 
 #ifdef SHELL
@@ -563,5 +562,4 @@ static void
 usage(void)
 {
 	(void)fprintf(stderr, "usage: printf format [arguments ...]\n");
-	exit(EX_USAGE);
 }



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