All of lore.kernel.org
 help / color / mirror / Atom feed
From: наб <nabijaczleweli@nabijaczleweli.xyz>
To: dash@vger.kernel.org
Subject: [PATCH] man: don't list unavailable built-ins and Command Line Editing section
Date: Fri, 6 May 2022 21:34:34 +0200	[thread overview]
Message-ID: <20220506193434.sza4mvudzuytauoj@tarta.nabijaczleweli.xyz> (raw)

[-- Attachment #1: Type: text/plain, Size: 4295 bytes --]

Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
---
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
-- 
2.30.2

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

             reply	other threads:[~2022-05-06 19:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-06 19:34 наб [this message]
2024-04-05 10:34 ` [PATCH] man: don't list unavailable built-ins and Command Line Editing section Herbert Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220506193434.sza4mvudzuytauoj@tarta.nabijaczleweli.xyz \
    --to=nabijaczleweli@nabijaczleweli.xyz \
    --cc=dash@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.