[PATCH] man: don't list unavailable built-ins and Command Line Editing section

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@xxxxxxxxxxxxxxxxxx>
---
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: signature.asc
Description: PGP signature


[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux