[Midnightbsd-cvs] src [11454] trunk/usr.bin/printf/printf.c: sync printf

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sat Jul 7 12:46:22 EDT 2018


Revision: 11454
          http://svnweb.midnightbsd.org/src/?rev=11454
Author:   laffer1
Date:     2018-07-07 12:46:21 -0400 (Sat, 07 Jul 2018)
Log Message:
-----------
sync printf

Modified Paths:
--------------
    trunk/usr.bin/printf/Makefile
    trunk/usr.bin/printf/printf.1
    trunk/usr.bin/printf/printf.c

Property Changed:
----------------
    trunk/usr.bin/printf/printf.1

Modified: trunk/usr.bin/printf/Makefile
===================================================================
--- trunk/usr.bin/printf/Makefile	2018-07-07 16:46:03 UTC (rev 11453)
+++ trunk/usr.bin/printf/Makefile	2018-07-07 16:46:21 UTC (rev 11454)
@@ -1,6 +1,13 @@
+# $MidnightBSD$
 #	@(#)Makefile	8.1 (Berkeley) 6/6/93
-# $MidnightBSD$
+# $FreeBSD: stable/10/usr.bin/printf/Makefile 264996 2014-04-27 01:15:10Z jmmv $
 
+.include <bsd.own.mk>
+
 PROG=	printf
 
+.if ${MK_TESTS} != "no"
+SUBDIR+= tests
+.endif
+
 .include <bsd.prog.mk>

Modified: trunk/usr.bin/printf/printf.1
===================================================================
--- trunk/usr.bin/printf/printf.1	2018-07-07 16:46:03 UTC (rev 11453)
+++ trunk/usr.bin/printf/printf.1	2018-07-07 16:46:21 UTC (rev 11454)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1989, 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -29,7 +30,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)printf.1	8.1 (Berkeley) 6/6/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/usr.bin/printf/printf.1 233648 2012-03-29 05:02:12Z eadler $
 .\"
 .Dd May 28, 2011
 .Dt PRINTF 1
@@ -344,7 +345,7 @@
 .Nm
 to interpret the dash as a program argument.
 .Nm --
-must be used before 
+must be used before
 .Ar format .
 .Pp
 If the locale contains multibyte characters


Property changes on: trunk/usr.bin/printf/printf.1
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/usr.bin/printf/printf.c
===================================================================
--- trunk/usr.bin/printf/printf.c	2018-07-07 16:46:03 UTC (rev 11453)
+++ trunk/usr.bin/printf/printf.c	2018-07-07 16:46:21 UTC (rev 11454)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1989, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -44,7 +45,7 @@
 static char const sccsid[] = "@(#)printf.c	8.1 (Berkeley) 7/20/93";
 #endif
 static const char rcsid[] =
-  "$MidnightBSD$";
+  "$FreeBSD: stable/10/usr.bin/printf/printf.c 265160 2014-04-30 20:39:08Z pfg $";
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -61,12 +62,13 @@
 #include <wchar.h>
 
 #ifdef SHELL
-#define main printfcmd
+#define	main printfcmd
 #include "bltin/bltin.h"
 #include "error.h"
+#include "options.h"
 #endif
 
-#define PF(f, func) do {						\
+#define	PF(f, func) do {						\
 	char *b = NULL;							\
 	if (havewidth)							\
 		if (haveprec)						\
@@ -101,15 +103,19 @@
 main(int argc, char *argv[])
 {
 	size_t len;
-	int ch, chopped, end, rval;
+	int chopped, end, rval;
 	char *format, *fmt, *start;
+#ifndef SHELL
+	int ch;
 
-#ifndef SHELL
 	(void) setlocale(LC_ALL, "");
 #endif
+
 #ifdef SHELL
-	optreset = 1; optind = 1; opterr = 0; /* initialize getopt */
-#endif
+	nextopt("");
+	argc -= argptr - argv;
+	argv = argptr;
+#else
 	while ((ch = getopt(argc, argv, "")) != -1)
 		switch (ch) {
 		case '?':
@@ -119,6 +125,7 @@
 		}
 	argc -= optind;
 	argv += optind;
+#endif
 
 	if (argc < 1) {
 		usage();



More information about the Midnightbsd-cvs mailing list