From nobody Wed Mar 25 00:42:11 2026 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4fgSm40xP3z6WS29 for ; Wed, 25 Mar 2026 00:42:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R12" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4fgSm36rmhz3MCn for ; Wed, 25 Mar 2026 00:42:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1774399331; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=KD6H3cf6X8+2NlGtezJJjfUKhiPuiWvyVdb07NKi8Ic=; b=o5S1MgmTbaxJlbZ3XkLdZXGres/aKcTQf+MYghPEkxS2rCn5Cu9jn51XdbWyIse2TpHGjr B6pfm+ZhSrBhDAfPkn5RJnedu6GWItZaoNHavqjx+jLsNVk0C/AKMdZ9a+3N91gOCUKnK0 LDVJGl2MgKVavw5Sp0kB4hLfasByvM1fMitFP/1Npsa49iP2z/hgAgxfTqwpKnzlvUnL7f 0FHaQOLPz3km8CHbegrumKcWHu99ns+znuennBbGdE1wIRRC2v0h3OxTYMn9Xyk9UCMiZO VMB+boUHOF+XWuvKqKm3P0RzSMIOlFgaSDKOxIu/nnr4G4sHH0cXxeE+hfRp2g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1774399331; a=rsa-sha256; cv=none; b=pe6obfS6U13pw0VGj4IEHAJ4IXA/upGvOOcUv8/HALxntOXE0MG3mUKIDlv1wYc7Joru6g Bz5gaYPuTqJ1Mg8xGjIqgyKLHQ6StfEJkc1fn+JP7BPQFvULrYJPRWiHLr8B1aDGgeuM21 qz0KGD+kHsaXaQn1TkAGvN8khilVRjIH0w8EqjDsvcgzbAJNyfxL6r+tTv6TgL3bGz9Wc6 9iCXCu5eBjw/aishrkti27Nwy4u8nRL+i3LTYWvDC041GWSOLUvMjehFauK9JZ/He+SncZ Elr1CG3kMRJOIpskUeUhkNuun1+3jocwKhFYPtYsmu8K4w4+8aNQq+mJZORf0w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1774399331; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=KD6H3cf6X8+2NlGtezJJjfUKhiPuiWvyVdb07NKi8Ic=; b=YfkRUi30K1SQcrs7+U3ERPGt6HUyeBlHrVKKu5BBXsdqkD9Xgct6zRgF1zRQ6NxBDk6TBB zCureLxVAb9NDej5yq7o1i5nZ9gVAEv4KNvQPL0wRi90nIhWmUauV/h30M+W7/hjAkc4jI frJ20cM1y6vtVXgGvnUVHk2NZN6VgH1hOtWt+m6dIrCVWBru80sDEoTQ3VLR3RwBYx1ioT BH+/Rvw0c0jKh4g+YmrcQ2GAjzGinxwNx9NzBcigNdgLXVO3CJaiJMkr9d1modjlGm8vZh Q3RzVAj9Uf/StejaSFknzpZ0o2xbWEXJkDyz8W07okD0Kp+p4YB01MSEDUO6Zw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4fgSm36DMkzjf3 for ; Wed, 25 Mar 2026 00:42:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3cd1e by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 25 Mar 2026 00:42:11 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Marc Espie From: Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav Subject: git: f8f6f1cbd576 - main - m4: Stop abbreviating builtin names List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f8f6f1cbd576ab5f15cef178cc05251365652f74 Auto-Submitted: auto-generated Date: Wed, 25 Mar 2026 00:42:11 +0000 Message-Id: <69c32f63.3cd1e.363f5d44@gitrepo.freebsd.org> The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=f8f6f1cbd576ab5f15cef178cc05251365652f74 commit f8f6f1cbd576ab5f15cef178cc05251365652f74 Author: Marc Espie AuthorDate: 2026-03-25 00:41:18 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2026-03-25 00:41:18 +0000 m4: Stop abbreviating builtin names * Stop abbreviating macro names half-randomly to 8 chars, this is no longer 1990. * Likewise for function names (in particular use doindex for a function that is notably different from the classic index function). * Rename a few things for more fidelity: eval is the builtin name, not expr and your maketemp/mkstemp conform to mkstemp semantics for better security. * Rewrap a few comments that were ludicrously short. No functional changes except improved accuracy of some error messages. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D55793 --- usr.bin/m4/eval.c | 184 ++++++++++++++++++++++++---------------------------- usr.bin/m4/extern.h | 2 +- usr.bin/m4/look.c | 6 +- usr.bin/m4/main.c | 65 ++++++++++--------- usr.bin/m4/mdef.h | 88 ++++++++++++------------- usr.bin/m4/misc.c | 2 +- 6 files changed, 168 insertions(+), 179 deletions(-) diff --git a/usr.bin/m4/eval.c b/usr.bin/m4/eval.c index 0963a61a2914..71be6f305dee 100644 --- a/usr.bin/m4/eval.c +++ b/usr.bin/m4/eval.c @@ -60,17 +60,17 @@ static void dodefn(const char *); static void dopushdef(const char *, const char *); -static void dodump(const char *[], int); +static void dodumpdef(const char *[], int); static void dotrace(const char *[], int, int); static void doifelse(const char *[], int); -static int doincl(const char *); +static int doinclude(const char *); static int dopaste(const char *); -static void dochq(const char *[], int); -static void dochc(const char *[], int); +static void dochangequote(const char *[], int); +static void dochangecom(const char *[], int); static void dom4wrap(const char *); -static void dodiv(int); -static void doundiv(const char *[], int); -static void dosub(const char *[], int); +static void dodivert(int); +static void doundivert(const char *[], int); +static void dosubstr(const char *[], int); static void map(char *, const char *, const char *, const char *); static const char *handledash(char *, char *, const char *); static void expand_builtin(const char *[], int, int); @@ -108,7 +108,7 @@ eval(const char *argv[], int argc, int td, int is_traced) m4errx(1, "expanding recursive definition for %s.", argv[1]); if (is_traced) mark = trace(argv, argc, infile+ilevel); - if (td == MACRTYPE) + if (td == MACROTYPE) expand_macro(argv, argc); else expand_builtin(argv, argc, td); @@ -149,18 +149,18 @@ expand_builtin(const char *argv[], int argc, int td) switch (td & TYPEMASK) { - case DEFITYPE: + case DEFINETYPE: if (argc > 2) dodefine(argv[2], (argc > 3) ? argv[3] : null); break; - case PUSDTYPE: + case PUSHDEFTYPE: if (argc > 2) dopushdef(argv[2], (argc > 3) ? argv[3] : null); break; - case DUMPTYPE: - dodump(argv, argc); + case DUMPDEFTYPE: + dodumpdef(argv, argc); break; case TRACEONTYPE: @@ -171,10 +171,9 @@ expand_builtin(const char *argv[], int argc, int td) dotrace(argv, argc, 0); break; - case EXPRTYPE: + case EVALTYPE: /* - * doexpr - evaluate arithmetic - * expression + * doeval - evaluate arithmetic expression */ { int base = 10; @@ -184,14 +183,14 @@ expand_builtin(const char *argv[], int argc, int td) if (argc > 3 && *argv[3] != '\0') { base = strtonum(argv[3], 2, 36, &errstr); if (errstr) { - m4errx(1, "expr: base is %s: %s.", + m4errx(1, "eval: base is %s: %s.", errstr, argv[3]); } } if (argc > 4) { mindigits = strtonum(argv[4], 0, INT_MAX, &errstr); if (errstr) { - m4errx(1, "expr: mindigits is %s: %s.", + m4errx(1, "eval: mindigits is %s: %s.", errstr, argv[4]); } } @@ -200,15 +199,14 @@ expand_builtin(const char *argv[], int argc, int td) break; } - case IFELTYPE: + case IFELSETYPE: doifelse(argv, argc); break; - case IFDFTYPE: + case IFDEFTYPE: /* - * doifdef - select one of two - * alternatives based on the existence of - * another definition + * doifdef - select one of two alternatives based + * on the existence of another definition */ if (argc > 3) { if (lookup_macro_definition(argv[2]) != NULL) @@ -218,18 +216,16 @@ expand_builtin(const char *argv[], int argc, int td) } break; - case LENGTYPE: + case LENTYPE: /* - * dolen - find the length of the - * argument + * dolen - find the length of the argument */ pbnum((argc > 2) ? strlen(argv[2]) : 0); break; case INCRTYPE: /* - * doincr - increment the value of the - * argument + * doincr - increment the value of the argument */ if (argc > 2) { n = strtonum(argv[2], INT_MIN, INT_MAX-1, &errstr); @@ -242,8 +238,7 @@ expand_builtin(const char *argv[], int argc, int td) case DECRTYPE: /* - * dodecr - decrement the value of the - * argument + * dodecr - decrement the value of the argument */ if (argc > 2) { n = strtonum(argv[2], INT_MIN+1, INT_MAX, &errstr); @@ -254,9 +249,9 @@ expand_builtin(const char *argv[], int argc, int td) } break; - case SYSCTYPE: + case SYSCMDTYPE: /* - * dosys - execute system command + * dosyscmd - execute system command */ if (argc > 2) { fflush(stdout); @@ -264,10 +259,9 @@ expand_builtin(const char *argv[], int argc, int td) } break; - case SYSVTYPE: + case SYSVALTYPE: /* - * dosysval - return value of the last - * system call. + * dosysval - return value of the last system call. * */ pbnum(sysval); @@ -277,9 +271,9 @@ expand_builtin(const char *argv[], int argc, int td) if (argc > 2) doesyscmd(argv[2]); break; - case INCLTYPE: + case INCLUDETYPE: if (argc > 2) { - if (!doincl(argv[2])) { + if (!doinclude(argv[2])) { if (mimic_gnu) { warn("%s at line %lu: include(%s)", CURRENT_NAME, CURRENT_LINE, argv[2]); @@ -295,19 +289,20 @@ expand_builtin(const char *argv[], int argc, int td) } break; - case SINCTYPE: + case SINCLUDETYPE: + /* like include, but don't error out if file not found */ if (argc > 2) - (void) doincl(argv[2]); + (void) doinclude(argv[2]); break; #ifdef EXTENDED - case PASTTYPE: + case PASTETYPE: if (argc > 2) if (!dopaste(argv[2])) err(1, "%s at line %lu: paste(%s)", CURRENT_NAME, CURRENT_LINE, argv[2]); break; - case SPASTYPE: + case SPASTETYPE: if (argc > 2) (void) dopaste(argv[2]); break; @@ -315,28 +310,27 @@ expand_builtin(const char *argv[], int argc, int td) doformat(argv, argc); break; #endif - case CHNQTYPE: - dochq(argv, ac); + case CHANGEQUOTETYPE: + dochangequote(argv, ac); break; - case CHNCTYPE: - dochc(argv, argc); + case CHANGECOMTYPE: + dochangecom(argv, argc); break; - case SUBSTYPE: + case SUBSTRTYPE: /* - * dosub - select substring + * dosubstr - select substring * */ if (argc > 3) - dosub(argv, argc); + dosubstr(argv, argc); break; - case SHIFTYPE: + case SHIFTTYPE: /* - * doshift - push back all arguments - * except the first one (i.e. skip - * argv[2]) + * doshift - push back all arguments except the first one + * (i.e. skip argv[2]) */ if (argc > 3) { for (n = argc - 1; n > 3; n--) { @@ -351,14 +345,14 @@ expand_builtin(const char *argv[], int argc, int td) } break; - case DIVRTYPE: + case DIVERTTYPE: if (argc > 2) { n = strtonum(argv[2], INT_MIN, INT_MAX, &errstr); if (errstr) m4errx(1, "divert: argument is %s: %s.", errstr, argv[2]); if (n != 0) { - dodiv(n); + dodivert(n); break; } } @@ -366,42 +360,40 @@ expand_builtin(const char *argv[], int argc, int td) oindex = 0; break; - case UNDVTYPE: - doundiv(argv, argc); + case UNDIVERTTYPE: + doundivert(argv, argc); break; - case DIVNTYPE: + case DIVNUMTYPE: /* - * dodivnum - return the number of - * current output diversion + * dodivnum - return the number of current output diversion */ pbnum(oindex); break; - case UNDFTYPE: + case UNDEFINETYPE: /* - * doundefine - undefine a previously - * defined macro(s) or m4 keyword(s). + * doundefine - undefine a previously defined macro(s) or m4 + * keyword(s). */ if (argc > 2) for (n = 2; n < argc; n++) macro_undefine(argv[n]); break; - case POPDTYPE: + case POPDEFTYPE: /* - * dopopdef - remove the topmost - * definitions of macro(s) or m4 - * keyword(s). + * dopopdef - remove the topmost definitions of macro(s) + * or m4 keyword(s). */ if (argc > 2) for (n = 2; n < argc; n++) macro_popdef(argv[n]); break; - case MKTMTYPE: + case MKSTEMPTYPE: /* - * dotemp - create a temporary file + * domkstemp - safely create a temporary file */ if (argc > 2) { int fd; @@ -420,11 +412,10 @@ expand_builtin(const char *argv[], int argc, int td) } break; - case TRNLTYPE: + case TRANSLITTYPE: /* - * dotranslit - replace all characters in - * the source string that appears in the - * "from" string with the corresponding + * dotranslit - replace all characters in the source string + * that appear in the "from" string with the corresponding * characters in the "to" string. */ if (argc > 3) { @@ -441,19 +432,17 @@ expand_builtin(const char *argv[], int argc, int td) pbstr(argv[2]); break; - case INDXTYPE: + case INDEXTYPE: /* - * doindex - find the index of the second - * argument string in the first argument - * string. -1 if not present. + * doindex - find the index of the second argument string + * in the first argument string. -1 if not present. */ - pbnum((argc > 3) ? indx(argv[2], argv[3]) : -1); + pbnum((argc > 3) ? doindex(argv[2], argv[3]) : -1); break; - case ERRPTYPE: + case ERRPRINTTYPE: /* - * doerrp - print the arguments to stderr - * file + * doerrprint - print the arguments to stderr */ if (argc > 2) { for (n = 2; n < argc; n++) @@ -462,16 +451,15 @@ expand_builtin(const char *argv[], int argc, int td) } break; - case DNLNTYPE: + case DNLTYPE: /* - * dodnl - eat-up-to and including - * newline + * dodnl - eat-up-to and including newline */ while ((c = gpbc()) != '\n' && c != EOF) ; break; - case M4WRTYPE: + case M4WRAPTYPE: /* * dom4wrap - set up for * wrap-up/wind-down activity @@ -480,9 +468,9 @@ expand_builtin(const char *argv[], int argc, int td) dom4wrap(argv[2]); break; - case EXITTYPE: + case M4EXITTYPE: /* - * doexit - immediate exit from m4. + * dom4exit - immediate exit from m4. */ killdiv(); exit((argc > 2) ? atoi(argv[2]) : 0); @@ -504,7 +492,7 @@ expand_builtin(const char *argv[], int argc, int td) dobuiltin(argv, argc); break; - case PATSTYPE: + case PATSUBSTTYPE: if (argc > 2) dopatsubst(argv, argc); break; @@ -625,7 +613,7 @@ dodefn(const char *name) struct macro_definition *p; if ((p = lookup_macro_definition(name)) != NULL) { - if ((p->type & TYPEMASK) == MACRTYPE) { + if ((p->type & TYPEMASK) == MACROTYPE) { pbstr(rquote); pbstr(p->defn); pbstr(lquote); @@ -661,7 +649,7 @@ dump_one_def(const char *name, struct macro_definition *p) if (!traceout) traceout = stderr; if (mimic_gnu) { - if ((p->type & TYPEMASK) == MACRTYPE) + if ((p->type & TYPEMASK) == MACROTYPE) fprintf(traceout, "%s:\t%s\n", name, p->defn); else { fprintf(traceout, "%s:\t<%s>\n", name, p->defn); @@ -676,7 +664,7 @@ dump_one_def(const char *name, struct macro_definition *p) * hash table is dumped. */ static void -dodump(const char *argv[], int argc) +dodumpdef(const char *argv[], int argc) { int n; struct macro_definition *p; @@ -728,7 +716,7 @@ doifelse(const char *argv[], int argc) * doinclude - include a given file. */ static int -doincl(const char *ifile) +doinclude(const char *ifile) { if (ilevel + 1 == MAXINP) m4errx(1, "too many include files."); @@ -765,10 +753,10 @@ dopaste(const char *pfile) #endif /* - * dochq - change quote characters + * dochangequote - change quote characters */ static void -dochq(const char *argv[], int ac) +dochangequote(const char *argv[], int ac) { if (ac == 2) { lquote[0] = LQUOTE; lquote[1] = EOS; @@ -784,10 +772,10 @@ dochq(const char *argv[], int ac) } /* - * dochc - change comment characters + * dochangecom - change comment characters */ static void -dochc(const char *argv[], int argc) +dochangecom(const char *argv[], int argc) { /* XXX Note that there is no difference between no argument and a single * empty argument. @@ -826,7 +814,7 @@ dom4wrap(const char *text) * dodivert - divert the output to a temporary file */ static void -dodiv(int n) +dodivert(int n) { int fd; @@ -856,7 +844,7 @@ dodiv(int n) * other outputs, in numerical order. */ static void -doundiv(const char *argv[], int argc) +doundivert(const char *argv[], int argc) { int ind; int n; @@ -881,10 +869,10 @@ doundiv(const char *argv[], int argc) } /* - * dosub - select substring + * dosubstr - select substring */ static void -dosub(const char *argv[], int argc) +dosubstr(const char *argv[], int argc) { const char *ap, *fc, *k; int nc; diff --git a/usr.bin/m4/extern.h b/usr.bin/m4/extern.h index 94eb66314bf4..a411cb6d5891 100644 --- a/usr.bin/m4/extern.h +++ b/usr.bin/m4/extern.h @@ -95,7 +95,7 @@ extern int exit_code; extern void chrsave(int); extern char *compute_prevep(void); extern void getdiv(int); -extern ptrdiff_t indx(const char *, const char *); +extern ptrdiff_t doindex(const char *, const char *); extern void initspaces(void); extern void killdiv(void); extern void onintr(int); diff --git a/usr.bin/m4/look.c b/usr.bin/m4/look.c index d7ad94b18bd0..a7e6d87b0494 100644 --- a/usr.bin/m4/look.c +++ b/usr.bin/m4/look.c @@ -127,7 +127,7 @@ setup_definition(struct macro_definition *d, const char *defn, const char *name) d->defn = __DECONST(char *, null); else d->defn = xstrdup(defn); - d->type = MACRTYPE; + d->type = MACROTYPE; } if (STREQ(name, defn)) d->type |= RECDEF; @@ -146,7 +146,7 @@ create_entry(const char *name) n = ohash_create_entry(¯o_info, name, &end); ohash_insert(¯os, i, n); n->trace_flags = FLAG_NO_TRACE; - n->builtin_type = MACRTYPE; + n->builtin_type = MACROTYPE; n->d = NULL; } return n; @@ -271,7 +271,7 @@ macro_getbuiltin(const char *name) ndptr p; p = lookup(name); - if (p == NULL || p->builtin_type == MACRTYPE) + if (p == NULL || p->builtin_type == MACROTYPE) return NULL; else return p; diff --git a/usr.bin/m4/main.c b/usr.bin/m4/main.c index d68069cb10a8..6e4e79b2a414 100644 --- a/usr.bin/m4/main.c +++ b/usr.bin/m4/main.c @@ -105,53 +105,54 @@ struct keyblk { }; static struct keyblk keywrds[] = { /* m4 keywords to be installed */ - { "include", INCLTYPE }, - { "sinclude", SINCTYPE }, - { "define", DEFITYPE }, + { "include", INCLUDETYPE }, + { "sinclude", SINCLUDETYPE }, + { "define", DEFINETYPE }, { "defn", DEFNTYPE }, - { "divert", DIVRTYPE | NOARGS }, - { "expr", EXPRTYPE }, - { "eval", EXPRTYPE }, - { "substr", SUBSTYPE }, - { "ifelse", IFELTYPE }, - { "ifdef", IFDFTYPE }, - { "len", LENGTYPE }, + { "divert", DIVERTTYPE | NOARGS }, + { "eval", EVALTYPE }, + { "expr", EVALTYPE }, + { "substr", SUBSTRTYPE }, + { "ifelse", IFELSETYPE }, + { "ifdef", IFDEFTYPE }, + { "len", LENTYPE }, { "incr", INCRTYPE }, { "decr", DECRTYPE }, - { "dnl", DNLNTYPE | NOARGS }, - { "changequote", CHNQTYPE | NOARGS }, - { "changecom", CHNCTYPE | NOARGS }, - { "index", INDXTYPE }, + { "dnl", DNLTYPE | NOARGS }, + { "changequote", CHANGEQUOTETYPE | NOARGS }, + { "changecom", CHANGECOMTYPE | NOARGS }, + { "index", INDEXTYPE }, #ifdef EXTENDED - { "paste", PASTTYPE }, - { "spaste", SPASTYPE }, + { "paste", PASTETYPE }, + { "spaste", SPASTETYPE }, /* Newer extensions, needed to handle gnu-m4 scripts */ { "indir", INDIRTYPE}, { "builtin", BUILTINTYPE}, - { "patsubst", PATSTYPE}, + { "patsubst", PATSUBSTTYPE}, { "regexp", REGEXPTYPE}, { "esyscmd", ESYSCMDTYPE}, { "__file__", FILENAMETYPE | NOARGS}, { "__line__", LINETYPE | NOARGS}, #endif - { "popdef", POPDTYPE }, - { "pushdef", PUSDTYPE }, - { "dumpdef", DUMPTYPE | NOARGS }, - { "shift", SHIFTYPE | NOARGS }, - { "translit", TRNLTYPE }, - { "undefine", UNDFTYPE }, - { "undivert", UNDVTYPE | NOARGS }, - { "divnum", DIVNTYPE | NOARGS }, - { "maketemp", MKTMTYPE }, - { "mkstemp", MKTMTYPE }, - { "errprint", ERRPTYPE | NOARGS }, - { "m4wrap", M4WRTYPE | NOARGS }, - { "m4exit", EXITTYPE | NOARGS }, - { "syscmd", SYSCTYPE }, - { "sysval", SYSVTYPE | NOARGS }, + { "popdef", POPDEFTYPE }, + { "pushdef", PUSHDEFTYPE }, + { "dumpdef", DUMPDEFTYPE | NOARGS }, + { "shift", SHIFTTYPE | NOARGS }, + { "translit", TRANSLITTYPE }, + { "undefine", UNDEFINETYPE }, + { "undivert", UNDIVERTTYPE | NOARGS }, + { "divnum", DIVNUMTYPE | NOARGS }, + { "maketemp", MKSTEMPTYPE }, + { "mkstemp", MKSTEMPTYPE }, + { "errprint", ERRPRINTTYPE | NOARGS }, + { "m4wrap", M4WRAPTYPE | NOARGS }, + { "m4exit", M4EXITTYPE | NOARGS }, + { "syscmd", SYSCMDTYPE }, + { "sysval", SYSVALTYPE | NOARGS }, { "traceon", TRACEONTYPE | NOARGS }, { "traceoff", TRACEOFFTYPE | NOARGS }, +/* Macro that expands to itself, signature of the current OS */ { "unix", SELFTYPE | NOARGS }, }; diff --git a/usr.bin/m4/mdef.h b/usr.bin/m4/mdef.h index d4fa5b0e0c14..a932315e8f2e 100644 --- a/usr.bin/m4/mdef.h +++ b/usr.bin/m4/mdef.h @@ -41,50 +41,50 @@ # define UNUSED #endif -#define MACRTYPE 1 -#define DEFITYPE 2 -#define EXPRTYPE 3 -#define SUBSTYPE 4 -#define IFELTYPE 5 -#define LENGTYPE 6 -#define CHNQTYPE 7 -#define SYSCTYPE 8 -#define UNDFTYPE 9 -#define INCLTYPE 10 -#define SINCTYPE 11 -#define PASTTYPE 12 -#define SPASTYPE 13 -#define INCRTYPE 14 -#define IFDFTYPE 15 -#define PUSDTYPE 16 -#define POPDTYPE 17 -#define SHIFTYPE 18 -#define DECRTYPE 19 -#define DIVRTYPE 20 -#define UNDVTYPE 21 -#define DIVNTYPE 22 -#define MKTMTYPE 23 -#define ERRPTYPE 24 -#define M4WRTYPE 25 -#define TRNLTYPE 26 -#define DNLNTYPE 27 -#define DUMPTYPE 28 -#define CHNCTYPE 29 -#define INDXTYPE 30 -#define SYSVTYPE 31 -#define EXITTYPE 32 -#define DEFNTYPE 33 -#define SELFTYPE 34 -#define INDIRTYPE 35 -#define BUILTINTYPE 36 -#define PATSTYPE 37 -#define FILENAMETYPE 38 -#define LINETYPE 39 -#define REGEXPTYPE 40 -#define ESYSCMDTYPE 41 -#define TRACEONTYPE 42 -#define TRACEOFFTYPE 43 -#define FORMATTYPE 44 +#define MACROTYPE 1 +#define DEFINETYPE 2 +#define EVALTYPE 3 +#define SUBSTRTYPE 4 +#define IFELSETYPE 5 +#define LENTYPE 6 +#define CHANGEQUOTETYPE 7 +#define SYSCMDTYPE 8 +#define UNDEFINETYPE 9 +#define INCLUDETYPE 10 +#define SINCLUDETYPE 11 +#define PASTETYPE 12 +#define SPASTETYPE 13 +#define INCRTYPE 14 +#define IFDEFTYPE 15 +#define PUSHDEFTYPE 16 +#define POPDEFTYPE 17 +#define SHIFTTYPE 18 +#define DECRTYPE 19 +#define DIVERTTYPE 20 +#define UNDIVERTTYPE 21 +#define DIVNUMTYPE 22 +#define MKSTEMPTYPE 23 +#define ERRPRINTTYPE 24 +#define M4WRAPTYPE 25 +#define TRANSLITTYPE 26 +#define DNLTYPE 27 +#define DUMPDEFTYPE 28 +#define CHANGECOMTYPE 29 +#define INDEXTYPE 30 +#define SYSVALTYPE 31 +#define M4EXITTYPE 32 +#define DEFNTYPE 33 +#define SELFTYPE 34 +#define INDIRTYPE 35 +#define BUILTINTYPE 36 +#define PATSUBSTTYPE 37 +#define FILENAMETYPE 38 +#define LINETYPE 39 +#define REGEXPTYPE 40 +#define ESYSCMDTYPE 41 +#define TRACEONTYPE 42 +#define TRACEOFFTYPE 43 +#define FORMATTYPE 44 #define BUILTIN_MARKER "__builtin_" diff --git a/usr.bin/m4/misc.c b/usr.bin/m4/misc.c index fd72292aeac0..e0a0e6935986 100644 --- a/usr.bin/m4/misc.c +++ b/usr.bin/m4/misc.c @@ -68,7 +68,7 @@ unsigned char *endpbb; /* end of push-back buffer */ * find the index of second str in the first str. */ ptrdiff_t -indx(const char *s1, const char *s2) +doindex(const char *s1, const char *s2) { char *t;