├── .gitignore ├── ABOUT-NLS ├── AUTHORS ├── COPYING ├── ChangeLog ├── ChangeLog.0 ├── Checklist ├── FUTURES ├── INSTALL ├── LIMITATIONS ├── Makefile.am ├── Makefile.in ├── NEWS ├── NEWS.0 ├── POSIX.STD ├── PROBLEMS ├── README ├── README.cvs ├── README.git ├── README_d ├── ChangeLog ├── ChangeLog.0 ├── README.VMS ├── README.bootstrap ├── README.hacking ├── README.mpfr ├── README.multibyte ├── README.os2 ├── README.pc ├── README.solaris ├── README.tests └── README.zos ├── TODO ├── TODO.xgawk ├── aclocal.m4 ├── array.c ├── awk.h ├── awkgram.c ├── awkgram.y ├── awklib ├── .gitignore ├── ChangeLog ├── ChangeLog.0 ├── Makefile.am ├── Makefile.in ├── eg │ ├── data │ │ ├── BBS-list │ │ ├── class_data1 │ │ ├── class_data2 │ │ ├── guide-mellow.po │ │ ├── guide.po │ │ └── inventory-shipped │ ├── lib │ │ ├── assert.awk │ │ ├── bits2str.awk │ │ ├── cliff_rand.awk │ │ ├── ctime.awk │ │ ├── ftrans.awk │ │ ├── getopt.awk │ │ ├── gettime.awk │ │ ├── grcat.c │ │ ├── groupawk.in │ │ ├── join.awk │ │ ├── libintl.awk │ │ ├── noassign.awk │ │ ├── ord.awk │ │ ├── passwdawk.in │ │ ├── pwcat.c │ │ ├── quicksort.awk │ │ ├── readable.awk │ │ ├── rewind.awk │ │ ├── round.awk │ │ ├── strtonum.awk │ │ ├── walkarray.awk │ │ └── zerofile.awk │ ├── misc │ │ ├── addresses.csv │ │ ├── arraymax.awk │ │ ├── arraymax.data │ │ ├── findpat.awk │ │ ├── findpat.data │ │ └── simple-csv.awk │ ├── network │ │ ├── PostAgent.sh │ │ ├── coreserv.awk │ │ ├── eliza.awk │ │ ├── fingerclient.awk │ │ ├── geturl.awk │ │ ├── hello-serv.awk │ │ ├── maze.awk │ │ ├── mobag.awk │ │ ├── panic.awk │ │ ├── protbase.awk │ │ ├── protbase.request │ │ ├── protbase.result │ │ ├── remconf.awk │ │ ├── statist.awk │ │ ├── stoxdata.txt │ │ ├── stoxpred.awk │ │ ├── testserv.awk │ │ ├── urlchk.awk │ │ └── webgrab.awk │ └── prog │ │ ├── alarm.awk │ │ ├── anagram.awk │ │ ├── awksed.awk │ │ ├── cut.awk │ │ ├── dupword.awk │ │ ├── egrep.awk │ │ ├── extract.awk │ │ ├── guide.awk │ │ ├── histsort.awk │ │ ├── id.awk │ │ ├── igawk.sh │ │ ├── indirectcall.awk │ │ ├── labels.awk │ │ ├── split.awk │ │ ├── tee.awk │ │ ├── testbits.awk │ │ ├── translate.awk │ │ ├── uniq.awk │ │ ├── wc.awk │ │ └── wordfreq.awk ├── extract.awk └── stamp-eg ├── bisonfix.awk ├── bootstrap.sh ├── builtin.c ├── cint_array.c ├── cmd.h ├── command.c ├── command.y ├── config.guess ├── config.rpath ├── config.sub ├── configh.in ├── configure ├── configure.ac ├── custom.h ├── debug.c ├── depcomp ├── dfa.c ├── dfa.h ├── doc ├── ChangeLog ├── ChangeLog.0 ├── Makefile.am ├── Makefile.in ├── README.card ├── ad.block ├── api.texi ├── awkcard.in ├── awkforai.txt ├── bc_notes ├── cardfonts ├── colors ├── gawk.1 ├── gawk.info ├── gawk.texi ├── gawkinet.info ├── gawkinet.texi ├── general-program.eps ├── general-program.fig ├── general-program.pdf ├── igawk.1 ├── lflashlight-small.xpic ├── lflashlight.eps ├── lflashlight.pdf ├── macros ├── no.colors ├── process-flow.eps ├── process-flow.fig ├── process-flow.pdf ├── rflashlight-small.xpic ├── rflashlight.eps ├── rflashlight.pdf ├── setter.outline ├── statist.eps ├── statist.jpg ├── statist.pdf └── texinfo.tex ├── eval.c ├── ext.c ├── extension ├── .gitignore ├── ABOUT-NLS ├── AUTHORS ├── COPYING ├── ChangeLog ├── ChangeLog.0 ├── INSTALL ├── Makefile.am ├── Makefile.in ├── NEWS ├── README ├── README.fts ├── aclocal.m4 ├── build-aux │ ├── ChangeLog │ ├── ar-lib │ ├── config.guess │ ├── config.rpath │ ├── config.sub │ ├── depcomp │ ├── install-sh │ ├── ltmain.sh │ └── missing ├── configh.in ├── configure ├── configure.ac ├── filefuncs.3am ├── filefuncs.c ├── fnmatch.3am ├── fnmatch.c ├── fork.3am ├── fork.c ├── fts.3 ├── gawkfts.c ├── gawkfts.h ├── m4 │ ├── ChangeLog │ ├── gettext.m4 │ ├── iconv.m4 │ ├── intlmacosx.m4 │ ├── lib-ld.m4 │ ├── lib-link.m4 │ ├── lib-prefix.m4 │ ├── libtool.m4 │ ├── ltoptions.m4 │ ├── ltsugar.m4 │ ├── ltversion.m4 │ ├── lt~obsolete.m4 │ ├── nls.m4 │ ├── po.m4 │ └── progtest.m4 ├── ordchr.3am ├── ordchr.c ├── readdir.3am ├── readdir.c ├── readfile.3am ├── readfile.c ├── revoutput.3am ├── revoutput.c ├── revtwoway.c ├── rwarray.3am ├── rwarray.c ├── rwarray0.c ├── stack.c ├── stack.h ├── testext.c ├── time.3am └── time.c ├── field.c ├── floatcomp.c ├── floatmagic.h ├── gawkapi.c ├── gawkapi.h ├── gawkmisc.c ├── getopt.c ├── getopt.h ├── getopt1.c ├── getopt_int.h ├── gettext.h ├── install-sh ├── int_array.c ├── interpret.h ├── io.c ├── m4 ├── ChangeLog ├── ChangeLog.0 ├── arch.m4 ├── codeset.m4 ├── gettext.m4 ├── glibc2.m4 ├── glibc21.m4 ├── iconv.m4 ├── intdiv0.m4 ├── intl.m4 ├── intldir.m4 ├── intlmacosx.m4 ├── intmax.m4 ├── intmax_t.m4 ├── inttypes-pri.m4 ├── inttypes.m4 ├── inttypes_h.m4 ├── isc-posix.m4 ├── lcmessage.m4 ├── lib-ld.m4 ├── lib-link.m4 ├── lib-prefix.m4 ├── libsigsegv.m4 ├── lock.m4 ├── longdouble.m4 ├── longlong.m4 ├── mpfr.m4 ├── nls.m4 ├── noreturn.m4 ├── po.m4 ├── printf-posix.m4 ├── progtest.m4 ├── readline.m4 ├── signed.m4 ├── size_max.m4 ├── socket.m4 ├── stdint_h.m4 ├── uintmax_t.m4 ├── ulonglong.m4 ├── visibility.m4 ├── wchar_t.m4 ├── wint_t.m4 └── xsize.m4 ├── main.c ├── mbsupport.h ├── missing ├── missing_d ├── COPYING.LIB ├── ChangeLog ├── ChangeLog.0 ├── README ├── gawkbool.h ├── getaddrinfo.c ├── getaddrinfo.h ├── memcmp.c ├── memcpy.c ├── memmove.c ├── memset.c ├── mktime.c ├── setenv.c ├── snprintf.c ├── strchr.c ├── strcoll.c ├── strerror.c ├── strftime.c ├── strncasecmp.c ├── strtod.c ├── strtoul.c ├── system.c ├── tzset.c ├── usleep.c └── wcmisc.c ├── mkinstalldirs ├── mpfr.c ├── msg.c ├── node.c ├── pc ├── ChangeLog ├── ChangeLog.0 ├── Makefile ├── Makefile.tst ├── awklib │ ├── igawk │ ├── igawk.awk │ └── igawk.bat ├── config.h ├── config.sed ├── configpk.sed ├── gawk.def ├── gawkmisc.pc ├── getid.c ├── install.awk ├── make-config.bat ├── mkinstal.sh ├── popen.c ├── popen.h └── testoutcmp.awk ├── po ├── .gitignore ├── ChangeLog ├── ChangeLog.0 ├── LINGUAS ├── Makefile.in.in ├── Makevars ├── Makevars.template ├── POTFILES.in ├── README ├── Rules-quot ├── ast.po ├── boldquot.sed ├── ca.po ├── da.gmo ├── da.po ├── de.gmo ├── de.po ├── en@boldquot.header ├── en@quot.header ├── es.gmo ├── es.po ├── fi.gmo ├── fi.po ├── fr.gmo ├── fr.po ├── ga.po ├── gawk.pot ├── he.po ├── id.po ├── insert-header.sin ├── it.gmo ├── it.po ├── ja.gmo ├── ja.po ├── nl.gmo ├── nl.po ├── pl.gmo ├── pl.po ├── pt_BR.po ├── quot.sed ├── remove-potcdate.sin ├── ro.po ├── rw.po ├── stamp-po ├── sv.gmo ├── sv.po ├── tr.po ├── vi.gmo ├── vi.po └── zh_CN.po ├── posix ├── ChangeLog ├── ChangeLog.0 └── gawkmisc.c ├── profile.c ├── protos.h ├── random.c ├── random.h ├── re.c ├── regcomp.c ├── regex.c ├── regex.h ├── regex_internal.c ├── regex_internal.h ├── regexec.c ├── replace.c ├── str_array.c ├── symbol.c ├── test ├── ChangeLog ├── ChangeLog.0 ├── Gentests ├── Gentests.vms ├── Makefile.am ├── Makefile.in ├── Maketests ├── README ├── aadelete1.awk ├── aadelete1.ok ├── aadelete2.awk ├── aadelete2.ok ├── aarray1.awk ├── aarray1.ok ├── aasort.awk ├── aasort.ok ├── aasorti.awk ├── aasorti.ok ├── addcomma.awk ├── addcomma.in ├── addcomma.ok ├── anchgsub.awk ├── anchgsub.in ├── anchgsub.ok ├── argarray.awk ├── argarray.in ├── argarray.ok ├── argtest.awk ├── argtest.ok ├── arrayparm.awk ├── arrayparm.ok ├── arrayprm2.awk ├── arrayprm2.ok ├── arrayprm3.awk ├── arrayprm3.ok ├── arrayref.awk ├── arrayref.ok ├── arraysort.awk ├── arraysort.ok ├── arrymem1.awk ├── arrymem1.ok ├── arryref2.awk ├── arryref2.ok ├── arryref3.awk ├── arryref3.ok ├── arryref4.awk ├── arryref4.ok ├── arryref5.awk ├── arryref5.ok ├── arynasty.awk ├── arynasty.ok ├── arynocls.awk ├── arynocls.in ├── arynocls.ok ├── aryprm1.awk ├── aryprm1.ok ├── aryprm2.awk ├── aryprm2.ok ├── aryprm3.awk ├── aryprm3.ok ├── aryprm4.awk ├── aryprm4.ok ├── aryprm5.awk ├── aryprm5.ok ├── aryprm6.awk ├── aryprm6.ok ├── aryprm7.awk ├── aryprm7.ok ├── aryprm8.awk ├── aryprm8.ok ├── arysubnm.awk ├── arysubnm.ok ├── asgext.awk ├── asgext.in ├── asgext.ok ├── asort.awk ├── asort.ok ├── asorti.awk ├── asorti.ok ├── assignconst.awk ├── assignconst.ok ├── awkpath.ok ├── back89.awk ├── back89.in ├── back89.ok ├── backgsub.awk ├── backgsub.in ├── backgsub.ok ├── backw.awk ├── backw.in ├── backw.ok ├── badargs.ok ├── beginfile1.awk ├── beginfile1.ok ├── beginfile2.in ├── beginfile2.ok ├── beginfile2.sh ├── binmode1.ok ├── charasbytes.awk ├── charasbytes.in ├── charasbytes.ok ├── childin.awk ├── childin.in ├── childin.ok ├── clobber.awk ├── clobber.ok ├── clos1way.awk ├── clos1way.ok ├── closebad.awk ├── closebad.ok ├── clsflnam.awk ├── clsflnam.in ├── clsflnam.ok ├── compare.awk ├── compare.in ├── compare.ok ├── compare2.awk ├── compare2.ok ├── concat1.awk ├── concat1.in ├── concat1.ok ├── concat2.awk ├── concat2.ok ├── concat3.awk ├── concat3.ok ├── concat4.awk ├── concat4.in ├── concat4.ok ├── convfmt.awk ├── convfmt.ok ├── datanonl.awk ├── datanonl.in ├── datanonl.ok ├── defref.awk ├── defref.ok ├── delargv.awk ├── delargv.ok ├── delarpm2.awk ├── delarpm2.ok ├── delarprm.awk ├── delarprm.ok ├── delfunc.awk ├── delfunc.ok ├── delsub.awk ├── delsub.ok ├── devfd.in1 ├── devfd.in2 ├── devfd.in4 ├── devfd.in5 ├── devfd.ok ├── devfd1.awk ├── devfd1.ok ├── devfd2.ok ├── dfastress.awk ├── dfastress.ok ├── double1.awk ├── double1.ok ├── double2.awk ├── double2.ok ├── dtdgport.awk ├── dumpvars.in ├── dumpvars.ok ├── dynlj.awk ├── dynlj.ok ├── eofsplit.awk ├── eofsplit.ok ├── exit.ok ├── exit.sh ├── exitval1.awk ├── exitval1.ok ├── exitval2.awk ├── exitval2.ok ├── exitval2.w32 ├── fcall_exit.awk ├── fcall_exit.ok ├── fcall_exit2.awk ├── fcall_exit2.in ├── fcall_exit2.ok ├── fflush.ok ├── fflush.sh ├── fieldwdth.awk ├── fieldwdth.in ├── fieldwdth.ok ├── filefuncs.awk ├── filefuncs.ok ├── fldchg.awk ├── fldchg.in ├── fldchg.ok ├── fldchgnf.awk ├── fldchgnf.in ├── fldchgnf.ok ├── fmtspcl-mpfr.ok ├── fmtspcl.awk ├── fmtspcl.tok ├── fmttest.awk ├── fmttest.ok ├── fnamedat.awk ├── fnamedat.in ├── fnamedat.ok ├── fnarray.awk ├── fnarray.ok ├── fnarray2.awk ├── fnarray2.in ├── fnarray2.ok ├── fnarydel-mpfr.ok ├── fnarydel.awk ├── fnarydel.ok ├── fnaryscl.awk ├── fnaryscl.ok ├── fnasgnm.awk ├── fnasgnm.in ├── fnasgnm.ok ├── fnmatch.awk ├── fnmatch.ok ├── fnmisc.awk ├── fnmisc.ok ├── fnparydl-mpfr.ok ├── fnparydl.awk ├── fnparydl.ok ├── fordel.awk ├── fordel.ok ├── fork.awk ├── fork.ok ├── fork2.awk ├── fork2.ok ├── forref.awk ├── forref.ok ├── forsimp.awk ├── forsimp.ok ├── fpat1.awk ├── fpat1.in ├── fpat1.ok ├── fpat2.awk ├── fpat2.ok ├── fpat3.awk ├── fpat3.in ├── fpat3.ok ├── fpatnull.awk ├── fpatnull.in ├── fpatnull.ok ├── fsbs.awk ├── fsbs.in ├── fsbs.ok ├── fsfwfs.awk ├── fsfwfs.in ├── fsfwfs.ok ├── fsrs.awk ├── fsrs.in ├── fsrs.ok ├── fsspcoln.awk ├── fsspcoln.in ├── fsspcoln.ok ├── fstabplus.awk ├── fstabplus.in ├── fstabplus.ok ├── fts.awk ├── functab1.awk ├── functab1.ok ├── functab2.awk ├── functab2.ok ├── functab3.awk ├── functab3.ok ├── functab4.awk ├── functab4.ok ├── funlen.awk ├── funlen.in ├── funlen.ok ├── funsemnl.awk ├── funsemnl.ok ├── funsmnam.awk ├── funsmnam.ok ├── funstack.awk ├── funstack.in ├── funstack.ok ├── fwtest.awk ├── fwtest.in ├── fwtest.ok ├── fwtest2.awk ├── fwtest2.in ├── fwtest2.ok ├── fwtest3.awk ├── fwtest3.in ├── fwtest3.ok ├── gensub.awk ├── gensub.in ├── gensub.ok ├── gensub2.awk ├── gensub2.ok ├── getline.awk ├── getline.in ├── getline.ok ├── getline2.awk ├── getline2.ok ├── getline3.awk ├── getline3.ok ├── getline4.awk ├── getline4.in ├── getline4.ok ├── getline5.awk ├── getline5.ok ├── getlnbuf.awk ├── getlnbuf.in ├── getlnbuf.ok ├── getlndir.awk ├── getlndir.ok ├── getlnhd.awk ├── getlnhd.ok ├── getnr2tb.awk ├── getnr2tb.in ├── getnr2tb.ok ├── getnr2tm.awk ├── getnr2tm.in ├── getnr2tm.ok ├── gnuops2.awk ├── gnuops2.ok ├── gnuops3.awk ├── gnuops3.ok ├── gnureops.awk ├── gnureops.ok ├── gsubasgn.awk ├── gsubasgn.ok ├── gsubtest.awk ├── gsubtest.ok ├── gsubtst2.awk ├── gsubtst2.ok ├── gsubtst3.awk ├── gsubtst3.in ├── gsubtst3.ok ├── gsubtst4.awk ├── gsubtst4.ok ├── gsubtst5.awk ├── gsubtst5.in ├── gsubtst5.ok ├── gsubtst6.awk ├── gsubtst6.ok ├── gsubtst7.awk ├── gsubtst7.in ├── gsubtst7.ok ├── gsubtst8.awk ├── gsubtst8.in ├── gsubtst8.ok ├── gtlnbufv.awk ├── hello.awk ├── hex.awk ├── hex.ok ├── hsprint.awk ├── hsprint.ok ├── icasefs.awk ├── icasefs.ok ├── icasers.awk ├── icasers.in ├── icasers.ok ├── id.awk ├── id.ok ├── igncdym.awk ├── igncdym.in ├── igncdym.ok ├── igncfs.awk ├── igncfs.in ├── igncfs.ok ├── ignrcas2.awk ├── ignrcas2.ok ├── ignrcase.awk ├── ignrcase.in ├── ignrcase.ok ├── incdupe.ok ├── incdupe2.ok ├── incdupe3.ok ├── incdupe4.ok ├── incdupe5.ok ├── incdupe6.ok ├── incdupe7.ok ├── inchello.awk ├── inclib.awk ├── include.awk ├── include.ok ├── include2.ok ├── indirectcall.awk ├── indirectcall.in ├── indirectcall.ok ├── inftest.awk ├── inftest.ok ├── inputred.awk ├── inputred.ok ├── intest.awk ├── intest.ok ├── intformat.awk ├── intformat.ok ├── intprec.awk ├── intprec.ok ├── iobug1.awk ├── iobug1.ok ├── jarebug.awk ├── jarebug.in ├── jarebug.ok ├── jarebug.sh ├── lc_num1.awk ├── lc_num1.ok ├── leaddig.awk ├── leaddig.ok ├── leadnl.awk ├── leadnl.in ├── leadnl.ok ├── lib │ └── awkpath.awk ├── lint.awk ├── lint.ok ├── lintold.awk ├── lintold.in ├── lintold.ok ├── lintwarn.awk ├── lintwarn.ok ├── litoct.awk ├── litoct.ok ├── localenl.ok ├── localenl.sh ├── longdbl.awk ├── longdbl.in ├── longdbl.ok ├── longsub.awk ├── longsub.in ├── longsub.ok ├── longwrds.awk ├── longwrds.in ├── longwrds.ok ├── manglprm.awk ├── manglprm.in ├── manglprm.ok ├── manyfiles.awk ├── manyfiles.ok ├── match1.awk ├── match1.ok ├── match2.awk ├── match2.ok ├── match3.awk ├── match3.in ├── match3.ok ├── math.awk ├── math.ok ├── mbfw1.awk ├── mbfw1.in ├── mbfw1.ok ├── mbprintf1.awk ├── mbprintf1.in ├── mbprintf1.ok ├── mbprintf2.awk ├── mbprintf2.ok ├── mbprintf3.awk ├── mbprintf3.in ├── mbprintf3.ok ├── mbstr1.awk ├── mbstr1.ok ├── membug1.awk ├── membug1.in ├── membug1.ok ├── messages.awk ├── minusstr.awk ├── minusstr.ok ├── mixed1.ok ├── mmap8k.in ├── mpfrbigint.awk ├── mpfrbigint.ok ├── mpfrexprange.awk ├── mpfrexprange.ok ├── mpfrieee.awk ├── mpfrieee.ok ├── mpfrnr.awk ├── mpfrnr.in ├── mpfrnr.ok ├── mpfrrnd.awk ├── mpfrrnd.ok ├── mpfrsort.awk ├── mpfrsort.ok ├── mtchi18n.awk ├── mtchi18n.in ├── mtchi18n.ok ├── nasty.awk ├── nasty.ok ├── nasty2.awk ├── nasty2.ok ├── nastyparm.awk ├── nastyparm.ok ├── negexp.awk ├── negexp.ok ├── negrange.awk ├── negrange.ok ├── nested.awk ├── nested.in ├── nested.ok ├── next.ok ├── next.sh ├── nfldstr.awk ├── nfldstr.in ├── nfldstr.ok ├── nfneg.awk ├── nfneg.ok ├── nfset.awk ├── nfset.in ├── nfset.ok ├── nlfldsep.awk ├── nlfldsep.in ├── nlfldsep.ok ├── nlinstr.awk ├── nlinstr.in ├── nlinstr.ok ├── nlstrina.awk ├── nlstrina.ok ├── noeffect.awk ├── noeffect.ok ├── nofile.ok ├── nofmtch.awk ├── nofmtch.ok ├── noloop1.awk ├── noloop1.in ├── noloop1.ok ├── noloop2.awk ├── noloop2.in ├── noloop2.ok ├── nondec.awk ├── nondec.ok ├── nondec2.awk ├── nondec2.ok ├── nonl.awk ├── nonl.ok ├── noparms.awk ├── noparms.ok ├── nors.in ├── nors.ok ├── nulrsend.awk ├── nulrsend.in ├── nulrsend.ok ├── numindex.awk ├── numindex.in ├── numindex.ok ├── numsubstr.awk ├── numsubstr.in ├── numsubstr.ok ├── octsub.awk ├── octsub.ok ├── ofmt.awk ├── ofmt.in ├── ofmt.ok ├── ofmta.awk ├── ofmta.ok ├── ofmtbig.awk ├── ofmtbig.in ├── ofmtbig.ok ├── ofmtfidl.awk ├── ofmtfidl.in ├── ofmtfidl.ok ├── ofmts.awk ├── ofmts.in ├── ofmts.ok ├── ofs1.awk ├── ofs1.in ├── ofs1.ok ├── onlynl.awk ├── onlynl.in ├── onlynl.ok ├── opasnidx.awk ├── opasnidx.ok ├── opasnslf.awk ├── opasnslf.ok ├── ordchr.awk ├── ordchr.ok ├── ordchr2.ok ├── out1.ok ├── out2.ok ├── out3.ok ├── paramdup.awk ├── paramdup.ok ├── paramres.awk ├── paramres.ok ├── paramtyp.awk ├── paramtyp.ok ├── parse1.awk ├── parse1.in ├── parse1.ok ├── parsefld.awk ├── parsefld.in ├── parsefld.ok ├── parseme.awk ├── parseme.ok ├── patsplit.awk ├── patsplit.ok ├── pcntplus.awk ├── pcntplus.ok ├── pid.awk ├── pid.ok ├── pid.sh ├── pipeio1.awk ├── pipeio1.ok ├── pipeio2.awk ├── pipeio2.in ├── pipeio2.ok ├── posix.awk ├── posix.in ├── posix.ok ├── posix2008sub.awk ├── posix2008sub.ok ├── poundbang.awk ├── prdupval.awk ├── prdupval.in ├── prdupval.ok ├── prec.awk ├── prec.ok ├── printf0.awk ├── printf0.ok ├── printf1.awk ├── printf1.ok ├── printfbad1.awk ├── printfbad1.ok ├── printfbad2.awk ├── printfbad2.in ├── printfbad2.ok ├── printfbad3.awk ├── printfbad3.ok ├── printfloat.awk ├── printlang.awk ├── prmarscl.awk ├── prmarscl.ok ├── prmreuse.awk ├── prmreuse.ok ├── procinfs.awk ├── procinfs.ok ├── profile2.ok ├── profile3.awk ├── profile3.ok ├── prt1eval.awk ├── prt1eval.ok ├── prtoeval.awk ├── prtoeval.ok ├── pty1.awk ├── pty1.ok ├── rand-mpfr.ok ├── rand-mpfr1.ok ├── rand.awk ├── rand.ok ├── range1.awk ├── range1.in ├── range1.ok ├── readdir.awk ├── readdir0.awk ├── rebt8b1.awk ├── rebt8b1.ok ├── rebt8b2.awk ├── rebt8b2.ok ├── rebuf.awk ├── rebuf.in ├── rebuf.ok ├── redfilnm.awk ├── redfilnm.in ├── redfilnm.ok ├── reg │ ├── Obsolete │ │ ├── exp.awk │ │ ├── exp.good │ │ ├── exp.in │ │ ├── log.awk │ │ ├── log.good │ │ └── log.in │ ├── exp-eq.awk │ ├── exp-eq.good │ ├── exp-eq.in │ ├── func.awk │ ├── func.good │ ├── func.in │ ├── func2.awk │ ├── func2.good │ └── func2.in ├── regeq.awk ├── regeq.in ├── regeq.ok ├── regexprange.awk ├── regexprange.ok ├── regrange.awk ├── regrange.ok ├── regtest.sh ├── regx8bit.awk ├── regx8bit.ok ├── reindops.awk ├── reindops.in ├── reindops.ok ├── reint.awk ├── reint.in ├── reint.ok ├── reint2.awk ├── reint2.in ├── reint2.ok ├── reparse.awk ├── reparse.in ├── reparse.ok ├── resplit.awk ├── resplit.in ├── resplit.ok ├── revout.awk ├── revout.ok ├── revtwoway.awk ├── revtwoway.ok ├── rri1.awk ├── rri1.in ├── rri1.ok ├── rs.awk ├── rs.in ├── rs.ok ├── rsnul1nl.awk ├── rsnul1nl.in ├── rsnul1nl.ok ├── rsnulbig.ok ├── rsnulbig2.ok ├── rsstart1.awk ├── rsstart1.in ├── rsstart1.ok ├── rsstart2.awk ├── rsstart2.ok ├── rsstart3.ok ├── rstest1.awk ├── rstest1.ok ├── rstest2.awk ├── rstest2.ok ├── rstest3.awk ├── rstest3.ok ├── rstest4.awk ├── rstest4.ok ├── rstest5.awk ├── rstest5.ok ├── rstest6.awk ├── rstest6.in ├── rstest6.ok ├── rswhite.awk ├── rswhite.in ├── rswhite.ok ├── rtlen.ok ├── rtlen.sh ├── rtlen01.ok ├── rtlen01.sh ├── rwarray.awk ├── rwarray.in ├── rwarray.ok ├── scalar.awk ├── scalar.ok ├── sclforin.awk ├── sclforin.ok ├── sclifin.awk ├── sclifin.ok ├── shadow.awk ├── shadow.ok ├── sort1.awk ├── sort1.ok ├── sortempty.awk ├── sortempty.ok ├── sortfor.awk ├── sortfor.in ├── sortfor.ok ├── sortu.awk ├── sortu.ok ├── space.ok ├── splitarg4.awk ├── splitarg4.in ├── splitarg4.ok ├── splitargv.awk ├── splitargv.in ├── splitargv.ok ├── splitarr.awk ├── splitarr.ok ├── splitdef.awk ├── splitdef.ok ├── splitvar.awk ├── splitvar.in ├── splitvar.ok ├── splitwht.awk ├── splitwht.ok ├── sprintfc.awk ├── sprintfc.in ├── sprintfc.ok ├── strcat1.awk ├── strcat1.ok ├── strftime.awk ├── strftlng.awk ├── strftlng.ok ├── strnum1.awk ├── strnum1.ok ├── strtod.awk ├── strtod.in ├── strtod.ok ├── strtonum.awk ├── strtonum.ok ├── subamp.awk ├── subamp.in ├── subamp.ok ├── subi18n.awk ├── subi18n.ok ├── subsepnm.awk ├── subsepnm.ok ├── subslash.awk ├── subslash.ok ├── substr.awk ├── substr.ok ├── swaplns.awk ├── swaplns.in ├── swaplns.ok ├── switch2.awk ├── switch2.ok ├── symtab1.awk ├── symtab1.ok ├── symtab2.awk ├── symtab2.ok ├── symtab3.awk ├── symtab3.ok ├── synerr1.awk ├── synerr1.ok ├── synerr2.awk ├── synerr2.ok ├── testext.ok ├── time.awk ├── time.ok ├── tradanch.awk ├── tradanch.in ├── tradanch.ok ├── tweakfld.awk ├── tweakfld.in ├── tweakfld.ok ├── uninit2.awk ├── uninit2.ok ├── uninit3.awk ├── uninit3.ok ├── uninit4.awk ├── uninit4.ok ├── uninit5.awk ├── uninit5.ok ├── uninitialized.awk ├── uninitialized.ok ├── unterm.awk ├── unterm.ok ├── uparrfs.awk ├── uparrfs.in ├── uparrfs.ok ├── wideidx.awk ├── wideidx.in ├── wideidx.ok ├── wideidx2.awk ├── wideidx2.ok ├── widesub.awk ├── widesub.ok ├── widesub2.awk ├── widesub2.ok ├── widesub3.awk ├── widesub3.in ├── widesub3.ok ├── widesub4.awk ├── widesub4.ok ├── wjposer1.awk ├── wjposer1.in ├── wjposer1.ok ├── xref.awk ├── xref.original ├── zero2.awk ├── zero2.ok ├── zeroe0.awk ├── zeroe0.ok ├── zeroflag.awk └── zeroflag.ok ├── version.c ├── version.in ├── vms ├── ChangeLog ├── ChangeLog.0 ├── descrip.mms ├── fcntl.h ├── gawk.cld ├── gawk.hlp ├── gawkmisc.vms ├── posix-cc.sh ├── redirect.h ├── unixlib.h ├── varargs.h ├── vms-conf.h ├── vms.h ├── vms_args.c ├── vms_cli.c ├── vms_fwrite.c ├── vms_gawk.c ├── vms_misc.c ├── vms_popen.c ├── vmsbuild.com └── vmstest.com ├── xalloc.h └── ylwrap /.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore files that are created by a build. 2 | # For example objects and archives. 3 | *.[oa] 4 | 5 | # Directories 6 | autom4te.cache 7 | .deps 8 | 9 | # Single files. 10 | Makefile 11 | config.h 12 | config.log 13 | config.status 14 | dgawk 15 | gawk 16 | pgawk 17 | stamp-h1 18 | libtool 19 | 20 | test/fmtspcl.ok 21 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Copyright (C) 2006, 2007 Free Software Foundation, Inc. 2 | 3 | Copying and distribution of this file, with or without modification, 4 | are permitted in any medium without royalty provided the copyright 5 | notice and this notice are preserved. 6 | 7 | Gawk was written by Paul Rubin, and finished by Paul Finlason and 8 | Richard Stallman. 9 | 10 | David Trueman and Arnold Robbins took it over, with David doing most 11 | of the work to make it compatible with new awk. 12 | 13 | Circa 1994, Arnold Robbins took over maintenance. 14 | -------------------------------------------------------------------------------- /README_d/ChangeLog.0: -------------------------------------------------------------------------------- 1 | 2010-12-18 Eli Zaretskii 2 | 3 | * README.pc: Update and simplify. Remove lots of 4 | outdated stuff for systems and configurations no longer supported. 5 | 6 | 2010-12-18 Arnold Robbins 7 | 8 | * ChangeLog: Created. 9 | -------------------------------------------------------------------------------- /README_d/README.hacking: -------------------------------------------------------------------------------- 1 | * Use one of the following macros to access the value of a numeric NODE: 2 | Macro Returned C type 3 | --------------------------------------- 4 | get_number_ui(n) unsigned long 5 | get_number_si(n) long 6 | get_number_d(n) double 7 | get_number_uj(n) uintmax_t 8 | 9 | * Use iszero(n) to test if a numeric NODE is zero. 10 | 11 | -------------------------------------------------------------------------------- /README_d/README.solaris: -------------------------------------------------------------------------------- 1 | Fri Jul 15 14:24:00 IDT 2011 2 | ============================ 3 | It looks like you need to use 4 | 5 | -Xc -D_XPG4_2 6 | 7 | on Solaris 10 with the Sun C compiler when compiling gawk in order for 8 | libsigsegv to be found correctly, and 9 | 10 | -Xc -D_XPG4_2 -Duint64_t=upad64_t 11 | 12 | on Solaris 9. 13 | 14 | Tue Apr 20 11:33:20 IDT 2010 15 | ============================ 16 | The lc_num1 test fails on Solaris 10 systems. This is a bug with Solaris, 17 | not gawk. 18 | 19 | Arnold Robbins 20 | arnold@skeeve.com 21 | -------------------------------------------------------------------------------- /awklib/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore files that are created by a build. 2 | # For example objects and archives. 3 | grcat 4 | group.awk 5 | igawk 6 | passwd.awk 7 | pwcat 8 | 9 | -------------------------------------------------------------------------------- /awklib/ChangeLog: -------------------------------------------------------------------------------- 1 | 2012-03-28 Arnold D. Robbins 2 | 3 | * 4.0.1: Release tar ball made. 4 | 5 | 2011-06-24 Arnold D. Robbins 6 | 7 | * Makefile.am (EXTRA_DIST): Add ChangeLog.0. 8 | * 4.0.0: Remake the tar ball. 9 | 10 | 2011-06-23 Arnold D. Robbins 11 | 12 | * ChangeLog.0: Rotated ChangeLog into this file. 13 | * ChangeLog: Created anew for gawk 4.0.0 and on. 14 | * 4.0.0: Release tar ball made. 15 | -------------------------------------------------------------------------------- /awklib/eg/data/BBS-list: -------------------------------------------------------------------------------- 1 | aardvark 555-5553 1200/300 B 2 | alpo-net 555-3412 2400/1200/300 A 3 | barfly 555-7685 1200/300 A 4 | bites 555-1675 2400/1200/300 A 5 | camelot 555-0542 300 C 6 | core 555-2912 1200/300 C 7 | fooey 555-1234 2400/1200/300 B 8 | foot 555-6699 1200/300 B 9 | macfoo 555-6480 1200/300 A 10 | sdace 555-3430 2400/1200/300 A 11 | sabafoo 555-2127 1200/300 C 12 | -------------------------------------------------------------------------------- /awklib/eg/data/class_data1: -------------------------------------------------------------------------------- 1 | Biology_101 sum average data: 87.0 92.4 78.5 94.9 2 | Chemistry_305 sum average data: 75.2 98.3 94.7 88.2 3 | English_401 sum average data: 100.0 95.6 87.1 93.4 4 | -------------------------------------------------------------------------------- /awklib/eg/data/class_data2: -------------------------------------------------------------------------------- 1 | Biology_101 sum average sort rsort data: 87.0 92.4 78.5 94.9 2 | Chemistry_305 sum average sort rsort data: 75.2 98.3 94.7 88.2 3 | English_401 sum average sort rsort data: 100.0 95.6 87.1 93.4 4 | -------------------------------------------------------------------------------- /awklib/eg/data/guide-mellow.po: -------------------------------------------------------------------------------- 1 | #: guide.awk:4 2 | msgid "Don't Panic" 3 | msgstr "Hey man, relax!" 4 | 5 | #: guide.awk:5 6 | msgid "The Answer Is" 7 | msgstr "Like, the scoop is" 8 | 9 | -------------------------------------------------------------------------------- /awklib/eg/data/guide.po: -------------------------------------------------------------------------------- 1 | #: guide.awk:4 2 | msgid "Don't Panic" 3 | msgstr "" 4 | 5 | #: guide.awk:5 6 | msgid "The Answer Is" 7 | msgstr "" 8 | 9 | -------------------------------------------------------------------------------- /awklib/eg/data/inventory-shipped: -------------------------------------------------------------------------------- 1 | Jan 13 25 15 115 2 | Feb 15 32 24 226 3 | Mar 15 24 34 228 4 | Apr 31 52 63 420 5 | May 16 34 29 208 6 | Jun 31 42 75 492 7 | Jul 24 34 67 436 8 | Aug 15 34 47 316 9 | Sep 13 55 37 277 10 | Oct 29 54 68 525 11 | Nov 20 87 82 577 12 | Dec 17 35 61 401 13 | 14 | Jan 21 36 64 620 15 | Feb 26 58 80 652 16 | Mar 24 75 70 495 17 | Apr 21 70 74 514 18 | -------------------------------------------------------------------------------- /awklib/eg/lib/assert.awk: -------------------------------------------------------------------------------- 1 | # assert --- assert that a condition is true. Otherwise exit. 2 | 3 | # 4 | # Arnold Robbins, arnold@skeeve.com, Public Domain 5 | # May, 1993 6 | 7 | function assert(condition, string) 8 | { 9 | if (! condition) { 10 | printf("%s:%d: assertion failed: %s\n", 11 | FILENAME, FNR, string) > "/dev/stderr" 12 | _assert_exit = 1 13 | exit 1 14 | } 15 | } 16 | 17 | END { 18 | if (_assert_exit) 19 | exit 1 20 | } 21 | -------------------------------------------------------------------------------- /awklib/eg/lib/bits2str.awk: -------------------------------------------------------------------------------- 1 | # bits2str --- turn a byte into readable 1's and 0's 2 | 3 | function bits2str(bits, data, mask) 4 | { 5 | if (bits == 0) 6 | return "0" 7 | 8 | mask = 1 9 | for (; bits != 0; bits = rshift(bits, 1)) 10 | data = (and(bits, mask) ? "1" : "0") data 11 | 12 | while ((length(data) % 8) != 0) 13 | data = "0" data 14 | 15 | return data 16 | } 17 | -------------------------------------------------------------------------------- /awklib/eg/lib/cliff_rand.awk: -------------------------------------------------------------------------------- 1 | # cliff_rand.awk --- generate Cliff random numbers 2 | # 3 | # Arnold Robbins, arnold@skeeve.com, Public Domain 4 | # December 2000 5 | 6 | BEGIN { _cliff_seed = 0.1 } 7 | 8 | function cliff_rand() 9 | { 10 | _cliff_seed = (100 * log(_cliff_seed)) % 1 11 | if (_cliff_seed < 0) 12 | _cliff_seed = - _cliff_seed 13 | return _cliff_seed 14 | } 15 | -------------------------------------------------------------------------------- /awklib/eg/lib/ctime.awk: -------------------------------------------------------------------------------- 1 | # ctime.awk 2 | # 3 | # awk version of C ctime(3) function 4 | 5 | function ctime(ts, format) 6 | { 7 | format = "%a %b %e %H:%M:%S %Z %Y" 8 | if (ts == 0) 9 | ts = systime() # use current time as default 10 | return strftime(format, ts) 11 | } 12 | -------------------------------------------------------------------------------- /awklib/eg/lib/ftrans.awk: -------------------------------------------------------------------------------- 1 | # ftrans.awk --- handle data file transitions 2 | # 3 | # user supplies beginfile() and endfile() functions 4 | # 5 | # Arnold Robbins, arnold@skeeve.com, Public Domain 6 | # November 1992 7 | 8 | FNR == 1 { 9 | if (_filename_ != "") 10 | endfile(_filename_) 11 | _filename_ = FILENAME 12 | beginfile(FILENAME) 13 | } 14 | 15 | END { endfile(_filename_) } 16 | -------------------------------------------------------------------------------- /awklib/eg/lib/join.awk: -------------------------------------------------------------------------------- 1 | # join.awk --- join an array into a string 2 | # 3 | # Arnold Robbins, arnold@skeeve.com, Public Domain 4 | # May 1993 5 | 6 | function join(array, start, end, sep, result, i) 7 | { 8 | if (sep == "") 9 | sep = " " 10 | else if (sep == SUBSEP) # magic value 11 | sep = "" 12 | result = array[start] 13 | for (i = start + 1; i <= end; i++) 14 | result = result sep array[i] 15 | return result 16 | } 17 | -------------------------------------------------------------------------------- /awklib/eg/lib/libintl.awk: -------------------------------------------------------------------------------- 1 | function bindtextdomain(dir, domain) 2 | { 3 | return dir 4 | } 5 | 6 | function dcgettext(string, domain, category) 7 | { 8 | return string 9 | } 10 | 11 | function dcngettext(string1, string2, number, domain, category) 12 | { 13 | return (number == 1 ? string1 : string2) 14 | } 15 | -------------------------------------------------------------------------------- /awklib/eg/lib/noassign.awk: -------------------------------------------------------------------------------- 1 | # noassign.awk --- library file to avoid the need for a 2 | # special option that disables command-line assignments 3 | # 4 | # Arnold Robbins, arnold@skeeve.com, Public Domain 5 | # October 1999 6 | 7 | function disable_assigns(argc, argv, i) 8 | { 9 | for (i = 1; i < argc; i++) 10 | if (argv[i] ~ /^[[:alpha:]_][[:alnum:]_]*=.*/) 11 | argv[i] = ("./" argv[i]) 12 | } 13 | 14 | BEGIN { 15 | if (No_command_assign) 16 | disable_assigns(ARGC, ARGV) 17 | } 18 | -------------------------------------------------------------------------------- /awklib/eg/lib/rewind.awk: -------------------------------------------------------------------------------- 1 | # rewind.awk --- rewind the current file and start over 2 | # 3 | # Arnold Robbins, arnold@skeeve.com, Public Domain 4 | # September 2000 5 | 6 | function rewind( i) 7 | { 8 | # shift remaining arguments up 9 | for (i = ARGC; i > ARGIND; i--) 10 | ARGV[i] = ARGV[i-1] 11 | 12 | # make sure gawk knows to keep going 13 | ARGC++ 14 | 15 | # make current file next to get done 16 | ARGV[ARGIND+1] = FILENAME 17 | 18 | # do it 19 | nextfile 20 | } 21 | -------------------------------------------------------------------------------- /awklib/eg/lib/walkarray.awk: -------------------------------------------------------------------------------- 1 | function walk_array(arr, name, i) 2 | { 3 | for (i in arr) { 4 | if (isarray(arr[i])) 5 | walk_array(arr[i], (name "[" i "]")) 6 | else 7 | printf("%s[%s] = %s\n", name, i, arr[i]) 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /awklib/eg/lib/zerofile.awk: -------------------------------------------------------------------------------- 1 | # zerofile.awk --- library file to process empty input files 2 | # 3 | # Arnold Robbins, arnold@skeeve.com, Public Domain 4 | # June 2003 5 | 6 | BEGIN { Argind = 0 } 7 | 8 | ARGIND > Argind + 1 { 9 | for (Argind++; Argind < ARGIND; Argind++) 10 | zerofile(ARGV[Argind], Argind) 11 | } 12 | 13 | ARGIND != Argind { Argind = ARGIND } 14 | 15 | END { 16 | if (ARGIND > Argind) 17 | for (Argind++; Argind <= ARGIND; Argind++) 18 | zerofile(ARGV[Argind], Argind) 19 | } 20 | -------------------------------------------------------------------------------- /awklib/eg/misc/addresses.csv: -------------------------------------------------------------------------------- 1 | Robbins,Arnold,"1234 A Pretty Street, NE",MyTown,MyState,12345-6789,USA 2 | -------------------------------------------------------------------------------- /awklib/eg/misc/arraymax.awk: -------------------------------------------------------------------------------- 1 | { 2 | if ($1 > max) 3 | max = $1 4 | arr[$1] = $0 5 | } 6 | 7 | END { 8 | for (x = 1; x <= max; x++) 9 | print arr[x] 10 | } 11 | -------------------------------------------------------------------------------- /awklib/eg/misc/arraymax.data: -------------------------------------------------------------------------------- 1 | 5 I am the Five man 2 | 2 Who are you? The new number two! 3 | 4 . . . And four on the floor 4 | 1 Who is number one? 5 | 3 I three you. 6 | -------------------------------------------------------------------------------- /awklib/eg/misc/findpat.awk: -------------------------------------------------------------------------------- 1 | { 2 | if ($1 == "FIND") 3 | regex = $2 4 | else { 5 | where = match($0, regex) 6 | if (where != 0) 7 | print "Match of", regex, "found at", 8 | where, "in", $0 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /awklib/eg/misc/findpat.data: -------------------------------------------------------------------------------- 1 | FIND ru+n 2 | My program runs 3 | but not very quickly 4 | FIND Melvin 5 | JF+KM 6 | This line is property of Reality Engineering Co. 7 | Melvin was here. 8 | -------------------------------------------------------------------------------- /awklib/eg/misc/simple-csv.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | FPAT = "([^,]+)|(\"[^\"]+\")" 3 | } 4 | 5 | { 6 | print "NF = ", NF 7 | for (i = 1; i <= NF; i++) { 8 | printf("$%d = <%s>\n", i, $i) 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /awklib/eg/network/PostAgent.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | MobAg=/tmp/MobileAgent.$$ 3 | # direct script to mobile agent file 4 | cat > $MobAg 5 | # execute agent concurrently 6 | gawk -f $MobAg $MobAg > /dev/null & 7 | # HTTP header, terminator and body 8 | gawk 'BEGIN { print "\r\nAgent started" }' 9 | rm $MobAg # delete script file of agent 10 | -------------------------------------------------------------------------------- /awklib/eg/network/fingerclient.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | NetService = "/inet/tcp/0/localhost/finger" 3 | print "var{name}" |& NetService 4 | while ((NetService |& getline) > 0) 5 | print $0 6 | close(NetService) 7 | } 8 | -------------------------------------------------------------------------------- /awklib/eg/network/hello-serv.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | RS = ORS = "\r\n" 3 | HttpService = "/inet/tcp/8080/0/0" 4 | Hello = "" \ 5 | "A Famous Greeting" \ 6 | "

