1*065dafacSuwe.\" $NetBSD: m4.1,v 1.31 2020/06/27 19:07:15 uwe Exp $ 2f3efdb75Schristos.\" @(#) $OpenBSD: m4.1,v 1.56 2009/10/14 17:19:47 sthen Exp $ 34b087712Stv.\" 4f3efdb75Schristos.\" Copyright (c) 1989, 1993 5f3efdb75Schristos.\" The Regents of the University of California. All rights reserved. 60d66213fSglass.\" 7f3efdb75Schristos.\" This code is derived from software contributed to Berkeley by 8f3efdb75Schristos.\" Ozan Yigit at York University. 9f3efdb75Schristos.\" 10f3efdb75Schristos.\" Redistribution and use in source and binary forms, with or without 11f3efdb75Schristos.\" modification, are permitted provided that the following conditions 12f3efdb75Schristos.\" are met: 13f3efdb75Schristos.\" 1. Redistributions of source code must retain the above copyright 14f3efdb75Schristos.\" notice, this list of conditions and the following disclaimer. 15f3efdb75Schristos.\" 2. Redistributions in binary form must reproduce the above copyright 16f3efdb75Schristos.\" notice, this list of conditions and the following disclaimer in the 17f3efdb75Schristos.\" documentation and/or other materials provided with the distribution. 18f3efdb75Schristos.\" 3. Neither the name of the University nor the names of its contributors 19f3efdb75Schristos.\" may be used to endorse or promote products derived from this software 20f3efdb75Schristos.\" without specific prior written permission. 21f3efdb75Schristos.\" 22f3efdb75Schristos.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 23f3efdb75Schristos.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24f3efdb75Schristos.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25f3efdb75Schristos.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 26f3efdb75Schristos.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27f3efdb75Schristos.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28f3efdb75Schristos.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29f3efdb75Schristos.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30f3efdb75Schristos.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31f3efdb75Schristos.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32f3efdb75Schristos.\" SUCH DAMAGE. 33f3efdb75Schristos.\" 348650439bSuwe.Dd June 25, 2020 35800af334Swiz.Dt M4 1 360d66213fSglass.Os 370d66213fSglass.Sh NAME 380d66213fSglass.Nm m4 390d66213fSglass.Nd macro language processor 400d66213fSglass.Sh SYNOPSIS 41*065dafacSuwe.Nm 42e039a836Swiz.Op Fl EGgiPQsv 430d66213fSglass.Oo 44f3efdb75Schristos.Sm off 45*065dafacSuwe.Fl D Ar name Op Cm = Ar value 46f3efdb75Schristos.Sm on 470d66213fSglass.Oc 484b087712Stv.Op Fl d Ar flags 49bb07b8b1Schristos.Op Fl F Ar filename 50f3efdb75Schristos.Op Fl I Ar dirname 51bb07b8b1Schristos.Op Fl L Ar number 52f3efdb75Schristos.Op Fl o Ar filename 53bb07b8b1Schristos.Op Fl R Ar filename 54f3efdb75Schristos.Op Fl t Ar macro 55f3efdb75Schristos.Op Fl U Ns Ar name 56f3efdb75Schristos.Op Ar 570d66213fSglass.Sh DESCRIPTION 580d66213fSglassThe 59*065dafacSuwe.Nm 600d66213fSglassutility is a macro processor that can be used as a front end to any 610d66213fSglasslanguage (e.g., C, ratfor, fortran, lex, and yacc). 62f3efdb75SchristosIf no input files are given, 63*065dafacSuwe.Nm 64f3efdb75Schristosreads from the standard input, 65f3efdb75Schristosotherwise files specified on the command line are 66f3efdb75Schristosprocessed in the given order. 67*065dafacSuweInput files can be regular files, files in the 68*065dafacSuwe.Nm 69*065dafacSuweinclude paths, or a 70f3efdb75Schristossingle dash 71*065dafacSuwe.Pq Sq Fl , 72f3efdb75Schristosdenoting standard input. 73*065dafacSuwe.Nm 74f3efdb75Schristoswrites 75f3efdb75Schristosthe processed text to the standard output, unless told otherwise. 760d66213fSglass.Pp 77*065dafacSuweMacro calls have the form 78*065dafacSuwe.Fo name 79*065dafacSuwe.Fa argument1\| 80*065dafacSuwe.Bo \" should be Oo/Oc but mandoc chokes on it 81*065dafacSuwe.Fa argument2 82*065dafacSuwe.Fa \&... 83*065dafacSuwe.Fa argumentN\| 84*065dafacSuwe.Bc Ns Fc 850d66213fSglass.Pp 860d66213fSglassThere cannot be any space following the macro name and the open 874b087712Stvparenthesis 88*065dafacSuwe.Ql \&( . 894b087712StvIf the macro name is not followed by an open 9068be8c5dSmikelparenthesis it is processed with no arguments. 910d66213fSglass.Pp 920d66213fSglassMacro names consist of a leading alphabetic or underscore 93*065dafacSuwepossibly followed by alphanumeric or underscore characters, 94*065dafacSuwei.e. valid macro names match the pattern 95*065dafacSuwe.Dq Li [a-zA-Z_][a-zA-Z0-9_]*\| . 960d66213fSglass.Pp 974b087712StvIn arguments to macros, leading unquoted space, tab, and newline 981a75c7b7Swiz.Pq Sq \en 994b087712Stvcharacters are ignored. 100*065dafacSuweTo quote strings, use left and right single quotes, e.g.\& 101*065dafacSuwe.Li "\` this is a string with a leading space\(aq" . 1024b087712StvYou can change the quote characters with the 1034b087712Stv.Ic changequote 1044b087712Stvbuilt-in macro. 1054b087712Stv.Pp 1064b087712StvMost built-ins don't make any sense without arguments, and hence are not 1074b087712Stvrecognized as special when not followed by an open parenthesis. 1080d66213fSglass.Pp 1090d66213fSglassThe options are as follows: 110*065dafacSuwe.Bl -tag -width Fl 111*065dafacSuwe.It Fl D , Fl Fl define Ar name Ns Op Ns Cm = Ns Ar value 1120d66213fSglassDefine the symbol 1130d66213fSglass.Ar name 114*065dafacSuweto have 115*065dafacSuwe.Ar value 116*065dafacSuweor to be a null string. 117bb07b8b1Schristos.It Fl d , Fl Fl debug Ar "flags" 1184b087712StvSet trace flags. 1194b087712Stv.Ar flags 1204b087712Stvmay hold the following: 121*065dafacSuwe.Pp 122*065dafacSuwe.Bl -tag -width ".Li XX" -compact 123*065dafacSuwe.It Cm a 1244b087712Stvprint macro arguments. 125*065dafacSuwe.It Cm c 1264b087712Stvprint macro expansion over several lines. 127*065dafacSuwe.It Cm e 1284b087712Stvprint result of macro expansion. 129*065dafacSuwe.It Cm f 1304b087712Stvprint filename location. 131*065dafacSuwe.It Cm l 1324b087712Stvprint line number. 133*065dafacSuwe.It Cm q 1344b087712Stvquote arguments and expansion with the current quotes. 135*065dafacSuwe.It Cm t 1364b087712Stvstart with all macros traced. 137*065dafacSuwe.It Cm x 1384b087712Stvnumber macro expansions. 139*065dafacSuwe.It Cm V 140*065dafacSuweturn on all trace flags. 1414b087712Stv.El 1424b087712Stv.Pp 1434b087712StvBy default, trace is set to 144*065dafacSuwe.Ql eq . 145e039a836Swiz.It Fl E , Fl Fl fatal-warnings 146bb07b8b1SchristosWarnings make 147bb07b8b1Schristos.Nm 148bb07b8b1Schristosexit. 149e039a836Swiz.It Fl F , Fl Fl freeze-state Ar filename 150bb07b8b1SchristosSave the input state to 151bb07b8b1Schristos.Ar filename . 152e039a836Swiz.It Fl G , Fl Fl traditional 153*065dafacSuweDisable GNU\~m4 extensions. 154bb07b8b1Schristos.It Fl g , Fl Fl gnu 155*065dafacSuweActivate GNU\~m4 compatibility mode. 156*065dafacSuweIn this mode 157*065dafacSuwe.Ic translit 158*065dafacSuwehandles simple character 159*065dafacSuweranges (e.g., 160*065dafacSuwe.Sq Li a-z ) , 161*065dafacSuweregular expressions mimic emacs behavior, 162*065dafacSuwemultiple 163*065dafacSuwe.Ic m4wrap 164*065dafacSuwecalls are handled as a stack, 165f3efdb75Schristosthe number of diversions is unlimited, 166f3efdb75Schristosempty names for macro definitions are allowed, 167*065dafacSuweand 168*065dafacSuwe.Ic eval 169*065dafacSuweunderstands 170*065dafacSuwe.Sq Ic 0r Ns Ar base Ns Cm \&: Ns Ar value 171f3efdb75Schristosnumbers. 172bb07b8b1Schristos.It Fl Fl help 173bb07b8b1SchristosPrint help message and exit. 174bb07b8b1Schristos.It Fl I , Fl Fl include Ar "dirname" 175f3efdb75SchristosAdd directory 176f3efdb75Schristos.Ar dirname 177f3efdb75Schristosto the include path. 178bb07b8b1Schristos.It Fl i , Fl Fl interactive 179bb07b8b1SchristosSet unbuffered output, disable tty signals. 180bb07b8b1Schristos.It Fl L , Fl Fl nesting-limit 181bb07b8b1SchristosSet the nesting limit in macro expansions. 182bb07b8b1SchristosThis is unimplemented and unlimited. 1831fece86bSuwe.It Fl o , Fl Fl error-output Ar filename 184e039a836SwizSend trace output to 185e039a836Swiz.Ar filename . 186bb07b8b1Schristos.It Fl P , Fl Fl prefix-builtins 187f3efdb75SchristosPrefix all built-in macros with 188*065dafacSuwe.Sq Li m4_ . 189f3efdb75SchristosFor example, instead of writing 190f3efdb75Schristos.Ic define , 191f3efdb75Schristosuse 192f3efdb75Schristos.Ic m4_define . 193bb07b8b1Schristos.It Fl Q , Fl Fl quiet , Fl Fl silent 194bb07b8b1SchristosDon't print warnings. 195bb07b8b1Schristos.It Fl R , Fl Fl reload-state Ar filename 196bb07b8b1SchristosReload a previously saved state from 197bb07b8b1Schristos.Ar filename . 198bb07b8b1Schristos.It Fl s , Fl Fl synclines 199f3efdb75SchristosOutput line synchronization directives, suitable for 200f3efdb75Schristos.Xr cpp 1 . 201bb07b8b1Schristos.It Fl t , Fl Fl trace Ar macro 2024b087712StvTurn tracing on for 2034b087712Stv.Ar macro . 204bb07b8b1Schristos.It Fl U , Fl Fl undefine Ar "name" 205f3efdb75SchristosUndefine the symbol 206f3efdb75Schristos.Ar name . 207bb07b8b1Schristos.It Fl v , Fl Fl version 208bb07b8b1SchristosPrint the version and exit. 2090d66213fSglass.El 2100d66213fSglass.Sh SYNTAX 211*065dafacSuwe.Nm 2124b087712Stvprovides the following built-in macros. 2134b087712StvThey may be redefined, losing their original meaning. 2144b087712StvReturn values are null unless otherwise stated. 215f3efdb75Schristos.Bl -tag -width changequote 216f3efdb75Schristos.It Fn builtin name 217f3efdb75SchristosCalls a built-in by its 218f3efdb75Schristos.Fa name , 219f3efdb75Schristosoverriding possible redefinitions. 220f3efdb75Schristos.It Fn changecom startcomment endcomment 221f3efdb75SchristosChanges the start comment and end comment sequences. 222f3efdb75SchristosComment sequences may be up to five characters long. 223f3efdb75SchristosThe default values are the hash sign 2244b087712Stvand the newline character. 225*065dafacSuwe.Pp 226*065dafacSuwe.Dl # This is a comment 227f3efdb75Schristos.Pp 228f3efdb75SchristosWith no arguments, comments are turned off. 229f3efdb75SchristosWith one single argument, the end comment sequence is set 230f3efdb75Schristosto the newline character. 231f3efdb75Schristos.It Fn changequote beginquote endquote 232f3efdb75SchristosDefines the open quote and close quote sequences. 233f3efdb75SchristosQuote sequences may be up to five characters long. 234f3efdb75SchristosThe default values are the backquote character and the quote 235f3efdb75Schristoscharacter. 236*065dafacSuwe.Pp 237*065dafacSuwe.Dl \&\`Here is a quoted string\(aq 238f3efdb75Schristos.Pp 239f3efdb75SchristosWith no arguments, the default quotes are restored. 240f3efdb75SchristosWith one single argument, the close quote sequence is set 241f3efdb75Schristosto the newline character. 242f3efdb75Schristos.It Fn decr arg 243f3efdb75SchristosDecrements the argument 244f3efdb75Schristos.Fa arg 245f3efdb75Schristosby 1. 246f3efdb75SchristosThe argument 247f3efdb75Schristos.Fa arg 248f3efdb75Schristosmust be a valid numeric string. 249f3efdb75Schristos.It Fn define name value 250f3efdb75SchristosDefine a new macro named by the first argument 251f3efdb75Schristos.Fa name 252f3efdb75Schristosto have the 253f3efdb75Schristosvalue of the second argument 254f3efdb75Schristos.Fa value . 2554b087712StvEach occurrence of 256*065dafacSuwe.Sq Li \&$ Ns Ar n 2574b087712Stv(where 2584b087712Stv.Ar n 2594b087712Stvis 0 through 9) is replaced by the 2604b087712Stv.Ar n Ns 'th 2614b087712Stvargument. 262*065dafacSuwe.Sq Li $0 2634b087712Stvis the name of the calling macro. 2644b087712StvUndefined arguments are replaced by a null string. 265*065dafacSuwe.Sq Li $# 2664b087712Stvis replaced by the number of arguments; 267*065dafacSuwe.Sq Li $*\| 2684b087712Stvis replaced by all arguments comma separated; 269*065dafacSuwe.Sq Li $@ 2704b087712Stvis the same as 271*065dafacSuwe.Sq Li $*\| 2724b087712Stvbut all arguments are quoted against further expansion. 273f3efdb75Schristos.It Fn defn name ... 2744b087712StvReturns the quoted definition for each argument. 2754b087712StvThis can be used to rename 2760d66213fSglassmacro definitions (even for built-in macros). 277f3efdb75Schristos.It Fn divert num 2780d66213fSglassThere are 10 output queues (numbered 0-9). 2790d66213fSglassAt the end of processing 280*065dafacSuwe.Nm 2810d66213fSglassconcatenates all the queues in numerical order to produce the 2824b087712Stvfinal output. 2834b087712StvInitially the output queue is 0. 2844b087712StvThe divert 2850d66213fSglassmacro allows you to select a new output queue (an invalid argument 2860d66213fSglasspassed to divert causes output to be discarded). 2874b087712Stv.It Ic divnum 2880d66213fSglassReturns the current output queue number. 2894b087712Stv.It Ic dnl 2900d66213fSglassDiscard input characters up to and including the next newline. 291f3efdb75Schristos.It Fn dumpdef name ... 2920d66213fSglassPrints the names and definitions for the named items, or for everything 2930d66213fSglassif no arguments are passed. 294f3efdb75Schristos.It Fn errprint msg 295*065dafacSuwePrints the first argument on the standard error stream. 296f3efdb75Schristos.It Fn esyscmd cmd 297f3efdb75SchristosPasses its first argument to a shell and returns the shell's standard output. 2984b087712StvNote that the shell shares its standard input and standard error with 299*065dafacSuwe.Nm . 300*065dafacSuwe.It Fn eval expr radix minimum 3010d66213fSglassComputes the first argument as an arithmetic expression using 32-bit 3024b087712Stvarithmetic. 3034b087712StvOperators are the standard C ternary, arithmetic, logical, 3044b087712Stvshift, relational, bitwise, and parentheses operators. 3054b087712StvYou can specify 3064b087712Stvoctal, decimal, and hexadecimal numbers as in C. 307d7b3b5e0SwizThe optional second argument 308d7b3b5e0Swiz.Fa radix 309d7b3b5e0Swizspecifies the radix for the result and the optional third argument 310d7b3b5e0Swiz.Fa minimum 3114b087712Stvspecifies the minimum number of digits in the result. 312f3efdb75Schristos.It Fn expr expr 3134b087712StvThis is an alias for 3144b087712Stv.Ic eval . 315f3efdb75Schristos.It Fn format formatstring arg1 ... 316f3efdb75SchristosReturns 317f3efdb75Schristos.Fa formatstring 318f3efdb75Schristoswith escape sequences substituted with 319f3efdb75Schristos.Fa arg1 320f3efdb75Schristosand following arguments, in a way similar to 321f3efdb75Schristos.Xr printf 3 . 322*065dafacSuweThis built-in is only available in GNU\~m4 compatibility mode, and the only 323f3efdb75Schristosparameters implemented are there for autoconf compatibility: 324f3efdb75Schristosleft-padding flag, an optional field width, a maximum field width, 325*065dafacSuwe.So Li \&*\| Sc Ns -specified 326*065dafacSuwefield widths, and the 327*065dafacSuwe.Ql %s 328*065dafacSuweand 329*065dafacSuwe.Ql %c 330*065dafacSuwedata type. 331f3efdb75Schristos.It Fn ifdef name yes no 3320d66213fSglassIf the macro named by the first argument is defined then return the second 3334b087712Stvargument, otherwise the third. 334*065dafacSuweIf there is no third argument, the value is null. 3354b087712StvThe word 336*065dafacSuwe.Sq Li unix 3374b087712Stvis predefined. 338f3efdb75Schristos.It Fn ifelse a b yes ... 339f3efdb75SchristosIf the first argument 340f3efdb75Schristos.Fa a 341f3efdb75Schristosmatches the second argument 342f3efdb75Schristos.Fa b 343f3efdb75Schristosthen 344f3efdb75Schristos.Fn ifelse 3454b087712Stvreturns 346f3efdb75Schristosthe third argument 347f3efdb75Schristos.Fa yes . 3484b087712StvIf the match fails the three arguments are 3490d66213fSglassdiscarded and the next three arguments are used until there is 350*065dafacSuwezero or one arguments left, either this last argument or null 3514b087712Stvis returned if no other matches were found. 352f3efdb75Schristos.It Fn include name 3530d66213fSglassReturns the contents of the file specified in the first argument. 3544b087712StvIf the file is not found as is, look through the include path: 3554b087712Stvfirst the directories specified with 3564b087712Stv.Fl I 3574b087712Stvon the command line, then the environment variable 3584b087712Stv.Ev M4PATH , 3594b087712Stvas a colon-separated list of directories. 3600d66213fSglassInclude aborts with an error message if the file cannot be included. 361f3efdb75Schristos.It Fn incr arg 3624b087712StvIncrements the argument by 1. 3634b087712StvThe argument must be a valid numeric string. 364f3efdb75Schristos.It Fn index string substring 365*065dafacSuweReturns the index of the second argument in the first argument, e.g., 366*065dafacSuwe.Pp 367*065dafacSuwe.Dl index(the quick brown fox jumped, fox) 368*065dafacSuwe.Pp 369*065dafacSuwereturns 16. 3704b087712StvIf the second 3714b087712Stvargument is not found index returns \-1. 372f3efdb75Schristos.It Fn indir macro arg1 ... 373f3efdb75SchristosIndirectly calls the macro whose name is passed as the first argument, 374*065dafacSuwewith the remaining arguments passed as first, etc arguments. 375f3efdb75Schristos.It Fn len arg 3764b087712StvReturns the number of characters in the first argument. 3774b087712StvExtra arguments 3780d66213fSglassare ignored. 379f3efdb75Schristos.It Fn m4exit code 3800d66213fSglassImmediately exits with the return value specified by the first argument, 3810d66213fSglass0 if none. 382f3efdb75Schristos.It Fn m4wrap todo 3834b087712StvAllows you to define what happens at the final 3844b087712Stv.Dv EOF , 385*065dafacSuweusually for cleanup purposes. 386*065dafacSuweE.g., 387*065dafacSuwe.Pp 388*065dafacSuwe.Dl m4wrap(\`cleanup(tempfile)\(aq) 389*065dafacSuwe.Pp 390*065dafacSuwecauses the macro 391*065dafacSuwe.Ql cleanup 392*065dafacSuweto be invoked after all other processing is done. 393f3efdb75Schristos.Pp 394f3efdb75SchristosMultiple calls to 395f3efdb75Schristos.Fn m4wrap 396f3efdb75Schristosget inserted in sequence at the final 397f3efdb75Schristos.Dv EOF . 398f3efdb75Schristos.It Fn maketemp template 399f3efdb75SchristosInvokes 400f3efdb75Schristos.Xr mkstemp 3 401f3efdb75Schristoson the first argument, and returns the modified string. 4024b087712StvThis can be used to create unique 4030d66213fSglasstemporary file names. 404f3efdb75Schristos.It Fn paste file 4050d66213fSglassIncludes the contents of the file specified by the first argument without 4064b087712Stvany macro processing. 4074b087712StvAborts with an error message if the file cannot be 4080d66213fSglassincluded. 409f3efdb75Schristos.It Fn patsubst string regexp replacement 4104b087712StvSubstitutes a regular expression in a string with a replacement string. 4114b087712StvUsual substitution patterns apply: an ampersand 412*065dafacSuwe.Pq Ql \&& 4134b087712Stvis replaced by the string matching the regular expression. 4144b087712StvThe string 415*065dafacSuwe.Sq Li \&\e Ns Ar \&# , 4164b087712Stvwhere 417*065dafacSuwe.Ar \&# 4184b087712Stvis a digit, is replaced by the corresponding back-reference. 419f3efdb75Schristos.It Fn popdef arg ... 4204b087712StvRestores the 4214b087712Stv.Ic pushdef Ns ed 4224b087712Stvdefinition for each argument. 423*065dafacSuwe.It Fn pushdef name value 4244b087712StvTakes the same arguments as 4254b087712Stv.Ic define , 426*065dafacSuwebut it saves the existing definition on a 4274b087712Stvstack for later retrieval by 428f3efdb75Schristos.Fn popdef . 429f3efdb75Schristos.It Fn regexp string regexp replacement 4304b087712StvFinds a regular expression in a string. 4314b087712StvIf no further arguments are given, 4324b087712Stvit returns the first match position or \-1 if no match. 4334b087712StvIf a third argument 4344b087712Stvis provided, it returns the replacement string, with sub-patterns replaced. 435f3efdb75Schristos.It Fn shift arg1 ... 4360d66213fSglassReturns all but the first argument, the remaining arguments are 4374b087712Stvquoted and pushed back with commas in between. 4384b087712StvThe quoting 4390d66213fSglassnullifies the effect of the extra scan that will subsequently be 4400d66213fSglassperformed. 441f3efdb75Schristos.It Fn sinclude file 4424b087712StvSimilar to 4434b087712Stv.Ic include , 4444b087712Stvexcept it ignores any errors. 445f3efdb75Schristos.It Fn spaste file 4464b087712StvSimilar to 447*065dafacSuwe.Ic paste , 4484b087712Stvexcept it ignores any errors. 449f3efdb75Schristos.It Fn substr string offset length 4500d66213fSglassReturns a substring of the first argument starting at the offset specified 4510d66213fSglassby the second argument and the length specified by the third argument. 4520d66213fSglassIf no third argument is present it returns the rest of the string. 453f3efdb75Schristos.It Fn syscmd cmd 4544b087712StvPasses the first argument to the shell. 4554b087712StvNothing is returned. 4564b087712Stv.It Ic sysval 4574b087712StvReturns the return value from the last 4584b087712Stv.Ic syscmd . 459*065dafacSuwe.It Fn traceon name ... 4604b087712StvEnables tracing of macro expansions for the given arguments, or for all 4614b087712Stvmacros if no argument is given. 462*065dafacSuwe.It Fn traceoff name ... 4634b087712StvDisables tracing of macro expansions for the given arguments, or for all 4644b087712Stvmacros if no argument is given. 465f3efdb75Schristos.It Fn translit string mapfrom mapto 4660d66213fSglassTransliterate the characters in the first argument from the set 4674b087712Stvgiven by the second argument to the set given by the third. 4684b087712StvYou cannot use 4690d66213fSglass.Xr tr 1 4700d66213fSglassstyle abbreviations. 471*065dafacSuwe.It Fn undefine name ... 472f3efdb75SchristosRemoves the definition for the macros specified by its arguments. 473f3efdb75Schristos.It Fn undivert arg ... 4740d66213fSglassFlushes the named output queues (or all queues if no arguments). 4754b087712Stv.It Ic unix 4760d66213fSglassA pre-defined macro for testing the OS platform. 4774b087712Stv.It Ic __file__ 4784b087712StvReturns the current file's name. 479*065dafacSuwe.It Ic __line__ 480*065dafacSuweReturns the current file's line number. 4810d66213fSglass.El 4824b087712Stv.Sh STANDARDS 4834b087712StvThe 4844b087712Stv.Nm 485f3efdb75Schristosutility is compliant with the 486f3efdb75Schristos.St -p1003.1-2008 487f3efdb75Schristosspecification. 4884b087712Stv.Pp 489f3efdb75SchristosThe flags 490*065dafacSuwe.Fl dgIot 491f3efdb75Schristosand the macros 4924b087712Stv.Ic builtin , 493f3efdb75Schristos.Ic esyscmd , 4944b087712Stv.Ic expr , 495f3efdb75Schristos.Ic format , 4964b087712Stv.Ic indir , 4974b087712Stv.Ic paste , 4984b087712Stv.Ic patsubst , 4994b087712Stv.Ic regexp , 5004b087712Stv.Ic spaste , 5014b087712Stv.Ic unix , 502*065dafacSuwe.Ic __file__ , 503f3efdb75Schristosand 504*065dafacSuwe.Ic __line__ 505f3efdb75Schristosare extensions to that specification. 5064b087712Stv.Pp 507f3efdb75SchristosThe output format of tracing and of 508f3efdb75Schristos.Ic dumpdef 509f3efdb75Schristosare not specified in any standard, 510f3efdb75Schristosare likely to change and should not be relied upon. 511f3efdb75SchristosThe current format of tracing is closely modelled on 512*065dafacSuweGNU\~m4, 513f3efdb75Schristosto allow 514f3efdb75Schristos.Nm autoconf 515f3efdb75Schristosto work. 516f3efdb75Schristos.Pp 517f3efdb75SchristosThe built-ins 518f3efdb75Schristos.Ic pushdef 519f3efdb75Schristosand 520f3efdb75Schristos.Ic popdef 521f3efdb75Schristoshandle macro definitions as a stack. 522f3efdb75SchristosHowever, 523f3efdb75Schristos.Ic define 524f3efdb75Schristosinteracts with the stack in an undefined way. 525f3efdb75SchristosIn this implementation, 526f3efdb75Schristos.Ic define 527f3efdb75Schristosreplaces the top-most definition only. 528f3efdb75SchristosOther implementations may erase all definitions on the stack instead. 529f3efdb75Schristos.Pp 530f3efdb75SchristosAll built-ins do expand without arguments in many other 531*065dafacSuwe.Nm . 532f3efdb75Schristos.Pp 533f3efdb75SchristosMany other 534f3efdb75Schristos.Nm 535f3efdb75Schristoshave dire size limitations with respect to buffer sizes. 536800af334Swiz.Sh AUTHORS 537f3efdb75Schristos.An -nosplit 538fb06f38bSwiz.An Ozan Yigit Aq Mt oz@sis.yorku.ca 539f3efdb75Schristosand 540fb06f38bSwiz.An Richard A. O'Keefe Aq Mt ok@goanna.cs.rmit.OZ.AU . 541f3efdb75Schristos.Pp 542*065dafacSuweGNU\~m4 compatibility extensions by 543fb06f38bSwiz.An Marc Espie Aq Mt espie@cvs.openbsd.org . 544