From patchwork Fri May 6 19:34:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?0L3QsNCx?= X-Patchwork-Id: 12841554 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6131C433EF for ; Fri, 6 May 2022 19:34:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352000AbiEFTiY (ORCPT ); Fri, 6 May 2022 15:38:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343640AbiEFTiX (ORCPT ); Fri, 6 May 2022 15:38:23 -0400 Received: from tarta.nabijaczleweli.xyz (unknown [139.28.40.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A4B8033E07 for ; Fri, 6 May 2022 12:34:38 -0700 (PDT) Received: from tarta.nabijaczleweli.xyz (unknown [192.168.1.250]) by tarta.nabijaczleweli.xyz (Postfix) with ESMTPSA id 12AFC117C for ; Fri, 6 May 2022 21:34:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nabijaczleweli.xyz; s=202006; t=1651865676; bh=Y692ralpRkhMkTBayN6EQoTdFE9+6yQkqZ2evL54XFI=; h=Date:From:To:Subject:From; b=pNf21cNH5ccV74NBBYuQt3TN6PpfiI6REtQQvwbEDdE0rZu77f7utZIh6IDPzhTDG q3ZZvgrEqh4U1TTPki1M//y2wraEya2xl1k/9wJF5yPFn6mOHVCOh0CmUmVLI9SKEJ JCfrW7cJ6xNw/j1oKyMaTMRtQ1ESjBXGS4AnLbNVl/LgveYEJA0rp/q4p6o83kJOcD AC+dc34QJNpRTmzXFiqV8xuuIpfLeKfVA4htlbKf+LyetlhFc/+mnlX+g/U4y+CPTd hwabHSmoR51hRR4+e87r19tI0EXNWMSSXqwCljmiuBZ+AadgQTWS63Z03gnUcuKm4a YggrQGgZBBO6w== Date: Fri, 6 May 2022 21:34:34 +0200 From: =?utf-8?b?0L3QsNCx?= To: dash@vger.kernel.org Subject: [PATCH] man: don't list unavailable built-ins and Command Line Editing section Message-ID: <20220506193434.sza4mvudzuytauoj@tarta.nabijaczleweli.xyz> MIME-Version: 1.0 Content-Disposition: inline User-Agent: NeoMutt/20220429 Precedence: bulk List-ID: X-Mailing-List: dash@vger.kernel.org Signed-off-by: Ahelenia ZiemiaƄska --- I went for a complete removal of the Command Line Editing sexion, but it's possible doing something like "unavailable, configure with --with-libedit" is better? Please keep me in CC, as I'm not subscribed. src/.gitignore | 2 ++ src/Makefile.am | 9 ++++++--- src/{dash.1 => dash.1.in} | 6 ++++++ src/mkbuiltins | 5 ++++- 4 files changed, 18 insertions(+), 4 deletions(-) rename src/{dash.1 => dash.1.in} (99%) mode change 100644 => 100755 src/mkbuiltins diff --git a/src/.gitignore b/src/.gitignore index 644eccb..66cdfff 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -1,6 +1,7 @@ *.o builtins.[ch] builtins.def +builtins.roff dash init.c mkinit @@ -11,3 +12,4 @@ nodes.[ch] signames.c syntax.[ch] token.h +dash.1 diff --git a/src/Makefile.am b/src/Makefile.am index 1732465..3c0d4da 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -35,7 +35,7 @@ HELPERS = mkinit mksyntax mknodes mksignames BUILT_SOURCES = builtins.h nodes.h syntax.h token.h token_vars.h CLEANFILES = \ $(BUILT_SOURCES) $(patsubst %.o,%.c,$(dash_LDADD)) \ - $(HELPERS) builtins.def + $(HELPERS) builtins.def builtins.roff dash.1 man_MANS = dash.1 EXTRA_DIST = \ @@ -49,8 +49,8 @@ token.h token_vars.h: mktokens builtins.def: builtins.def.in $(top_builddir)/config.h $(AM_V_CC)$(COMPILE) -E -x c -o $@ $< -builtins.c builtins.h: mkbuiltins builtins.def - $(AM_V_GEN)$(SHELL) $^ +builtins.c builtins.roff builtins.h: mkbuiltins builtins.def + $(AM_V_GEN)./$^ init.c: mkinit $(dash_CFILES) $(AM_V_GEN)./$^ @@ -66,5 +66,8 @@ signames.c: mksignames mksyntax: token.h +dash.1: dash.1.in builtins.roff + $(AM_V_GEN)$(AWK) '{print} /^\.Ss Builtins$$/ {while((getline < "builtins.roff") > 0) print}' $< > $@ + $(HELPERS): %: %.c $(AM_V_CC)$(COMPILE_FOR_BUILD) -o $@ $< diff --git a/src/dash.1 b/src/dash.1.in similarity index 99% rename from src/dash.1 rename to src/dash.1.in index 514fcfe..5084d79 100644 --- a/src/dash.1 +++ b/src/dash.1.in @@ -1254,6 +1254,7 @@ With no arguments the export command lists the names of all exported variables. With the .Fl p option specified the output will be formatted suitably for non-interactive use. +.if !\n[BUILTIN_fc] .ig .It Xo fc Op Fl e Ar editor .Op Ar first Op Ar last .Xc @@ -1340,6 +1341,7 @@ Name of the editor to use. .It Ev HISTSIZE The number of previous commands that are accessible. .El +.. .It fg Op Ar job Move the specified job or the current job to the foreground. .It getopts Ar optstring var @@ -2160,6 +2162,7 @@ command, tracked alias and not found. For aliases the alias expansion is printed; for commands and tracked aliases the complete pathname of the command is printed. +.if !\n[BUILTIN_ulimit] .ig .It ulimit Xo .Op Fl H \*(Ba Fl S .Op Fl a \*(Ba Fl tfdscmlpnv Op Ar value @@ -2228,6 +2231,7 @@ Limits of an arbitrary process can be displayed or set using the .Xr sysctl 8 utility. .\".Pp +.. .It umask Op Ar mask Set the value of umask (see .Xr umask 2 ) @@ -2261,6 +2265,7 @@ last process in the job. If the argument is omitted, wait for all jobs to complete and return an exit status of zero. .El +.if !\n[BUILTIN_fc] .ig .Ss Command Line Editing When .Nm @@ -2283,6 +2288,7 @@ enters vi command mode. Hitting .Aq return while in command mode will pass the line to the shell. +.. .Sh EXIT STATUS Errors that are detected by the shell, such as a syntax error, will cause the shell to exit with a non-zero exit status. diff --git a/src/mkbuiltins b/src/mkbuiltins old mode 100644 new mode 100755 index f1f2593..70bb616 --- a/src/mkbuiltins +++ b/src/mkbuiltins @@ -41,7 +41,7 @@ if ! type tempfile > /dev/null 2>&1 && ! type mktemp > /dev/null 2>&1; then { local index=0 while test -f "${TMPDIR:-/tmp}/builtin.$$.$index"; do - index=`expr $index + 1` + index=$(( index + 1 )) done touch "${TMPDIR:-/tmp}/builtin.$$.$index" @@ -118,3 +118,6 @@ struct builtincmd { }; extern const struct builtincmd builtincmd[];' + +exec > builtins.roff +awk '{print ".nr BUILTIN_" $1 " 1"}' $temp2