Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/jot Apply modified fix for PR bin/23763



details:   https://anonhg.NetBSD.org/src/rev/d639a586c1ae
branches:  trunk
changeset: 586978:d639a586c1ae
user:      garbled <garbled%NetBSD.org@localhost>
date:      Sat Jan 07 07:09:01 2006 +0000

description:
Apply modified fix for PR bin/23763
jot(1)'s output now matches the examples given in the manpage.

diffstat:

 usr.bin/jot/Makefile |  4 +++-
 usr.bin/jot/jot.c    |  7 +++++--
 2 files changed, 8 insertions(+), 3 deletions(-)

diffs (49 lines):

diff -r bd203332c8ff -r d639a586c1ae usr.bin/jot/Makefile
--- a/usr.bin/jot/Makefile      Sat Jan 07 01:11:42 2006 +0000
+++ b/usr.bin/jot/Makefile      Sat Jan 07 07:09:01 2006 +0000
@@ -1,7 +1,9 @@
-#      $NetBSD: Makefile,v 1.3 2000/10/11 14:46:05 is Exp $
+#      $NetBSD: Makefile,v 1.4 2006/01/07 07:09:01 garbled Exp $
 #      @(#)Makefile    8.1 (Berkeley) 6/6/93
 
 PROG=  jot
 WFORMAT=1
+DPADD= ${LIBMATH}
+LDADD= -lm
 
 .include <bsd.prog.mk>
diff -r bd203332c8ff -r d639a586c1ae usr.bin/jot/jot.c
--- a/usr.bin/jot/jot.c Sat Jan 07 01:11:42 2006 +0000
+++ b/usr.bin/jot/jot.c Sat Jan 07 07:09:01 2006 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: jot.c,v 1.13 2006/01/04 01:52:17 perry Exp $   */
+/*     $NetBSD: jot.c,v 1.14 2006/01/07 07:09:01 garbled Exp $ */
 
 /*-
  * Copyright (c) 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)jot.c      8.1 (Berkeley) 6/6/93";
 #endif
-__RCSID("$NetBSD: jot.c,v 1.13 2006/01/04 01:52:17 perry Exp $");
+__RCSID("$NetBSD: jot.c,v 1.14 2006/01/07 07:09:01 garbled Exp $");
 #endif /* not lint */
 
 /*
@@ -51,6 +51,7 @@
 #include <ctype.h>
 #include <err.h>
 #include <limits.h>
+#include <math.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -311,6 +312,8 @@
                printf("%s", format);
        else if (dox)                           /* scalar */
                printf(format, *dp);
+       else if (prec == 0)                     /* integer */
+               printf(format, round(x));
        else                                    /* real */
                printf(format, x);
        if (notlast != 0)



Home | Main Index | Thread Index | Old Index