Source-Changes-HG archive

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

[src/trunk]: src/lib/libterm restore 0 padding for %2 and %3. From David Laight.



details:   https://anonhg.NetBSD.org/src/rev/9abe935a15c3
branches:  trunk
changeset: 533590:9abe935a15c3
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Jul 04 18:47:28 2002 +0000

description:
restore 0 padding for %2 and %3. From David Laight.

diffstat:

 lib/libterm/tgoto.c |  15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diffs (36 lines):

diff -r 959c0ef1113d -r 9abe935a15c3 lib/libterm/tgoto.c
--- a/lib/libterm/tgoto.c       Thu Jul 04 18:09:59 2002 +0000
+++ b/lib/libterm/tgoto.c       Thu Jul 04 18:47:28 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tgoto.c,v 1.20 2002/06/26 18:08:49 christos Exp $      */
+/*     $NetBSD: tgoto.c,v 1.21 2002/07/04 18:47:28 christos Exp $      */
 
 /*
  * Copyright (c) 1980, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)tgoto.c    8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: tgoto.c,v 1.20 2002/06/26 18:08:49 christos Exp $");
+__RCSID("$NetBSD: tgoto.c,v 1.21 2002/07/04 18:47:28 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -162,6 +162,17 @@
                        do
                                dig_buf[k++] = which % 10 | '0';
                        while ((which /= 10) != 0);
+
+                       if (c != 'd') {
+                               c -= '0';
+                               if (k > c) {
+                                       errno = E2BIG;
+                                       return -1;
+                               }
+                               while (k < c)
+                                       dig_buf[k++] = '0';
+                       }
+
                        if (dp + k >= buf_lim) {
                                errno = E2BIG;
                                return -1;



Home | Main Index | Thread Index | Old Index