Hello, world

" 7 | Len = length(Hello) + length(ORS) 8 | print "HTTP/1.0 200 OK" |& HttpService 9 | print "Content-Length: " Len ORS |& HttpService 10 | print Hello |& HttpService 11 | while ((HttpService |& getline) > 0) 12 | continue; 13 | close(HttpService) 14 | } 15 | -------------------------------------------------------------------------------- /awklib/eg/network/protbase.awk: -------------------------------------------------------------------------------- 1 | { request = request "\n" $0 } 2 | 3 | END { 4 | BLASTService = "/inet/tcp/0/www.ncbi.nlm.nih.gov/80" 5 | printf "POST /cgi-bin/BLAST/nph-blast_report HTTP/1.0\n" |& BLASTService 6 | printf "Content-Length: " length(request) "\n\n" |& BLASTService 7 | printf request |& BLASTService 8 | while ((BLASTService |& getline) > 0) 9 | print $0 10 | close(BLASTService) 11 | } 12 | -------------------------------------------------------------------------------- /awklib/eg/network/protbase.request: -------------------------------------------------------------------------------- 1 | PROGRAM blastn 2 | DATALIB month 3 | EXPECT 0.75 4 | BEGIN 5 | >GAWK310 the gawking gene GNU AWK 6 | tgcttggctgaggagccataggacgagagcttcctggtgaagtgtgtttcttgaaatcat 7 | caccaccatggacagcaaa 8 | -------------------------------------------------------------------------------- /awklib/eg/network/stoxdata.txt: -------------------------------------------------------------------------------- 1 | Date,Open,High,Low,Close,Volume 2 | 9-Oct-00,22.75,22.75,21.375,22.375,7888500 3 | 6-Oct-00,23.8125,24.9375,21.5625,22,10701100 4 | 5-Oct-00,24.4375,24.625,23.125,23.50,5810300 5 | -------------------------------------------------------------------------------- /awklib/eg/network/testserv.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | CGI_setup("GET", 3 | "http://www.gnu.org/cgi-bin/foo?p1=stuff&p2=stuff%26junk" \ 4 | "&percent=a %25 sign", 5 | "1.0") 6 | for (i in MENU) 7 | printf "MENU[\"%s\"] = %s\n", i, MENU[i] 8 | for (i in PARAM) 9 | printf "PARAM[\"%s\"] = %s\n", i, PARAM[i] 10 | for (i in GETARG) 11 | printf "GETARG[\"%s\"] = %s\n", i, GETARG[i] 12 | } 13 | -------------------------------------------------------------------------------- /awklib/eg/network/webgrab.awk: -------------------------------------------------------------------------------- 1 | BEGIN { RS = "http://[#%&\\+\\-\\./0-9\\:;\\?A-Z_a-z\\~]*" } 2 | RT != "" { 3 | command = ("gawk -v Proxy=MyProxy -f geturl.awk " RT \ 4 | " > doc" NR ".html") 5 | print command 6 | } 7 | -------------------------------------------------------------------------------- /awklib/eg/prog/guide.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | TEXTDOMAIN = "guide" 3 | bindtextdomain(".") # for testing 4 | print _"Don't Panic" 5 | print _"The Answer Is", 42 6 | print "Pardon me, Zaphod who?" 7 | } 8 | -------------------------------------------------------------------------------- /awklib/eg/prog/histsort.awk: -------------------------------------------------------------------------------- 1 | # histsort.awk --- compact a shell history file 2 | # Thanks to Byron Rakitzis for the general idea 3 | # 4 | # Arnold Robbins, arnold@skeeve.com, Public Domain 5 | # May 1993 6 | 7 | { 8 | if (data[$0]++ == 0) 9 | lines[++count] = $0 10 | } 11 | 12 | END { 13 | for (i = 1; i <= count; i++) 14 | print lines[i] 15 | } 16 | -------------------------------------------------------------------------------- /awklib/eg/prog/wordfreq.awk: -------------------------------------------------------------------------------- 1 | # wordfreq.awk --- print list of word frequencies 2 | 3 | { 4 | $0 = tolower($0) # remove case distinctions 5 | # remove punctuation 6 | gsub(/[^[:alnum:]_[:blank:]]/, "", $0) 7 | for (i = 1; i <= NF; i++) 8 | freq[$i]++ 9 | } 10 | 11 | END { 12 | sort = "sort -k 2nr" 13 | for (word in freq) 14 | printf "%s\t%d\n", word, freq[word] | sort 15 | close(sort) 16 | } 17 | -------------------------------------------------------------------------------- /awklib/stamp-eg: -------------------------------------------------------------------------------- 1 | some makes are stupid and will not check a directory 2 | against a file, so this file is a place holder. gack. 3 | -------------------------------------------------------------------------------- /doc/general-program.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/doc/general-program.pdf -------------------------------------------------------------------------------- /doc/lflashlight-small.xpic: -------------------------------------------------------------------------------- 1 | #! /usr/X11R6/bin/xpic 2 | 80 48 160 80 8 3 | 1 75 144 48 160 56 0 0 4 | 2 5 | 160 48 144 56 6 | 1 76 112 48 136 56 0 0 7 | 2 8 | 112 56 136 48 9 | 1 77 112 72 136 80 0 0 10 | 2 11 | 112 72 136 80 12 | 5 78 128 48 144 80 0 0 13 | 136 64 8 16 14 | 3 79 80 56 112 72 0 0 15 | 1 80 144 64 160 64 0 0 16 | 2 17 | 144 64 160 64 18 | 1 81 144 72 160 80 0 0 19 | 2 20 | 144 72 160 80 21 | -------------------------------------------------------------------------------- /doc/lflashlight.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/doc/lflashlight.pdf -------------------------------------------------------------------------------- /doc/process-flow.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/doc/process-flow.pdf -------------------------------------------------------------------------------- /doc/rflashlight-small.xpic: -------------------------------------------------------------------------------- 1 | #! /usr/X11R6/bin/xpic 2 | 80 48 160 80 8 3 | 5 36 96 48 112 80 0 0 4 | 104 64 8 16 5 | 1 37 104 48 128 56 0 0 6 | 2 7 | 104 48 128 56 8 | 1 38 104 72 128 80 0 0 9 | 2 10 | 104 80 128 72 11 | 2 39 128 56 128 72 0 0 12 | 2 13 | 128 56 128 72 14 | 3 40 128 56 160 72 0 0 15 | 1 41 80 72 80 72 0 0 16 | 2 17 | 80 72 80 72 18 | 1 42 80 72 96 80 0 0 19 | 2 20 | 80 80 96 72 21 | 1 43 80 64 96 64 0 0 22 | 2 23 | 80 64 96 64 24 | 1 45 80 48 96 56 0 0 25 | 2 26 | 96 56 80 48 27 | -------------------------------------------------------------------------------- /doc/rflashlight.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/doc/rflashlight.pdf -------------------------------------------------------------------------------- /doc/statist.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/doc/statist.jpg -------------------------------------------------------------------------------- /doc/statist.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/doc/statist.pdf -------------------------------------------------------------------------------- /extension/.gitignore: -------------------------------------------------------------------------------- 1 | # ignore files created by libtool 2 | *.l[oa] 3 | .libs 4 | -------------------------------------------------------------------------------- /extension/AUTHORS: -------------------------------------------------------------------------------- 1 | Copyright (C) 2006, 2007 Free Software Foundation, Inc. 2 | 3 | Copying and distribution of this file, with or without modification, 4 | are permitted in any medium without royalty provided the copyright 5 | notice and this notice are preserved. 6 | 7 | Gawk was written by Paul Rubin, and finished by Paul Finlason and 8 | Richard Stallman. 9 | 10 | David Trueman and Arnold Robbins took it over, with David doing most 11 | of the work to make it compatible with new awk. 12 | 13 | Circa 1994, Arnold Robbins took over maintenance. 14 | -------------------------------------------------------------------------------- /extension/NEWS: -------------------------------------------------------------------------------- 1 | Copyright (C) 2012 Free Software Foundation, Inc. 2 | 3 | Copying and distribution of this file, with or without modification, 4 | are permitted in any medium without royalty provided the copyright 5 | notice and this notice are preserved. 6 | 7 | Extensions now build separately. 8 | -------------------------------------------------------------------------------- /extension/README: -------------------------------------------------------------------------------- 1 | Copyright (C) 2005, 2006, 2007, 2009, 2010, 2011, 2012 2 | Free Software Foundation, Inc. 3 | 4 | Copying and distribution of this file, with or without modification, 5 | are permitted in any medium without royalty provided the copyright 6 | notice and this notice are preserved. 7 | 8 | README: 9 | 10 | This directory contain the standard bundled extensions for GNU Awk. 11 | -------------------------------------------------------------------------------- /extension/build-aux/ChangeLog: -------------------------------------------------------------------------------- 1 | 2012-07-30 Arnold D. Robbins 2 | 3 | * config.rpath: New file. 4 | 5 | 2012-05-21 Andrew J. Schorr 6 | 7 | * ar-lib, config.guess, config.sub, depcomp, install-sh, ltmain.sh, 8 | missing: New files related to autoconf and libtool. 9 | -------------------------------------------------------------------------------- /extension/m4/ChangeLog: -------------------------------------------------------------------------------- 1 | 2012-08-24 Arnold D. Robbins 2 | 3 | * intlmacosx.m4: New file. 4 | 5 | 2012-07-30 Arnold D. Robbins 6 | 7 | * gettext.m4, iconv.m4, lib-ld.m4, lib-link.m4, lib-prefix.m4, 8 | nls.m4, po.m4, progtest.m4: New files for gettext support. 9 | 10 | 2012-05-21 Andrew J. Schorr 11 | 12 | * libtool.m4, ltoptions.m4, ltsugar.m4, ltversion.m4, lt~obsolete.m4: 13 | New files to support libtool. 14 | -------------------------------------------------------------------------------- /m4/xsize.m4: -------------------------------------------------------------------------------- 1 | # xsize.m4 serial 4 2 | dnl Copyright (C) 2003-2004, 2008-2010 Free Software Foundation, Inc. 3 | dnl This file is free software; the Free Software Foundation 4 | dnl gives unlimited permission to copy and/or distribute it, 5 | dnl with or without modifications, as long as this notice is preserved. 6 | 7 | AC_DEFUN([gl_XSIZE], 8 | [ 9 | dnl Prerequisites of lib/xsize.h. 10 | AC_REQUIRE([gl_SIZE_MAX]) 11 | AC_REQUIRE([AC_C_INLINE]) 12 | AC_CHECK_HEADERS([stdint.h]) 13 | ]) 14 | -------------------------------------------------------------------------------- /missing_d/README: -------------------------------------------------------------------------------- 1 | Fri Aug 25 13:23:06 IDT 2006 2 | ============================ 3 | 4 | The files memmove.c, mktime.c, snprintf.c, strerror.c, strftime.c, 5 | strncasecmp.c, and system.c are copyright by the Free Software 6 | Foundation. They are licensed under the GPL or the LGPL. See the 7 | COPYING.LIB file in this directory and the COPYING file in the parent 8 | directory for licensing information. 9 | 10 | All other files are public domain. 11 | 12 | Arnold Robbins 13 | arnold@skeeve.com 14 | 15 | -------------------------------------------------------------------------------- /missing_d/memcmp.c: -------------------------------------------------------------------------------- 1 | /* 2 | * memcmp --- compare strings. 3 | * 4 | * We use our own routine since it has to act like strcmp() for return 5 | * value, and the BSD manual says bcmp() only returns zero/non-zero. 6 | */ 7 | 8 | int 9 | memcmp (s1, s2, l) 10 | char *s1, *s2; 11 | int l; 12 | { 13 | for (; l-- > 0; s1++, s2++) { 14 | if (*s1 != *s2) 15 | return (*s1 - *s2); 16 | } 17 | return (0); 18 | } 19 | -------------------------------------------------------------------------------- /missing_d/memcpy.c: -------------------------------------------------------------------------------- 1 | /* 2 | * memcpy --- copy strings. 3 | * 4 | * We supply this routine for those systems that aren't standard yet. 5 | */ 6 | 7 | char * 8 | memcpy (dest, src, l) 9 | char *dest, *src; 10 | int l; 11 | { 12 | char *ret = dest; 13 | 14 | while (l--) 15 | *dest++ = *src++; 16 | 17 | return ret; 18 | } 19 | -------------------------------------------------------------------------------- /missing_d/memset.c: -------------------------------------------------------------------------------- 1 | /* 2 | * memset --- initialize memory 3 | * 4 | * We supply this routine for those systems that aren't standard yet. 5 | */ 6 | 7 | void * 8 | memset(dest, val, l) 9 | void *dest; 10 | int val; 11 | size_t l; 12 | { 13 | char *ret = dest; 14 | char *d = dest; 15 | 16 | while (l--) 17 | *d++ = val; 18 | 19 | return ((void *) ret); 20 | } 21 | -------------------------------------------------------------------------------- /missing_d/strcoll.c: -------------------------------------------------------------------------------- 1 | /* replacement strcoll.c */ 2 | 3 | int 4 | strcoll(const char *s1, const char *s2) 5 | { 6 | return strcmp(s1, s2); /* nyah, nyah, so there */ 7 | } 8 | -------------------------------------------------------------------------------- /missing_d/usleep.c: -------------------------------------------------------------------------------- 1 | /* 2 | * usleep - round microseconds up to an integral number of seconds. 3 | * 4 | * The real usleep() doesn't work this way; this is a hack for systems 5 | * that don't have usleep(). 6 | */ 7 | 8 | int 9 | usleep(unsigned int usec) 10 | { 11 | unsigned int seconds = usec / 1000000; 12 | 13 | /* Round up: */ 14 | seconds += (usec % 1000000 > 0); /* 1 or 0 */ 15 | 16 | return sleep(seconds); 17 | } 18 | -------------------------------------------------------------------------------- /pc/awklib/igawk.bat: -------------------------------------------------------------------------------- 1 | @sh igawk %1 %2 %3 %4 %5 %6 %7 %8 %9 -------------------------------------------------------------------------------- /pc/configpk.sed: -------------------------------------------------------------------------------- 1 | s/^AC_INIT([[]\{0,1\}\([^],]*\)[]]\{0,1\}, *[[]\{0,1\}\([^],]*\)[]]\{0,1\}, *[[]\{0,1\}\([^],]*\)[]]\{0,1\}, *[[]\{0,1\}\([^],)]*\).*$/\ 2 | s|^#undef PACKAGE_NAME *$|#define PACKAGE_NAME "\1"|\ 3 | s|^#undef VERSION *$|#define VERSION "\2"\|\ 4 | s|^#undef PACKAGE_VERSION *$|#define PACKAGE_VERSION "\2"|\ 5 | s|^#undef PACKAGE_STRING *$|#define PACKAGE_STRING "\1 \2"|\ 6 | s|^#undef PACKAGE_BUGREPORT *$|#define PACKAGE_BUGREPORT "\3"|\ 7 | s|^#undef PACKAGE *$|#define PACKAGE "\4"|\ 8 | s|^#undef PACKAGE_TARNAME *$|#define PACKAGE_TARNAME "\4"|\ 9 | /p 10 | -------------------------------------------------------------------------------- /pc/gawk.def: -------------------------------------------------------------------------------- 1 | NAME gawk WINDOWCOMPAT NEWFILES 2 | DESCRIPTION 'GNU awk for OS/2' 3 | -------------------------------------------------------------------------------- /pc/make-config.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | sed -n -f configpk.sed < ..\configure.ac > tmp.sed 3 | sed -f config.sed < ..\configh.in > config.tmp 4 | sed -f tmp.sed < config.tmp > config.h 5 | del tmp.sed 6 | del config.tmp 7 | -------------------------------------------------------------------------------- /pc/popen.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** popen.h -- prototypes for pipe functions 3 | */ 4 | #if !defined (__DJGPP__) 5 | # if defined (popen) 6 | # undef popen 7 | # undef pclose 8 | # endif 9 | # define popen(c, m) os_popen(c, m) 10 | # define pclose(f) os_pclose(f) 11 | extern FILE *os_popen( const char *, const char * ); 12 | extern int os_pclose( FILE * ); 13 | # ifdef __MINGW32__ 14 | # define system(c) os_system(c) 15 | extern int os_system( const char * ); 16 | # endif /* __MINGW32__ */ 17 | #endif /* !__DJGPP__ */ 18 | -------------------------------------------------------------------------------- /po/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore files that are created by a build. 2 | Makefile.in 3 | POTFILES 4 | 5 | -------------------------------------------------------------------------------- /po/LINGUAS: -------------------------------------------------------------------------------- 1 | da 2 | de 3 | es 4 | fi 5 | fr 6 | it 7 | ja 8 | nl 9 | pl 10 | sv 11 | vi 12 | -------------------------------------------------------------------------------- /po/README: -------------------------------------------------------------------------------- 1 | Sun May 1 20:34:31 IDT 2011 2 | ============================ 3 | 4 | For gawk 4.0, I have removed .po files that are not being maintained 5 | from the distribution, since the code base has changed so much. 6 | 7 | The original files are still available from the gawk git repository 8 | and/or from the translation project. If your language used to be supported 9 | and no longer is, please consider updating the translation so that it 10 | can be restored to the distribution. 11 | 12 | Thanks! 13 | 14 | Arnold Robbins 15 | arnold@skeeve.com 16 | -------------------------------------------------------------------------------- /po/boldquot.sed: -------------------------------------------------------------------------------- 1 | s/"\([^"]*\)"/“\1”/g 2 | s/`\([^`']*\)'/‘\1’/g 3 | s/ '\([^`']*\)' / ‘\1’ /g 4 | s/ '\([^`']*\)'$/ ‘\1’/g 5 | s/^'\([^`']*\)' /‘\1’ /g 6 | s/“”/""/g 7 | s/“/“/g 8 | s/”/”/g 9 | s/‘/‘/g 10 | s/’/’/g 11 | -------------------------------------------------------------------------------- /po/ca.po: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/po/ca.po -------------------------------------------------------------------------------- /po/da.gmo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/po/da.gmo -------------------------------------------------------------------------------- /po/da.po: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/po/da.po -------------------------------------------------------------------------------- /po/de.gmo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/po/de.gmo -------------------------------------------------------------------------------- /po/es.gmo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/po/es.gmo -------------------------------------------------------------------------------- /po/fi.gmo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/po/fi.gmo -------------------------------------------------------------------------------- /po/fr.gmo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/po/fr.gmo -------------------------------------------------------------------------------- /po/ga.po: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/po/ga.po -------------------------------------------------------------------------------- /po/he.po: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/po/he.po -------------------------------------------------------------------------------- /po/it.gmo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/po/it.gmo -------------------------------------------------------------------------------- /po/it.po: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/po/it.po -------------------------------------------------------------------------------- /po/ja.gmo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/po/ja.gmo -------------------------------------------------------------------------------- /po/nl.gmo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/po/nl.gmo -------------------------------------------------------------------------------- /po/pl.gmo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/po/pl.gmo -------------------------------------------------------------------------------- /po/pt_BR.po: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/po/pt_BR.po -------------------------------------------------------------------------------- /po/quot.sed: -------------------------------------------------------------------------------- 1 | s/"\([^"]*\)"/“\1”/g 2 | s/`\([^`']*\)'/‘\1’/g 3 | s/ '\([^`']*\)' / ‘\1’ /g 4 | s/ '\([^`']*\)'$/ ‘\1’/g 5 | s/^'\([^`']*\)' /‘\1’ /g 6 | s/“”/""/g 7 | -------------------------------------------------------------------------------- /po/remove-potcdate.sin: -------------------------------------------------------------------------------- 1 | # Sed script that remove the POT-Creation-Date line in the header entry 2 | # from a POT file. 3 | # 4 | # The distinction between the first and the following occurrences of the 5 | # pattern is achieved by looking at the hold space. 6 | /^"POT-Creation-Date: .*"$/{ 7 | x 8 | # Test if the hold space is empty. 9 | s/P/P/ 10 | ta 11 | # Yes it was empty. First occurrence. Remove the line. 12 | g 13 | d 14 | bb 15 | :a 16 | # The hold space was nonempty. Following occurrences. Do nothing. 17 | x 18 | :b 19 | } 20 | -------------------------------------------------------------------------------- /po/ro.po: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/po/ro.po -------------------------------------------------------------------------------- /po/stamp-po: -------------------------------------------------------------------------------- 1 | timestamp 2 | -------------------------------------------------------------------------------- /po/sv.gmo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/po/sv.gmo -------------------------------------------------------------------------------- /po/sv.po: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/po/sv.po -------------------------------------------------------------------------------- /po/vi.gmo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/po/vi.gmo -------------------------------------------------------------------------------- /test/aadelete1.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | a[1][1] = 11 3 | a[1][2] = 12 4 | a[2] = 2 5 | delete a[1][1] 6 | f(a, a[1]) 7 | print a[1][1] 8 | print length(a), length(a[1]) 9 | delete a 10 | print length(a), length(a[1]), length(a) 11 | a[1][1] = 11 12 | } 13 | 14 | function f(c, b) { 15 | delete b 16 | b[1] = 1 17 | print c[1][1], b[1] 18 | delete c[2] 19 | } 20 | -------------------------------------------------------------------------------- /test/aadelete1.ok: -------------------------------------------------------------------------------- 1 | 1 1 2 | 1 3 | 1 1 4 | 0 0 1 5 | gawk: aadelete1.awk:11: fatal: attempt to use scalar `a["1"]' as an array 6 | EXIT CODE: 2 7 | -------------------------------------------------------------------------------- /test/aadelete2.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | a[1][1]=1; 3 | b[1][1]=11; 4 | # delete b[a[1]][1]; 5 | f(b, a) 6 | } 7 | 8 | function f(arr, s) { 9 | delete arr[s[1]][1] 10 | } 11 | -------------------------------------------------------------------------------- /test/aadelete2.ok: -------------------------------------------------------------------------------- 1 | gawk: aadelete2.awk:9: fatal: attempt to use array `a["1"]' in a scalar context 2 | EXIT CODE: 2 3 | -------------------------------------------------------------------------------- /test/aarray1.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | a[1][1] = 10; 3 | a[1][2] = 20; 4 | a[1][3] = 30; 5 | a[2] = "hello world! we have multi-dimensional array" 6 | a[3, "X"] = "Y" 7 | print length(a), length(a[1]) 8 | delete a[2] 9 | delete a[3, "X"] 10 | a[2][1] = 100; 11 | a[2][2] = 200; 12 | a[2][3] = 300; 13 | for (i in a) { 14 | sum[i] = 0 15 | for (j in a[i]) 16 | sum[i] += a[i][j] 17 | } 18 | print sum[1], sum[2] 19 | f(a[1]) 20 | print a[1][1] 21 | } 22 | 23 | function f(x, i) 24 | { 25 | for (i=1;i<=length(x);i++) 26 | print x[i] 27 | x[1] = 1001 28 | } 29 | -------------------------------------------------------------------------------- /test/aarray1.ok: -------------------------------------------------------------------------------- 1 | 3 3 2 | 60 600 3 | 10 4 | 20 5 | 30 6 | 1001 7 | -------------------------------------------------------------------------------- /test/aasorti.ok: -------------------------------------------------------------------------------- 1 | b[0][1] = "Alligator" 2 | b[0][2] = "Iguana" 3 | b[0][3] = "Nouns" 4 | b[0][4] = "aardvark" 5 | b[0][5] = "animal" 6 | b[0][6] = "people" 7 | b[0][7] = "zebra" 8 | b[0][8] = "zoo" 9 | ============ 10 | b[1][1] = "aardvark" 11 | b[1][2] = "Alligator" 12 | b[1][3] = "animal" 13 | b[1][4] = "Iguana" 14 | b[1][5] = "Nouns" 15 | b[1][6] = "people" 16 | b[1][7] = "zebra" 17 | b[1][8] = "zoo" 18 | ============ 19 | b[1] = "0" 20 | b[2] = "1" 21 | -------------------------------------------------------------------------------- /test/addcomma.awk: -------------------------------------------------------------------------------- 1 | # addcomma - put commas in numbers 2 | # input: a number per line 3 | # output: the input number followed by 4 | # the number with commas and two decimal places 5 | 6 | { printf("%-12s %20s\n", $0, addcomma($0)) } 7 | 8 | function addcomma(x, num) { 9 | if (x < 0) 10 | return "-" addcomma(-x) 11 | num = sprintf("%.2f", x) # num is dddddd.dd 12 | while (num ~ /[0-9][0-9][0-9][0-9]/) 13 | sub(/[0-9][0-9][0-9][,.]/, ",&", num) 14 | return num 15 | } 16 | -------------------------------------------------------------------------------- /test/addcomma.in: -------------------------------------------------------------------------------- 1 | 0 2 | -1 3 | -12.34 4 | 12345 5 | -1234567.89 6 | -123. 7 | -123456 8 | -------------------------------------------------------------------------------- /test/addcomma.ok: -------------------------------------------------------------------------------- 1 | 0 0.00 2 | -1 -1.00 3 | -12.34 -12.34 4 | 12345 12,345.00 5 | -1234567.89 -1,234,567.89 6 | -123. -123.00 7 | -123456 -123,456.00 8 | -------------------------------------------------------------------------------- /test/anchgsub.awk: -------------------------------------------------------------------------------- 1 | { gsub(/^[ ]*/, "", $0) ; print } 2 | -------------------------------------------------------------------------------- /test/anchgsub.in: -------------------------------------------------------------------------------- 1 | This is a test, this is only a test. 2 | -------------------------------------------------------------------------------- /test/anchgsub.ok: -------------------------------------------------------------------------------- 1 | This is a test, this is only a test. 2 | -------------------------------------------------------------------------------- /test/argarray.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | argn = " argument" (ARGC > 1 ? "s" : "") 3 | are = ARGC > 1 ? "are" : "is" 4 | print "here we have " ARGC argn 5 | print "which " are 6 | for (x = 0; x < ARGC; x++) 7 | print "\t", ARGV[x] 8 | print "Environment variable TEST=" ENVIRON["TEST"] 9 | print "and the current input file is called \"" FILENAME "\"" 10 | } 11 | 12 | FNR == 1 { 13 | print "in main loop, this input file is known as \"" FILENAME "\"" 14 | } 15 | -------------------------------------------------------------------------------- /test/argarray.in: -------------------------------------------------------------------------------- 1 | this is a simple test file 2 | -------------------------------------------------------------------------------- /test/argarray.ok: -------------------------------------------------------------------------------- 1 | here we have 3 arguments 2 | which are 3 | gawk 4 | ./argarray.in 5 | - 6 | Environment variable TEST= 7 | and the current input file is called "" 8 | in main loop, this input file is known as "./argarray.in" 9 | in main loop, this input file is known as "-" 10 | -------------------------------------------------------------------------------- /test/argtest.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | for (i = 0; i < ARGC; i++) 3 | printf("ARGV[%d] = %s\n", i, ARGV[i]) 4 | } 5 | -------------------------------------------------------------------------------- /test/argtest.ok: -------------------------------------------------------------------------------- 1 | ARGV[0] = gawk 2 | ARGV[1] = -x 3 | ARGV[2] = -y 4 | ARGV[3] = abc 5 | -------------------------------------------------------------------------------- /test/arrayparm.awk: -------------------------------------------------------------------------------- 1 | # 2 | # Test program from: 3 | # 4 | # Date: Tue, 21 Feb 95 16:09:29 EST 5 | # From: emory!blackhawk.com!aaron (Aaron Sosnick) 6 | # 7 | BEGIN { 8 | foo[1]=1; 9 | foo[2]=2; 10 | bug1(foo); 11 | } 12 | function bug1(i) { 13 | for (i in foo) { 14 | bug2(i); 15 | delete foo[i]; 16 | print i,1,bot[1]; 17 | } 18 | } 19 | function bug2(arg) { 20 | bot[arg]=arg; 21 | } 22 | -------------------------------------------------------------------------------- /test/arrayparm.ok: -------------------------------------------------------------------------------- 1 | gawk: arrayparm.awk:13: fatal: attempt to use array `i (from foo)' in a scalar context 2 | EXIT CODE: 2 3 | -------------------------------------------------------------------------------- /test/arrayprm2.ok: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/test/arrayprm2.ok -------------------------------------------------------------------------------- /test/arrayprm3.ok: -------------------------------------------------------------------------------- 1 | 1 2 | -------------------------------------------------------------------------------- /test/arrayref.awk: -------------------------------------------------------------------------------- 1 | BEGIN { # foo[10] = 0 # put this line in and it will work 2 | test(foo); print foo[1] 3 | test2(foo2); print foo2[1] 4 | } 5 | 6 | function test(foo) 7 | { 8 | test2(foo) 9 | } 10 | function test2(bar) 11 | { 12 | bar[1] = 1 13 | } 14 | -------------------------------------------------------------------------------- /test/arrayref.ok: -------------------------------------------------------------------------------- 1 | 1 2 | 1 3 | -------------------------------------------------------------------------------- /test/arrymem1.ok: -------------------------------------------------------------------------------- 1 | test 2 | b[""] = "b" 3 | -------------------------------------------------------------------------------- /test/arryref2.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | foo(a) 3 | 4 | for (i in a) 5 | print i, a[i] 6 | } 7 | 8 | function foo(b) 9 | { 10 | bar(b) 11 | b[2] = "local" 12 | } 13 | 14 | function bar(c) 15 | { 16 | a[3] = "global" 17 | c[1] = "local2" 18 | } 19 | -------------------------------------------------------------------------------- /test/arryref2.ok: -------------------------------------------------------------------------------- 1 | 1 local2 2 | 2 local 3 | 3 global 4 | -------------------------------------------------------------------------------- /test/arryref3.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | foo(a) 3 | 4 | for (i in a) 5 | print i, a[i] 6 | } 7 | 8 | function foo(b) 9 | { 10 | a[1] = "global" 11 | b[2] = "local" 12 | bar(b) 13 | } 14 | 15 | function bar(c) 16 | { 17 | c = 12 18 | } 19 | -------------------------------------------------------------------------------- /test/arryref3.ok: -------------------------------------------------------------------------------- 1 | gawk: arryref3.awk:17: fatal: attempt to use array `c (from b, from a)' in a scalar context 2 | EXIT CODE: 2 3 | -------------------------------------------------------------------------------- /test/arryref4.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | foo(a) 3 | 4 | print a 5 | } 6 | 7 | function foo(b) 8 | { 9 | a = "global" 10 | b[2] = "local" 11 | # bar(b) 12 | } 13 | 14 | function bar(c) 15 | { 16 | c = 12 17 | } 18 | -------------------------------------------------------------------------------- /test/arryref4.ok: -------------------------------------------------------------------------------- 1 | gawk: arryref4.awk:10: fatal: attempt to use scalar parameter `b' as an array 2 | EXIT CODE: 2 3 | -------------------------------------------------------------------------------- /test/arryref5.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | foo(a) 3 | 4 | print a 5 | } 6 | 7 | function foo(b) 8 | { 9 | b[2] = "local" 10 | a = "global" 11 | # bar(b) 12 | } 13 | 14 | function bar(c) 15 | { 16 | c = 12 17 | } 18 | -------------------------------------------------------------------------------- /test/arryref5.ok: -------------------------------------------------------------------------------- 1 | gawk: arryref5.awk:10: fatal: attempt to use array `a' in a scalar context 2 | EXIT CODE: 2 3 | -------------------------------------------------------------------------------- /test/arynasty.ok: -------------------------------------------------------------------------------- 1 | test[12.153] = hi 2 | -------------------------------------------------------------------------------- /test/arynocls.awk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/test/arynocls.awk -------------------------------------------------------------------------------- /test/arynocls.ok: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/test/arynocls.ok -------------------------------------------------------------------------------- /test/aryprm1.awk: -------------------------------------------------------------------------------- 1 | function f(a) { 2 | if (3 in a) 3 | print 7 4 | a = 5 5 | } 6 | 7 | BEGIN { 8 | f(arr) 9 | } 10 | -------------------------------------------------------------------------------- /test/aryprm1.ok: -------------------------------------------------------------------------------- 1 | gawk: aryprm1.awk:4: fatal: attempt to use array `a (from arr)' in a scalar context 2 | EXIT CODE: 2 3 | -------------------------------------------------------------------------------- /test/aryprm2.awk: -------------------------------------------------------------------------------- 1 | function f(a) { 2 | delete a 3 | a *= 5 4 | } 5 | 6 | BEGIN { 7 | f(arr) 8 | } 9 | -------------------------------------------------------------------------------- /test/aryprm2.ok: -------------------------------------------------------------------------------- 1 | gawk: aryprm2.awk:3: fatal: attempt to use array `a (from arr)' in a scalar context 2 | EXIT CODE: 2 3 | -------------------------------------------------------------------------------- /test/aryprm3.awk: -------------------------------------------------------------------------------- 1 | function f(a, i) { 2 | for (i in a) 3 | delete a[i] 4 | if (a == 0) 5 | print 7 6 | } 7 | 8 | BEGIN { 9 | f(arr) 10 | } 11 | -------------------------------------------------------------------------------- /test/aryprm3.ok: -------------------------------------------------------------------------------- 1 | gawk: aryprm3.awk:4: fatal: attempt to use array `a (from arr)' in a scalar context 2 | EXIT CODE: 2 3 | -------------------------------------------------------------------------------- /test/aryprm4.awk: -------------------------------------------------------------------------------- 1 | function f(x){ 2 | x = 1 3 | } 4 | BEGIN { 5 | f(a) 6 | a[1] 7 | } 8 | -------------------------------------------------------------------------------- /test/aryprm4.ok: -------------------------------------------------------------------------------- 1 | gawk: aryprm4.awk:6: fatal: attempt to use scalar `a' as an array 2 | EXIT CODE: 2 3 | -------------------------------------------------------------------------------- /test/aryprm5.awk: -------------------------------------------------------------------------------- 1 | function f(x){ 2 | x[1] = x 3 | } 4 | BEGIN { 5 | f(a) 6 | } 7 | -------------------------------------------------------------------------------- /test/aryprm5.ok: -------------------------------------------------------------------------------- 1 | gawk: aryprm5.awk:2: fatal: attempt to use scalar parameter `x' as an array 2 | EXIT CODE: 2 3 | -------------------------------------------------------------------------------- /test/aryprm6.awk: -------------------------------------------------------------------------------- 1 | function f(x){ 2 | a 3 | x[1] = 3 4 | } 5 | BEGIN { 6 | f(a) 7 | } 8 | -------------------------------------------------------------------------------- /test/aryprm6.ok: -------------------------------------------------------------------------------- 1 | gawk: aryprm6.awk:3: fatal: attempt to use scalar parameter `x' as an array 2 | EXIT CODE: 2 3 | -------------------------------------------------------------------------------- /test/aryprm7.awk: -------------------------------------------------------------------------------- 1 | function f(x, y){ 2 | y[1] = x 3 | } 4 | BEGIN { 5 | f(a, a) 6 | } 7 | -------------------------------------------------------------------------------- /test/aryprm7.ok: -------------------------------------------------------------------------------- 1 | gawk: aryprm7.awk:2: fatal: attempt to use scalar parameter `y' as an array 2 | EXIT CODE: 2 3 | -------------------------------------------------------------------------------- /test/aryprm8.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | f(0, a) # nothing 3 | f(1, a) 4 | } 5 | function f(i, a) { 6 | if (i == 0) return 7 | g(a, a) 8 | pr(a) 9 | } 10 | function g(x, y) { 11 | h(y, x, y) 12 | } 13 | function h(b, c, d) { 14 | b[1] = 1 15 | c[1] = 2 # rewrite 16 | print b[1], d[1] 17 | c[2] = 1 18 | b[2] = 2 # should rewrite 19 | } 20 | function pr(x) { 21 | print x[1], x[2] 22 | } 23 | -------------------------------------------------------------------------------- /test/aryprm8.ok: -------------------------------------------------------------------------------- 1 | 2 2 2 | 2 2 3 | -------------------------------------------------------------------------------- /test/arysubnm.awk: -------------------------------------------------------------------------------- 1 | BEGIN { n = 11 ; foo[n] = n; print (2 <= n) } 2 | -------------------------------------------------------------------------------- /test/arysubnm.ok: -------------------------------------------------------------------------------- 1 | 1 2 | -------------------------------------------------------------------------------- /test/asgext.awk: -------------------------------------------------------------------------------- 1 | { print $3; $4 = "a"; print } 2 | -------------------------------------------------------------------------------- /test/asgext.in: -------------------------------------------------------------------------------- 1 | 1 2 3 2 | 1 3 | 1 2 3 4 4 | -------------------------------------------------------------------------------- /test/asgext.ok: -------------------------------------------------------------------------------- 1 | 3 2 | 1 2 3 a 3 | 4 | 1 a 5 | 3 6 | 1 2 3 a 7 | -------------------------------------------------------------------------------- /test/asort.awk: -------------------------------------------------------------------------------- 1 | function init(a) 2 | { 3 | a[1] = "aardvark" 4 | a[2] = "animal" 5 | a[3] = "zebra" 6 | a[4] = "zoo" 7 | a[5] = "Iguana" 8 | a[6] = "Alligator" 9 | a[7] = "Nouns" 10 | a[8] = "people" 11 | } 12 | 13 | BEGIN { 14 | 15 | for (IGNORECASE = 0; IGNORECASE < 2; IGNORECASE++) { 16 | init(a) 17 | 18 | n = asort(a) 19 | 20 | for (i = 1; i <= n; i++) 21 | printf("a[%d] = \"%s\"\n", i, a[i]) 22 | 23 | print "============" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /test/asort.ok: -------------------------------------------------------------------------------- 1 | a[1] = "Alligator" 2 | a[2] = "Iguana" 3 | a[3] = "Nouns" 4 | a[4] = "aardvark" 5 | a[5] = "animal" 6 | a[6] = "people" 7 | a[7] = "zebra" 8 | a[8] = "zoo" 9 | ============ 10 | a[1] = "aardvark" 11 | a[2] = "Alligator" 12 | a[3] = "animal" 13 | a[4] = "Iguana" 14 | a[5] = "Nouns" 15 | a[6] = "people" 16 | a[7] = "zebra" 17 | a[8] = "zoo" 18 | ============ 19 | -------------------------------------------------------------------------------- /test/asorti.awk: -------------------------------------------------------------------------------- 1 | function init(a) 2 | { 3 | delete a 4 | 5 | a["aardvark"] = 1 6 | a["animal"] = 2 7 | a["zebra"] = 3 8 | a["zoo"] = 4 9 | a["Iguana"] = 5 10 | a["Alligator"] = 6 11 | a["Nouns"] = 7 12 | a["people"] = 8 13 | } 14 | 15 | BEGIN { 16 | 17 | for (IGNORECASE = 0; IGNORECASE < 2; IGNORECASE++) { 18 | init(a) 19 | 20 | n = asorti(a) 21 | 22 | for (i = 1; i <= n; i++) 23 | printf("a[%d] = \"%s\"\n", i, a[i]) 24 | 25 | print "============" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /test/asorti.ok: -------------------------------------------------------------------------------- 1 | a[1] = "Alligator" 2 | a[2] = "Iguana" 3 | a[3] = "Nouns" 4 | a[4] = "aardvark" 5 | a[5] = "animal" 6 | a[6] = "people" 7 | a[7] = "zebra" 8 | a[8] = "zoo" 9 | ============ 10 | a[1] = "aardvark" 11 | a[2] = "Alligator" 12 | a[3] = "animal" 13 | a[4] = "Iguana" 14 | a[5] = "Nouns" 15 | a[6] = "people" 16 | a[7] = "zebra" 17 | a[8] = "zoo" 18 | ============ 19 | -------------------------------------------------------------------------------- /test/awkpath.ok: -------------------------------------------------------------------------------- 1 | Found it. 2 | -------------------------------------------------------------------------------- /test/back89.awk: -------------------------------------------------------------------------------- 1 | /a\8b/ 2 | -------------------------------------------------------------------------------- /test/back89.in: -------------------------------------------------------------------------------- 1 | a8b 2 | a\8b 3 | -------------------------------------------------------------------------------- /test/back89.ok: -------------------------------------------------------------------------------- 1 | a8b 2 | -------------------------------------------------------------------------------- /test/backgsub.awk: -------------------------------------------------------------------------------- 1 | { 2 | gsub( "\\\\", "\\\\") 3 | print 4 | } 5 | -------------------------------------------------------------------------------- /test/backgsub.in: -------------------------------------------------------------------------------- 1 | \x\y\z 2 | -------------------------------------------------------------------------------- /test/backgsub.ok: -------------------------------------------------------------------------------- 1 | \\x\\y\\z 2 | -------------------------------------------------------------------------------- /test/backw.awk: -------------------------------------------------------------------------------- 1 | /\w+/ 2 | -------------------------------------------------------------------------------- /test/backw.in: -------------------------------------------------------------------------------- 1 | 123 2 | abc 3 | 456 4 | -------------------------------------------------------------------------------- /test/backw.ok: -------------------------------------------------------------------------------- 1 | 123 2 | abc 3 | 456 4 | -------------------------------------------------------------------------------- /test/beginfile1.awk: -------------------------------------------------------------------------------- 1 | BEGINFILE { 2 | print "In BEGINFILE:" 3 | filename = FILENAME 4 | gsub(/.*[/]/, "", filename) 5 | printf "\tFILENAME = %s, FNR = %d, ERRNO = \"%s\"\n", filename, FNR, ERRNO 6 | 7 | if (ERRNO != "") 8 | nextfile 9 | } 10 | 11 | FNR == 1 { print "processing", filename } 12 | FNR > 1 { nextfile } 13 | 14 | ENDFILE { 15 | print "In ENDFILE:" 16 | filename = FILENAME 17 | gsub(/.*[/]/, "", filename) 18 | printf "\tFILENAME = %s, FNR = %d, ERRNO = \"%s\"\n", filename, FNR, ERRNO 19 | } 20 | -------------------------------------------------------------------------------- /test/beginfile1.ok: -------------------------------------------------------------------------------- 1 | In BEGINFILE: 2 | FILENAME = beginfile1.awk, FNR = 0, ERRNO = "" 3 | processing beginfile1.awk 4 | In ENDFILE: 5 | FILENAME = beginfile1.awk, FNR = 2, ERRNO = "" 6 | In BEGINFILE: 7 | FILENAME = ., FNR = 0, ERRNO = "Is a directory" 8 | In BEGINFILE: 9 | FILENAME = file, FNR = 0, ERRNO = "No such file or directory" 10 | In BEGINFILE: 11 | FILENAME = Makefile, FNR = 0, ERRNO = "" 12 | processing Makefile 13 | In ENDFILE: 14 | FILENAME = Makefile, FNR = 2, ERRNO = "" 15 | -------------------------------------------------------------------------------- /test/binmode1.ok: -------------------------------------------------------------------------------- 1 | 3 2 | -------------------------------------------------------------------------------- /test/charasbytes.awk: -------------------------------------------------------------------------------- 1 | { print gensub(/\xE2\x80./, "ZZZ", "g", $0) } 2 | -------------------------------------------------------------------------------- /test/charasbytes.in: -------------------------------------------------------------------------------- 1 | – 2 | -------------------------------------------------------------------------------- /test/charasbytes.ok: -------------------------------------------------------------------------------- 1 | 0000000 Z Z Z \n 2 | 5a 5a 5a 0a 3 | 0000004 4 | -------------------------------------------------------------------------------- /test/childin.awk: -------------------------------------------------------------------------------- 1 | BEGIN { "cat" | getline; print; close("cat") } 2 | -------------------------------------------------------------------------------- /test/childin.in: -------------------------------------------------------------------------------- 1 | hi 2 | -------------------------------------------------------------------------------- /test/childin.ok: -------------------------------------------------------------------------------- 1 | hi 2 | -------------------------------------------------------------------------------- /test/clobber.ok: -------------------------------------------------------------------------------- 1 | 000801 -------------------------------------------------------------------------------- /test/clos1way.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | command = "LC_ALL=C sort" 3 | 4 | n = split("abcdefghijklmnopqrstuvwxyz", a, "") 5 | for (i = n; i > 0; i--) { 6 | # print "printing", a[i] > "/dev/stderr" 7 | print a[i] |& command 8 | } 9 | 10 | close(command, "to") 11 | 12 | # print "starting read loop" > "/dev/stderr" 13 | do { 14 | if (line) 15 | print "got", line 16 | # stopme(); 17 | } while ((command |& getline line) > 0) 18 | 19 | # print "doing final close" > "/dev/stderr" 20 | close(command) 21 | } 22 | -------------------------------------------------------------------------------- /test/clos1way.ok: -------------------------------------------------------------------------------- 1 | got a 2 | got b 3 | got c 4 | got d 5 | got e 6 | got f 7 | got g 8 | got h 9 | got i 10 | got j 11 | got k 12 | got l 13 | got m 14 | got n 15 | got o 16 | got p 17 | got q 18 | got r 19 | got s 20 | got t 21 | got u 22 | got v 23 | got w 24 | got x 25 | got y 26 | got z 27 | -------------------------------------------------------------------------------- /test/closebad.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | f = "/no/such/file/1" 3 | print (getline junk < f) 4 | print close(f) 5 | f = "/no/such/file/2" 6 | print close(f) 7 | } 8 | -------------------------------------------------------------------------------- /test/closebad.ok: -------------------------------------------------------------------------------- 1 | -1 2 | -1 3 | -1 4 | -------------------------------------------------------------------------------- /test/clsflnam.awk: -------------------------------------------------------------------------------- 1 | #! /usr/bin/awk -f 2 | BEGIN { 3 | getline 4 | # print ("FILENAME =", FILENAME) > "/dev/stderr" 5 | #Rewind the file 6 | if (close(FILENAME)) { 7 | print "Error `" ERRNO "' closing input file" > "/dev/stderr"; 8 | exit; 9 | } 10 | } 11 | { print "Analysing ", $0 } 12 | 13 | -------------------------------------------------------------------------------- /test/clsflnam.in: -------------------------------------------------------------------------------- 1 | line 1 2 | line 2 3 | line 3 4 | -------------------------------------------------------------------------------- /test/clsflnam.ok: -------------------------------------------------------------------------------- 1 | Error `close of redirection that was never opened' closing input file 2 | -------------------------------------------------------------------------------- /test/compare.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | if (ARGV[1]) print 1 3 | ARGV[1] = "" 4 | if (ARGV[2]) print 2 5 | ARGV[2] = "" 6 | if ("0") print "zero" 7 | if ("") print "null" 8 | if (0) print 0 9 | } 10 | { 11 | if ($0) print $0 12 | if ($1) print $1 13 | } 14 | -------------------------------------------------------------------------------- /test/compare.in: -------------------------------------------------------------------------------- 1 | 0 2 | 1 3 | 0 1 4 | 5 | -------------------------------------------------------------------------------- /test/compare.ok: -------------------------------------------------------------------------------- 1 | 2 2 | zero 3 | 1 4 | 1 5 | 0 1 6 | -------------------------------------------------------------------------------- /test/compare2.ok: -------------------------------------------------------------------------------- 1 | OK: zero strings compare equal to number zero 2 | -------------------------------------------------------------------------------- /test/concat1.in: -------------------------------------------------------------------------------- 1 | A 2 | B 3 | C 4 | D 5 | -------------------------------------------------------------------------------- /test/concat1.ok: -------------------------------------------------------------------------------- 1 | Input = A ; 2 | Input = B ; 3 | Input = C ; 4 | Input = D ; 5 | -------------------------------------------------------------------------------- /test/concat2.awk: -------------------------------------------------------------------------------- 1 | function f(s, x) { 2 | x = 1 3 | s = 3 4 | s = s x 5 | print s 6 | } 7 | 8 | BEGIN { for (i = 1; i <=12; i++) f() } 9 | -------------------------------------------------------------------------------- /test/concat2.ok: -------------------------------------------------------------------------------- 1 | 31 2 | 31 3 | 31 4 | 31 5 | 31 6 | 31 7 | 31 8 | 31 9 | 31 10 | 31 11 | 31 12 | 31 13 | -------------------------------------------------------------------------------- /test/concat3.awk: -------------------------------------------------------------------------------- 1 | BEGIN { a; a = a (b "c"); print a; print b } 2 | -------------------------------------------------------------------------------- /test/concat3.ok: -------------------------------------------------------------------------------- 1 | c 2 | 3 | -------------------------------------------------------------------------------- /test/concat4.awk: -------------------------------------------------------------------------------- 1 | { 2 | a = $0 3 | print a 4 | print index(a,"b") 5 | getline 6 | a = a $0 7 | print a 8 | print index(a,"b") 9 | } 10 | -------------------------------------------------------------------------------- /test/concat4.in: -------------------------------------------------------------------------------- 1 | foo 2 | bar 3 | -------------------------------------------------------------------------------- /test/concat4.ok: -------------------------------------------------------------------------------- 1 | foo 2 | 0 3 | foobar 4 | 4 5 | -------------------------------------------------------------------------------- /test/convfmt.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | CONVFMT = "%2.2f" 3 | a = 123.456 4 | b = a "" # give `a' string value also 5 | printf "a = %s\n", a 6 | CONVFMT = "%.6g" 7 | printf "a = %s\n", a 8 | a += 0 # make `a' numeric only again 9 | printf "a = %s\n", a # use `a' as string 10 | } 11 | -------------------------------------------------------------------------------- /test/convfmt.ok: -------------------------------------------------------------------------------- 1 | a = 123.46 2 | a = 123.456 3 | a = 123.456 4 | -------------------------------------------------------------------------------- /test/datanonl.awk: -------------------------------------------------------------------------------- 1 | # example program from alex@bofh.torun.pl 2 | BEGIN { IGNORECASE=1 } 3 | /\w+@([[:alnum:]]+\.)+[[:alnum:]]+[[:blank:]]+/ {print $0} 4 | -------------------------------------------------------------------------------- /test/datanonl.in: -------------------------------------------------------------------------------- 1 | bleble@foo1.bh.pl deny -------------------------------------------------------------------------------- /test/datanonl.ok: -------------------------------------------------------------------------------- 1 | bleble@foo1.bh.pl deny 2 | -------------------------------------------------------------------------------- /test/defref.awk: -------------------------------------------------------------------------------- 1 | BEGIN { foo() } 2 | -------------------------------------------------------------------------------- /test/defref.ok: -------------------------------------------------------------------------------- 1 | gawk: warning: function `foo' called but never defined 2 | gawk: defref.awk:1: fatal: function `foo' not defined 3 | EXIT CODE: 2 4 | -------------------------------------------------------------------------------- /test/delargv.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | ARGV[1] = "/dev/null" 3 | ARGV[2] = "/dev/null" 4 | ARGV[3] = "/dev/null" 5 | ARGC = 4 6 | delete ARGV[2] 7 | } 8 | 9 | END { 10 | for (i in ARGV) 11 | printf("length of ARGV[%d] is %d\n", i, length(ARGV[i])) 12 | } 13 | -------------------------------------------------------------------------------- /test/delargv.ok: -------------------------------------------------------------------------------- 1 | length of ARGV[0] is 4 2 | length of ARGV[1] is 9 3 | length of ARGV[3] is 9 4 | -------------------------------------------------------------------------------- /test/delarpm2.ok: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | -------------------------------------------------------------------------------- /test/delarprm.ok: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/test/delarprm.ok -------------------------------------------------------------------------------- /test/delfunc.awk: -------------------------------------------------------------------------------- 1 | # from Stepan Kasal, 9 July 2003 2 | function f() 3 | { 4 | delete f 5 | } 6 | 7 | BEGIN { f() } 8 | -------------------------------------------------------------------------------- /test/delfunc.ok: -------------------------------------------------------------------------------- 1 | gawk: delfunc.awk:4: error: function `f' called with space between name and `(', 2 | or used as a variable or an array 3 | EXIT CODE: 1 4 | -------------------------------------------------------------------------------- /test/delsub.awk: -------------------------------------------------------------------------------- 1 | function f(c, d, x) { delete c; x = d[0] } 2 | BEGIN { a[0][0] = 1; f(a, a[0]); print "still here" } 3 | -------------------------------------------------------------------------------- /test/delsub.ok: -------------------------------------------------------------------------------- 1 | still here 2 | -------------------------------------------------------------------------------- /test/devfd.in4: -------------------------------------------------------------------------------- 1 | file on fd 4 2 | -------------------------------------------------------------------------------- /test/devfd.in5: -------------------------------------------------------------------------------- 1 | file on fd 5 2 | -------------------------------------------------------------------------------- /test/devfd.ok: -------------------------------------------------------------------------------- 1 | file on fd 4 2 | file on fd 5 3 | -------------------------------------------------------------------------------- /test/devfd1.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | while (1) { 3 | if ((getline l1 < "/dev/fd/4") <= 0) 4 | break 5 | print l1 6 | 7 | if ((getline l2 < "/dev/fd/5") <= 0) 8 | break 9 | print l2 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /test/dfastress.awk: -------------------------------------------------------------------------------- 1 | BEGIN { print "a" ~ /(^| )*(a|b)*(c|d)( |$)/ } 2 | -------------------------------------------------------------------------------- /test/dfastress.ok: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /test/double1.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | print 9223372036854775808 3 | printf("%d\n", 9223372036854775808) 4 | } 5 | -------------------------------------------------------------------------------- /test/double1.ok: -------------------------------------------------------------------------------- 1 | 9223372036854775808 2 | 9223372036854775808 3 | -------------------------------------------------------------------------------- /test/double2.ok: -------------------------------------------------------------------------------- 1 | 2^60= 1152921504606846976 1152921504606846976 1.15292e+18 100000000000000000000 2 | 2^61= 2305843009213693952 2305843009213693952 2.30584e+18 200000000000000000000 3 | 2^62= 4611686018427387904 4611686018427387904 4.61169e+18 400000000000000000000 4 | 2^63= 9223372036854775808 9223372036854775808 9.22337e+18 1000000000000000000000 5 | -------------------------------------------------------------------------------- /test/dumpvars.in: -------------------------------------------------------------------------------- 1 | A 2 | B 3 | C 4 | -------------------------------------------------------------------------------- /test/dumpvars.ok: -------------------------------------------------------------------------------- 1 | ARGC: 1 2 | ARGIND: 0 3 | ARGV: array, 1 elements 4 | BINMODE: 0 5 | CONVFMT: "%.6g" 6 | ERRNO: "" 7 | FIELDWIDTHS: "" 8 | FILENAME: "-" 9 | FNR: 3 10 | FPAT: "[^[:space:]]+" 11 | FS: " " 12 | IGNORECASE: 0 13 | LINT: 0 14 | NF: 1 15 | NR: 3 16 | OFMT: "%.6g" 17 | OFS: " " 18 | ORS: "\n" 19 | PREC: 53 20 | RLENGTH: 0 21 | ROUNDMODE: "N" 22 | RS: "\n" 23 | RSTART: 0 24 | RT: "\n" 25 | SUBSEP: "\034" 26 | TEXTDOMAIN: "messages" 27 | -------------------------------------------------------------------------------- /test/dynlj.awk: -------------------------------------------------------------------------------- 1 | BEGIN { printf "%*sworld\n", -20, "hello" } 2 | -------------------------------------------------------------------------------- /test/dynlj.ok: -------------------------------------------------------------------------------- 1 | hello world 2 | -------------------------------------------------------------------------------- /test/eofsplit.ok: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/test/eofsplit.ok -------------------------------------------------------------------------------- /test/exit.ok: -------------------------------------------------------------------------------- 1 | 1 2 | 3 3 | -- 1 4 | 2 5 | -- 2 6 | 2 7 | -- 3 8 | 2 9 | 2 10 | -- 4 11 | 0 12 | -- 5 13 | 1 null 14 | -- 6 15 | 1 null 16 | -- 7 17 | 0 exit.sh 18 | -- 8 19 | 1 20 | 0 exit.sh 21 | -- 9 22 | 0 null 23 | -- 10 24 | 1 null 25 | -- 11 26 | -------------------------------------------------------------------------------- /test/exitval1.awk: -------------------------------------------------------------------------------- 1 | # This should exit 0, even though child exits 1 2 | BEGIN { "exit 1" | getline junk ; exit 12 } 3 | END { exit 0 } 4 | -------------------------------------------------------------------------------- /test/exitval1.ok: -------------------------------------------------------------------------------- 1 | EXIT CODE: 0 2 | -------------------------------------------------------------------------------- /test/exitval2.awk: -------------------------------------------------------------------------------- 1 | BEGIN { print "foo" | "read x ; echo $x ; exit 12" } 2 | # this should still exit 0, as pointed out by kenny mccormack in 3 | # comp.lang.awk on 2 feb 2005 4 | -------------------------------------------------------------------------------- /test/exitval2.ok: -------------------------------------------------------------------------------- 1 | foo 2 | -------------------------------------------------------------------------------- /test/exitval2.w32: -------------------------------------------------------------------------------- 1 | BEGIN { print "foo" | "sh -c \"read x ; echo $x ; exit 12\"" } 2 | # this should still exit 0, as pointed out by kenny mccormack in 3 | # comp.lang.awk on 2 feb 2005 4 | -------------------------------------------------------------------------------- /test/fcall_exit.awk: -------------------------------------------------------------------------------- 1 | #!/bin/awk -f 2 | 3 | function crash () { 4 | exit 1 5 | } 6 | 7 | function true (a,b,c) { 8 | return 0 9 | } 10 | 11 | BEGIN { 12 | if (ARGV[1] == 1) { 13 | print "true(1, 1, crash()) => crash properly." 14 | true(1, 1, crash()) 15 | } else if (ARGV[1] == 2) { 16 | print "true(1, crash(), 1) => do not crash properly." 17 | true(1, crash(),1) 18 | } else { 19 | print "true(1, crash()) => do not crash properly." 20 | true(1, crash()) 21 | } 22 | } 23 | 24 | # FdF 25 | -------------------------------------------------------------------------------- /test/fcall_exit.ok: -------------------------------------------------------------------------------- 1 | true(1, crash()) => do not crash properly. 2 | EXIT CODE: 1 3 | -------------------------------------------------------------------------------- /test/fcall_exit2.awk: -------------------------------------------------------------------------------- 1 | #!/bin/awk -f 2 | 3 | function crash () { 4 | exit 1 5 | } 6 | 7 | function true (a,b,c) { 8 | return 1 9 | } 10 | 11 | BEGIN { 12 | if (ARGV[2] == 1) { 13 | print " true(1, crash()) => crash properly." 14 | true(1, crash()) 15 | # ADR: Added: 16 | delete ARGV[2] 17 | } 18 | } 19 | 20 | { 21 | print " true(1, crash()) => do not crash properly." 22 | true(1, crash()) 23 | } 24 | 25 | # FdF 26 | -------------------------------------------------------------------------------- /test/fcall_exit2.in: -------------------------------------------------------------------------------- 1 | dummy input line 2 | -------------------------------------------------------------------------------- /test/fcall_exit2.ok: -------------------------------------------------------------------------------- 1 | true(1, crash()) => do not crash properly. 2 | EXIT CODE: 1 3 | -------------------------------------------------------------------------------- /test/fflush.ok: -------------------------------------------------------------------------------- 1 | 1st 2 | 2nd 3 | 1st 4 | 2nd 5 | 1st 6 | 2nd 7 | 1st 8 | 2nd 9 | 1st 10 | 2nd 11 | 1st 12 | 2nd 13 | 1st 14 | 2nd 15 | 1st 16 | 2nd 17 | -------------------------------------------------------------------------------- /test/fieldwdth.awk: -------------------------------------------------------------------------------- 1 | BEGIN { FIELDWIDTHS = "2 3 4" } 2 | { print $2 } 3 | -------------------------------------------------------------------------------- /test/fieldwdth.in: -------------------------------------------------------------------------------- 1 | 123456789 2 | -------------------------------------------------------------------------------- /test/fieldwdth.ok: -------------------------------------------------------------------------------- 1 | 345 2 | -------------------------------------------------------------------------------- /test/filefuncs.ok: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/test/filefuncs.ok -------------------------------------------------------------------------------- /test/fldchg.awk: -------------------------------------------------------------------------------- 1 | { 2 | # print "0:", $0 3 | gsub("aa", "+") 4 | print "1:", $0 5 | $3 = "<" $3 ">" 6 | print "2:", $0 7 | print "2a:" "%" $1 "%" $2 "%" $3 "%" $4 "%" $5 8 | } 9 | -------------------------------------------------------------------------------- /test/fldchg.in: -------------------------------------------------------------------------------- 1 | aa aab c d e f 2 | -------------------------------------------------------------------------------- /test/fldchg.ok: -------------------------------------------------------------------------------- 1 | 1: + +b c d e f 2 | 2: + +b d e f 3 | 2a:%+%+b%%d%e 4 | -------------------------------------------------------------------------------- /test/fldchgnf.awk: -------------------------------------------------------------------------------- 1 | { OFS = ":"; $2 = ""; print $0; print NF } 2 | -------------------------------------------------------------------------------- /test/fldchgnf.in: -------------------------------------------------------------------------------- 1 | a b c d 2 | -------------------------------------------------------------------------------- /test/fldchgnf.ok: -------------------------------------------------------------------------------- 1 | a::c:d 2 | 4 3 | -------------------------------------------------------------------------------- /test/fmtspcl-mpfr.ok: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/test/fmtspcl-mpfr.ok -------------------------------------------------------------------------------- /test/fnamedat.awk: -------------------------------------------------------------------------------- 1 | function foo() { print foo } {foo()} 2 | -------------------------------------------------------------------------------- /test/fnamedat.in: -------------------------------------------------------------------------------- 1 | foo 2 | -------------------------------------------------------------------------------- /test/fnamedat.ok: -------------------------------------------------------------------------------- 1 | gawk: fnamedat.awk:1: error: function `foo' called with space between name and `(', 2 | or used as a variable or an array 3 | EXIT CODE: 1 4 | -------------------------------------------------------------------------------- /test/fnarray.awk: -------------------------------------------------------------------------------- 1 | function foo(N) { 2 | return 0 3 | } 4 | BEGIN { 5 | Num = foo[c] 6 | } 7 | 8 | -------------------------------------------------------------------------------- /test/fnarray.ok: -------------------------------------------------------------------------------- 1 | gawk: fnarray.awk:5: error: function `foo' called with space between name and `(', 2 | or used as a variable or an array 3 | EXIT CODE: 1 4 | -------------------------------------------------------------------------------- /test/fnarray2.awk: -------------------------------------------------------------------------------- 1 | function pile(c, r) 2 | { 3 | r = ++pile[c] 4 | } 5 | { pile($1) } 6 | -------------------------------------------------------------------------------- /test/fnarray2.in: -------------------------------------------------------------------------------- 1 | x 2 | -------------------------------------------------------------------------------- /test/fnarray2.ok: -------------------------------------------------------------------------------- 1 | gawk: fnarray2.awk:3: error: function `pile' called with space between name and `(', 2 | or used as a variable or an array 3 | EXIT CODE: 1 4 | -------------------------------------------------------------------------------- /test/fnarydel-mpfr.ok: -------------------------------------------------------------------------------- 1 | first loop 2 | 4 3 | 5 4 | 6 5 | 7 6 | 8 7 | 9 8 | 1 9 | 2 10 | 3 11 | second loop 12 | third loop 13 | 4 14 | 5 15 | 6 16 | 7 17 | 8 18 | 9 19 | 1 20 | 2 21 | 3 22 | call func 23 | fourth loop 24 | You should just see: 4 4 25 | 4 4 26 | You should see nothing between this line 27 | And this one 28 | -------------------------------------------------------------------------------- /test/fnarydel.ok: -------------------------------------------------------------------------------- 1 | first loop 2 | 1 3 | 2 4 | 3 5 | 4 6 | 5 7 | 6 8 | 7 9 | 8 10 | 9 11 | second loop 12 | third loop 13 | 1 14 | 2 15 | 3 16 | 4 17 | 5 18 | 6 19 | 7 20 | 8 21 | 9 22 | call func 23 | fourth loop 24 | You should just see: 4 4 25 | 4 4 26 | You should see nothing between this line 27 | And this one 28 | -------------------------------------------------------------------------------- /test/fnaryscl.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | foo[1] = 4 3 | f1(foo) 4 | } 5 | 6 | function f1(a) { f2(a) } 7 | 8 | function f2(b) { f3(b) } 9 | 10 | function f3(c) { c = 6 } 11 | -------------------------------------------------------------------------------- /test/fnaryscl.ok: -------------------------------------------------------------------------------- 1 | gawk: fnaryscl.awk:10: fatal: attempt to use array `c (from b, from a, from foo)' in a scalar context 2 | EXIT CODE: 2 3 | -------------------------------------------------------------------------------- /test/fnasgnm.awk: -------------------------------------------------------------------------------- 1 | # AFP_Bug1.awk - illustrate a problem with `gawk' (GNU Awk 3.0.3 on OS/2) 2 | # Arthur Pool .. pool@commerce.uq.edu.au 3 | # $Id: fnasgnm.awk,v 1.1.1.1 2008/11/16 19:21:15 arnold Exp $ 4 | 5 | # Assignment to a variable with the same name as a function from within 6 | # that function causes an ABEND. 7 | # 8 | # Yes, I do realise that it's not a smart thing to do, but an error 9 | # message would be a kinder response than a core dump (and would make 10 | # debugging a whole lot easier). 11 | 12 | {ShowMe()} 13 | 14 | function ShowMe() {ShowMe = 1} 15 | -------------------------------------------------------------------------------- /test/fnasgnm.in: -------------------------------------------------------------------------------- 1 | junk 2 | -------------------------------------------------------------------------------- /test/fnasgnm.ok: -------------------------------------------------------------------------------- 1 | gawk: fnasgnm.awk:14: error: function `ShowMe' called with space between name and `(', 2 | or used as a variable or an array 3 | EXIT CODE: 1 4 | -------------------------------------------------------------------------------- /test/fnmatch.awk: -------------------------------------------------------------------------------- 1 | @load "fnmatch" 2 | 3 | BEGIN { 4 | print "FNM_NOMATCH =", FNM_NOMATCH 5 | # can't print the values; they vary from system to system 6 | for (i in FNM) 7 | printf("\"%s\" is an element in FNM\n", i) 8 | 9 | printf("fnmatch(\"*.a\", \"foo.a\", 0) = %d\n", fnmatch("*.a", "foo.a", 0) ) 10 | printf("fnmatch(\"*.a\", \"foo.c\", 0) = %d\n", fnmatch("*.a", "foo.c", 0)) 11 | } 12 | -------------------------------------------------------------------------------- /test/fnmatch.ok: -------------------------------------------------------------------------------- 1 | FNM_NOMATCH = 1 2 | "LEADING_DIR" is an element in FNM 3 | "CASEFOLD" is an element in FNM 4 | "NOESCAPE" is an element in FNM 5 | "PERIOD" is an element in FNM 6 | "PATHNAME" is an element in FNM 7 | "FILE_NAME" is an element in FNM 8 | fnmatch("*.a", "foo.a", 0) = 0 9 | fnmatch("*.a", "foo.c", 0) = 1 10 | -------------------------------------------------------------------------------- /test/fnmisc.awk: -------------------------------------------------------------------------------- 1 | # Tue Feb 4 12:20:10 IST 2003 2 | 3 | # Misc functions tests, in case we start mucking around in the grammar again. 4 | 5 | # Empty body shouldn't hurt anything: 6 | function f() {} 7 | BEGIN { f() } 8 | 9 | # Using a built-in function name should manage the symbol table 10 | # correctly: 11 | function split(x) { return x } 12 | 13 | function x(a) { return a } 14 | -------------------------------------------------------------------------------- /test/fnmisc.ok: -------------------------------------------------------------------------------- 1 | gawk: fnmisc.awk:11: function split(x) { return x } 2 | gawk: fnmisc.awk:11: ^ `split' is a built-in function, it cannot be redefined 3 | EXIT CODE: 1 4 | -------------------------------------------------------------------------------- /test/fnparydl-mpfr.ok: -------------------------------------------------------------------------------- 1 | BEFORE LOOP 2 | DELETING KEY 4 3 | DELETING KEY 5 4 | DELETING KEY 6 5 | DELETING KEY 7 6 | DELETING KEY 1 7 | DELETING KEY 2 8 | DELETING KEY 3 9 | AFTER LOOP 10 | 0 elements still in q[] 11 | -------------------------------------------------------------------------------- /test/fnparydl.ok: -------------------------------------------------------------------------------- 1 | BEFORE LOOP 2 | DELETING KEY 1 3 | DELETING KEY 2 4 | DELETING KEY 3 5 | DELETING KEY 4 6 | DELETING KEY 5 7 | DELETING KEY 6 8 | DELETING KEY 7 9 | AFTER LOOP 10 | 0 elements still in q[] 11 | -------------------------------------------------------------------------------- /test/fordel.ok: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/test/fordel.ok -------------------------------------------------------------------------------- /test/fork.ok: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/test/fork.ok -------------------------------------------------------------------------------- /test/fork2.ok: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/test/fork2.ok -------------------------------------------------------------------------------- /test/forref.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | names[1] = "s" 3 | names[2] = "m" 4 | for (i in names) { 5 | x[names[i]] = i 6 | print i, names[i], x[names[i]] 7 | } 8 | print x["s"] 9 | # adump(x) 10 | # adump(names) 11 | } 12 | -------------------------------------------------------------------------------- /test/forref.ok: -------------------------------------------------------------------------------- 1 | 1 s 1 2 | 2 m 2 3 | 1 4 | -------------------------------------------------------------------------------- /test/forsimp.awk: -------------------------------------------------------------------------------- 1 | BEGIN { for (print 9; 0;); } 2 | -------------------------------------------------------------------------------- /test/forsimp.ok: -------------------------------------------------------------------------------- 1 | 9 2 | -------------------------------------------------------------------------------- /test/fpat1.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | # if (t == 0) 3 | FPAT = "([^,]+)|(\"[^\"]+\")" 4 | # else 5 | # FPAT = "([^,]*)|(\"[^\"]+\")" 6 | } 7 | FNR == 1 { 8 | # This part was added later 9 | print $1 10 | print $1, $3 11 | for (i = 1; i <= NF; i++) 12 | print i, $i 13 | 14 | # Reset for original part of test 15 | FPAT = "([^,]*)|(\"[^\"]+\")" 16 | $0 = $0 17 | } 18 | { 19 | print "NF =", NF 20 | for (i = 1; i <= NF; i++) 21 | printf("$%d = <%s>\n", i, $i) 22 | } 23 | -------------------------------------------------------------------------------- /test/fpat1.in: -------------------------------------------------------------------------------- 1 | Robbins,Arnold,"1234 A Pretty Place, NE",Sometown,NY,12345-6789,USA 2 | Smith,,"1234 A Pretty Place, NE",Sometown,NY,12345-6789,USA 3 | -------------------------------------------------------------------------------- /test/fpat1.ok: -------------------------------------------------------------------------------- 1 | Robbins 2 | Robbins "1234 A Pretty Place, NE" 3 | 1 Robbins 4 | 2 Arnold 5 | 3 "1234 A Pretty Place, NE" 6 | 4 Sometown 7 | 5 NY 8 | 6 12345-6789 9 | 7 USA 10 | NF = 7 11 | $1 = 12 | $2 = 13 | $3 = <"1234 A Pretty Place, NE"> 14 | $4 = 15 | $5 = 16 | $6 = <12345-6789> 17 | $7 = 18 | NF = 7 19 | $1 = 20 | $2 = <> 21 | $3 = <"1234 A Pretty Place, NE"> 22 | $4 = 23 | $5 = 24 | $6 = <12345-6789> 25 | $7 = 26 | -------------------------------------------------------------------------------- /test/fpat2.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | FPAT = " " 3 | $0 = "" 4 | print NF 5 | 6 | $0 = "abc" 7 | print NF 8 | 9 | $0 = "a b c" 10 | print NF 11 | } 12 | -------------------------------------------------------------------------------- /test/fpat2.ok: -------------------------------------------------------------------------------- 1 | 0 2 | 0 3 | 2 4 | -------------------------------------------------------------------------------- /test/fpat3.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | FPAT = "[^,]*" 3 | 4 | } 5 | 6 | { 7 | if (x) NF 8 | for (i = 1; i <= 4; ++i) 9 | print i, $i 10 | } 11 | -------------------------------------------------------------------------------- /test/fpat3.in: -------------------------------------------------------------------------------- 1 | a,b,,c 2 | -------------------------------------------------------------------------------- /test/fpat3.ok: -------------------------------------------------------------------------------- 1 | 1 a 2 | 2 b 3 | 3 4 | 4 c 5 | -------------------------------------------------------------------------------- /test/fpatnull.awk: -------------------------------------------------------------------------------- 1 | BEGIN { FPAT = "" } 2 | { print NF } 3 | -------------------------------------------------------------------------------- /test/fpatnull.in: -------------------------------------------------------------------------------- 1 | hello, world 2 | -------------------------------------------------------------------------------- /test/fpatnull.ok: -------------------------------------------------------------------------------- 1 | 13 2 | -------------------------------------------------------------------------------- /test/fsbs.awk: -------------------------------------------------------------------------------- 1 | BEGIN { FS = "\\" } 2 | { print $1, $2} 3 | -------------------------------------------------------------------------------- /test/fsbs.in: -------------------------------------------------------------------------------- 1 | 1\2 2 | -------------------------------------------------------------------------------- /test/fsbs.ok: -------------------------------------------------------------------------------- 1 | 1 2 2 | -------------------------------------------------------------------------------- /test/fsfwfs.awk: -------------------------------------------------------------------------------- 1 | BEGIN{FIELDWIDTHS="6 6 6 5";OFS=",";FS=FS}{print $1,$2,$3,$4} 2 | -------------------------------------------------------------------------------- /test/fsfwfs.in: -------------------------------------------------------------------------------- 1 | 00000113000 00000000000 2 | 00000275000 00000000000 3 | 00000321334 00000000000 4 | 00000048709 00000010000 5 | 00000117000 00000100000 6 | 00000152000 00000138000 7 | 00000000000 00000150000 8 | 00000189425 00000000000 9 | 00000146128 00000000000 10 | 00000146128 00000000000 11 | 00000146128 00000000000 12 | 00000000000 00000050000 13 | 00000000000 00000050000 14 | 00000000000 00000000000 15 | 00000158014 00000000000 16 | 00000113656 00000000000 17 | -------------------------------------------------------------------------------- /test/fsfwfs.ok: -------------------------------------------------------------------------------- 1 | 00000113000,00000000000,, 2 | 00000275000,00000000000,, 3 | 00000321334,00000000000,, 4 | 00000048709,00000010000,, 5 | 00000117000,00000100000,, 6 | 00000152000,00000138000,, 7 | 00000000000,00000150000,, 8 | 00000189425,00000000000,, 9 | 00000146128,00000000000,, 10 | 00000146128,00000000000,, 11 | 00000146128,00000000000,, 12 | 00000000000,00000050000,, 13 | 00000000000,00000050000,, 14 | 00000000000,00000000000,, 15 | 00000158014,00000000000,, 16 | 00000113656,00000000000,, 17 | -------------------------------------------------------------------------------- /test/fsrs.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | RS=""; FS="\n"; 3 | ORS=""; OFS="\n"; 4 | } 5 | { 6 | split ($2,f," ") 7 | print $0; 8 | } 9 | -------------------------------------------------------------------------------- /test/fsrs.in: -------------------------------------------------------------------------------- 1 | a b 2 | c d 3 | e f 4 | 5 | 1 2 6 | 3 4 7 | 5 6 8 | -------------------------------------------------------------------------------- /test/fsrs.ok: -------------------------------------------------------------------------------- 1 | a b 2 | c d 3 | e f1 2 4 | 3 4 5 | 5 6 -------------------------------------------------------------------------------- /test/fsspcoln.in: -------------------------------------------------------------------------------- 1 | a:b:c 2 | -------------------------------------------------------------------------------- /test/fsspcoln.ok: -------------------------------------------------------------------------------- 1 | b 2 | -------------------------------------------------------------------------------- /test/fstabplus.awk: -------------------------------------------------------------------------------- 1 | BEGIN { FS = "\t+" } 2 | { print $1, $2 } 3 | -------------------------------------------------------------------------------- /test/fstabplus.in: -------------------------------------------------------------------------------- 1 | 1 2 2 | -------------------------------------------------------------------------------- /test/fstabplus.ok: -------------------------------------------------------------------------------- 1 | 1 2 2 | -------------------------------------------------------------------------------- /test/functab1.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | delete FUNCTAB 3 | } 4 | -------------------------------------------------------------------------------- /test/functab1.ok: -------------------------------------------------------------------------------- 1 | gawk: functab1.awk:3: fatal: `delete' is not allowed with FUNCTAB 2 | EXIT CODE: 2 3 | -------------------------------------------------------------------------------- /test/functab2.awk: -------------------------------------------------------------------------------- 1 | function foo() 2 | { 3 | print "foo!" 4 | } 5 | 6 | BEGIN { 7 | FUNCTAB["a"] = "something" 8 | } 9 | -------------------------------------------------------------------------------- /test/functab2.ok: -------------------------------------------------------------------------------- 1 | gawk: functab2.awk:7: fatal: cannot assign to elements of FUNCTAB 2 | EXIT CODE: 2 3 | -------------------------------------------------------------------------------- /test/functab3.awk: -------------------------------------------------------------------------------- 1 | function foo() 2 | { 3 | print "foo!" 4 | } 5 | 6 | BEGIN { 7 | x = FUNCTAB["foo"] 8 | print "x =", x 9 | @x() 10 | } 11 | -------------------------------------------------------------------------------- /test/functab3.ok: -------------------------------------------------------------------------------- 1 | x = foo 2 | foo! 3 | -------------------------------------------------------------------------------- /test/functab4.awk: -------------------------------------------------------------------------------- 1 | @load "filefuncs" 2 | 3 | function foo() 4 | { 5 | print "foo!" 6 | } 7 | 8 | BEGIN { 9 | x = FUNCTAB["chdir"] 10 | print "x =", x 11 | @x("/tmp") 12 | printf "we are now in --> " 13 | system("/bin/pwd || /usr/bin/pwd") 14 | } 15 | -------------------------------------------------------------------------------- /test/functab4.ok: -------------------------------------------------------------------------------- 1 | x = chdir 2 | gawk: functab4.awk:11: fatal: cannot (yet) call extension functions indirectly 3 | EXIT CODE: 2 4 | -------------------------------------------------------------------------------- /test/funlen.in: -------------------------------------------------------------------------------- 1 | CD NAME 2 | AT Austria 3 | BG Bulgaria 4 | CH Switzerland 5 | DE Germany 6 | EE Estonia 7 | FR France 8 | GR Greece 9 | -------------------------------------------------------------------------------- /test/funlen.ok: -------------------------------------------------------------------------------- 1 | array: 7 2 | array_A: 7 3 | -------------------------------------------------------------------------------- /test/funsemnl.awk: -------------------------------------------------------------------------------- 1 | # make sure that ; + \n at end after function works 2 | function foo() { print "foo" } ; 3 | BEGIN { foo() } 4 | -------------------------------------------------------------------------------- /test/funsemnl.ok: -------------------------------------------------------------------------------- 1 | foo 2 | -------------------------------------------------------------------------------- /test/funsmnam.awk: -------------------------------------------------------------------------------- 1 | function foo( \ 2 | foo) 3 | { 4 | print foo 5 | } 6 | { foo() } 7 | -------------------------------------------------------------------------------- /test/funsmnam.ok: -------------------------------------------------------------------------------- 1 | gawk: funsmnam.awk:2: error: function `foo': can't use function name as parameter name 2 | EXIT CODE: 1 3 | -------------------------------------------------------------------------------- /test/funstack.ok: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/test/funstack.ok -------------------------------------------------------------------------------- /test/fwtest.awk: -------------------------------------------------------------------------------- 1 | BEGIN { FIELDWIDTHS = "1 1 1" } 2 | { print NF, $1, $2, $3 } 3 | -------------------------------------------------------------------------------- /test/fwtest.in: -------------------------------------------------------------------------------- 1 | abc 2 | -------------------------------------------------------------------------------- /test/fwtest.ok: -------------------------------------------------------------------------------- 1 | 3 a b c 2 | -------------------------------------------------------------------------------- /test/fwtest3.awk: -------------------------------------------------------------------------------- 1 | BEGIN { FIELDWIDTHS="5" } { print $1 } 2 | -------------------------------------------------------------------------------- /test/fwtest3.in: -------------------------------------------------------------------------------- 1 | 1234567890 2 | -------------------------------------------------------------------------------- /test/fwtest3.ok: -------------------------------------------------------------------------------- 1 | 12345 2 | -------------------------------------------------------------------------------- /test/gensub.awk: -------------------------------------------------------------------------------- 1 | BEGIN { a = "this is a test of gawk" 2 | b = gensub(/(this).*(test).*(gawk)/, "3 = <\\3>, 2 = <\\2>, 1 = <\\1>", 1, a) 3 | print b 4 | } 5 | NR == 1 { print gensub(/b/, "BB", 2) } 6 | NR == 2 { print gensub(/c/, "CC", "global") } 7 | END { print gensub(/foo/, "bar", 1, "DON'T PANIC") } 8 | -------------------------------------------------------------------------------- /test/gensub.in: -------------------------------------------------------------------------------- 1 | a b c a b c a b c 2 | a b c a b c a b c 3 | -------------------------------------------------------------------------------- /test/gensub.ok: -------------------------------------------------------------------------------- 1 | 3 = , 2 = , 1 = 2 | a b c a BB c a b c 3 | a b CC a b CC a b CC 4 | DON'T PANIC 5 | -------------------------------------------------------------------------------- /test/gensub2.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | print gensub("x","y",2,"xx") 3 | print gensub("x","y","2","xx") 4 | print gensub("x","y","a","xx") 5 | } 6 | -------------------------------------------------------------------------------- /test/gensub2.ok: -------------------------------------------------------------------------------- 1 | xy 2 | xy 3 | yx 4 | -------------------------------------------------------------------------------- /test/getline.in: -------------------------------------------------------------------------------- 1 | A 2 | B 3 | C 4 | -------------------------------------------------------------------------------- /test/getline.ok: -------------------------------------------------------------------------------- 1 | 1s A 2 | 2 B 3 | -1 C 4 | 1s A 5 | 2 B 6 | -1 C 7 | 1 D 8 | date 9 | -------------------------------------------------------------------------------- /test/getline2.awk: -------------------------------------------------------------------------------- 1 | BEGIN { while( getline > 0) { print } } 2 | -------------------------------------------------------------------------------- /test/getline2.ok: -------------------------------------------------------------------------------- 1 | BEGIN { while( getline > 0) { print } } 2 | BEGIN { while( getline > 0) { print } } 3 | -------------------------------------------------------------------------------- /test/getline3.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | cmd = "echo 3" 3 | y = 7 4 | cmd | getline x y 5 | close(cmd) 6 | print (cmd | getline x y) 7 | } 8 | -------------------------------------------------------------------------------- /test/getline3.ok: -------------------------------------------------------------------------------- 1 | 17 2 | -------------------------------------------------------------------------------- /test/getline4.awk: -------------------------------------------------------------------------------- 1 | END { getline $2; print} 2 | -------------------------------------------------------------------------------- /test/getline4.in: -------------------------------------------------------------------------------- 1 | aaa bbb 2 | -------------------------------------------------------------------------------- /test/getline4.ok: -------------------------------------------------------------------------------- 1 | aaa bbb 2 | -------------------------------------------------------------------------------- /test/getline5.ok: -------------------------------------------------------------------------------- 1 | 2 2 | -------------------------------------------------------------------------------- /test/getlndir.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | if (!SRCDIR) SRCDIR = "." 3 | OFS = ", " 4 | x = 4 5 | ret = (getline x < SRCDIR) 6 | print x, ret, ERRNO 7 | } 8 | -------------------------------------------------------------------------------- /test/getlndir.ok: -------------------------------------------------------------------------------- 1 | 4, -1, Is a directory 2 | -------------------------------------------------------------------------------- /test/getlnhd.awk: -------------------------------------------------------------------------------- 1 | BEGIN { pipe = "cat < 0) 7 | print 8 | 9 | exit 0 10 | } 11 | -------------------------------------------------------------------------------- /test/getlnhd.ok: -------------------------------------------------------------------------------- 1 | select * from user 2 | where Name = 'O\'Donell' 3 | -------------------------------------------------------------------------------- /test/getnr2tb.in: -------------------------------------------------------------------------------- 1 | line 1 2 | line 2 3 | line 3 4 | line 4 5 | line 5 6 | line 6 7 | -------------------------------------------------------------------------------- /test/getnr2tb.ok: -------------------------------------------------------------------------------- 1 | 1 10 2 | 2 5 3 | 3 3.33333 4 | 4 2.5 5 | 5 2 6 | 6 1.66667 7 | -------------------------------------------------------------------------------- /test/getnr2tm.awk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/test/getnr2tm.awk -------------------------------------------------------------------------------- /test/getnr2tm.in: -------------------------------------------------------------------------------- 1 | a 2 | -------------------------------------------------------------------------------- /test/getnr2tm.ok: -------------------------------------------------------------------------------- 1 | 1 lines in 1 sec: 1 lines/sec; nlines=1 2 | -------------------------------------------------------------------------------- /test/gnuops2.ok: -------------------------------------------------------------------------------- 1 | 3 2 | 3 3 | 3 4 | 3 5 | 3 6 | 3 7 | 3 8 | -------------------------------------------------------------------------------- /test/gnuops3.awk: -------------------------------------------------------------------------------- 1 | # Mon Jan 31 09:57:30 IST 2005 2 | # test both dfa and regex matchers on \B 3 | # tests from Stepan Kasal, kasal@ucw.cz 4 | BEGIN { 5 | 6 | print (" " ~ / \B /) # test dfa matcher 7 | print ("a b" ~ /\B/) 8 | print (" b" ~ /\B/) 9 | print ("a " ~ /\B/) 10 | 11 | a = " " 12 | gsub(/\B/, "x", a) # test regex matcher 13 | print a 14 | } 15 | -------------------------------------------------------------------------------- /test/gnuops3.ok: -------------------------------------------------------------------------------- 1 | 1 2 | 0 3 | 1 4 | 1 5 | x x x 6 | -------------------------------------------------------------------------------- /test/gnureops.ok: -------------------------------------------------------------------------------- 1 | test 1 ok (\y) 2 | test 2 ok (\y) 3 | test 3 ok (\y) 4 | test 4 ok (\B) 5 | test 5 ok (\B) 6 | test 6 ok (\<) 7 | test 7 ok (\<) 8 | test 8 ok (\>) 9 | test 9 ok (\>) 10 | test 10 ok (\w) 11 | test 11 ok (\w) 12 | test 12 ok (\W) 13 | test 13 ok (\W) 14 | test 14 ok (\`) 15 | test 15 ok (\`) 16 | test 16 ok (\') 17 | test 17 ok (\') 18 | -------------------------------------------------------------------------------- /test/gsubasgn.awk: -------------------------------------------------------------------------------- 1 | # tests for assigning to a function within that function 2 | 3 | #1 - should be bad 4 | function test1 (r) { gsub(r, "x", test1) } 5 | BEGIN { test1("") } 6 | 7 | #2 - should be bad 8 | function test2 () { gsub(/a/, "x", test2) } 9 | BEGIN { test2() } 10 | 11 | #3 - should be ok 12 | function test3 (r) { gsub(/a/, "x", r) } 13 | BEGIN { test3("") } 14 | -------------------------------------------------------------------------------- /test/gsubasgn.ok: -------------------------------------------------------------------------------- 1 | gawk: gsubasgn.awk:4: error: function `test1' called with space between name and `(', 2 | or used as a variable or an array 3 | gawk: gsubasgn.awk:8: error: function `test2' called with space between name and `(', 4 | or used as a variable or an array 5 | EXIT CODE: 1 6 | -------------------------------------------------------------------------------- /test/gsubtest.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | str = "abc"; print gsub("b+", "FOO", str), str 3 | str = "abc"; print gsub("x*", "X", str), str 4 | str = "abc"; print gsub("b*", "X", str), str 5 | str = "abc"; print gsub("c", "X", str), str 6 | str = "abc"; print gsub("c+", "X", str), str 7 | str = "abc"; print gsub("x*$", "X", str), str 8 | str = "abc"; print gsub("b|$", "X", str), str 9 | } 10 | -------------------------------------------------------------------------------- /test/gsubtest.ok: -------------------------------------------------------------------------------- 1 | 1 aFOOc 2 | 4 XaXbXcX 3 | 3 XaXcX 4 | 1 abX 5 | 1 abX 6 | 1 abcX 7 | 2 aXcX 8 | -------------------------------------------------------------------------------- /test/gsubtst5.in: -------------------------------------------------------------------------------- 1 | This Is a Title: My Title? 2 | -------------------------------------------------------------------------------- /test/gsubtst5.ok: -------------------------------------------------------------------------------- 1 | ThisIsaTitleMyTitle 2 | -------------------------------------------------------------------------------- /test/gsubtst6.ok: -------------------------------------------------------------------------------- 1 | a:b:c:d 2 | -------------------------------------------------------------------------------- /test/gsubtst7.in: -------------------------------------------------------------------------------- 1 | aaa -------------------------------------------------------------------------------- /test/gsubtst7.ok: -------------------------------------------------------------------------------- 1 | aaa 2 | -------------------------------------------------------------------------------- /test/gsubtst8.awk: -------------------------------------------------------------------------------- 1 | { 2 | OFS = " " $2 " " 3 | gsub("foo", "_", OFS) 4 | print $1, $2 5 | } 6 | -------------------------------------------------------------------------------- /test/gsubtst8.in: -------------------------------------------------------------------------------- 1 | a bar b 2 | c foo d 3 | -------------------------------------------------------------------------------- /test/gsubtst8.ok: -------------------------------------------------------------------------------- 1 | a bar bar 2 | c _ foo 3 | -------------------------------------------------------------------------------- /test/gtlnbufv.awk: -------------------------------------------------------------------------------- 1 | /@K@CODE/ { print ; getline temp ; print temp ;next } 2 | {print} 3 | -------------------------------------------------------------------------------- /test/hello.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | print "Hello" 3 | } 4 | -------------------------------------------------------------------------------- /test/hex.awk: -------------------------------------------------------------------------------- 1 | # Test program from Paul Eggert, eggert@cs.ucla.edu, Jan. 14, 2005 2 | 3 | BEGIN { 4 | e = "1(e)" 5 | ex = "3e2(ex)" 6 | x = "6e5(x)" 7 | 8 | print e+0, x+0 9 | print 0x 10 | print 0e+x 11 | print 0ex 12 | print 010e2 13 | print 0e9.3 14 | } 15 | 16 | # Expected results: 17 | # 1 600000 18 | # 06e5(x) 19 | # 0600001 20 | # 03e2(ex) 21 | # 1000 22 | # 00.3 23 | -------------------------------------------------------------------------------- /test/hex.ok: -------------------------------------------------------------------------------- 1 | 1 600000 2 | 06e5(x) 3 | 0600001 4 | 03e2(ex) 5 | 1000 6 | 00.3 7 | -------------------------------------------------------------------------------- /test/icasefs.ok: -------------------------------------------------------------------------------- 1 | aCa 2 | a 3 | a 4 | aCa 5 | aCa 6 | aCa 7 | -------------------------------------------------------------------------------- /test/icasers.awk: -------------------------------------------------------------------------------- 1 | BEGIN { RS = "[[:upper:]\\n]+" } 2 | { print ; IGNORECASE = ! IGNORECASE } 3 | -------------------------------------------------------------------------------- /test/icasers.in: -------------------------------------------------------------------------------- 1 | 1111AAAA2222bbbb -------------------------------------------------------------------------------- /test/icasers.ok: -------------------------------------------------------------------------------- 1 | 1111 2 | 2222 3 | -------------------------------------------------------------------------------- /test/id.awk: -------------------------------------------------------------------------------- 1 | function function1() 2 | { 3 | print "function1" 4 | } 5 | 6 | BEGIN { 7 | an_array[1] = 1 8 | 9 | for (i in PROCINFO["identifiers"]) 10 | printf("%s -> %s\n", i, PROCINFO["identifiers"][i]) 11 | } 12 | -------------------------------------------------------------------------------- /test/igncdym.in: -------------------------------------------------------------------------------- 1 | This is foo 2 | This is bar 3 | -------------------------------------------------------------------------------- /test/igncdym.ok: -------------------------------------------------------------------------------- 1 | 0 bar:This is foo 2 | 9 foo:This is foo 3 | 9 bar:This is bar 4 | 0 foo:This is bar 5 | -------------------------------------------------------------------------------- /test/igncfs.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | IGNORECASE=1 3 | FS="[^[:lower:]]+" 4 | } 5 | { 6 | for (i=1; i 4 | # To: bug-gawk@gnu.org 5 | # Subject: Internal error in gawk-3.1.3 with character class 6 | 7 | BEGIN { 8 | IGNORECASE = 1 9 | if ("a" ~ /[[:alnum:]]/) 10 | print "OK" 11 | else 12 | print "NOT OK" 13 | } 14 | -------------------------------------------------------------------------------- /test/ignrcas2.ok: -------------------------------------------------------------------------------- 1 | OK 2 | -------------------------------------------------------------------------------- /test/ignrcase.awk: -------------------------------------------------------------------------------- 1 | BEGIN { IGNORECASE = 1 } 2 | { sub(/y/, ""); print } 3 | -------------------------------------------------------------------------------- /test/ignrcase.in: -------------------------------------------------------------------------------- 1 | xYz 2 | -------------------------------------------------------------------------------- /test/ignrcase.ok: -------------------------------------------------------------------------------- 1 | xz 2 | -------------------------------------------------------------------------------- /test/incdupe.ok: -------------------------------------------------------------------------------- 1 | gawk: warning: already included source file `inclib.awk' 2 | Include library loaded. 3 | abc 4 | -------------------------------------------------------------------------------- /test/incdupe2.ok: -------------------------------------------------------------------------------- 1 | gawk: inclib.awk:5: error: function name `sandwich' previously defined 2 | EXIT CODE: 1 3 | -------------------------------------------------------------------------------- /test/incdupe3.ok: -------------------------------------------------------------------------------- 1 | Hello 2 | Hello 3 | -------------------------------------------------------------------------------- /test/incdupe4.ok: -------------------------------------------------------------------------------- 1 | gawk: fatal: can't include `hello.awk' and use it as a program file 2 | EXIT CODE: 2 3 | -------------------------------------------------------------------------------- /test/incdupe5.ok: -------------------------------------------------------------------------------- 1 | gawk: fatal: can't include `hello.awk' and use it as a program file 2 | EXIT CODE: 2 3 | -------------------------------------------------------------------------------- /test/incdupe6.ok: -------------------------------------------------------------------------------- 1 | gawk: inchello:1: warning: `include' is a gawk extension 2 | gawk: inchello:2: fatal: can't include `hello' and use it as a program file 3 | EXIT CODE: 2 4 | -------------------------------------------------------------------------------- /test/incdupe7.ok: -------------------------------------------------------------------------------- 1 | gawk: inchello:1: warning: `include' is a gawk extension 2 | gawk: inchello:2: fatal: can't include `hello' and use it as a program file 3 | EXIT CODE: 2 4 | -------------------------------------------------------------------------------- /test/inchello.awk: -------------------------------------------------------------------------------- 1 | @include "hello" 2 | -------------------------------------------------------------------------------- /test/inclib.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | print "Include library loaded." 3 | } 4 | 5 | function sandwich(pfx,x,sfx) { 6 | return (pfx x sfx) 7 | } 8 | -------------------------------------------------------------------------------- /test/include.awk: -------------------------------------------------------------------------------- 1 | @include "inclib.awk" 2 | 3 | BEGIN { 4 | print sandwich("a", "b", "c") 5 | } 6 | -------------------------------------------------------------------------------- /test/include.ok: -------------------------------------------------------------------------------- 1 | Include library loaded. 2 | abc 3 | -------------------------------------------------------------------------------- /test/include2.ok: -------------------------------------------------------------------------------- 1 | Include library loaded. 2 | abc 3 | -------------------------------------------------------------------------------- /test/indirectcall.in: -------------------------------------------------------------------------------- 1 | Biology_101 sum average sort rsort data: 87.0 92.4 78.5 94.9 2 | Chemistry_305 sum average sort rsort data: 75.2 98.3 94.7 88.2 3 | English_401 sum average sort rsort data: 100.0 95.6 87.1 93.4 4 | -------------------------------------------------------------------------------- /test/indirectcall.ok: -------------------------------------------------------------------------------- 1 | Biology 101: 2 | sum: <352.8> 3 | average: <88.2> 4 | sort: <78.5 87.0 92.4 94.9> 5 | rsort: <94.9 92.4 87.0 78.5> 6 | 7 | Chemistry 305: 8 | sum: <356.4> 9 | average: <89.1> 10 | sort: <75.2 88.2 94.7 98.3> 11 | rsort: <98.3 94.7 88.2 75.2> 12 | 13 | English 401: 14 | sum: <376.1> 15 | average: <94.025> 16 | sort: <87.1 93.4 95.6 100.0> 17 | rsort: <100.0 95.6 93.4 87.1> 18 | 19 | -------------------------------------------------------------------------------- /test/inftest.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | k = 0 3 | x = 100 4 | # Added k limit test after finding some systems that didn't terminate 5 | # the loop correctly, sigh... 6 | do { k++; y = x ; x *= 1000; print x,y } while ( y < x && k < 1700) 7 | print "loop terminated" 8 | } 9 | -------------------------------------------------------------------------------- /test/inputred.awk: -------------------------------------------------------------------------------- 1 | BEGIN { print getline < "file" ".txt" } 2 | -------------------------------------------------------------------------------- /test/inputred.ok: -------------------------------------------------------------------------------- 1 | -1.txt 2 | -------------------------------------------------------------------------------- /test/intest.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | bool = ((b = 1) in c); 3 | print bool, b # gawk-3.0.1 prints "0 "; should print "0 1" 4 | } 5 | -------------------------------------------------------------------------------- /test/intest.ok: -------------------------------------------------------------------------------- 1 | 0 1 2 | -------------------------------------------------------------------------------- /test/intformat.ok: -------------------------------------------------------------------------------- 1 | 3 -3 17 2 | 0000000000000000000000000000000000000000000000000000001 3 | -------------------------------------------------------------------------------- /test/intprec.awk: -------------------------------------------------------------------------------- 1 | BEGIN { printf "%.10d:%.10x\n", 5, 14 } 2 | -------------------------------------------------------------------------------- /test/intprec.ok: -------------------------------------------------------------------------------- 1 | 0000000005:000000000e 2 | -------------------------------------------------------------------------------- /test/iobug1.ok: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/test/iobug1.ok -------------------------------------------------------------------------------- /test/jarebug.awk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/test/jarebug.awk -------------------------------------------------------------------------------- /test/jarebug.in: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/test/jarebug.in -------------------------------------------------------------------------------- /test/jarebug.ok: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/test/jarebug.ok -------------------------------------------------------------------------------- /test/jarebug.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | awk=$1 4 | prog=$2 5 | infile=$3 6 | out=$4 7 | 8 | # GLIBC gives us ja_JP.EUC-JP but Mac OS X uses ja_JP.eucJP 9 | 10 | cp $infile $out # set up default 11 | 12 | for locale in ja_JP.EUC-JP ja_JP.eucJP 13 | do 14 | if locale -a | grep $locale > /dev/null 15 | then 16 | LANG=$locale 17 | LC_ALL=$locale 18 | export LANG LC_ALL 19 | $awk -f $prog $infile >$out 2>&1 || echo EXIT CODE: $? >> $out 20 | fi 21 | done 22 | -------------------------------------------------------------------------------- /test/lc_num1.awk: -------------------------------------------------------------------------------- 1 | # Bug reported by Ulrich Drepper. 2 | # BEGIN { 3 | # printf("%'d %d\n", 1000000, 1000000) 4 | # } 5 | 6 | # April 2010: 7 | # This needs to be a smarter test so that systems without the %'d flag 8 | # don't generate a needless failure. 9 | 10 | BEGIN { 11 | s = sprintf("%'d", 1234) 12 | if (s == "1,234" || s == "1234") 13 | print "ok, or at least the quote flag isn't supported" 14 | else { 15 | command = "od -c" 16 | print("fail:", s) | command 17 | close(command) 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /test/lc_num1.ok: -------------------------------------------------------------------------------- 1 | ok, or at least the quote flag isn't supported 2 | -------------------------------------------------------------------------------- /test/leaddig.awk: -------------------------------------------------------------------------------- 1 | # check that values with leading digits get converted the 2 | # right way, based on a note in comp.lang.awk. 3 | # 4 | # run with gawk -v x=2E -f leaddig.awk 5 | BEGIN { 6 | print "x =", x, (x == 2), (x == 2E0), (x == 2E), (x == 2D) 7 | } 8 | -------------------------------------------------------------------------------- /test/leaddig.ok: -------------------------------------------------------------------------------- 1 | x = 2E 0 0 0 0 2 | -------------------------------------------------------------------------------- /test/leadnl.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | RS = ""; FS = "\n" 3 | } 4 | 5 | { 6 | print "Name is: ", $1 7 | print "Address is: ", $2 8 | print "City and State are: ", $3 9 | print "" 10 | } 11 | -------------------------------------------------------------------------------- /test/leadnl.in: -------------------------------------------------------------------------------- 1 | 2 | Jane Doe 3 | 123 Main Street 4 | Anywhere, SE 12345-6789 5 | 6 | John Smith 7 | 456 Tree-lined Avenue 8 | Smallville, MW 98765-4321 9 | 10 | -------------------------------------------------------------------------------- /test/leadnl.ok: -------------------------------------------------------------------------------- 1 | Name is: Jane Doe 2 | Address is: 123 Main Street 3 | City and State are: Anywhere, SE 12345-6789 4 | 5 | Name is: John Smith 6 | Address is: 456 Tree-lined Avenue 7 | City and State are: Smallville, MW 98765-4321 8 | 9 | -------------------------------------------------------------------------------- /test/lib/awkpath.awk: -------------------------------------------------------------------------------- 1 | BEGIN { print "Found it." } 2 | -------------------------------------------------------------------------------- /test/lint.awk: -------------------------------------------------------------------------------- 1 | # lint.awk --- test lint variable 2 | 3 | BEGIN { 4 | a[1] = 1 5 | LINT = 1 6 | delete a[2] 7 | LINT = "" 8 | delete a[3] 9 | LINT = "true" 10 | delete a[4] 11 | LINT = 0 12 | delete a[5] 13 | print "done" 14 | } 15 | -------------------------------------------------------------------------------- /test/lint.ok: -------------------------------------------------------------------------------- 1 | gawk: lint.awk:6: warning: delete: index `2' not in array `a' 2 | gawk: lint.awk:7: warning: turning off `--lint' due to assignment to `LINT' 3 | gawk: lint.awk:10: warning: delete: index `4' not in array `a' 4 | gawk: lint.awk:11: warning: turning off `--lint' due to assignment to `LINT' 5 | done 6 | -------------------------------------------------------------------------------- /test/lintold.awk: -------------------------------------------------------------------------------- 1 | # lintold.awk --- test --lint-old 2 | 3 | BEGIN { 4 | a[1] = 1 5 | for (i in a) 6 | print a[i] 7 | delete a[1] 8 | if (2 in a) 9 | a[2] **= 2; 10 | if ((2,3) in a) 11 | a[2,3] ^= 2 ** 3 ^ 5; 12 | } 13 | BEGIN { 14 | FS = "ab" 15 | foo = "\b\f\r" 16 | } 17 | END { 18 | } 19 | END { 20 | print "done" 21 | } 22 | -------------------------------------------------------------------------------- /test/lintold.in: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /test/lintwarn.awk: -------------------------------------------------------------------------------- 1 | # gawk --lint -f lintwarn.awk 2 | BEGINFILE { 3 | getline var 4 | getline 5 | } 6 | 7 | BEGIN { 8 | PROCINFO["sorted_in"] 9 | print 10 | nextfile 11 | delete a 12 | delete(a) 13 | y = /a/ 14 | y == /a/ 15 | /b/ ~ x 16 | length 17 | switch(s) { 18 | case 1: 19 | default: 20 | case 1: 21 | default: 22 | } 23 | break 24 | continue 25 | next 26 | a[] 27 | f(/pqr/) 28 | // 29 | /* */ 30 | } 31 | END { 32 | getline 33 | } 34 | function zz(aa, aa) 35 | { 36 | return aa 37 | } 38 | @include "" 39 | -------------------------------------------------------------------------------- /test/litoct.awk: -------------------------------------------------------------------------------- 1 | { if (/a\52b/) print "match" ; else print "no match" } 2 | -------------------------------------------------------------------------------- /test/litoct.ok: -------------------------------------------------------------------------------- 1 | no match 2 | -------------------------------------------------------------------------------- /test/localenl.ok: -------------------------------------------------------------------------------- 1 | LC_ALL=C passed 2 | LC_ALL=POSIX passed 3 | LC_ALL=en_US.ISO-8859-1 passed 4 | LC_ALL=en_US.UTF-8 passed 5 | -------------------------------------------------------------------------------- /test/longdbl.in: -------------------------------------------------------------------------------- 1 | 0xa000000100000813 2 | 0xffffffffffffffff 3 | -------------------------------------------------------------------------------- /test/longdbl.ok: -------------------------------------------------------------------------------- 1 | 0xa000000100000813 2 | 0xffffffffffffffff 3 | -------------------------------------------------------------------------------- /test/longsub.awk: -------------------------------------------------------------------------------- 1 | {sub( "^.*AA", "BB"); print} 2 | -------------------------------------------------------------------------------- /test/longwrds.ok: -------------------------------------------------------------------------------- 1 | 20 long words 2 | compatibility 3 | concatenated 4 | consistency 5 | definitions 6 | description 7 | distributing 8 | fistatements 9 | gawk-options 10 | gnu-specific 11 | identically 12 | implementation 13 | implementations 14 | information 15 | non-portable 16 | pattern-action 17 | pre-defined 18 | program-file 19 | program-text 20 | programming 21 | restrictions 22 | -------------------------------------------------------------------------------- /test/manglprm.in: -------------------------------------------------------------------------------- 1 | Testing 2 | -------------------------------------------------------------------------------- /test/manglprm.ok: -------------------------------------------------------------------------------- 1 | Buffer = [] 2 | -------------------------------------------------------------------------------- /test/manyfiles.awk: -------------------------------------------------------------------------------- 1 | { print $2 > ("junk/" $1) } 2 | -------------------------------------------------------------------------------- /test/manyfiles.ok: -------------------------------------------------------------------------------- 1 | 1 2 | -------------------------------------------------------------------------------- /test/match1.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | data = "foooobazbarrrrr" 3 | match(data, /(fo+).+(bar*)/, arr) 4 | for (i = 0; i in arr; i++) { 5 | printf("arr[%d] = \"%s\"\n", i, arr[i]) 6 | printf("arr[%d, \"start\"] = %s, arr[%d, \"length\"] = %s\n", 7 | i, arr[i, "start"], i, arr[i, "length"]) 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /test/match1.ok: -------------------------------------------------------------------------------- 1 | arr[0] = "foooobazbarrrrr" 2 | arr[0, "start"] = 1, arr[0, "length"] = 15 3 | arr[1] = "foooo" 4 | arr[1, "start"] = 1, arr[1, "length"] = 5 5 | arr[2] = "barrrrr" 6 | arr[2, "start"] = 9, arr[2, "length"] = 7 7 | -------------------------------------------------------------------------------- /test/match2.awk: -------------------------------------------------------------------------------- 1 | function f(a, b, c) 2 | { 3 | print match("foo", "bar", f) 4 | } 5 | 6 | BEGIN { f(1, 2, 3) } 7 | -------------------------------------------------------------------------------- /test/match2.ok: -------------------------------------------------------------------------------- 1 | gawk: match2.awk:3: error: function `f' called with space between name and `(', 2 | or used as a variable or an array 3 | EXIT CODE: 1 4 | -------------------------------------------------------------------------------- /test/match3.in: -------------------------------------------------------------------------------- 1 | 5 2 | 5.0 3 | 0.5 4 | .5 5 | -------------------------------------------------------------------------------- /test/match3.ok: -------------------------------------------------------------------------------- 1 | OK 2 | OK 3 | OK 4 | OK 5 | -------------------------------------------------------------------------------- /test/math.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | pi = 3.1415927 3 | printf "cos(%f) = %f\n", pi/4, cos(pi/4) 4 | printf "sin(%f) = %f\n", pi/4, sin(pi/4) 5 | e = exp(1) 6 | printf "e = %f\n", e 7 | printf "log(e) = %f\n", log(e) 8 | printf "sqrt(pi ^ 2) = %f\n", sqrt(pi ^ 2) 9 | printf "atan2(1, 1) = %f\n", atan2(1, 1) 10 | } 11 | -------------------------------------------------------------------------------- /test/math.ok: -------------------------------------------------------------------------------- 1 | cos(0.785398) = 0.707107 2 | sin(0.785398) = 0.707107 3 | e = 2.718282 4 | log(e) = 1.000000 5 | sqrt(pi ^ 2) = 3.141593 6 | atan2(1, 1) = 0.785398 7 | -------------------------------------------------------------------------------- /test/mbfw1.in: -------------------------------------------------------------------------------- 1 | CDRegion Commune Site 2 | SEVästsverige Hallands län Kungsbacka 3 | SESmåland med öarna Västra Götalands länGöteborg 4 | SEKronoberg Alvesta Stenungsund 5 | -------------------------------------------------------------------------------- /test/mbfw1.ok: -------------------------------------------------------------------------------- 1 | Site 2 | Kungsbacka 3 | Göteborg 4 | Stenungsund 5 | -------------------------------------------------------------------------------- /test/mbprintf1.awk: -------------------------------------------------------------------------------- 1 | { printf "%-7s|\n", $0 } 2 | -------------------------------------------------------------------------------- /test/mbprintf1.in: -------------------------------------------------------------------------------- 1 | AAA 2 | ÅÃÆ 3 | -------------------------------------------------------------------------------- /test/mbprintf1.ok: -------------------------------------------------------------------------------- 1 | AAA | 2 | ÅÃÆ | 3 | -------------------------------------------------------------------------------- /test/mbprintf2.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | printf "%c\n", 65 3 | printf "%c\n", "AA" 4 | } 5 | -------------------------------------------------------------------------------- /test/mbprintf2.ok: -------------------------------------------------------------------------------- 1 | A 2 | A 3 | -------------------------------------------------------------------------------- /test/mbprintf3.awk: -------------------------------------------------------------------------------- 1 | FNR == 1 { print $0; printf "%s\n", $0 } 2 | -------------------------------------------------------------------------------- /test/mbprintf3.in: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/test/mbprintf3.in -------------------------------------------------------------------------------- /test/mbprintf3.ok: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/test/mbprintf3.ok -------------------------------------------------------------------------------- /test/mbstr1.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | print length("\x81\x82\x83\x84") 3 | print index("\x81\x82\x83\x84", "\x81\x82") 4 | } 5 | -------------------------------------------------------------------------------- /test/mbstr1.ok: -------------------------------------------------------------------------------- 1 | 4 2 | 1 3 | -------------------------------------------------------------------------------- /test/membug1.awk: -------------------------------------------------------------------------------- 1 | { one != one = $1 } 2 | -------------------------------------------------------------------------------- /test/membug1.in: -------------------------------------------------------------------------------- 1 | yes 2 | yes 3 | -------------------------------------------------------------------------------- /test/membug1.ok: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/test/membug1.ok -------------------------------------------------------------------------------- /test/messages.awk: -------------------------------------------------------------------------------- 1 | # This is a demo of different ways of printing with gawk. Try it 2 | # with and without -c (compatibility) flag, redirecting output 3 | # from gawk to a file or not. Some results can be quite unexpected. 4 | BEGIN { 5 | print "Goes to a file out1" > "out1" 6 | print "Normal print statement" 7 | print "This printed on stdout" > "/dev/stdout" 8 | print "You blew it!" > "/dev/stderr" 9 | } 10 | -------------------------------------------------------------------------------- /test/minusstr.awk: -------------------------------------------------------------------------------- 1 | BEGIN { print-"6" } 2 | -------------------------------------------------------------------------------- /test/minusstr.ok: -------------------------------------------------------------------------------- 1 | -6 2 | -------------------------------------------------------------------------------- /test/mixed1.ok: -------------------------------------------------------------------------------- 1 | gawk: BEGIN {return junk} 2 | gawk: ^ `return' used outside function context 3 | EXIT CODE: 1 4 | -------------------------------------------------------------------------------- /test/mpfrbigint.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | x = 5^4^3^2 3 | print "# of digits =", length(x) 4 | print substr(x, 1, 20), "...", substr(x, length(x) - 19, 20) 5 | 6 | PREC = 1 + 3.321928095 * length(x); # 1 + digits * log2(10) 7 | print "floating-point computation with precision =", PREC 8 | y = 5.0^4.0^3.0^2.0 9 | print "# of digits =", length(y) 10 | print substr(y, 1, 20), "...", substr(y, length(y) - 19, 20) 11 | } 12 | -------------------------------------------------------------------------------- /test/mpfrbigint.ok: -------------------------------------------------------------------------------- 1 | # of digits = 183231 2 | 62060698786608744707 ... 92256259918212890625 3 | floating-point computation with precision = 608681 4 | # of digits = 183231 5 | 62060698786608744707 ... 92256259918212890625 6 | -------------------------------------------------------------------------------- /test/mpfrexprange.awk: -------------------------------------------------------------------------------- 1 | # test change of allowed exponent range 2 | BEGIN { 3 | x=1.0e-10000 4 | print x+0 5 | PREC="double" 6 | print x+0 7 | } 8 | -------------------------------------------------------------------------------- /test/mpfrexprange.ok: -------------------------------------------------------------------------------- 1 | 1e-10000 2 | 0 3 | -------------------------------------------------------------------------------- /test/mpfrieee.awk: -------------------------------------------------------------------------------- 1 | # Test IEEE-754 binary double format 2 | BEGIN { 3 | x = 1.0e-320 4 | i = 0 5 | while (x > 0) { 6 | printf("%.15e\n", x) 7 | x /= 2 8 | 9 | # terminate early when the test is going to fail. 10 | if (++i > 50) 11 | break 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /test/mpfrieee.ok: -------------------------------------------------------------------------------- 1 | 9.999888671826830e-321 2 | 4.999944335913415e-321 3 | 2.499972167956708e-321 4 | 1.249986083978354e-321 5 | 6.225227137599706e-322 6 | 3.112613568799853e-322 7 | 1.581010066691989e-322 8 | 7.905050333459945e-323 9 | 3.952525166729972e-323 10 | 1.976262583364986e-323 11 | 9.881312916824931e-324 12 | 4.940656458412465e-324 13 | -------------------------------------------------------------------------------- /test/mpfrnr.awk: -------------------------------------------------------------------------------- 1 | # Test NR and FNR for file(s) with records > LONG_MAX 2 | BEGIN { 3 | NR = 0x7FFFFFFF 4 | } 5 | BEGINFILE { 6 | FNR = 0x7fffffffffffffff 7 | } 8 | END { 9 | print NR, NR-0x7FFFFFFF, FNR, FNR-0x7fffffffffffffff 10 | } 11 | -------------------------------------------------------------------------------- /test/mpfrnr.in: -------------------------------------------------------------------------------- 1 | Line 1 2 | Line 2 3 | Line 3 4 | -------------------------------------------------------------------------------- /test/mpfrnr.ok: -------------------------------------------------------------------------------- 1 | 2147483650 3 9223372036854775810 3 2 | -------------------------------------------------------------------------------- /test/mpfrrnd.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | N = 22/7 3 | printf(" %.15f\n", N) 4 | 5 | printf("* %.10f\n", N) # default 6 | ROUNDMODE="N"; printf("N %.10f\n", N) 7 | ROUNDMODE="U"; printf("U %.10f\n", N) 8 | ROUNDMODE="D"; printf("D %.10f\n", N) 9 | ROUNDMODE="Z"; printf("Z %.10f\n", N) 10 | N = -N 11 | ROUNDMODE="N"; printf("N %.10f\n", N) 12 | ROUNDMODE="U"; printf("U %.10f\n", N) 13 | ROUNDMODE="D"; printf("D %.10f\n", N) 14 | ROUNDMODE="Z"; printf("Z %.10f\n", N) 15 | } 16 | -------------------------------------------------------------------------------- /test/mpfrrnd.ok: -------------------------------------------------------------------------------- 1 | 3.142857142857143 2 | * 3.1428571429 3 | N 3.1428571429 4 | U 3.1428571429 5 | D 3.1428571428 6 | Z 3.1428571428 7 | N -3.1428571429 8 | U -3.1428571428 9 | D -3.1428571429 10 | Z -3.1428571428 11 | -------------------------------------------------------------------------------- /test/mpfrsort.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | # s = "1.0 +nan 0.0 -1 +inf -0.0 1 nan 1.0 -nan -inf 2.0" 3 | s = "1.0 +nan 0.0 -1 +inf -0.0 1 1.0 -nan -inf 2.0" 4 | split(s, a) 5 | PROCINFO["sorted_in"] = "@val_num_asc" 6 | for (i in a) 7 | print a[i] 8 | } 9 | -------------------------------------------------------------------------------- /test/mpfrsort.ok: -------------------------------------------------------------------------------- 1 | -inf 2 | -1 3 | -0.0 4 | 0.0 5 | 1 6 | 1.0 7 | 1.0 8 | 2.0 9 | +inf 10 | +nan 11 | -nan 12 | -------------------------------------------------------------------------------- /test/mtchi18n.awk: -------------------------------------------------------------------------------- 1 | {print match(""," *")} 2 | -------------------------------------------------------------------------------- /test/mtchi18n.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /test/mtchi18n.ok: -------------------------------------------------------------------------------- 1 | 1 2 | 1 3 | -------------------------------------------------------------------------------- /test/nasty.ok: -------------------------------------------------------------------------------- 1 | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 2 | X 3 | -------------------------------------------------------------------------------- /test/nasty2.awk: -------------------------------------------------------------------------------- 1 | # Based on nasty.awk, test same thing for printf 2 | # 3 | BEGIN { 4 | a="aaaaa" 5 | a=a a #10 6 | a=a a #20 7 | a=a a #40 8 | a=a a #80 9 | a=a a #160 10 | a=a a # i.e. a is long enough 11 | 12 | printf("a = %s, f() = %s\n", a, f()) 13 | print a 14 | } 15 | 16 | function f() 17 | { 18 | gsub(/a/, "123", a) 19 | return "X" 20 | } 21 | -------------------------------------------------------------------------------- /test/nastyparm.ok: -------------------------------------------------------------------------------- 1 | 0 2 | fy 3 | 10 20 4 | 20 5 | 3 3 6 | 3 3 3 3 7 | baz2 4 8 | 3 3 3 3 9 | baz2 4 10 | gawk: nastyparm.awk:3: fatal: attempt to use array `baz (from b)' in a scalar context 11 | EXIT CODE: 2 12 | -------------------------------------------------------------------------------- /test/negexp.awk: -------------------------------------------------------------------------------- 1 | BEGIN { a = -2; print 10^a } 2 | -------------------------------------------------------------------------------- /test/negexp.ok: -------------------------------------------------------------------------------- 1 | 0.01 2 | -------------------------------------------------------------------------------- /test/negrange.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | s = "Volume 8, Numbers 1-2 / January 1971" 3 | n = split(s, parts, "[^-A-Za-z0-9]+") 4 | print "n =", n 5 | for (i = 1; i <= n; i++) 6 | printf("s[%d] = \"%s\"\n", i, parts[i]) 7 | } 8 | -------------------------------------------------------------------------------- /test/negrange.ok: -------------------------------------------------------------------------------- 1 | n = 6 2 | s[1] = "Volume" 3 | s[2] = "8" 4 | s[3] = "Numbers" 5 | s[4] = "1-2" 6 | s[5] = "January" 7 | s[6] = "1971" 8 | -------------------------------------------------------------------------------- /test/nested.in: -------------------------------------------------------------------------------- 1 | a_b 2 | -------------------------------------------------------------------------------- /test/nested.ok: -------------------------------------------------------------------------------- 1 | a 2 | a 3 | -------------------------------------------------------------------------------- /test/next.ok: -------------------------------------------------------------------------------- 1 | gawk: cmd. line:1: fatal: `next' cannot be called from a `BEGIN' rule 2 | gawk: cmd. line:1: fatal: `next' cannot be called from a `END' rule 3 | gawk: cmd. line:1: fatal: `next' cannot be called from a `BEGINFILE' rule 4 | gawk: cmd. line:1: fatal: `next' cannot be called from a `ENDFILE' rule 5 | -------------------------------------------------------------------------------- /test/next.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # next.sh --- test next invoked in various ways 4 | 5 | if [ "$AWK" = "" ] 6 | then 7 | echo $0: You must set AWK >&2 8 | exit 1 9 | fi 10 | 11 | # non-fatal 12 | $AWK '{next}' /dev/null 13 | $AWK 'function f() { next}; {f()}' /dev/null 14 | # fatal 15 | $AWK 'function f() { next}; BEGIN{f()}' 16 | $AWK 'function f() { next}; {f()}; END{f()}' /dev/null 17 | $AWK 'function f() { next}; BEGINFILE{f()}' 18 | $AWK 'function f() { next}; {f()}; ENDFILE{f()}' /dev/null 19 | 20 | exit 0 # for make 21 | -------------------------------------------------------------------------------- /test/nfldstr.awk: -------------------------------------------------------------------------------- 1 | $1 == 0 { 2 | print "bug" 3 | } 4 | { 5 | $0 = "0" 6 | if (!$0) 7 | print "another bug" 8 | $0 = a = "0" 9 | if (!$0) 10 | print "yet another bug" 11 | if ($1) 12 | print "a buggie" 13 | } 14 | -------------------------------------------------------------------------------- /test/nfldstr.in: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /test/nfldstr.ok: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/test/nfldstr.ok -------------------------------------------------------------------------------- /test/nfneg.awk: -------------------------------------------------------------------------------- 1 | BEGIN { NF -= 2 ; print } 2 | -------------------------------------------------------------------------------- /test/nfneg.ok: -------------------------------------------------------------------------------- 1 | gawk: nfneg.awk:1: fatal: NF set to negative value 2 | EXIT CODE: 2 3 | -------------------------------------------------------------------------------- /test/nfset.awk: -------------------------------------------------------------------------------- 1 | { NF = 5 ; print } 2 | -------------------------------------------------------------------------------- /test/nfset.in: -------------------------------------------------------------------------------- 1 | 1 2 2 | 1 2 3 4 3 | 1 2 3 4 5 4 | 1 2 3 4 5 6 7 8 5 | 1 6 | -------------------------------------------------------------------------------- /test/nfset.ok: -------------------------------------------------------------------------------- 1 | 1 2 2 | 1 2 3 4 3 | 1 2 3 4 5 4 | 1 2 3 4 5 5 | 1 6 | -------------------------------------------------------------------------------- /test/nlfldsep.awk: -------------------------------------------------------------------------------- 1 | BEGIN { RS = "A" } 2 | {print NF; for (i = 1; i <= NF; i++) print $i ; print ""} 3 | -------------------------------------------------------------------------------- /test/nlfldsep.in: -------------------------------------------------------------------------------- 1 | some stuff 2 | more stuffA 3 | junk 4 | stuffA 5 | final 6 | -------------------------------------------------------------------------------- /test/nlfldsep.ok: -------------------------------------------------------------------------------- 1 | 4 2 | some 3 | stuff 4 | more 5 | stuff 6 | 7 | 2 8 | junk 9 | stuff 10 | 11 | 1 12 | final 13 | 14 | -------------------------------------------------------------------------------- /test/nlinstr.awk: -------------------------------------------------------------------------------- 1 | BEGIN { RS = "" } 2 | 3 | { 4 | if (/^@/) 5 | print "not ok" 6 | else 7 | print "ok" 8 | } 9 | -------------------------------------------------------------------------------- /test/nlinstr.in: -------------------------------------------------------------------------------- 1 | line 1 2 | @line 2 3 | -------------------------------------------------------------------------------- /test/nlinstr.ok: -------------------------------------------------------------------------------- 1 | ok 2 | -------------------------------------------------------------------------------- /test/nlstrina.ok: -------------------------------------------------------------------------------- 1 | a 2 2 2 | b 3 3 3 | c 1 3 4 | -------------------------------------------------------------------------------- /test/noeffect.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | s == "hello, world"; 3 | s + 1 4 | ;; 5 | } 6 | -------------------------------------------------------------------------------- /test/noeffect.ok: -------------------------------------------------------------------------------- 1 | gawk: noeffect.awk:2: warning: statement may have no effect 2 | gawk: noeffect.awk:3: warning: statement may have no effect 3 | gawk: noeffect.awk:2: warning: reference to uninitialized variable `s' 4 | gawk: noeffect.awk:3: warning: reference to uninitialized variable `s' 5 | -------------------------------------------------------------------------------- /test/nofile.ok: -------------------------------------------------------------------------------- 1 | gawk: fatal: cannot open file `no/such/file' for reading (No such file or directory) 2 | EXIT CODE: 2 3 | -------------------------------------------------------------------------------- /test/nofmtch.awk: -------------------------------------------------------------------------------- 1 | BEGIN { printf "%3\n" } 2 | -------------------------------------------------------------------------------- /test/nofmtch.ok: -------------------------------------------------------------------------------- 1 | gawk: nofmtch.awk:1: warning: [s]printf: format specifier does not have control letter 2 | %3 3 | -------------------------------------------------------------------------------- /test/noloop1.in: -------------------------------------------------------------------------------- 1 | ''Italics with an apostrophe'' embedded'' 2 | -------------------------------------------------------------------------------- /test/noloop1.ok: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/test/noloop1.ok -------------------------------------------------------------------------------- /test/noloop2.in: -------------------------------------------------------------------------------- 1 | ''Italics with an apostrophe' embedded'' 2 | -------------------------------------------------------------------------------- /test/noloop2.ok: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/test/noloop2.ok -------------------------------------------------------------------------------- /test/nondec.awk: -------------------------------------------------------------------------------- 1 | BEGIN { print 0x81c3e8, 0x744018, 00.34 } 2 | -------------------------------------------------------------------------------- /test/nondec.ok: -------------------------------------------------------------------------------- 1 | 8504296 7618584 0.34 2 | -------------------------------------------------------------------------------- /test/nondec2.ok: -------------------------------------------------------------------------------- 1 | 1 2 | -------------------------------------------------------------------------------- /test/nonl.awk: -------------------------------------------------------------------------------- 1 | 0 -------------------------------------------------------------------------------- /test/nonl.ok: -------------------------------------------------------------------------------- 1 | gawk: nonl.awk:1: warning: source file does not end in newline 2 | -------------------------------------------------------------------------------- /test/noparms.awk: -------------------------------------------------------------------------------- 1 | function x(a, b, c , ,) {} 2 | -------------------------------------------------------------------------------- /test/noparms.ok: -------------------------------------------------------------------------------- 1 | gawk: noparms.awk:1: function x(a, b, c , ,) {} 2 | gawk: noparms.awk:1: ^ syntax error 3 | gawk: noparms.awk:1: function x(a, b, c , ,) {} 4 | gawk: noparms.awk:1: ^ syntax error 5 | EXIT CODE: 1 6 | -------------------------------------------------------------------------------- /test/nors.in: -------------------------------------------------------------------------------- 1 | A B C D E -------------------------------------------------------------------------------- /test/nors.ok: -------------------------------------------------------------------------------- 1 | E 2 | E 3 | -------------------------------------------------------------------------------- /test/nulrsend.in: -------------------------------------------------------------------------------- 1 | 1111 2 | 3 | 2222 4 | 5 | -------------------------------------------------------------------------------- /test/nulrsend.ok: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | -------------------------------------------------------------------------------- /test/numindex.in: -------------------------------------------------------------------------------- 1 | 322322111111112232231111 2 | 322322111111112213223111 3 | 322322111111112211132231 4 | 322322111111112211113223 5 | -------------------------------------------------------------------------------- /test/numindex.ok: -------------------------------------------------------------------------------- 1 | 0 0.000000% 2 | -------------------------------------------------------------------------------- /test/numsubstr.awk: -------------------------------------------------------------------------------- 1 | { print substr(1000+$1, 2) } 2 | -------------------------------------------------------------------------------- /test/numsubstr.in: -------------------------------------------------------------------------------- 1 | 5000 2 | 10000 3 | 5000 4 | -------------------------------------------------------------------------------- /test/numsubstr.ok: -------------------------------------------------------------------------------- 1 | 000 2 | 1000 3 | 000 4 | -------------------------------------------------------------------------------- /test/octsub.awk: -------------------------------------------------------------------------------- 1 | BEGIN{ ++x[03]; print "/" x[0] "/" x[3] "/"} 2 | -------------------------------------------------------------------------------- /test/octsub.ok: -------------------------------------------------------------------------------- 1 | //1/ 2 | -------------------------------------------------------------------------------- /test/ofmt.ok: -------------------------------------------------------------------------------- 1 | alt/binaries/warez/crypto - - 2 | alt/fan/douglas-adams 7491 7407 3 | alt/os/linux - - 4 | alt/security 9641 9617 5 | alt/security/index - - 6 | alt/security/keydist 253 253 7 | -------------------------------------------------------------------------------- /test/ofmta.ok: -------------------------------------------------------------------------------- 1 | 4.2 2 | 4.2345 hi 3 | hi 4 | -------- 5 | 4.234 6 | 4.2345 hi 7 | 8 | -------------------------------------------------------------------------------- /test/ofmtbig.in: -------------------------------------------------------------------------------- 1 | a 2 | 1 3 | b 4 | -------------------------------------------------------------------------------- /test/ofmtbig.ok: -------------------------------------------------------------------------------- 1 | 0 99999999999 2 | a 1 1 3 | -------------------------------------------------------------------------------- /test/ofmtfidl.in: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 3 4 | 4 5 | 5 6 | 6 7 | 7 8 | 8 9 | 9 10 | 10 11 | -------------------------------------------------------------------------------- /test/ofmtfidl.ok: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 3 4 | 4 5 | 5 6 | 6 7 | 7 8 | 8 9 | 9 10 | 10 11 | -------------------------------------------------------------------------------- /test/ofmts.awk: -------------------------------------------------------------------------------- 1 | BEGIN { OFMT= "%s" } 2 | { $1 + $2; print $1, $2 } 3 | -------------------------------------------------------------------------------- /test/ofmts.in: -------------------------------------------------------------------------------- 1 | 1.2 2.2 2 | -------------------------------------------------------------------------------- /test/ofmts.ok: -------------------------------------------------------------------------------- 1 | 1.2 2.2 2 | -------------------------------------------------------------------------------- /test/ofs1.in: -------------------------------------------------------------------------------- 1 | a:b:c 2 | a:b:c 3 | a:b:c 4 | a:b:c 5 | -------------------------------------------------------------------------------- /test/ofs1.ok: -------------------------------------------------------------------------------- 1 | a:x:c 2 | a x c 3 | a x c 4 | a 5 | a:x:c 6 | a x c 7 | a:x:c 8 | -------------------------------------------------------------------------------- /test/onlynl.awk: -------------------------------------------------------------------------------- 1 | BEGIN { RS = "" } 2 | { print "got", $0 } 3 | -------------------------------------------------------------------------------- /test/onlynl.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /test/onlynl.ok: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/test/onlynl.ok -------------------------------------------------------------------------------- /test/opasnidx.awk: -------------------------------------------------------------------------------- 1 | BEGIN { b = 1; a[b] = 2; a[b++] += 1; print b,a[1] } 2 | -------------------------------------------------------------------------------- /test/opasnidx.ok: -------------------------------------------------------------------------------- 1 | 2 3 2 | -------------------------------------------------------------------------------- /test/opasnslf.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | print b += b += 1 3 | b = 6 4 | print b += b++ 5 | print b 6 | } 7 | -------------------------------------------------------------------------------- /test/opasnslf.ok: -------------------------------------------------------------------------------- 1 | 2 2 | 13 3 | 13 4 | -------------------------------------------------------------------------------- /test/ordchr.awk: -------------------------------------------------------------------------------- 1 | @load "ordchr" 2 | 3 | BEGIN { 4 | print chr(ord("A")) 5 | print chr(ord("0")) 6 | print ord(chr(65)) 7 | # test if type conversion between strings and numbers is working properly 8 | print chr(ord(0)) 9 | print ord(chr("65")) 10 | } 11 | -------------------------------------------------------------------------------- /test/ordchr.ok: -------------------------------------------------------------------------------- 1 | A 2 | 0 3 | 65 4 | 0 5 | 65 6 | -------------------------------------------------------------------------------- /test/ordchr2.ok: -------------------------------------------------------------------------------- 1 | z 2 | -------------------------------------------------------------------------------- /test/out1.ok: -------------------------------------------------------------------------------- 1 | Goes to a file out1 2 | -------------------------------------------------------------------------------- /test/out2.ok: -------------------------------------------------------------------------------- 1 | Normal print statement 2 | This printed on stdout 3 | -------------------------------------------------------------------------------- /test/out3.ok: -------------------------------------------------------------------------------- 1 | You blew it! 2 | -------------------------------------------------------------------------------- /test/paramdup.awk: -------------------------------------------------------------------------------- 1 | BEGIN { foo(0, 1, 2) } 2 | 3 | function foo(a, b, c, b, a) 4 | { 5 | print "a =", a 6 | print "b =", b 7 | print "c =", c 8 | } 9 | -------------------------------------------------------------------------------- /test/paramdup.ok: -------------------------------------------------------------------------------- 1 | gawk: paramdup.awk:3: error: function `foo': parameter #4, `b', duplicates parameter #2 2 | gawk: paramdup.awk:3: error: function `foo': parameter #5, `a', duplicates parameter #1 3 | EXIT CODE: 1 4 | -------------------------------------------------------------------------------- /test/paramres.awk: -------------------------------------------------------------------------------- 1 | BEGIN { foo() } 2 | 3 | function foo(a, FS, q) 4 | { 5 | print "a =", a 6 | } 7 | -------------------------------------------------------------------------------- /test/paramres.ok: -------------------------------------------------------------------------------- 1 | gawk: paramres.awk:3: error: function `foo': can't use special variable `FS' as a function parameter 2 | EXIT CODE: 1 3 | -------------------------------------------------------------------------------- /test/paramtyp.awk: -------------------------------------------------------------------------------- 1 | # Sun Apr 25 13:28:58 IDT 1999 2 | # from Juegen Khars. This program should not core dump. 3 | function ReadPGM(f, d) { 4 | print "ReadPGM" 5 | d[1] = 1 6 | } 7 | 8 | function WritePGM(f, d) { 9 | print "WritePGM" 10 | d[1] = 0 11 | } 12 | 13 | BEGIN { 14 | print "before ReadPGM" 15 | ReadPGM("", d) 16 | print "after ReadPGM" 17 | print "before WritePGM" 18 | WritePGM("", d) 19 | print "after WritePGM" 20 | } 21 | -------------------------------------------------------------------------------- /test/paramtyp.ok: -------------------------------------------------------------------------------- 1 | before ReadPGM 2 | ReadPGM 3 | after ReadPGM 4 | before WritePGM 5 | WritePGM 6 | after WritePGM 7 | -------------------------------------------------------------------------------- /test/parse1.in: -------------------------------------------------------------------------------- 1 | 3 4 5 6 7 8 9 2 | -------------------------------------------------------------------------------- /test/parse1.ok: -------------------------------------------------------------------------------- 1 | in: 3 4 5 6 7 8 9 2 | a = 3 3 | 7 4 | out: 3 4 6 6 8 8 9 5 | -------------------------------------------------------------------------------- /test/parsefld.awk: -------------------------------------------------------------------------------- 1 | { print $/= b/ c /= d/ } 2 | { print /a/ + /b/ + !/c/} 3 | -------------------------------------------------------------------------------- /test/parsefld.in: -------------------------------------------------------------------------------- 1 | a = b 2 | -------------------------------------------------------------------------------- /test/parsefld.ok: -------------------------------------------------------------------------------- 1 | a0 2 | 3 3 | -------------------------------------------------------------------------------- /test/parseme.awk: -------------------------------------------------------------------------------- 1 | BEGIN { toupper(substr*line,1,12)) } 2 | -------------------------------------------------------------------------------- /test/parseme.ok: -------------------------------------------------------------------------------- 1 | gawk: parseme.awk:1: BEGIN { toupper(substr*line,1,12)) } 2 | gawk: parseme.awk:1: ^ syntax error 3 | gawk: parseme.awk:1: BEGIN { toupper(substr*line,1,12)) } 4 | gawk: parseme.awk:1: ^ 2 is invalid as number of arguments for toupper 5 | EXIT CODE: 1 6 | -------------------------------------------------------------------------------- /test/pcntplus.awk: -------------------------------------------------------------------------------- 1 | BEGIN { printf "%+d %d\n", 3, 4 } 2 | -------------------------------------------------------------------------------- /test/pcntplus.ok: -------------------------------------------------------------------------------- 1 | +3 4 2 | -------------------------------------------------------------------------------- /test/pid.ok: -------------------------------------------------------------------------------- 1 | PID ok 2 | PPID ok 3 | All Done. 4 | -------------------------------------------------------------------------------- /test/pid.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | AWK=${AWK-../gawk} 3 | exec $AWK -v "ok_pid=$$" -v "ok_ppid=$1" -f pid.awk 2>/dev/null 4 | -------------------------------------------------------------------------------- /test/pipeio1.ok: -------------------------------------------------------------------------------- 1 | 1 2 2 | 2 3 | -------------------------------------------------------------------------------- /test/pipeio2.in: -------------------------------------------------------------------------------- 1 | January 1997 2 | S M Tu W Th F S 3 | 1 2 3 4 4 | 5 6 7 8 9 10 11 5 | 12 13 14 15 16 17 18 6 | 19 20 21 22 23 24 25 7 | 26 27 28 29 30 31 8 | 9 | -------------------------------------------------------------------------------- /test/pipeio2.ok: -------------------------------------------------------------------------------- 1 | 'echo January 1997 | sed "s/[0-9]/./g"' 2 | January .... 3 | 'echo S M Tu W Th F S | sed "s/[0-9]/./g"' 4 | S M Tu W Th F S 5 | 'echo 1 2 3 4 | sed "s/[0-9]/./g"' 6 | . . . . 7 | 'echo 5 6 7 8 9 10 11 | sed "s/[0-9]/./g"' 8 | . . . . . .. .. 9 | 'echo 12 13 14 15 16 17 18 | sed "s/[0-9]/./g"' 10 | .. .. .. .. .. .. .. 11 | 'echo 19 20 21 22 23 24 25 | sed "s/[0-9]/./g"' 12 | .. .. .. .. .. .. .. 13 | 'echo 26 27 28 29 30 31 | sed "s/[0-9]/./g"' 14 | .. .. .. .. .. .. 15 | -------------------------------------------------------------------------------- /test/posix.in: -------------------------------------------------------------------------------- 1 | 1:2,3 4 2 | -------------------------------------------------------------------------------- /test/posix.ok: -------------------------------------------------------------------------------- 1 | Test #1: "+2" compares as a string 2 | Test #2: "+2a" compares as a string 3 | Test #3: "+2 " compares as a string 4 | Test #4: " 2" compares as a string 5 | after addition 6 | Test #5: "+2" compares as a string 7 | Test #6: "+2a" compares as a string 8 | Test #7: "+2 " compares as a string 9 | Test #8: " 2" compares as a string 10 | Test #9: "3e5" <= "5" 11 | Test #10: test 12 | Test #11: test 13 | Test #12: 1.500000 1.500000e+00 14 | Test #13: nomatch 15 | Test #14: 1:2,3 16 | Test #15: 4 17 | -------------------------------------------------------------------------------- /test/posix2008sub.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | text = "here is some text" 3 | repl = "" 4 | printf "orig = \"%s\", repl = \"%s\"\n", text, repl 5 | sub(/some/, repl, text) 6 | printf "result is \"%s\"\n", text 7 | } 8 | -------------------------------------------------------------------------------- /test/posix2008sub.ok: -------------------------------------------------------------------------------- 1 | orig = "here is some text", repl = "" 2 | result is "here is text" 3 | -------------------------------------------------------------------------------- /test/poundbang.awk: -------------------------------------------------------------------------------- 1 | #! /tmp/gawk -f 2 | { print } 3 | -------------------------------------------------------------------------------- /test/prdupval.awk: -------------------------------------------------------------------------------- 1 | { print NF, $NF, "abc" $NF } 2 | -------------------------------------------------------------------------------- /test/prdupval.in: -------------------------------------------------------------------------------- 1 | one 2 | -------------------------------------------------------------------------------- /test/prdupval.ok: -------------------------------------------------------------------------------- 1 | 1 one abcone 2 | -------------------------------------------------------------------------------- /test/prec.awk: -------------------------------------------------------------------------------- 1 | # check the precedence of operators: 2 | BEGIN { 3 | $1 = i = 1 4 | $+i++ 5 | $- -i++ 6 | print 7 | } 8 | -------------------------------------------------------------------------------- /test/prec.ok: -------------------------------------------------------------------------------- 1 | 1 2 | -------------------------------------------------------------------------------- /test/printf0.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | # bwk accepts this silently: 3 | printf 4 | print "X" 5 | } 6 | -------------------------------------------------------------------------------- /test/printf0.ok: -------------------------------------------------------------------------------- 1 | X 2 | -------------------------------------------------------------------------------- /test/printf1.awk: -------------------------------------------------------------------------------- 1 | # Tue May 25 16:36:16 IDT 1999 2 | # 3 | # Test cases based on email from Andreas Schwab, schwab@gnu.org 4 | 5 | BEGIN { 6 | fmt[1] = "%8.5d"; data[1] = 100 7 | fmt[2] = "%#o"; data[2] = 0 8 | fmt[3] = "%#.1o"; data[3] = 0 9 | fmt[4] = "%#.0o"; data[4] = 0 10 | fmt[5] = "%#x"; data[5] = 0 11 | fmt[6] = "%.0d"; data[6] = 0 12 | fmt[7] = "%5.0d"; data[7] = 0 13 | 14 | for (i = 1; i <= 7; i++) { 15 | format = "%s, %d --- |" fmt[i] "|\n" 16 | printf(format, fmt[i], data[i], data[i]) 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /test/printf1.ok: -------------------------------------------------------------------------------- 1 | %8.5d, 100 --- | 00100| 2 | %#o, 0 --- |0| 3 | %#.1o, 0 --- |0| 4 | %#.0o, 0 --- |0| 5 | %#x, 0 --- |0| 6 | %.0d, 0 --- || 7 | %5.0d, 0 --- | | 8 | -------------------------------------------------------------------------------- /test/printfbad1.ok: -------------------------------------------------------------------------------- 1 | gawk: printfbad1.awk:35: fatal: not enough arguments to satisfy format string 2 | `%3$*10$.*1$s 3 | ' 4 | ^ ran out for this one 5 | EXIT CODE: 2 6 | -------------------------------------------------------------------------------- /test/printfbad2.awk: -------------------------------------------------------------------------------- 1 | BEGIN { FS = "a" } 2 | { printf ($2 "\n") } 3 | -------------------------------------------------------------------------------- /test/printfbad2.in: -------------------------------------------------------------------------------- 1 | a%28b%29%c 2 | -------------------------------------------------------------------------------- /test/printfbad2.ok: -------------------------------------------------------------------------------- 1 | gawk: printfbad2.awk:2: (FILENAME=printfbad2.in FNR=1) warning: ignoring unknown format specifier character `b': no argument converted 2 | gawk: printfbad2.awk:2: (FILENAME=printfbad2.in FNR=1) warning: field width is ignored for `%%' specifier 3 | %28b%c 4 | -------------------------------------------------------------------------------- /test/printfbad3.ok: -------------------------------------------------------------------------------- 1 | >><< >>0xa7<< >>0xa7<< 2 | -------------------------------------------------------------------------------- /test/printlang.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | printf "\nLocale environment:\n\tLC_ALL=\"%s\" LANG=\"%s\"\n\n", 3 | ENVIRON["LC_ALL"], ENVIRON["LANG"] 4 | } 5 | -------------------------------------------------------------------------------- /test/prmarscl.awk: -------------------------------------------------------------------------------- 1 | function test(a) 2 | { 3 | print a[1] 4 | } 5 | 6 | BEGIN { j = 4; test(j) } 7 | -------------------------------------------------------------------------------- /test/prmarscl.ok: -------------------------------------------------------------------------------- 1 | gawk: prmarscl.awk:3: fatal: attempt to use scalar parameter `a' as an array 2 | EXIT CODE: 2 3 | -------------------------------------------------------------------------------- /test/prmreuse.awk: -------------------------------------------------------------------------------- 1 | # from Pat Rankin, rankin@eql.caltech.edu, now rankin@pactechdata.com 2 | 3 | BEGIN { dummy(1); legit(); exit } 4 | 5 | function dummy(arg) 6 | { 7 | return arg 8 | } 9 | 10 | function legit( scratch) 11 | { 12 | split("1 2 3", scratch) 13 | return "" 14 | } 15 | -------------------------------------------------------------------------------- /test/prmreuse.ok: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/test/prmreuse.ok -------------------------------------------------------------------------------- /test/procinfs.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | printf "Initially, PROCINFO[\"FS\"] = %s\n", PROCINFO["FS"] 3 | FIELDWIDTHS = "3 4 5 6" 4 | printf "After assign to FIELDWIDTHS, PROCINFO[\"FS\"] = %s\n", PROCINFO["FS"] 5 | FS = FS 6 | printf "After assign to FS, PROCINFO[\"FS\"] = %s\n", PROCINFO["FS"] 7 | } 8 | -------------------------------------------------------------------------------- /test/procinfs.ok: -------------------------------------------------------------------------------- 1 | Initially, PROCINFO["FS"] = FS 2 | After assign to FIELDWIDTHS, PROCINFO["FS"] = FIELDWIDTHS 3 | After assign to FS, PROCINFO["FS"] = FS 4 | -------------------------------------------------------------------------------- /test/profile3.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | the_func = "p" 3 | print @the_func("Hello") 4 | } 5 | 6 | function p(str) 7 | { 8 | print "! " str " !" 9 | } 10 | -------------------------------------------------------------------------------- /test/profile3.ok: -------------------------------------------------------------------------------- 1 | # BEGIN block(s) 2 | 3 | BEGIN { 4 | 1 the_func = "p" 5 | 1 print @the_func("Hello") 6 | } 7 | 8 | 9 | # Functions, listed alphabetically 10 | 11 | 1 function p(str) 12 | { 13 | 1 print "! " str " !" 14 | } 15 | -------------------------------------------------------------------------------- /test/prt1eval.awk: -------------------------------------------------------------------------------- 1 | function tst () { 2 | sum += 1 3 | return sum 4 | } 5 | 6 | BEGIN { OFMT = "%.0f" ; print tst() } 7 | -------------------------------------------------------------------------------- /test/prt1eval.ok: -------------------------------------------------------------------------------- 1 | 1 2 | -------------------------------------------------------------------------------- /test/prtoeval.awk: -------------------------------------------------------------------------------- 1 | function returns_a_str() { print "" ; return "'A STRING'" } 2 | BEGIN { 3 | print "partial line:", returns_a_str() 4 | } 5 | -------------------------------------------------------------------------------- /test/prtoeval.ok: -------------------------------------------------------------------------------- 1 | 2 | partial line: 'A STRING' 3 | -------------------------------------------------------------------------------- /test/pty1.ok: -------------------------------------------------------------------------------- 1 | 123 2 | x is abc 3 | -------------------------------------------------------------------------------- /test/rand-mpfr.ok: -------------------------------------------------------------------------------- 1 | 27 89 11 47 77 49 13 34 78 93 76 96 91 53 3 94 25 51 10 2 | -------------------------------------------------------------------------------- /test/rand-mpfr1.ok: -------------------------------------------------------------------------------- 1 | 25 42 47 49 80 5 4 92 59 96 8 63 92 28 41 37 80 51 48 2 | -------------------------------------------------------------------------------- /test/rand.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | srand(2) 3 | for (i = 0; i < 19; i++) 4 | printf "%3d ", (1 + int(100 * rand())) 5 | print "" 6 | } 7 | -------------------------------------------------------------------------------- /test/rand.ok: -------------------------------------------------------------------------------- 1 | 62 67 88 6 35 77 3 68 30 96 90 26 35 8 88 93 49 53 37 2 | -------------------------------------------------------------------------------- /test/range1.awk: -------------------------------------------------------------------------------- 1 | /foo/,/bar/ { print } 2 | -------------------------------------------------------------------------------- /test/range1.in: -------------------------------------------------------------------------------- 1 | foobar 2 | junk 3 | -------------------------------------------------------------------------------- /test/range1.ok: -------------------------------------------------------------------------------- 1 | foobar 2 | -------------------------------------------------------------------------------- /test/readdir.awk: -------------------------------------------------------------------------------- 1 | @load "readdir" 2 | 3 | BEGIN { 4 | readdir_do_ftype("stat") 5 | } 6 | 7 | { print } 8 | -------------------------------------------------------------------------------- /test/readdir0.awk: -------------------------------------------------------------------------------- 1 | { 2 | ino = $1 3 | name = $NF 4 | type = substr($2, 1, 1) 5 | if (type == "-") 6 | type = "f" 7 | 8 | printf "%s/%s/%s\n", ino, name, type 9 | } 10 | -------------------------------------------------------------------------------- /test/rebt8b1.awk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/test/rebt8b1.awk -------------------------------------------------------------------------------- /test/rebt8b1.ok: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/test/rebt8b1.ok -------------------------------------------------------------------------------- /test/rebt8b2.awk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/test/rebt8b2.awk -------------------------------------------------------------------------------- /test/redfilnm.in: -------------------------------------------------------------------------------- 1 | hello, world 2 | -------------------------------------------------------------------------------- /test/redfilnm.ok: -------------------------------------------------------------------------------- 1 | hello, world 2 | hello, world 3 | hello, world 4 | hello, world 5 | hello, world 6 | hello, world 7 | hello, world 8 | hello, world 9 | hello, world 10 | -------------------------------------------------------------------------------- /test/reg/Obsolete/exp.awk: -------------------------------------------------------------------------------- 1 | BEGIN { print exp(0), exp(1000000), exp(0.5) } 2 | -------------------------------------------------------------------------------- /test/reg/Obsolete/exp.good: -------------------------------------------------------------------------------- 1 | 1 gawk: reg/exp.awk:1: warning: exp argument 1e+06 is out of range 2 | Inf 1.64872 3 | -------------------------------------------------------------------------------- /test/reg/Obsolete/exp.in: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/test/reg/Obsolete/exp.in -------------------------------------------------------------------------------- /test/reg/Obsolete/log.awk: -------------------------------------------------------------------------------- 1 | BEGIN { print log(0), log(-1), log(100) } 2 | -------------------------------------------------------------------------------- /test/reg/Obsolete/log.good: -------------------------------------------------------------------------------- 1 | log: SING error 2 | -Inf gawk: reg/log.awk:1: warning: log called with negative argument -1 3 | log: DOMAIN error 4 | NaN 4.60517 5 | -------------------------------------------------------------------------------- /test/reg/Obsolete/log.in: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/test/reg/Obsolete/log.in -------------------------------------------------------------------------------- /test/reg/exp-eq.awk: -------------------------------------------------------------------------------- 1 | { $0 ^= 3 ; print $1} 2 | -------------------------------------------------------------------------------- /test/reg/exp-eq.good: -------------------------------------------------------------------------------- 1 | 1 2 | 8 3 | 27 4 | -------------------------------------------------------------------------------- /test/reg/exp-eq.in: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 3 4 | -------------------------------------------------------------------------------- /test/reg/func.awk: -------------------------------------------------------------------------------- 1 | BEGIN { print dummy(1) } 2 | -------------------------------------------------------------------------------- /test/reg/func.good: -------------------------------------------------------------------------------- 1 | gawk: reg/func.awk:1: fatal: function `dummy' not defined 2 | -------------------------------------------------------------------------------- /test/reg/func.in: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/test/reg/func.in -------------------------------------------------------------------------------- /test/reg/func2.awk: -------------------------------------------------------------------------------- 1 | function dummy() { ; } 2 | BEGIN { print dummy (1) } 3 | -------------------------------------------------------------------------------- /test/reg/func2.good: -------------------------------------------------------------------------------- 1 | gawk: reg/func2.awk:2: error: function `dummy' called with space between name and `(', 2 | or used as a variable or an array 3 | -------------------------------------------------------------------------------- /test/reg/func2.in: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/test/reg/func2.in -------------------------------------------------------------------------------- /test/regeq.in: -------------------------------------------------------------------------------- 1 | sdgfa 2 | asdfds=a 3 | -------------------------------------------------------------------------------- /test/regeq.ok: -------------------------------------------------------------------------------- 1 | 0 2 | 7 3 | -------------------------------------------------------------------------------- /test/regexprange.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | range = "[a-dx-z]" 3 | 4 | split("ABCDEFGHIJKLMNOPQRSTUVWXYZ", upper, "") 5 | split("abcdefghijklmnopqrstuvwxyz", lower, "") 6 | 7 | for (i = 1; i in upper; i++) 8 | printf("%s ~ %s ---> %s\n", 9 | upper[i], range, (upper[i] ~ range) ? "true" : "false") 10 | 11 | for (i = 1; i in lower; i++) 12 | printf("%s ~ %s ---> %s\n", 13 | lower[i], range, (lower[i] ~ range) ? "true" : "false") 14 | } 15 | -------------------------------------------------------------------------------- /test/regrange.ok: -------------------------------------------------------------------------------- 1 | "." ~ /[--\/]/ --> 1 2 | "a" ~ /[]-c]/ --> 1 3 | "c" ~ /[[a-d]/ --> 1 4 | "\" ~ /[\[-\]]/ --> 1 5 | "[.c.]" ~ /[a-[.e.]]/ --> 1 6 | "[.d.]" ~ /[[.c.]-[.z.]]/ --> 0 7 | -------------------------------------------------------------------------------- /test/regtest.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | case "$AWK" in 4 | "") AWK=../gawk ;; 5 | esac 6 | #AWK=${AWK:-../gawk} 7 | 8 | for i in reg/*.awk 9 | do 10 | it=`basename $i .awk` 11 | $AWK -f $i reg/$it.out 2>&1 12 | if diff reg/$it.out reg/$it.good 13 | then 14 | rm -f reg/$it.out 15 | else 16 | echo "regtest: $it fails" 17 | fi 18 | done 19 | -------------------------------------------------------------------------------- /test/regx8bit.awk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/test/regx8bit.awk -------------------------------------------------------------------------------- /test/regx8bit.ok: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/test/regx8bit.ok -------------------------------------------------------------------------------- /test/reindops.awk: -------------------------------------------------------------------------------- 1 | { 2 | if ($1 !~ /^+[2-9]/) 3 | print "gawk is broken" 4 | else 5 | print "gawk is ok" 6 | } 7 | -------------------------------------------------------------------------------- /test/reindops.in: -------------------------------------------------------------------------------- 1 | +44 123 456 2 | -------------------------------------------------------------------------------- /test/reindops.ok: -------------------------------------------------------------------------------- 1 | gawk is ok 2 | -------------------------------------------------------------------------------- /test/reint.awk: -------------------------------------------------------------------------------- 1 | { print match($0, /a{3}/) } 2 | -------------------------------------------------------------------------------- /test/reint.in: -------------------------------------------------------------------------------- 1 | match this: aaa 2 | -------------------------------------------------------------------------------- /test/reint.ok: -------------------------------------------------------------------------------- 1 | 13 2 | -------------------------------------------------------------------------------- /test/reint2.awk: -------------------------------------------------------------------------------- 1 | /^([[:digit:]]+[[:space:]]+){2}/ 2 | -------------------------------------------------------------------------------- /test/reint2.in: -------------------------------------------------------------------------------- 1 | 1 2 3 2 | -------------------------------------------------------------------------------- /test/reint2.ok: -------------------------------------------------------------------------------- 1 | 1 2 3 2 | -------------------------------------------------------------------------------- /test/reparse.awk: -------------------------------------------------------------------------------- 1 | { 2 | gsub(/x/, " ") 3 | $0 = $0 4 | print $1 5 | print $0 6 | print $1, $2, $3 7 | } 8 | -------------------------------------------------------------------------------- /test/reparse.in: -------------------------------------------------------------------------------- 1 | 1 axbxc 2 2 | -------------------------------------------------------------------------------- /test/reparse.ok: -------------------------------------------------------------------------------- 1 | 1 2 | 1 a b c 2 3 | 1 a b 4 | -------------------------------------------------------------------------------- /test/resplit.awk: -------------------------------------------------------------------------------- 1 | { FS = ":"; $0 = $0; print $2 } 2 | -------------------------------------------------------------------------------- /test/resplit.in: -------------------------------------------------------------------------------- 1 | a:b:c d:e:f 2 | -------------------------------------------------------------------------------- /test/resplit.ok: -------------------------------------------------------------------------------- 1 | b 2 | -------------------------------------------------------------------------------- /test/revout.awk: -------------------------------------------------------------------------------- 1 | @load "revoutput" 2 | 3 | BEGIN { 4 | REVOUT = 1 5 | print "hello, world" > "/dev/stdout" 6 | } 7 | -------------------------------------------------------------------------------- /test/revout.ok: -------------------------------------------------------------------------------- 1 | dlrow ,olleh 2 | -------------------------------------------------------------------------------- /test/revtwoway.awk: -------------------------------------------------------------------------------- 1 | @load "revtwoway" 2 | 3 | BEGIN { 4 | cmd = "/magic/mirror" 5 | 6 | print "hello, world" |& cmd 7 | cmd |& getline line 8 | 9 | printf("got back: <%s>, RT = <%s>\n", line, RT) 10 | close(cmd) 11 | } 12 | -------------------------------------------------------------------------------- /test/revtwoway.ok: -------------------------------------------------------------------------------- 1 | got back: , RT = < 2 | > 3 | -------------------------------------------------------------------------------- /test/rri1.awk: -------------------------------------------------------------------------------- 1 | /[d-f]/ 2 | -------------------------------------------------------------------------------- /test/rri1.in: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/test/rri1.in -------------------------------------------------------------------------------- /test/rri1.ok: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/test/rri1.ok -------------------------------------------------------------------------------- /test/rs.awk: -------------------------------------------------------------------------------- 1 | BEGIN { RS = "" } 2 | { print $1, $2 } 3 | -------------------------------------------------------------------------------- /test/rs.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | a 4 | b 5 | 6 | 7 | c d 8 | 9 | 10 | 11 | e 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /test/rs.ok: -------------------------------------------------------------------------------- 1 | a b 2 | c d 3 | e 4 | -------------------------------------------------------------------------------- /test/rsnul1nl.awk: -------------------------------------------------------------------------------- 1 | BEGIN { RS = "" } 2 | { print } 3 | -------------------------------------------------------------------------------- /test/rsnul1nl.in: -------------------------------------------------------------------------------- 1 | 2 | This is... 3 | the first record. 4 | -------------------------------------------------------------------------------- /test/rsnul1nl.ok: -------------------------------------------------------------------------------- 1 | This is... 2 | the first record. 3 | -------------------------------------------------------------------------------- /test/rsnulbig.ok: -------------------------------------------------------------------------------- 1 | 16386 2 | -------------------------------------------------------------------------------- /test/rsnulbig2.ok: -------------------------------------------------------------------------------- 1 | 2 2 | -------------------------------------------------------------------------------- /test/rsstart1.ok: -------------------------------------------------------------------------------- 1 | 2 2 | -------------------------------------------------------------------------------- /test/rsstart2.awk: -------------------------------------------------------------------------------- 1 | BEGIN { RS = "^Ax*\n" } 2 | END { print NR } 3 | -------------------------------------------------------------------------------- /test/rsstart2.ok: -------------------------------------------------------------------------------- 1 | 2 2 | -------------------------------------------------------------------------------- /test/rsstart3.ok: -------------------------------------------------------------------------------- 1 | 2 2 | -------------------------------------------------------------------------------- /test/rstest1.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | RS = "" 3 | FS = ":" 4 | s = "a:b\nc:d" 5 | print split(s,a) 6 | print length(a[2]) 7 | } 8 | -------------------------------------------------------------------------------- /test/rstest1.ok: -------------------------------------------------------------------------------- 1 | 3 2 | 3 3 | -------------------------------------------------------------------------------- /test/rstest2.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | RS = "" 3 | FS = "\\" 4 | $0 = "a\\b" 5 | print $1 6 | } 7 | -------------------------------------------------------------------------------- /test/rstest2.ok: -------------------------------------------------------------------------------- 1 | a 2 | -------------------------------------------------------------------------------- /test/rstest3.ok: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/test/rstest3.ok -------------------------------------------------------------------------------- /test/rstest4.ok: -------------------------------------------------------------------------------- 1 | y = 2 | x = <> 3 | -------------------------------------------------------------------------------- /test/rstest5.ok: -------------------------------------------------------------------------------- 1 | foo 2 | baz 3 | bar 4 | x = <> 5 | -------------------------------------------------------------------------------- /test/rstest6.awk: -------------------------------------------------------------------------------- 1 | # Wed Jul 14 16:02:45 IDT 2004 2 | # Test case from John Haque mary1john8@earthlink.net 3 | 4 | BEGIN { RS = "XYZ" } 5 | 6 | { print } 7 | -------------------------------------------------------------------------------- /test/rstest6.in: -------------------------------------------------------------------------------- 1 | ABCD -------------------------------------------------------------------------------- /test/rstest6.ok: -------------------------------------------------------------------------------- 1 | ABCD 2 | -------------------------------------------------------------------------------- /test/rswhite.awk: -------------------------------------------------------------------------------- 1 | BEGIN { RS = "" } 2 | { printf("<%s>\n", $0) } 3 | -------------------------------------------------------------------------------- /test/rswhite.in: -------------------------------------------------------------------------------- 1 | a b 2 | c d 3 | -------------------------------------------------------------------------------- /test/rswhite.ok: -------------------------------------------------------------------------------- 1 | < a b 2 | c d> 3 | -------------------------------------------------------------------------------- /test/rtlen.ok: -------------------------------------------------------------------------------- 1 | 3 2 | 5 3 | 2 4 | -------------------------------------------------------------------------------- /test/rtlen.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | AWK=${AWK:-../gawk} 4 | 5 | $AWK 'BEGIN {printf "0\n\n\n1\n\n\n\n\n2\n\n"; exit}' | $AWK 'BEGIN {RS=""}; {print length(RT)}' 6 | -------------------------------------------------------------------------------- /test/rtlen01.ok: -------------------------------------------------------------------------------- 1 | 0 2 | 1 3 | 2 4 | -------------------------------------------------------------------------------- /test/rtlen01.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | AWK=${AWK:-../gawk} 4 | 5 | $AWK 'BEGIN {printf "0"; exit}' | $AWK 'BEGIN {RS=""}; {print length(RT)}' 6 | $AWK 'BEGIN {printf "0\n"; exit}' | $AWK 'BEGIN {RS=""}; {print length(RT)}' 7 | $AWK 'BEGIN {printf "0\n\n"; exit}' | $AWK 'BEGIN {RS=""}; {print length(RT)}' 8 | 9 | -------------------------------------------------------------------------------- /test/rwarray.ok: -------------------------------------------------------------------------------- 1 | writea() returned 1, expecting 1 2 | reada() returned 1, expecting 1 3 | old and new are equal - GOOD 4 | -------------------------------------------------------------------------------- /test/scalar.awk: -------------------------------------------------------------------------------- 1 | BEGIN{ 2 | sub(/x/,"",a) 3 | a[1] 4 | } 5 | -------------------------------------------------------------------------------- /test/scalar.ok: -------------------------------------------------------------------------------- 1 | gawk: scalar.awk:3: fatal: attempt to use scalar `a' as an array 2 | EXIT CODE: 2 3 | -------------------------------------------------------------------------------- /test/sclforin.awk: -------------------------------------------------------------------------------- 1 | BEGIN { j = 4; for (i in j) print j[i] } 2 | -------------------------------------------------------------------------------- /test/sclforin.ok: -------------------------------------------------------------------------------- 1 | gawk: sclforin.awk:1: fatal: attempt to use scalar `j' as an array 2 | EXIT CODE: 2 3 | -------------------------------------------------------------------------------- /test/sclifin.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | j = 4 3 | if ("foo" in j) 4 | print "ouch" 5 | else 6 | print "ok" 7 | } 8 | -------------------------------------------------------------------------------- /test/sclifin.ok: -------------------------------------------------------------------------------- 1 | gawk: sclifin.awk:3: fatal: attempt to use scalar `j' as an array 2 | EXIT CODE: 2 3 | -------------------------------------------------------------------------------- /test/shadow.awk: -------------------------------------------------------------------------------- 1 | function foo() 2 | { 3 | print "foo" 4 | } 5 | 6 | function bar(A, Z, q) 7 | { 8 | print "bar" 9 | } 10 | 11 | function baz(C, D) 12 | { 13 | print "baz" 14 | } 15 | 16 | BEGIN { 17 | A = C = D = Z = y = 1 18 | foo() 19 | bar() 20 | baz() 21 | } 22 | -------------------------------------------------------------------------------- /test/shadow.ok: -------------------------------------------------------------------------------- 1 | gawk: shadow.awk:6: warning: function `bar': parameter `A' shadows global variable 2 | gawk: shadow.awk:6: warning: function `bar': parameter `Z' shadows global variable 3 | gawk: shadow.awk:11: warning: function `baz': parameter `C' shadows global variable 4 | gawk: shadow.awk:11: warning: function `baz': parameter `D' shadows global variable 5 | foo 6 | bar 7 | baz 8 | -------------------------------------------------------------------------------- /test/sortempty.awk: -------------------------------------------------------------------------------- 1 | BEGIN { print asort(a) } 2 | -------------------------------------------------------------------------------- /test/sortempty.ok: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /test/sortfor.awk: -------------------------------------------------------------------------------- 1 | { a[$0]++ } 2 | END { 3 | PROCINFO["sorted_in"] = "@ind_str_asc" 4 | for (i in a) 5 | print i 6 | PROCINFO["sorted_in"] = "@ind_str_desc" 7 | for (i in a) 8 | print i 9 | } 10 | -------------------------------------------------------------------------------- /test/space.ok: -------------------------------------------------------------------------------- 1 | gawk: fatal: can't open source file ` ' for reading (No such file or directory) 2 | EXIT CODE: 2 3 | -------------------------------------------------------------------------------- /test/splitarg4.in: -------------------------------------------------------------------------------- 1 | caccbdc 2 | acbcd 3 | 4 | a b def 5 | a b dwf 6 | a b dwf 7 | a b dwf 8 | abc 9 | a 10 | aabaabbabbbaabbb 11 | ab 12 | -------------------------------------------------------------------------------- /test/splitargv.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | for (idx = 1; idx < ARGC; idx++) 3 | split(ARGV[idx], temp, "."); 4 | } 5 | { 6 | print $0; 7 | } 8 | -------------------------------------------------------------------------------- /test/splitargv.in: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | for (idx = 1; idx < ARGC; idx++) 3 | split(ARGV[idx], temp, "."); 4 | } 5 | { 6 | print $0; 7 | } 8 | -------------------------------------------------------------------------------- /test/splitargv.ok: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | for (idx = 1; idx < ARGC; idx++) 3 | split(ARGV[idx], temp, "."); 4 | } 5 | { 6 | print $0; 7 | } 8 | -------------------------------------------------------------------------------- /test/splitarr.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | a[1] = "elephantie" 3 | a[2] = "e" 4 | print split(a[1],a,a[2]), a[2], a[3], split(a[2],a,a[2]) 5 | } 6 | -------------------------------------------------------------------------------- /test/splitarr.ok: -------------------------------------------------------------------------------- 1 | 4 l phanti 2 2 | -------------------------------------------------------------------------------- /test/splitdef.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | data = "abc:easy:as:one:two:three" 3 | FS = ":" 4 | FIELDWIDTHS = "3 1 4 1 2 1 3 1 3 1 5" 5 | n = split(data, a) 6 | printf "n = %d, a[3] = %s\n", n, a[3] 7 | } 8 | -------------------------------------------------------------------------------- /test/splitdef.ok: -------------------------------------------------------------------------------- 1 | n = 6, a[3] = as 2 | -------------------------------------------------------------------------------- /test/splitvar.awk: -------------------------------------------------------------------------------- 1 | { 2 | sep = "=+" 3 | n = split($0, a, sep) 4 | print n 5 | } 6 | -------------------------------------------------------------------------------- /test/splitvar.in: -------------------------------------------------------------------------------- 1 | Here===Is=Some=====Data 2 | -------------------------------------------------------------------------------- /test/splitvar.ok: -------------------------------------------------------------------------------- 1 | 4 2 | -------------------------------------------------------------------------------- /test/splitwht.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | str = "a b\t\tc d" 3 | n = split(str, a, " ") 4 | print n 5 | m = split(str, b, / /) 6 | print m 7 | } 8 | -------------------------------------------------------------------------------- /test/splitwht.ok: -------------------------------------------------------------------------------- 1 | 4 2 | 5 3 | -------------------------------------------------------------------------------- /test/sprintfc.awk: -------------------------------------------------------------------------------- 1 | { print sprintf("%c", $1), $1 } 2 | -------------------------------------------------------------------------------- /test/sprintfc.in: -------------------------------------------------------------------------------- 1 | 65 2 | 66 3 | foo 4 | -------------------------------------------------------------------------------- /test/sprintfc.ok: -------------------------------------------------------------------------------- 1 | A 65 2 | B 66 3 | f foo 4 | -------------------------------------------------------------------------------- /test/strcat1.awk: -------------------------------------------------------------------------------- 1 | 2 | function f1(b) { b = b "c"; print f(b); } 3 | 4 | function f(a) { a = a "b"; return a; } 5 | 6 | BEGIN { A = "a"; f1(A); } 7 | -------------------------------------------------------------------------------- /test/strcat1.ok: -------------------------------------------------------------------------------- 1 | acb 2 | -------------------------------------------------------------------------------- /test/strftlng.awk: -------------------------------------------------------------------------------- 1 | # test file from Paul Eggert, eggert@twinsun.com 2 | # modified for portability (%c doesn't cut it) 3 | 4 | BEGIN { 5 | BUFSIZ = 1024 6 | simpleformat = format = "%m/%d/%y %H:%M:%S\n" 7 | clen = length(strftime(format, 0)) 8 | for (i = 1; i < BUFSIZ / clen + 1; i++) 9 | format = format simpleformat 10 | printf "%s", strftime(format, 0) 11 | } 12 | -------------------------------------------------------------------------------- /test/strnum1.ok: -------------------------------------------------------------------------------- 1 | 8 = 8 2 | 88 = 88 3 | -------------------------------------------------------------------------------- /test/strtod.awk: -------------------------------------------------------------------------------- 1 | { 2 | x = "0x" $1 ; print x, x + 0 3 | for (i=1; i<=NF; i++) 4 | if ($i) print $i, "is not zero" 5 | } 6 | -------------------------------------------------------------------------------- /test/strtod.in: -------------------------------------------------------------------------------- 1 | 345 0 00 0e0 0E1 00E0 000e-5 .0e+0 2 | -------------------------------------------------------------------------------- /test/strtod.ok: -------------------------------------------------------------------------------- 1 | 0x345 0 2 | 345 is not zero 3 | -------------------------------------------------------------------------------- /test/strtonum.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | print strtonum("0x13") 3 | print strtonum("013") 4 | print strtonum("13") 5 | print strtonum(13) 6 | } 7 | -------------------------------------------------------------------------------- /test/strtonum.ok: -------------------------------------------------------------------------------- 1 | 19 2 | 11 3 | 13 4 | 13 5 | -------------------------------------------------------------------------------- /test/subamp.awk: -------------------------------------------------------------------------------- 1 | { sub(/[[:lower:]]/, "&") ; print } 2 | -------------------------------------------------------------------------------- /test/subamp.in: -------------------------------------------------------------------------------- 1 | aaa 2 | -------------------------------------------------------------------------------- /test/subamp.ok: -------------------------------------------------------------------------------- 1 | aaa 2 | -------------------------------------------------------------------------------- /test/subi18n.ok: -------------------------------------------------------------------------------- 1 | "directory" version="1.0" 2 | "1.0" 3 | -------------------------------------------------------------------------------- /test/subsepnm.awk: -------------------------------------------------------------------------------- 1 | BEGIN { SUBSEP = 10; a[1, 1] = 100 ; print a[1 SUBSEP 1] } 2 | -------------------------------------------------------------------------------- /test/subsepnm.ok: -------------------------------------------------------------------------------- 1 | 100 2 | -------------------------------------------------------------------------------- /test/subslash.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | i = 2 3 | a[i] = 5 4 | a[i] /= 2 5 | printf "a[%s] = %f\n", i, a[i] 6 | } 7 | -------------------------------------------------------------------------------- /test/subslash.ok: -------------------------------------------------------------------------------- 1 | a[2] = 2.500000 2 | -------------------------------------------------------------------------------- /test/substr.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | x = "A" 3 | printf("%-39s\n", substr(x,1,39)) 4 | print substr("abcdef", 0, 2) 5 | print substr("abcdef", 2.3, 2) 6 | print substr("abcdef", -1, 2) 7 | print substr("abcdef", 1, 0) 8 | print substr("abcdef", 1, -3) 9 | print substr("abcdef", 1, 2.3) 10 | print substr("", 1, 2) 11 | print substr("abcdef", 5, 5) 12 | print substr("abcdef", 7, 2) 13 | exit (0) 14 | } 15 | -------------------------------------------------------------------------------- /test/substr.ok: -------------------------------------------------------------------------------- 1 | A 2 | ab 3 | bc 4 | ab 5 | 6 | 7 | ab 8 | 9 | ef 10 | 11 | -------------------------------------------------------------------------------- /test/swaplns.awk: -------------------------------------------------------------------------------- 1 | { 2 | if ((getline tmp) > 0) { 3 | print tmp 4 | print 5 | } else 6 | print 7 | } 8 | -------------------------------------------------------------------------------- /test/swaplns.in: -------------------------------------------------------------------------------- 1 | This directory contains some examples/test-cases for different 2 | features of gawk - mostly not present in an old awk. Some are from 3 | "The GAWK Manual", some are original, and some are mixture of the two. 4 | Read header comments before attempting to use. Have fun and remember 5 | that program which consists only of BEGIN block does not need an input 6 | file. 7 | 8 | --mj 9 | 10 | -------------------------------------------------------------------------------- /test/swaplns.ok: -------------------------------------------------------------------------------- 1 | features of gawk - mostly not present in an old awk. Some are from 2 | This directory contains some examples/test-cases for different 3 | Read header comments before attempting to use. Have fun and remember 4 | "The GAWK Manual", some are original, and some are mixture of the two. 5 | file. 6 | that program which consists only of BEGIN block does not need an input 7 | --mj 8 | 9 | 10 | -------------------------------------------------------------------------------- /test/switch2.ok: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/test/switch2.ok -------------------------------------------------------------------------------- /test/symtab1.awk: -------------------------------------------------------------------------------- 1 | function dumparray(name, array, i) 2 | { 3 | for (i in array) 4 | if (isarray(array[i])) 5 | dumparray(name "[" i "]", array[i]) 6 | else 7 | printf("%s[%s] = %s\n", name, i, array[i]) 8 | } 9 | 10 | BEGIN { 11 | a[1] = 1 12 | a[2][1] = 21 13 | for (i in SYMTAB) 14 | if (isarray(SYMTAB[i])) 15 | dumparray(i, SYMTAB[i]) 16 | else 17 | printf("SYMTAB[\"%s\"] = \"%s\"\n", i, SYMTAB[i]) 18 | } 19 | -------------------------------------------------------------------------------- /test/symtab2.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | a = 5 3 | printf "a = %d, SYMTAB[\"a\"] = %d\n", a, SYMTAB["a"] 4 | SYMTAB["a"] = 4 5 | printf "a = %d, SYMTAB[\"a\"] = %d\n", a, SYMTAB["a"] 6 | } 7 | -------------------------------------------------------------------------------- /test/symtab2.ok: -------------------------------------------------------------------------------- 1 | a = 5, SYMTAB["a"] = 5 2 | a = 4, SYMTAB["a"] = 4 3 | -------------------------------------------------------------------------------- /test/symtab3.awk: -------------------------------------------------------------------------------- 1 | BEGIN { a = 5 ; delete SYMTAB["a"] } 2 | -------------------------------------------------------------------------------- /test/symtab3.ok: -------------------------------------------------------------------------------- 1 | gawk: symtab3.awk:1: fatal: `delete' is not allowed with SYMTAB 2 | EXIT CODE: 2 3 | -------------------------------------------------------------------------------- /test/synerr1.awk: -------------------------------------------------------------------------------- 1 | # program to make sure we don't infinite 2 | # syntax errors 3 | 4 | print "hi" 5 | -------------------------------------------------------------------------------- /test/synerr1.ok: -------------------------------------------------------------------------------- 1 | gawk: synerr1.awk:4: print "hi" 2 | gawk: synerr1.awk:4: ^ syntax error 3 | EXIT CODE: 1 4 | -------------------------------------------------------------------------------- /test/synerr2.ok: -------------------------------------------------------------------------------- 1 | gawk: synerr2.awk:47: BEGIN { sprintf("%s", $) } 2 | gawk: synerr2.awk:47: ^ syntax error 3 | EXIT CODE: 1 4 | -------------------------------------------------------------------------------- /test/time.ok: -------------------------------------------------------------------------------- 1 | gettimeofday - systime = 0 2 | sleep(1.3) = 0 3 | gettimeofday - systime = 0 4 | -------------------------------------------------------------------------------- /test/tradanch.awk: -------------------------------------------------------------------------------- 1 | /foo^bar/ 2 | /foo$bar/ 3 | -------------------------------------------------------------------------------- /test/tradanch.in: -------------------------------------------------------------------------------- 1 | foo^bar 2 | foo$bar 3 | -------------------------------------------------------------------------------- /test/tradanch.ok: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvlx/gawk/a892293556960b0813098ede7da7a34774da7d3c/test/tradanch.ok -------------------------------------------------------------------------------- /test/uninit2.awk: -------------------------------------------------------------------------------- 1 | BEGIN { a = a + 1; x = a; print a} 2 | BEGIN { ++b; x = b; print b} 3 | -------------------------------------------------------------------------------- /test/uninit2.ok: -------------------------------------------------------------------------------- 1 | gawk: uninit2.awk:1: warning: reference to uninitialized variable `a' 2 | 1 3 | gawk: uninit2.awk:2: warning: reference to uninitialized variable `b' 4 | 1 5 | -------------------------------------------------------------------------------- /test/uninit3.awk: -------------------------------------------------------------------------------- 1 | function f(x){ 2 | print x 3 | } 4 | 5 | BEGIN { 6 | f(x) 7 | } 8 | -------------------------------------------------------------------------------- /test/uninit3.ok: -------------------------------------------------------------------------------- 1 | gawk: uninit3.awk:1: warning: function `f': parameter `x' shadows global variable 2 | gawk: uninit3.awk:2: warning: reference to uninitialized argument `x' 3 | 4 | -------------------------------------------------------------------------------- /test/uninit4.awk: -------------------------------------------------------------------------------- 1 | # test whether --lint catches uninitialized fields: 2 | function pr() 3 | { 4 | print 5 | } 6 | 7 | BEGIN { 8 | pr() 9 | print $0 10 | print $(1-1) 11 | print $1 12 | NF=3; print $2 13 | } 14 | -------------------------------------------------------------------------------- /test/uninit4.ok: -------------------------------------------------------------------------------- 1 | gawk: uninit4.awk:4: warning: reference to uninitialized field `$0' 2 | 3 | gawk: uninit4.awk:9: warning: reference to uninitialized field `$0' 4 | 5 | gawk: uninit4.awk:10: warning: reference to uninitialized field `$0' 6 | 7 | gawk: uninit4.awk:11: warning: reference to uninitialized field `$1' 8 | 9 | gawk: uninit4.awk:12: warning: reference to uninitialized field `$2' 10 | 11 | -------------------------------------------------------------------------------- /test/uninit5.ok: -------------------------------------------------------------------------------- 1 | gawk: uninit5.awk:75: warning: reference to uninitialized argument `a' 2 | length: 0 3 | gawk: uninit5.awk:77: warning: reference to uninitialized argument `a' 4 | 5 | 6 | gawk: uninit5.awk:97: warning: reference to uninitialized argument `a' 7 | length: 0 8 | 9 | 10 | -------------------------------------------------------------------------------- /test/uninitialized.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | a += 2 3 | } 4 | -------------------------------------------------------------------------------- /test/uninitialized.ok: -------------------------------------------------------------------------------- 1 | gawk: uninitialized.awk:2: warning: reference to uninitialized variable `a' 2 | -------------------------------------------------------------------------------- /test/unterm.awk: -------------------------------------------------------------------------------- 1 | BEGIN{x=".........................................................................................................................................................................................................................................................} -------------------------------------------------------------------------------- /test/uparrfs.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | FS = "(^x+)|( +)" 3 | } 4 | 5 | { 6 | for (i = 1; i <= NF; i++) 7 | printf "-->%s<--\n", $i 8 | } 9 | -------------------------------------------------------------------------------- /test/uparrfs.in: -------------------------------------------------------------------------------- 1 | xxAA xxBxx C 2 | -------------------------------------------------------------------------------- /test/uparrfs.ok: -------------------------------------------------------------------------------- 1 | --><-- 2 | -->AA<-- 3 | -->xxBxx<-- 4 | -->C<-- 5 | -------------------------------------------------------------------------------- /test/wideidx.awk: -------------------------------------------------------------------------------- 1 | { 2 | a=$0 3 | print index(a,"b") 4 | getline 5 | a = a $0 6 | print index(a,"b") 7 | } 8 | -------------------------------------------------------------------------------- /test/wideidx.in: -------------------------------------------------------------------------------- 1 | foo 2 | bar 3 | -------------------------------------------------------------------------------- /test/wideidx.ok: -------------------------------------------------------------------------------- 1 | 0 2 | 4 3 | -------------------------------------------------------------------------------- /test/wideidx2.ok: -------------------------------------------------------------------------------- 1 | Before 2 2 | After 3 3 | -------------------------------------------------------------------------------- /test/widesub.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | str = "type=\"directory\" version=\"1.0\"" 3 | #print "BEGIN:", str 4 | 5 | while (str) { 6 | sub(/^[^=]*/, "", str); 7 | s = substr(str, 2) 8 | print s 9 | sub(/^="[^"]*"/, "", str) 10 | sub(/^[ \t]*/, "", str) 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /test/widesub.ok: -------------------------------------------------------------------------------- 1 | "directory" version="1.0" 2 | "1.0" 3 | -------------------------------------------------------------------------------- /test/widesub2.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | Value = "abc" 3 | 4 | print "Before <" Value "> ", index( Value, "bc" ) 5 | 6 | sub( /bc/, "bbc", Value ) 7 | 8 | print "After <" Value ">", index( Value, "bc" ) 9 | } 10 | -------------------------------------------------------------------------------- /test/widesub2.ok: -------------------------------------------------------------------------------- 1 | Before 2 2 | After 3 3 | -------------------------------------------------------------------------------- /test/widesub3.awk: -------------------------------------------------------------------------------- 1 | { 2 | if (substr($1,1,1) == substr($0,1,1)) 3 | print "substr matches" 4 | sub(/foo/,"bar") 5 | print nr++ 6 | } 7 | -------------------------------------------------------------------------------- /test/widesub3.in: -------------------------------------------------------------------------------- 1 | test 2 | foo 3 | -------------------------------------------------------------------------------- /test/widesub3.ok: -------------------------------------------------------------------------------- 1 | substr matches 2 | 0 3 | substr matches 4 | 1 5 | -------------------------------------------------------------------------------- /test/widesub4.ok: -------------------------------------------------------------------------------- 1 | 16 A=1234567890abcdef. 2 | 12 A=567890abcdef. 3 | 8 A=90abcdef. 4 | 4 A=cdef. 5 | 0 A=. 6 | 16 A=1234567890abcdef. 7 | 12 A=567890abcdef. 8 | 8 A=90abcdef. 9 | 4 A=cdef. 10 | 0 A=. 11 | -------------------------------------------------------------------------------- /test/zero2.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | printf "%d\n", -.4 3 | printf "%d\n", -0.0 4 | printf "%d\n", -.9 5 | } 6 | -------------------------------------------------------------------------------- /test/zero2.ok: -------------------------------------------------------------------------------- 1 | 0 2 | 0 3 | 0 4 | -------------------------------------------------------------------------------- /test/zeroe0.ok: -------------------------------------------------------------------------------- 1 | 00E0, 1, 1 2 | 00E0, 1, 1 3 | -------------------------------------------------------------------------------- /test/zeroflag.awk: -------------------------------------------------------------------------------- 1 | BEGIN { printf("%2.1d---%02.1d\n", 2, 2) } 2 | -------------------------------------------------------------------------------- /test/zeroflag.ok: -------------------------------------------------------------------------------- 1 | 2--- 2 2 | -------------------------------------------------------------------------------- /version.c: -------------------------------------------------------------------------------- 1 | #include "config.h" 2 | 3 | const char *version_string = "GNU Awk 4.0.70"; 4 | -------------------------------------------------------------------------------- /version.in: -------------------------------------------------------------------------------- 1 | #include "config.h" 2 | 3 | const char *version_string = "@PACKAGE_STRING@"; 4 | -------------------------------------------------------------------------------- /vms/fcntl.h: -------------------------------------------------------------------------------- 1 | /* "fcntl.h" -- constants for BSD-style I/O routines (ala VAX C's ) */ 2 | #define O_RDONLY 0 3 | #define O_WRONLY 1 4 | #define O_RDWR 2 5 | #define O_NDELAY 4 6 | #define O_NOWAIT 4 7 | #define O_APPEND 8 8 | #define O_CREAT 0x0200 9 | #define O_TRUNC 0x0400 10 | #define O_EXCL 0x0800 11 | --------------------------------------------------------------------------------