From: Lionel Sambuc Date: Wed, 30 Jan 2013 14:45:47 +0000 (+0100) Subject: Upgrading printf X-Git-Tag: v3.2.1~43 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zlib_tech.html?a=commitdiff_plain;h=2c96f0541bedd077c13a319ee9900a99311d41c9;p=minix.git Upgrading printf Change-Id: I78dbbf0d14e4d61f5dfbec53d3938453b3e03ee6 --- diff --git a/commands/Makefile b/commands/Makefile index 7103cfe83..d6e9dd83f 100644 --- a/commands/Makefile +++ b/commands/Makefile @@ -18,7 +18,7 @@ SUBDIR= add_route arp ash at backup banner basename btrace cal \ mesg mined mkfifo \ mount mt netconf nice acknm nohup \ nonamed od paste patch \ - ping postinstall poweroff pr prep printf printroot \ + ping postinstall poweroff pr prep printroot \ profile progressbar pr_routes ps pwd pwdauth \ ramdisk rarpd rawspeed rcp rdate readclock \ reboot remsync rev rget rlogin \ diff --git a/commands/printf/Makefile b/commands/printf/Makefile deleted file mode 100644 index 67169b90a..000000000 --- a/commands/printf/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -# $NetBSD: Makefile,v 1.9 2004/10/30 19:28:35 christos Exp $ -# from: @(#)Makefile 8.1 (Berkeley) 6/6/93 - -PROG= printf - -.include diff --git a/releasetools/nbsd_ports b/releasetools/nbsd_ports index 167cce6af..7d7613946 100644 --- a/releasetools/nbsd_ports +++ b/releasetools/nbsd_ports @@ -137,6 +137,7 @@ 2012/10/17 12:00:00,usr.bin/nvi 2010/05/14 17:28:23,usr.bin/newgrp 2012/10/17 12:00:00,usr.bin/passwd +2012/10/17 12:00:00,usr.bin/printf 2010/02/19 16:35:27,usr.bin/sed 2010/05/27 08:40:19,usr.bin/seq 2012/10/17 12:00:00,usr.bin/sort diff --git a/usr.bin/Makefile b/usr.bin/Makefile index 8d8899612..90ba80abe 100644 --- a/usr.bin/Makefile +++ b/usr.bin/Makefile @@ -20,7 +20,7 @@ SUBDIR= \ \ nbperf newgrp nvi \ passwd \ - \ + printf \ \ \ sed seq \ diff --git a/usr.bin/printf/Makefile b/usr.bin/printf/Makefile new file mode 100644 index 000000000..0a8cba836 --- /dev/null +++ b/usr.bin/printf/Makefile @@ -0,0 +1,8 @@ +# $NetBSD: Makefile,v 1.11 2011/08/16 10:37:21 christos Exp $ +# from: @(#)Makefile 8.1 (Berkeley) 6/6/93 + +PROG= printf + +COPTS.printf.c = -Wno-format-nonliteral + +.include diff --git a/commands/printf/printf.1 b/usr.bin/printf/printf.1 similarity index 98% rename from commands/printf/printf.1 rename to usr.bin/printf/printf.1 index 7f1aff2ec..3f48f6856 100644 --- a/commands/printf/printf.1 +++ b/usr.bin/printf/printf.1 @@ -1,4 +1,4 @@ -.\" $NetBSD: printf.1,v 1.22 2008/09/01 09:20:41 dholland Exp $ +.\" $NetBSD: printf.1,v 1.24 2010/04/05 21:24:14 joerg Exp $ .\" .\" Copyright (c) 1989, 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -277,7 +277,7 @@ The .Ar argument is printed in the style .Sm off -.Pf [\-]d Cm \&. No ddd Cm e No \\*(Pmdd +.Pf [\-]d Cm \&. No ddd Cm e No \*(Pmdd .Sm on where there is one digit before the decimal point and the number after is equal to @@ -299,7 +299,7 @@ whichever gives full precision in minimum space. Characters from the string .Ar argument are printed with backslash-escape sequences expanded. -.br +.Pp The following additional backslash-escape sequences are supported: .Bl -tag -width Ds .It Cm \ec diff --git a/commands/printf/printf.c b/usr.bin/printf/printf.c similarity index 96% rename from commands/printf/printf.c rename to usr.bin/printf/printf.c index 532f64dab..5167a60aa 100644 --- a/commands/printf/printf.c +++ b/usr.bin/printf/printf.c @@ -1,4 +1,4 @@ -/* $NetBSD: printf.c,v 1.33.8.1 2009/10/14 18:37:30 sborrill Exp $ */ +/* $NetBSD: printf.c,v 1.35 2011/03/15 23:11:49 christos Exp $ */ /* * Copyright (c) 1989, 1993 @@ -30,6 +30,20 @@ */ #include +#ifndef lint +#if !defined(BUILTIN) && !defined(SHELL) +__COPYRIGHT("@(#) Copyright (c) 1989, 1993\ + The Regents of the University of California. All rights reserved."); +#endif +#endif + +#ifndef lint +#if 0 +static char sccsid[] = "@(#)printf.c 8.2 (Berkeley) 3/22/95"; +#else +__RCSID("$NetBSD: printf.c,v 1.35 2011/03/15 23:11:49 christos Exp $"); +#endif +#endif /* not lint */ #include @@ -44,7 +58,6 @@ #include #include #include -#include #ifdef __GNUC__ #define ESCAPE '\e' @@ -94,7 +107,6 @@ static char **gargv; error = printf(f, func); \ } -#if 0 #define APF(cpp, f, func) { \ if (fieldwidth != -1) { \ if (precision != -1) \ @@ -106,7 +118,6 @@ static char **gargv; else \ error = asprintf(cpp, f, func); \ } -#endif #ifdef main int main(int, char *[]); @@ -143,7 +154,7 @@ int main(int argc, char *argv[]) format = *argv; gargv = ++argv; -#define SKIP1 "#-+ 0" +#define SKIP1 "#-+ 0'" #define SKIP2 "0123456789" do { /* @@ -238,8 +249,7 @@ int main(int argc, char *argv[]) t[b_length] = 0; /* Get printf to calculate the lengths */ *fmt = 's'; - abort(); -/* APF(&a, start, t); */ + APF(&a, start, t); if (error == -1) goto out; b_fmt = a; @@ -609,7 +619,7 @@ getintmax(void) return *(cp+1); errno = 0; - val = strtol(cp, &ep, 0); + val = strtoimax(cp, &ep, 0); check_conversion(cp, ep); return val; } @@ -638,7 +648,7 @@ getuintmax(void) } errno = 0; - val = strtoul(cp, &ep, 0); + val = strtoumax(cp, &ep, 0); check_conversion(cp, ep); return val; }