diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/ChangeLog | 44 | ||||
-rw-r--r-- | test/Makefile.in | 31 | ||||
-rw-r--r-- | test/badargs.ok | 4 | ||||
-rw-r--r-- | test/getnr2tb.awk | 111 | ||||
-rw-r--r-- | test/getnr2tb.in | 6 | ||||
-rw-r--r-- | test/getnr2tb.ok | 6 | ||||
-rw-r--r-- | test/getnr2tm.awk | 75 | ||||
-rw-r--r-- | test/getnr2tm.in | 1 | ||||
-rw-r--r-- | test/getnr2tm.ok | 1 | ||||
-rwxr-xr-x | test/gsubtest.awk | 12 | ||||
-rw-r--r-- | test/gsubtest.ok | 12 | ||||
-rw-r--r-- | test/nasty.awk | 92 | ||||
-rw-r--r-- | test/nasty.ok | 2 | ||||
-rw-r--r-- | test/printf1.awk | 19 | ||||
-rw-r--r-- | test/printf1.ok | 7 | ||||
-rw-r--r-- | test/reg/Obsolete/exp.awk (renamed from test/reg/exp.awk) | 0 | ||||
-rw-r--r-- | test/reg/Obsolete/exp.good (renamed from test/reg/exp.good) | 0 | ||||
-rw-r--r-- | test/reg/Obsolete/exp.in (renamed from test/reg/exp.in) | 0 | ||||
-rw-r--r-- | test/reg/Obsolete/log.awk (renamed from test/reg/log.awk) | 0 | ||||
-rw-r--r-- | test/reg/Obsolete/log.good (renamed from test/reg/log.good) | 0 | ||||
-rw-r--r-- | test/reg/Obsolete/log.in (renamed from test/reg/log.in) | 0 | ||||
-rw-r--r-- | test/zeroflag.awk | 1 | ||||
-rw-r--r-- | test/zeroflag.ok | 1 |
23 files changed, 407 insertions, 18 deletions
diff --git a/test/ChangeLog b/test/ChangeLog index 8efafaad..7d7aeb84 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,47 @@ +Wed Jun 30 16:14:36 1999 Arnold D. Robbins <arnold@gnu.org> + + * Release 3.0.4: Release tar file made. This time for sure. + +Tue May 25 16:37:50 1999 Arnold D. Robbins <arnold@gnu.org> + + * Makefile.in (printf1): new test case. + * printf1.awk, printf1.ok: new files. + +Wed May 19 15:32:09 1999 Arnold D. Robbins <arnold@gnu.org> + + * reg/*: moved exp and log tests to new `Obsolete' directory; they + would only succeed under SunOS 4.x. + +Mon May 3 11:53:33 1999 Arnold D. Robbins <arnold@gnu.org> + + * Makefile.in (gawk.extensions): removed `nondec' until the + associated features get documented in 3.1. + +Tue Nov 3 16:46:39 1998 Arnold D. Robbins <arnold@gnu.org> + + * Makefile.in (getnr2tm, getnr2tb): new test cases. + * getnr2tm.awk, getnr2tm.in, getnr2tm.ok: new files. + * getnr2tb.awk, getnr2tb.in, getnr2tb.ok: new files. + +Sun Nov 1 13:20:08 1998 Arnold D. Robbins <arnold@gnu.org> + + * Makefile.in (zeroflag): new test case. + * zeroflag.awk, zeroflag.ok: new files + +Wed Oct 28 18:44:19 1998 Arnold D. Robbins <arnold@gnu.org> + + * Makefile.in (nasty): new test case. + * nasty.awk, nasty.ok: new files + +Sun Nov 16 20:08:59 1997 Arnold D. Robbins <arnold@gnu.org> + + * gsubtest.awk, gsubtest.ok: fix for count of matches in gsub + from Geert.Debyser@esat.kuleuven.ac.be. + +Sun Nov 16 19:54:50 1997 Arnold D. Robbins <arnold@gnu.org> + + * Makefile.in (strftime): fix a typo (LANC -> LANG). + Thu May 15 12:49:08 1997 Arnold D. Robbins <arnold@skeeve.atl.ga.us> * Release 3.0.3: Release tar file made. diff --git a/test/Makefile.in b/test/Makefile.in index 07d0cbcf..0a4ad8c3 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -1,6 +1,6 @@ # Makefile for GNU Awk test suite. # -# Copyright (C) 1988-1997 the Free Software Foundation, Inc. +# Copyright (C) 1988-1998 the Free Software Foundation, Inc. # # This file is part of GAWK, the GNU implementation of the # AWK Programming Language. @@ -37,12 +37,15 @@ basic: msg swaplns messages argarray longwrds \ sprintfc backgsub tweakfld clsflnam mmap8k fnarray \ dynlj substr eofsplit prt1eval gsubasgn prtoeval gsubtest splitwht \ back89 tradanch nlfldsep splitvar intest nfldstr nors fnarydel \ - noparms funstack clobber delarprm prdupval + noparms funstack clobber delarprm prdupval nasty zeroflag \ + getnr2tm getnr2tb printf1 unix-tests: poundbang fflush getlnhd pipeio1 pipeio2 strftlng pid gawk.extensions: fieldwdth ignrcase posix manyfiles igncfs argtest \ - badargs strftime gensub gnureops reint nondec + badargs strftime gensub gnureops reint +# add this back for 3.1 +# nondec extra: regtest inftest @@ -211,7 +214,7 @@ nofmtch:: strftime:: : this test could fail on slow machines or on a second boundary, : so if it does, double check the actual results - @LC_ALL=C; export LC_ALL; LANC=C; export LANG; \ + @LC_ALL=C; export LC_ALL; LANG=C; export LANG; \ date | $(AWK) '{ $$3 = sprintf("%02d", $$3 + 0) ; \ print > "strftime.ok" ; \ print strftime() > "'_$@'" }' @@ -442,6 +445,26 @@ nondec:: fi $(CMP) $(srcdir)/nondec.ok _$@ && rm -f _$@ +nasty:: + @$(AWK) -f $(srcdir)/nasty.awk >_$@ + $(CMP) $(srcdir)/nasty.ok _$@ && rm -f _$@ + +zeroflag:: + @$(AWK) -f $(srcdir)/zeroflag.awk >_$@ + $(CMP) $(srcdir)/zeroflag.ok _$@ && rm -f _$@ + +getnr2tm:: + @$(AWK) -f $(srcdir)/getnr2tm.awk $(srcdir)/getnr2tm.in >_$@ + $(CMP) $(srcdir)/getnr2tm.ok _$@ && rm -f _$@ + +getnr2tb:: + @$(AWK) -f $(srcdir)/getnr2tb.awk $(srcdir)/getnr2tb.in >_$@ + $(CMP) $(srcdir)/getnr2tb.ok _$@ && rm -f _$@ + +printf1:: + @$(AWK) -f $(srcdir)/printf1.awk >_$@ + $(CMP) $(srcdir)/printf1.ok _$@ && rm -f _$@ + clean: rm -fr _* core junk out1 out2 out3 strftime.ok test1 test2 seq *~ diff --git a/test/badargs.ok b/test/badargs.ok index c89e520f..2278702c 100644 --- a/test/badargs.ok +++ b/test/badargs.ok @@ -19,5 +19,5 @@ POSIX options: GNU long options: -W usage --usage -W version --version -Report bugs to bug-gnu-utils@prep.ai.mit.edu, -with a Cc: to arnold@gnu.ai.mit.edu +Report bugs to bug-gnu-utils@gnu.org, +with a Cc: to arnold@gnu.org diff --git a/test/getnr2tb.awk b/test/getnr2tb.awk new file mode 100644 index 00000000..204acf46 --- /dev/null +++ b/test/getnr2tb.awk @@ -0,0 +1,111 @@ +#From vp@dmat.uevora.pt Thu Jun 18 09:10 EDT 1998 +#Received: from mescaline.gnu.org (we-refuse-to-spy-on-our-users@mescaline.gnu.org [158.121.106.21]) by cssun.mathcs.emory.edu (8.7.5/8.6.9-940818.01cssun) with ESMTP id JAA23649 for <arnold@mathcs.emory.edu>; Thu, 18 Jun 1998 09:10:54 -0400 (EDT) +#Received: from khromeleque.dmat.uevora.pt by mescaline.gnu.org (8.8.5/8.6.12GNU) with ESMTP id JAA21732 for <arnold@gnu.ai.mit.edu>; Thu, 18 Jun 1998 09:11:19 -0400 +#Received: from khromeleque.dmat.uevora.pt (vp@localhost [127.0.0.1]) +# by khromeleque.dmat.uevora.pt (8.8.8/8.8.8/Debian/GNU) with ESMTP id OAA11817 +# for <arnold@gnu.ai.mit.edu>; Thu, 18 Jun 1998 14:13:57 +0100 +#Message-Id: <199806181313.OAA11817@khromeleque.dmat.uevora.pt> +#To: arnold@gnu.org +#Subject: concatenation bug in gawk 3.0.3 +#Date: Thu, 18 Jun 1998 14:13:57 +0200 +#From: Vasco Pedro <vp@dmat.uevora.pt> +#Content-Type: text +#Content-Length: 2285 +#Status: RO +# +#Hi, +# +#The gawk program '{print NR " " 10/NR}' will print: +# +#1 10 +#5 5 +#3 3.33333 +#2 2.5 +#2 2 +#1 1.66667 +# +#instead of the correct: +# +#1 10 +#2 5 +#3 3.33333 +#4 2.5 +#5 2 +#6 1.66667 +# +#You'll notice, on the incorrect output, that the first column is +#the first digit of the second. +# +#I think the problem comes from the way builtin variables are handled. +#Since the items to be concatenated are processed in reverse order and +#the return value of tree_eval(``NR'') is a pointer to the value part +#of `NR_node', the `unref()' of `NR_node' due to its second occurrence +#will leave a dangling pointer in `strlist'. The reason that it doesn't +#reuse the freed space with objects of the same type. (Using Electric +#Fence with EF_PROTECT_FREE set confirms that freed space is being +#accessed.) +# +#The enclosed patch (hack would be a better word to describe it) is +#all I could come up with. With it installed, things seem to work ok, +#but I doubt this is the correct way to do it. (If I treated the +#case for `Node_field_spec' as the I did others, `make check' would +#fail in several places.) +# +#Regards, +#vasco +# +#*** eval.c~ Tue May 6 21:39:55 1997 +#--- eval.c Thu Jun 18 13:39:25 1998 +#*************** +#*** 685,697 **** +# return func_call(tree->rnode, tree->lnode); +# +# /* unary operations */ +# case Node_NR: +# case Node_FNR: +# case Node_NF: +# case Node_FIELDWIDTHS: +# case Node_FS: +# case Node_RS: +#- case Node_field_spec: +# case Node_subscript: +# case Node_IGNORECASE: +# case Node_OFS: +#--- 685,700 ---- +# return func_call(tree->rnode, tree->lnode); +# +# /* unary operations */ +#+ case Node_field_spec: +#+ lhs = get_lhs(tree, (Func_ptr *) NULL); +#+ return *lhs; +#+ +# case Node_NR: +# case Node_FNR: +# case Node_NF: +# case Node_FIELDWIDTHS: +# case Node_FS: +# case Node_RS: +# case Node_subscript: +# case Node_IGNORECASE: +# case Node_OFS: +#*************** +#*** 699,705 **** +# case Node_OFMT: +# case Node_CONVFMT: +# lhs = get_lhs(tree, (Func_ptr *) NULL); +#! return *lhs; +# +# case Node_var_array: +# fatal("attempt to use array `%s' in a scalar context", +#--- 702,710 ---- +# case Node_OFMT: +# case Node_CONVFMT: +# lhs = get_lhs(tree, (Func_ptr *) NULL); +#! r = dupnode(*lhs); +#! r->flags |= TEMP; +#! return r; +# +# case Node_var_array: +# fatal("attempt to use array `%s' in a scalar context", +# +{ print NR " " 10/NR } diff --git a/test/getnr2tb.in b/test/getnr2tb.in new file mode 100644 index 00000000..f9858572 --- /dev/null +++ b/test/getnr2tb.in @@ -0,0 +1,6 @@ +line 1 +line 2 +line 3 +line 4 +line 5 +line 6 diff --git a/test/getnr2tb.ok b/test/getnr2tb.ok new file mode 100644 index 00000000..7b40e8d7 --- /dev/null +++ b/test/getnr2tb.ok @@ -0,0 +1,6 @@ +1 10 +2 5 +3 3.33333 +4 2.5 +5 2 +6 1.66667 diff --git a/test/getnr2tm.awk b/test/getnr2tm.awk new file mode 100644 index 00000000..dfe377a8 --- /dev/null +++ b/test/getnr2tm.awk @@ -0,0 +1,75 @@ +#From dhw@gamgee.acad.emich.edu Sat Oct 31 22:54:07 1998 +#Return-Path: <dhw@gamgee.acad.emich.edu> +#Received: from cssun.mathcs.emory.edu (cssun.mathcs.emory.edu [170.140.150.1]) +# by amx.netvision.net.il (8.9.0.Beta5/8.8.6) with ESMTP id HAA08891 +# for <arobbins@netvision.net.il>; Sat, 31 Oct 1998 07:14:07 +0200 (IST) +#Received: from mescaline.gnu.org (we-refuse-to-spy-on-our-users@mescaline.gnu.org [158.121.106.21]) by cssun.mathcs.emory.edu (8.7.5/8.6.9-940818.01cssun) with ESMTP id AAA14947 for <arnold@mathcs.emory.edu>; Sat, 31 Oct 1998 00:14:32 -0500 (EST) +#Received: from gamgee.acad.emich.edu (gamgee.acad.emich.edu [164.76.102.76]) +# by mescaline.gnu.org (8.9.1a/8.9.1) with SMTP id AAA20645 +# for <arnold@gnu.ai.mit.edu>; Sat, 31 Oct 1998 00:17:54 -0500 +#Received: by gamgee.acad.emich.edu (Smail3.1.29.1 #57) +# id m0zZUKY-000IDSC; Sat, 31 Oct 98 00:16 CST +#Message-Id: <m0zZUKY-000IDSC@gamgee.acad.emich.edu> +#Date: Sat, 31 Oct 98 00:16 CST +#From: dhw@gamgee.acad.emich.edu (David H. West) +#To: bug-gnu-utils@gnu.org +#Subject: gawk 3.0.3 bug report +#Cc: arnold@gnu.org +#X-UIDL: 7474b825cff989adf38f13883d84fdd7 +#Status: RO +# +#gawk version: 3.03 +#System used: Linux, kernel 2.0.28, libc 5.4.33, AMD K5PR133 (i586 clone) +#Remark: There seems to be at least one bug shown by the demo below. +# There may also be a Dark Corner involving the value of NR in an +# END block, a topic on which the info file is silent. In gawk +# 3.0.3, NR often seems to have the least-surprise value in an +# END block, but sometimes it doesn't - see example below. +#Problem descr: the log below shows a case where: +# a) (this may be a red herring) the output of the gawk script +# is different depending on whether its input file is named on +# the command line or catted to stdin, without any use of the +# legitimate means which could produce this effect. +# b) NR is clearly getting clobbered; I have tried to simplify +# the 19-line script "awkerr1" below, but seemingly unrelated +# changes, like shortening constant strings which appear only in +# print statements, or removing unexecuted or irrelevant code, +# cause the clobbering to go away. Some previous (larger) +# versions of this code would clobber NR also when reading from +# stdin, but I thought you'd prefer a shorter example :-). +#Reproduce-By: using the gawk script "awkerr1", the contents of +# which appear in the transcript below as the output of the +# command "cat awkerr1". Comments following # were added +# to the transcript later as explanation. +#---------------------------------------------- Script started on Fri +#Oct 30 20:04:16 1998 chipmunk:/ram0# ls -l a1 awkerr1 -rw-r--r-- 1 +#root root 2 Oct 30 18:42 a1 -rwxr-xr-x 1 root root +#389 Oct 30 19:54 awkerr1 chipmunk:/ram0# cat a1 #a1 contains +#one printable char and a newline a chipmunk:/ram0# od -c xc a1 +#0000000 0a61 +# a \n +#0000002 chipmunk:/ram0# cat a1 | awkerr1 #no surprises here +#1 lines in 1 sec: 1 lines/sec; nlines=1 chipmunk:/ram0# awkerr1 a1 È +#lines in 1 sec: 1 lines/sec; nlines=1 #?! first char is an uppercase +#E-grave chipmunk:/ram0# awkerr1 a1 | od -N1 -xc 0000000 00c8 +# 310 \0 +#0000001 chipmunk:/ram0# cat awkerr1 #the apparent ^M's are not +#actually in the file +#!/usr/bin/awk -f +function process(w) { + if(w in ws) { + printf " : found\n"; lc[p " " w]++; rc[w " " n]++; } + } +BEGIN {IGNORECASE=1; + } +/^/ {if(NR % 10 ==0)print "processing line " NR; + process($1); nlines++; + } +END {p=w; w=n; n=""; + if(w)process(w); t=1; print NR " lines in " t " sec: " NR+0 " lines/sec; nlines=" nlines; + } +#chipmunk:/ram0# exit Script done on Fri Oct 30 20:07:31 1998 +#--------------------------------------------- +# +#-David West dhw@gamgee.acad.emich.edu +# diff --git a/test/getnr2tm.in b/test/getnr2tm.in new file mode 100644 index 00000000..78981922 --- /dev/null +++ b/test/getnr2tm.in @@ -0,0 +1 @@ +a diff --git a/test/getnr2tm.ok b/test/getnr2tm.ok new file mode 100644 index 00000000..d63fca09 --- /dev/null +++ b/test/getnr2tm.ok @@ -0,0 +1 @@ +1 lines in 1 sec: 1 lines/sec; nlines=1 diff --git a/test/gsubtest.awk b/test/gsubtest.awk index 31374795..5dfefe93 100755 --- a/test/gsubtest.awk +++ b/test/gsubtest.awk @@ -1,8 +1,8 @@ BEGIN { - str = "abc"; gsub("b+", "FOO", str); print str - str = "abc"; gsub("x*", "X", str); print str - str = "abc"; gsub("b*", "X", str); print str - str = "abc"; gsub("c", "X", str); print str - str = "abc"; gsub("c+", "X", str); print str - str = "abc"; gsub("x*$", "X", str); print str + str = "abc"; print gsub("b+", "FOO", str), str + str = "abc"; print gsub("x*", "X", str), str + str = "abc"; print gsub("b*", "X", str), str + str = "abc"; print gsub("c", "X", str), str + str = "abc"; print gsub("c+", "X", str), str + str = "abc"; print gsub("x*$", "X", str), str } diff --git a/test/gsubtest.ok b/test/gsubtest.ok index 191bebda..7c18f431 100644 --- a/test/gsubtest.ok +++ b/test/gsubtest.ok @@ -1,6 +1,6 @@ -aFOOc -XaXbXcX -XaXcX -abX -abX -abcX +1 aFOOc +4 XaXbXcX +3 XaXcX +1 abX +1 abX +1 abcX diff --git a/test/nasty.awk b/test/nasty.awk new file mode 100644 index 00000000..b9c20c8b --- /dev/null +++ b/test/nasty.awk @@ -0,0 +1,92 @@ +#From hankedr@manatee.dms.auburn.edu Tue Oct 13 22:15:59 1998 +#Return-Path: <hankedr@manatee.dms.auburn.edu> +#Received: from cssun.mathcs.emory.edu (cssun.mathcs.emory.edu [170.140.150.1]) +# by dmx.netvision.net.il (8.9.0.Beta5/8.8.6) with ESMTP id PAA03924 +# for <arobbins@netvision.net.il>; Tue, 13 Oct 1998 15:32:13 +0200 (IST) +#Received: from mescaline.gnu.org (we-refuse-to-spy-on-our-users@mescaline.gnu.org [158.121.106.21]) by cssun.mathcs.emory.edu (8.7.5/8.6.9-940818.01cssun) with ESMTP id KAA11644 for <arnold@mathcs.emory.edu>; Tue, 13 Oct 1998 10:22:32 -0400 (EDT) +#Received: from manatee.dms.auburn.edu (manatee.dms.auburn.edu [131.204.53.104]) +# by mescaline.gnu.org (8.9.1a/8.9.1) with ESMTP id KAA03250 +# for <arnold@gnu.org>; Tue, 13 Oct 1998 10:25:32 -0400 +#Received: (from hankedr@localhost) +# by manatee.dms.auburn.edu (8.9.1a/8.9.1) id JAA13348; +# Tue, 13 Oct 1998 09:22:29 -0500 (CDT) +#Date: Tue, 13 Oct 1998 09:22:29 -0500 (CDT) +#Message-Id: <199810131422.JAA13348@manatee.dms.auburn.edu> +#From: Darrel Hankerson <hankedr@dms.auburn.edu> +#To: arnold@gnu.org +#In-reply-to: <199810131313.QAA31784@alpha.netvision.net.il> (message from +# Aharon Robbins on Tue, 13 Oct 1998 16:10:36 +0200) +#Subject: Re: full text of bug report? +#Mime-Version: 1.0 +#Content-Type: text/plain; charset=US-ASCII +#X-UIDL: bf3fce492dad4ab030c561e7b2f27d0a +#Status: RO +# +# Do you have the full text of the a = a "\n" f() bug report? +# I can't find it.... I'm not sure there really is a bug. +# +#Yes, see below. +# +#His example has unnecessary fragments (in particular, the use of +#gensub is irrelevant). As I wrote to you earlier, the interesting +#question for me is: +# +# Is the concatenation result undefined? If the result is defined or +# implementation-dependent, then gawk has a bug. +# +# +#=== Original report ===================================================== +#From: Attila Torcsvari <arcdev@mail.matav.hu> +#To: "'bug-gnu-utils@prep.ai.mit.edu'" <bug-gnu-utils@gnu.org> +#Subject: gawk 3.0.3 bug +#Date: Thu, 17 Sep 1998 18:12:13 +0200 +#MIME-Version: 1.0 +#Content-Transfer-Encoding: 7bit +#Resent-From: bug-gnu-utils@gnu.org +#X-Mailing-List: <bug-gnu-utils@gnu.org> archive/latest/3396 +#X-Loop: bug-gnu-utils@gnu.org +#Precedence: list +#Resent-Sender: bug-gnu-utils-request@gnu.org +#Content-Transfer-Encoding: 7bit +#Content-Type: text/plain; charset="us-ascii" +#Content-Length: 618 +# +#Bug-gnuers, +#please pass it to the responsible. +# +#The following generates something interesting: +# +BEGIN{ +a="aaaaa" +a=a a #10 +a=a a #20 +a=a a #40 +a=a a #80 +a=a a #160 +a=a a # i.e. a is long enough + +a=a"\n"f() # this causes the trouble +print a # guess the result +} + +function f() +{ +#print "a before: ", a +#a=gensub("a","123,","g",a) # 'a' will be just a bit longer (4 times, but still should fit: 4*160=640) +gsub(/a/, "123", a) +#print "a after: ", a +return "X" +} +# +#Possible reason: +#during f the a is modified, +#it can be even freed, because gensub modifies its size +#the printout contains trash. +# +#Used version: VC compiled WinNT 32 bit Intel. +# +#Regards, +# +#Attila Torcsvari +#Arcanum Development +# diff --git a/test/nasty.ok b/test/nasty.ok new file mode 100644 index 00000000..5189cf81 --- /dev/null +++ b/test/nasty.ok @@ -0,0 +1,2 @@ +123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123 +X diff --git a/test/printf1.awk b/test/printf1.awk new file mode 100644 index 00000000..1cd7b99f --- /dev/null +++ b/test/printf1.awk @@ -0,0 +1,19 @@ +# Tue May 25 16:36:16 IDT 1999 +# +# Test cases based on email from Andreas Schwab, schwab@gnu.org + +BEGIN { + fmt[1] = "%8.5d"; data[1] = 100 + fmt[2] = "%#o"; data[2] = 0 + fmt[3] = "%#.1o"; data[3] = 0 + fmt[4] = "%#.0o"; data[4] = 0 + fmt[5] = "%#x"; data[5] = 0 + fmt[6] = "%.0d"; data[6] = 0 + fmt[7] = "%5.0d"; data[7] = 0 + + for (i = 1; i <= 7; i++) { + format = "%s, %d --- |" fmt[i] "|\n" + printf(format, fmt[i], data[i], data[i]) + } + +} diff --git a/test/printf1.ok b/test/printf1.ok new file mode 100644 index 00000000..32b3a7d8 --- /dev/null +++ b/test/printf1.ok @@ -0,0 +1,7 @@ +%8.5d, 100 --- | 00100| +%#o, 0 --- |0| +%#.1o, 0 --- |0| +%#.0o, 0 --- |0| +%#x, 0 --- |0| +%.0d, 0 --- || +%5.0d, 0 --- | | diff --git a/test/reg/exp.awk b/test/reg/Obsolete/exp.awk index 4e707f89..4e707f89 100644 --- a/test/reg/exp.awk +++ b/test/reg/Obsolete/exp.awk diff --git a/test/reg/exp.good b/test/reg/Obsolete/exp.good index 07b88537..07b88537 100644 --- a/test/reg/exp.good +++ b/test/reg/Obsolete/exp.good diff --git a/test/reg/exp.in b/test/reg/Obsolete/exp.in index e69de29b..e69de29b 100644 --- a/test/reg/exp.in +++ b/test/reg/Obsolete/exp.in diff --git a/test/reg/log.awk b/test/reg/Obsolete/log.awk index bcae90b8..bcae90b8 100644 --- a/test/reg/log.awk +++ b/test/reg/Obsolete/log.awk diff --git a/test/reg/log.good b/test/reg/Obsolete/log.good index 857ab770..857ab770 100644 --- a/test/reg/log.good +++ b/test/reg/Obsolete/log.good diff --git a/test/reg/log.in b/test/reg/Obsolete/log.in index e69de29b..e69de29b 100644 --- a/test/reg/log.in +++ b/test/reg/Obsolete/log.in diff --git a/test/zeroflag.awk b/test/zeroflag.awk new file mode 100644 index 00000000..526ed0e8 --- /dev/null +++ b/test/zeroflag.awk @@ -0,0 +1 @@ +BEGIN { printf("%2.1d---%02.1d\n", 2, 2) } diff --git a/test/zeroflag.ok b/test/zeroflag.ok new file mode 100644 index 00000000..937c0ede --- /dev/null +++ b/test/zeroflag.ok @@ -0,0 +1 @@ + 2--- 2 |